SWIFT: voluem export

This commit is contained in:
anthony 2011-12-19 20:34:57 -08:00
parent 1bde4520e1
commit 71d05d531e
1 changed files with 12 additions and 19 deletions

View File

@ -5442,25 +5442,18 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
if (!createSecondaryStorageFolder(conn, remoteVolumesMountPath, volumeFolder)) {
throw new InternalErrorException("Failed to create the volume folder.");
}
VDI vdi = VDI.getByUuid(conn, volumeUUID);
String pUuid = getVhdParent(conn, srUuid, vdi.getUuid(conn), IsISCSI(primaryStoragePool.getType(conn)));
if( pUuid != null ) {
SR secondaryStorage = null;
try {
// Create a SR for the volume UUID folder
secondaryStorage = createNfsSRbyURI(conn, new URI(secondaryStorageURL + "/volumes/" + volumeFolder), false);
// Look up the volume on the source primary storage pool
VDI srcVolume = getVDIbyUuid(conn, volumeUUID);
// Copy the volume to secondary storage
VDI destVolume = cloudVDIcopy(conn, srcVolume, secondaryStorage, wait);
String destVolumeUUID = destVolume.getUuid(conn);
return new CopyVolumeAnswer(cmd, true, null, null, destVolumeUUID);
} finally {
removeSR(conn, secondaryStorage);
}
} else {
String uuid = copy_vhd_to_secondarystorage(conn, mountpoint, volumeUUID, srUuid, wait);
return new CopyVolumeAnswer(cmd, true, null, null, uuid);
SR secondaryStorage = null;
try {
// Create a SR for the volume UUID folder
secondaryStorage = createNfsSRbyURI(conn, new URI(secondaryStorageURL + "/volumes/" + volumeFolder), false);
// Look up the volume on the source primary storage pool
VDI srcVolume = getVDIbyUuid(conn, volumeUUID);
// Copy the volume to secondary storage
VDI destVolume = cloudVDIcopy(conn, srcVolume, secondaryStorage, wait);
String destVolumeUUID = destVolume.getUuid(conn);
return new CopyVolumeAnswer(cmd, true, null, null, destVolumeUUID);
} finally {
removeSR(conn, secondaryStorage);
}
} else {
try {