@@ -2983,6 +2983,17 @@ public String getVolumePath(final Connect conn, final DiskTO volume, boolean dis
29832983 return dataPath ;
29842984 }
29852985
2986+ public static boolean useBLOCKDiskType (KVMPhysicalDisk physicalDisk ) {
2987+ return physicalDisk != null &&
2988+ physicalDisk .getPool ().getType () == StoragePoolType .Linstor &&
2989+ physicalDisk .getFormat () != null &&
2990+ physicalDisk .getFormat ()== PhysicalDiskFormat .RAW ;
2991+ }
2992+
2993+ public static DiskDef .DiskType getDiskType (KVMPhysicalDisk physicalDisk ) {
2994+ return useBLOCKDiskType (physicalDisk ) ? DiskDef .DiskType .BLOCK : DiskDef .DiskType .FILE ;
2995+ }
2996+
29862997 public void createVbd (final Connect conn , final VirtualMachineTO vmSpec , final String vmName , final LibvirtVMDef vm ) throws InternalErrorException , LibvirtException , URISyntaxException {
29872998 final Map <String , String > details = vmSpec .getDetails ();
29882999 final List <DiskTO > disks = Arrays .asList (vmSpec .getDisks ());
@@ -3028,7 +3039,8 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
30283039 physicalDisk = getPhysicalDiskFromNfsStore (dataStoreUrl , data );
30293040 } else if (primaryDataStoreTO .getPoolType ().equals (StoragePoolType .SharedMountPoint ) ||
30303041 primaryDataStoreTO .getPoolType ().equals (StoragePoolType .Filesystem ) ||
3031- primaryDataStoreTO .getPoolType ().equals (StoragePoolType .StorPool )) {
3042+ primaryDataStoreTO .getPoolType ().equals (StoragePoolType .StorPool ) ||
3043+ primaryDataStoreTO .getPoolType ().equals (StoragePoolType .Linstor )) {
30323044 physicalDisk = getPhysicalDiskPrimaryStore (primaryDataStoreTO , data );
30333045 }
30343046 }
@@ -3078,8 +3090,8 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
30783090 final DiskDef disk = new DiskDef ();
30793091 int devId = volume .getDiskSeq ().intValue ();
30803092 if (volume .getType () == Volume .Type .ISO ) {
3081-
3082- disk .defISODisk (volPath , devId , isUefiEnabled );
3093+ final DiskDef . DiskType diskType = getDiskType ( physicalDisk );
3094+ disk .defISODisk (volPath , devId , isUefiEnabled , diskType );
30833095
30843096 if (guestCpuArch != null && guestCpuArch .equals ("aarch64" )) {
30853097 disk .setBusType (DiskDef .DiskBus .SCSI );
@@ -3171,7 +3183,7 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
31713183
31723184 if (vmSpec .getType () != VirtualMachine .Type .User ) {
31733185 final DiskDef iso = new DiskDef ();
3174- iso .defISODisk (sysvmISOPath );
3186+ iso .defISODisk (sysvmISOPath , DiskDef . DiskType . FILE );
31753187 if (guestCpuArch != null && guestCpuArch .equals ("aarch64" )) {
31763188 iso .setBusType (DiskDef .DiskBus .SCSI );
31773189 }
@@ -3384,7 +3396,7 @@ public void detachAndAttachConfigDriveISO(final Connect conn, final String vmNam
33843396 List <DiskDef > disks = getDisks (conn , vmName );
33853397 DiskDef configdrive = null ;
33863398 for (DiskDef disk : disks ) {
3387- if (disk .getDeviceType () == DiskDef .DeviceType .CDROM && disk .getDiskLabel () == CONFIG_DRIVE_ISO_DISK_LABEL ) {
3399+ if (disk .getDeviceType () == DiskDef .DeviceType .CDROM && CONFIG_DRIVE_ISO_DISK_LABEL . equals ( disk .getDiskLabel ()) ) {
33883400 configdrive = disk ;
33893401 }
33903402 }
@@ -3414,19 +3426,20 @@ public synchronized String attachOrDetachISO(final Connect conn, final String vm
34143426 final String name = isoPath .substring (index + 1 );
34153427 final KVMStoragePool secondaryPool = storagePoolManager .getStoragePoolByURI (path );
34163428 final KVMPhysicalDisk isoVol = secondaryPool .getPhysicalDisk (name );
3429+ final DiskDef .DiskType diskType = getDiskType (isoVol );
34173430 isoPath = isoVol .getPath ();
34183431
3419- iso .defISODisk (isoPath , diskSeq );
3432+ iso .defISODisk (isoPath , diskSeq , diskType );
34203433 } else {
3421- iso .defISODisk (null , diskSeq );
3434+ iso .defISODisk (null , diskSeq , DiskDef . DiskType . FILE );
34223435 }
34233436
34243437 final String result = attachOrDetachDevice (conn , true , vmName , iso .toString ());
34253438 if (result == null && !isAttach ) {
34263439 final List <DiskDef > disks = getDisks (conn , vmName );
34273440 for (final DiskDef disk : disks ) {
34283441 if (disk .getDeviceType () == DiskDef .DeviceType .CDROM
3429- && (diskSeq == null || disk .getDiskLabel () == iso .getDiskLabel ())) {
3442+ && (diskSeq == null || disk .getDiskLabel (). equals ( iso .getDiskLabel () ))) {
34303443 cleanupDisk (disk );
34313444 }
34323445 }
@@ -4002,7 +4015,7 @@ public String stopVM(final Connect conn, final String vmName, final boolean forc
40024015 return stopVMInternal (conn , vmName , true );
40034016 }
40044017 String ret = stopVMInternal (conn , vmName , false );
4005- if (ret == Script .ERR_TIMEOUT ) {
4018+ if (Script .ERR_TIMEOUT . equals ( ret ) ) {
40064019 ret = stopVMInternal (conn , vmName , true );
40074020 } else if (ret != null ) {
40084021 /*
0 commit comments