summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authormatt.dietz@rackspace.com <>2011-03-07 17:17:41 +0000
committermatt.dietz@rackspace.com <>2011-03-07 17:17:41 +0000
commita775c4eee279e11268a6cc447aee24c452e4665a (patch)
tree56cefa95312fc27bf19fef780d8d8877a26e1b3e /nova/virt
parent4e98750e0a39b177d6f6523ebf4071f3cebd1a46 (diff)
Merge prop changes and test fixes
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/xenapi/vm_utils.py30
-rw-r--r--nova/virt/xenapi/vmops.py4
2 files changed, 14 insertions, 20 deletions
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py
index eff207a51..80b7540d4 100644
--- a/nova/virt/xenapi/vm_utils.py
+++ b/nova/virt/xenapi/vm_utils.py
@@ -307,10 +307,16 @@ class VMHelper(HelperBase):
return session.call_xenapi('SR.get_by_name_label', sr_label)[0]
@classmethod
- def get_sr_path(cls, session, sr_label='slices'):
- """Finds the SR and then coerces it into a path on the dom0 file
- system"""
- return FLAGS.xenapi_sr_base_path + cls.get_sr(session, sr_label)
+ def get_sr_path(cls, session):
+ """Return the path to our storage repository
+
+ This is used when we're dealing with VHDs directly, either by taking
+ snapshots or by restoring an image in the DISK_VHD format.
+ """
+ sr_ref = safe_find_sr(session)
+ sr_rec = session.get_xenapi().SR.get_record(sr_ref)
+ sr_uuid = sr_rec["uuid"]
+ return os.path.join(FLAGS.xenapi_sr_base_path, sr_uuid)
@classmethod
def upload_image(cls, session, instance_id, vdi_uuids, image_id):
@@ -326,7 +332,7 @@ class VMHelper(HelperBase):
'image_id': image_id,
'glance_host': FLAGS.glance_host,
'glance_port': FLAGS.glance_port,
- 'sr_path': get_sr_path(session)}
+ 'sr_path': cls.get_sr_path(session)}
kwargs = {'params': pickle.dumps(params)}
task = session.async_call_plugin('glance', 'upload_vhd', kwargs)
@@ -369,7 +375,7 @@ class VMHelper(HelperBase):
'glance_host': FLAGS.glance_host,
'glance_port': FLAGS.glance_port,
'uuid_stack': uuid_stack,
- 'sr_path': get_sr_path(session)}
+ 'sr_path': cls.get_sr_path(session)}
kwargs = {'params': pickle.dumps(params)}
task = session.async_call_plugin('glance', 'download_vhd', kwargs)
@@ -775,18 +781,6 @@ def find_sr(session):
return None
-def get_sr_path(session):
- """Return the path to our storage repository
-
- This is used when we're dealing with VHDs directly, either by taking
- snapshots or by restoring an image in the DISK_VHD format.
- """
- sr_ref = safe_find_sr(session)
- sr_rec = session.get_xenapi().SR.get_record(sr_ref)
- sr_uuid = sr_rec["uuid"]
- return os.path.join(FLAGS.xenapi_sr_base_path, sr_uuid)
-
-
def remap_vbd_dev(dev):
"""Return the appropriate location for a plugged-in VBD device
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 01bfa2dc5..b862c9de9 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -262,7 +262,7 @@ class VMOps(object):
self._session, instance.id, template_vdi_uuids, image_id)
finally:
if template_vm_ref:
- self.virt._destroy(self.instance, template_vm_ref,
+ self._destroy(instance, template_vm_ref,
shutdown=False, destroy_kernel_ramdisk=False)
logging.debug(_("Finished snapshot and upload for VM %s"), instance)
@@ -330,7 +330,7 @@ class VMOps(object):
finally:
if template_vm_ref:
- self.virt._destroy(self.instance, template_vm_ref,
+ self._destroy(instance, template_vm_ref,
shutdown=False, destroy_kernel_ramdisk=False)
# TODO(mdietz): we could also consider renaming these to something