mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Report the PowerFlex/ScaleIO disk copy failure during volume migration and fail the migration (#5542)
* Report the PowerFlex/ScaleIO disk copy failure during volume migration and fail the migration. * Code improvements * Addressed review comments
This commit is contained in:
		
							parent
							
								
									52a9dbdcd2
								
							
						
					
					
						commit
						e198edfaf8
					
				| @ -1988,14 +1988,20 @@ public class KVMStorageProcessor implements StorageProcessor { | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             destPool = storagePoolMgr.getStoragePool(destPrimaryStore.getPoolType(), destPrimaryStore.getUuid()); |             destPool = storagePoolMgr.getStoragePool(destPrimaryStore.getPoolType(), destPrimaryStore.getUuid()); | ||||||
|             storagePoolMgr.copyPhysicalDisk(volume, destVolumeName, destPool, cmd.getWaitInMillSeconds()); |             try { | ||||||
|  |                 storagePoolMgr.copyPhysicalDisk(volume, destVolumeName, destPool, cmd.getWaitInMillSeconds()); | ||||||
|  |             } catch (Exception e) { // Any exceptions while copying the disk, should send failed answer with the error message | ||||||
|  |                 String errMsg = String.format("Failed to copy volume: %s to dest storage: %s, due to %s", srcVol.getName(), destPrimaryStore.getName(), e.toString()); | ||||||
|  |                 s_logger.debug(errMsg, e); | ||||||
|  |                 throw new CloudRuntimeException(errMsg); | ||||||
|  |             } finally { | ||||||
|  |                 if (srcPrimaryStore.isManaged()) { | ||||||
|  |                     storagePoolMgr.disconnectPhysicalDisk(srcPrimaryStore.getPoolType(), srcPrimaryStore.getUuid(), srcVolumePath); | ||||||
|  |                 } | ||||||
| 
 | 
 | ||||||
|             if (srcPrimaryStore.isManaged()) { |                 if (destPrimaryStore.isManaged()) { | ||||||
|                 storagePoolMgr.disconnectPhysicalDisk(srcPrimaryStore.getPoolType(), srcPrimaryStore.getUuid(), srcVolumePath); |                     storagePoolMgr.disconnectPhysicalDisk(destPrimaryStore.getPoolType(), destPrimaryStore.getUuid(), destVolumePath); | ||||||
|             } |                 } | ||||||
| 
 |  | ||||||
|             if (destPrimaryStore.isManaged()) { |  | ||||||
|                 storagePoolMgr.disconnectPhysicalDisk(destPrimaryStore.getPoolType(), destPrimaryStore.getUuid(), destVolumePath); |  | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             final VolumeObjectTO newVol = new VolumeObjectTO(); |             final VolumeObjectTO newVol = new VolumeObjectTO(); | ||||||
|  | |||||||
| @ -19,6 +19,7 @@ package com.cloud.hypervisor.kvm.storage; | |||||||
| 
 | 
 | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.io.FileFilter; | import java.io.FileFilter; | ||||||
|  | import java.util.Arrays; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| @ -268,12 +269,20 @@ public class ScaleIOStorageAdaptor implements StorageAdaptor { | |||||||
|             srcFile = new QemuImgFile(disk.getPath(), disk.getFormat()); |             srcFile = new QemuImgFile(disk.getPath(), disk.getFormat()); | ||||||
|             destFile = new QemuImgFile(destDisk.getPath(), destDisk.getFormat()); |             destFile = new QemuImgFile(destDisk.getPath(), destDisk.getFormat()); | ||||||
| 
 | 
 | ||||||
|             LOGGER.debug("Starting copy from source image " + srcFile.getFileName() + " to PowerFlex volume: " + destDisk.getPath()); |             LOGGER.debug("Starting copy from source disk image " + srcFile.getFileName() + " to PowerFlex volume: " + destDisk.getPath()); | ||||||
|             qemu.convert(srcFile, destFile); |             qemu.convert(srcFile, destFile); | ||||||
|             LOGGER.debug("Succesfully converted source image " + srcFile.getFileName() + " to PowerFlex volume: " + destDisk.getPath()); |             LOGGER.debug("Succesfully converted source disk image " + srcFile.getFileName() + " to PowerFlex volume: " + destDisk.getPath()); | ||||||
|         }  catch (QemuImgException | LibvirtException e) { |         }  catch (QemuImgException | LibvirtException e) { | ||||||
|             LOGGER.error("Failed to convert from " + srcFile.getFileName() + " to " + destFile.getFileName() + " the error was: " + e.getMessage(), e); |             try { | ||||||
|             destDisk = null; |                 Map<String, String> srcInfo = qemu.info(srcFile); | ||||||
|  |                 LOGGER.debug("Source disk info: " + Arrays.asList(srcInfo)); | ||||||
|  |             } catch (Exception ignored) { | ||||||
|  |                 LOGGER.warn("Unable to get info from source disk: " + disk.getName()); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             String errMsg = String.format("Unable to convert/copy from %s to %s, due to: %s", disk.getName(), name, ((Strings.isNullOrEmpty(e.getMessage())) ? "an unknown error" : e.getMessage())); | ||||||
|  |             LOGGER.error(errMsg); | ||||||
|  |             throw new CloudRuntimeException(errMsg, e); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         return destDisk; |         return destDisk; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user