@@ -2052,13 +2052,19 @@ protected List<VgpuTypesInfo> parseGpuDevicesFromResult(String result) {
20522052 gpuDevices .add (vgpuType );
20532053
20542054 for (JsonElement vgpuInstance : vgpuInstances ) {
2055- gpuDevices .add (getGpuDeviceFromVgpuInstance (vgpuInstance , busAddress , vendorId , vendorName , deviceId ,
2056- deviceName , numaNode , pciRoot ));
2055+ VgpuTypesInfo vgpu = getGpuDeviceFromVgpuInstance (vgpuInstance , busAddress , vendorId , vendorName ,
2056+ deviceId , deviceName , numaNode , pciRoot );
2057+ if (vgpu != null ) {
2058+ gpuDevices .add (vgpu );
2059+ }
20572060 }
20582061
20592062 for (JsonElement vfInstance : vfInstances ) {
2060- gpuDevices .add (getGpuDeviceFromVfInstance (vfInstance , busAddress , vendorId , vendorName , deviceId ,
2061- deviceName , numaNode , pciRoot ));
2063+ VgpuTypesInfo vf = getGpuDeviceFromVfInstance (vfInstance , busAddress , vendorId , vendorName ,
2064+ deviceId , deviceName , numaNode , pciRoot );
2065+ if (vf != null ) {
2066+ gpuDevices .add (vf );
2067+ }
20622068 }
20632069 }
20642070
@@ -2073,6 +2079,9 @@ protected VgpuTypesInfo getGpuDeviceFromVgpuInstance(JsonElement vgpuInstance, S
20732079 JsonObject vgpuInstanceJsonObject = vgpuInstance .getAsJsonObject ();
20742080 String mdevUuid = getJsonStringValueOrNull (vgpuInstanceJsonObject , "mdev_uuid" );
20752081 String profileName = getJsonStringValueOrNull (vgpuInstanceJsonObject , "profile_name" );
2082+ if (profileName == null || profileName .isEmpty ()) {
2083+ return null ; // Skip if profile name is not provided
2084+ }
20762085 Long maxInstances = getJsonLongValueOrNull (vgpuInstanceJsonObject , "max_instances" );
20772086 Long videoRam = getJsonLongValueOrNull (vgpuInstanceJsonObject , "video_ram" );
20782087 Long maxHeads = getJsonLongValueOrNull (vgpuInstanceJsonObject , "max_heads" );
@@ -2094,6 +2103,9 @@ protected VgpuTypesInfo getGpuDeviceFromVfInstance(JsonElement vfInstance, Strin
20942103 JsonObject vfInstanceJsonObject = vfInstance .getAsJsonObject ();
20952104 String vfPciAddress = vfInstanceJsonObject .get ("vf_pci_address" ).getAsString ();
20962105 String vfProfile = vfInstanceJsonObject .get ("vf_profile" ).getAsString ();
2106+ if (vfProfile == null || vfProfile .isEmpty ()) {
2107+ return null ; // Skip if profile name is not provided
2108+ }
20972109 Long maxInstances = getJsonLongValueOrNull (vfInstanceJsonObject , "max_instances" );
20982110 Long videoRam = getJsonLongValueOrNull (vfInstanceJsonObject , "video_ram" );
20992111 Long maxHeads = getJsonLongValueOrNull (vfInstanceJsonObject , "max_heads" );
0 commit comments