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); } }
if (copyVolumeAnswer == null || !copyVolumeAnswer.getResult()) { if (copyVolumeAnswer != null && !StringUtils.isEmpty(copyVolumeAnswer.getDetails())) { throw new CloudRuntimeException(copyVolumeAnswer.getDetails()); return copyVolumeAnswer.getVolumePath();
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); } }
return new CopyVolumeAnswer(command, false, "No IQN was specified", null, null); return new CopyVolumeAnswer(command, true, null, null, destVolumePath + destVolumeName); } catch (final CloudRuntimeException e) { return new CopyVolumeAnswer(command, false, e.toString(), null, null); } finally { try {
pool.getUserInfo(), pool.getType()); } else { return new CopyVolumeAnswer(command, false, e.getMessage(), null, null); storagePoolMgr.copyPhysicalDisk(volume, destVolumeName, secondaryStoragePool, 0); return new CopyVolumeAnswer(command, true, null, null, volumeName); } else { volumePath = "/volumes/" + command.getVolumeId() + File.separator; return new CopyVolumeAnswer(command, true, null, null, volumeName); return new CopyVolumeAnswer(command, false, e.toString(), null, null); } finally { if (secondaryStoragePool != null) {