Fixed root disk resize on deploy for RBD.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
(cherry picked from commit 3a52a83faeaa72a8488b2db1253fef6d3308d708)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
This commit is contained in:
Logan Barfield 2014-10-30 16:18:52 -04:00 committed by Rohit Yadav
parent bf9e1ae7e8
commit 3a36681b6e

View File

@ -1080,6 +1080,13 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
rbd.clone(template.getName(), this.rbdTemplateSnapName, io, disk.getName(), this.rbdFeatures, this.rbdOrder);
s_logger.debug("Succesfully cloned " + template.getName() + "@" + this.rbdTemplateSnapName + " to " + disk.getName());
/* We also need to resize the image if the VM was deployed with a larger root disk size */
if (disk.getVirtualSize() > template.getVirtualSize()) {
RbdImage diskImage = rbd.open(disk.getName());
diskImage.resize(disk.getVirtualSize());
rbd.close(diskImage);
s_logger.debug("Resized " + disk.getName() + " to " + disk.getVirtualSize());
}
}
rbd.close(srcImage);