mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix of deployment VM from a copied snapshot in another zone (#11351)
* Fix of deploy VM with a snapshot that is copied to another zone * Fix of creating StorPool volume from a snapshot if the size in the offering is bigger than the snapshot size
This commit is contained in:
parent
ae95be3702
commit
dc5e475bd2
@ -103,9 +103,10 @@ public final class StorPoolDownloadTemplateCommandWrapper extends CommandWrapper
|
|||||||
final QemuImgFile srcFile = new QemuImgFile(srcDisk.getPath(), srcDisk.getFormat());
|
final QemuImgFile srcFile = new QemuImgFile(srcDisk.getPath(), srcDisk.getFormat());
|
||||||
|
|
||||||
final QemuImg qemu = new QemuImg(cmd.getWaitInMillSeconds());
|
final QemuImg qemu = new QemuImg(cmd.getWaitInMillSeconds());
|
||||||
StorPoolStorageAdaptor.resize( Long.toString(srcDisk.getVirtualSize()), dst.getPath());
|
|
||||||
|
|
||||||
if (dst instanceof TemplateObjectTO) {
|
if (dst instanceof TemplateObjectTO) {
|
||||||
|
StorPoolStorageAdaptor.resize(Long.toString(srcDisk.getVirtualSize()), dst.getPath());
|
||||||
|
|
||||||
((TemplateObjectTO) dst).setSize(srcDisk.getVirtualSize());
|
((TemplateObjectTO) dst).setSize(srcDisk.getVirtualSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4195,15 +4195,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
}
|
}
|
||||||
|
|
||||||
DiskOfferingVO rootDiskOffering = _diskOfferingDao.findById(rootDiskOfferingId);
|
DiskOfferingVO rootDiskOffering = _diskOfferingDao.findById(rootDiskOfferingId);
|
||||||
long volumesSize = 0;
|
long volumesSize = configureCustomRootDiskSize(customParameters, template, hypervisorType, rootDiskOffering);
|
||||||
if (volume != null) {
|
|
||||||
volumesSize = volume.getSize();
|
|
||||||
} else if (snapshot != null) {
|
|
||||||
VolumeVO volumeVO = _volsDao.findById(snapshot.getVolumeId());
|
|
||||||
volumesSize = volumeVO != null ? volumeVO.getSize() : 0;
|
|
||||||
} else {
|
|
||||||
volumesSize = configureCustomRootDiskSize(customParameters, template, hypervisorType, rootDiskOffering);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rootDiskOffering.getEncrypt() && hypervisorType != HypervisorType.KVM) {
|
if (rootDiskOffering.getEncrypt() && hypervisorType != HypervisorType.KVM) {
|
||||||
throw new InvalidParameterValueException("Root volume encryption is not supported for hypervisor type " + hypervisorType);
|
throw new InvalidParameterValueException("Root volume encryption is not supported for hypervisor type " + hypervisorType);
|
||||||
@ -6292,7 +6284,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
}
|
}
|
||||||
_accountMgr.checkAccess(caller, null, true, volume);
|
_accountMgr.checkAccess(caller, null, true, volume);
|
||||||
templateId = volume.getTemplateId();
|
templateId = volume.getTemplateId();
|
||||||
overrideDiskOfferingId = volume.getDiskOfferingId();
|
|
||||||
} else if (cmd.getSnapshotId() != null) {
|
} else if (cmd.getSnapshotId() != null) {
|
||||||
snapshot = _snapshotDao.findById(cmd.getSnapshotId());
|
snapshot = _snapshotDao.findById(cmd.getSnapshotId());
|
||||||
if (snapshot == null) {
|
if (snapshot == null) {
|
||||||
@ -6301,7 +6292,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||||||
_accountMgr.checkAccess(caller, null, true, snapshot);
|
_accountMgr.checkAccess(caller, null, true, snapshot);
|
||||||
VolumeInfo volumeOfSnapshot = getVolume(snapshot.getVolumeId(), templateId, true);
|
VolumeInfo volumeOfSnapshot = getVolume(snapshot.getVolumeId(), templateId, true);
|
||||||
templateId = volumeOfSnapshot.getTemplateId();
|
templateId = volumeOfSnapshot.getTemplateId();
|
||||||
overrideDiskOfferingId = volumeOfSnapshot.getDiskOfferingId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualMachineTemplate template = null;
|
VirtualMachineTemplate template = null;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user