Fixed root disk resize on deploy for RBD.

Signed-off-by: Wido den Hollander <wido@widodh.nl>
This commit is contained in:
Logan Barfield 2014-10-30 16:18:52 -04:00 committed by Wido den Hollander
parent f28ade56f2
commit 3a52a83fae
1 changed files with 8 additions and 0 deletions

View File

@ -1083,6 +1083,14 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
rbd.clone(template.getName(), rbdTemplateSnapName, io, disk.getName(), rbdFeatures, rbdOrder);
s_logger.debug("Succesfully cloned " + template.getName() + "@" + 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);