protected CopyVolumeAnswer execute(CopyVolumeCommand cmd) { String volumePath = cmd.getVolumePath(); String secondaryStorageURL = cmd.getSecondaryStorageURL(); int wait = cmd.getWait(); if (wait == 0) { wait = 7200; } try { URI uri = new URI(secondaryStorageURL); String secStorageMountPath = uri.getHost() + ":" + uri.getPath(); String volumeFolderOnSecStorage = "volumes/" + String.valueOf(cmd.getVolumeId()); String storagePoolUuid = cmd.getPool().getUuid(); Boolean toSec = cmd.toSecondaryStorage(); String res = OvmStoragePool.copyVolume(_conn, secStorageMountPath, volumeFolderOnSecStorage, volumePath, storagePoolUuid, toSec, wait); return new CopyVolumeAnswer(cmd, true, null, null, res); } catch (Exception e) { s_logger.debug("Copy volume failed", e); return new CopyVolumeAnswer(cmd, false, e.getMessage(), null, null); } }
public CopyVolumeAnswer execute(CopyVolumeCommand cmd) { LOGGER.debug("execute: "+ cmd.getClass()); String volumePath = cmd.getVolumePath(); /* is a repository */ String secondaryStorageURL = cmd.getSecondaryStorageURL(); int wait = cmd.getWait(); if (wait == 0) { wait = 7200; } try { Linux host = new Linux(c); /* to secondary storage */ if (cmd.toSecondaryStorage()) { LOGGER.debug("Copy to secondary storage " + volumePath + " to " + secondaryStorageURL); host.copyFile(volumePath, secondaryStorageURL); /* from secondary storage */ } else { LOGGER.debug("Copy from secondary storage " + secondaryStorageURL + " to " + volumePath); host.copyFile(secondaryStorageURL, volumePath); } /* check the truth of this */ return new CopyVolumeAnswer(cmd, true, null, null, null); } catch (Ovm3ResourceException e) { LOGGER.debug("Copy volume failed", e); return new CopyVolumeAnswer(cmd, false, e.getMessage(), null, null); } }
Map<String, String> srcDetails = command.getSrcDetails(); final boolean copyToSecondary = command.toSecondaryStorage(); final StorageFilerTO pool = command.getPool(); final String secondaryStorageUrl = command.getSecondaryStorageURL(); final KVMPhysicalDisk volume = primaryPool.getPhysicalDisk(command.getVolumePath()); final String volumeDestPath = "/volumes/" + command.getVolumeId() + File.separator; volumePath = "/volumes/" + command.getVolumeId() + File.separator; secondaryStoragePool = storagePoolMgr.getStoragePoolByURI(secondaryStorageUrl + volumePath); final KVMPhysicalDisk volume = secondaryStoragePool.getPhysicalDisk(command.getVolumePath() + ".qcow2");
KVMStoragePool secondaryStoragePool = null; Map<String, String> srcDetails = command.getSrcDetails(); LibvirtUtilitiesHelper libvirtUtilitiesHelper = libvirtComputingResource.getLibvirtUtilitiesHelper(); String destVolumeName = libvirtUtilitiesHelper.generateUUIDName() + ".qcow2"; String destVolumePath = command.getVolumePath() + File.separator; String secondaryStorageUrl = command.getSecondaryStorageURL(); VolumeObjectTO srcVolumeObjectTO = (VolumeObjectTO)command.getSrcData(); storagePoolMgr.copyPhysicalDisk(srcPhysicalDisk, destVolumeName, secondaryStoragePool, command.getWait() * 1000);
Map<String, String> srcDetails = getVolumeDetails(srcVolumeInfo); CopyVolumeCommand copyVolumeCommand = new CopyVolumeCommand(srcVolumeInfo.getId(), destVolumeInfo.getPath(), storagePoolVO, destVolumeInfo.getDataStore().getUri(), true, StorageManager.KvmStorageOfflineMigrationWait.value(), true); copyVolumeCommand.setSrcData(srcVolumeInfo.getTO()); copyVolumeCommand.setSrcDetails(srcDetails);