summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorCerberus <matt.dietz@rackspace.com>2011-03-10 16:07:50 -0600
committerCerberus <matt.dietz@rackspace.com>2011-03-10 16:07:50 -0600
commit4a9f4f4eef4e6fd6ab84ec2e03437144f9ab62f8 (patch)
tree5be1194b0104ebfae3c7d43c4c22499a2ce22c91 /nova/virt
parentaf894c1f171212e722f5d0b8042e2c205df2aee4 (diff)
More resize
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/xenapi/vmops.py13
-rw-r--r--nova/virt/xenapi_conn.py9
2 files changed, 16 insertions, 6 deletions
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 562ecd4d5..9e0bd6a75 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -365,9 +365,18 @@ class VMOps(object):
return new_cow_uuid
- def resize(self, instance, flavor):
+ def resize_instance(self, instance, vdi_uuid):
"""Resize a running instance by changing it's RAM and disk size """
- raise NotImplementedError()
+ vm_ref = VMHelper.lookup(self._session, instance.name)
+ vdi_ref, vm_vdi_rec = \
+ VMHelper.get_vdi_for_vm_safely(self._session, vm_ref)
+ new_disk_size = instance.local_gb
+
+ #TODO(mdietz): this will need to be adjusted for swap later
+ task = self._session.call_xenapi('VDI.resize_online', vdi_ref,
+ new_disk_size)
+ vm_ref = VMHelper.lookup(self._session, instance.name)
+ self._session.wait_for_task(task, instance.id)
def reboot(self, instance):
"""Reboot VM instance"""
diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py
index b63a5f8c3..92b262479 100644
--- a/nova/virt/xenapi_conn.py
+++ b/nova/virt/xenapi_conn.py
@@ -158,6 +158,11 @@ class XenAPIConnection(object):
"""Create VM instance"""
self._vmops.spawn(instance)
+ def resize_instance(self, instance, disk_info):
+ """Resizes instance attributes such as RAM and disk space to the
+ attributes specified by the record"""
+ self._vmops.resize_instance(instance, disk_info['cow'])
+
def finish_resize(self, instance, disk_info):
"""Completes a resize, turning on the migrated instance"""
vdi_uuid = self._vmops.attach_disk(instance, disk_info['base_copy'],
@@ -168,10 +173,6 @@ class XenAPIConnection(object):
""" Create snapshot from a running VM instance """
self._vmops.snapshot(instance, image_id)
- def resize(self, instance, flavor):
- """Resize a VM instance"""
- raise NotImplementedError()
-
def reboot(self, instance):
"""Reboot VM instance"""
self._vmops.reboot(instance)