summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCerberus <matt.dietz@rackspace.com>2011-02-14 15:55:52 -0600
committerCerberus <matt.dietz@rackspace.com>2011-02-14 15:55:52 -0600
commitfad5baf307b74a92fd5b9d8e2d1479f558e180aa (patch)
treea815c1278db6182728fd82bca43b3355a306c77b
parent7bb6122549ad5ac549465f0012020f8e5dc9d506 (diff)
hurr
-rw-r--r--nova/virt/xenapi/vm_utils.py12
-rw-r--r--nova/virt/xenapi/vmops.py13
-rw-r--r--plugins/xenserver/xenapi/etc/xapi.d/plugins/migration7
3 files changed, 20 insertions, 12 deletions
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py
index eeb5502ed..23f9547d7 100644
--- a/nova/virt/xenapi/vm_utils.py
+++ b/nova/virt/xenapi/vm_utils.py
@@ -504,10 +504,14 @@ class VMHelper(HelperBase):
return {"Unable to retrieve diagnostics": e}
@classmethod
- def scan_sr(cls, session, instance_id, sr_ref):
- LOG.debug(_("Re-scanning SR %s"), sr_ref)
- task = session.call_xenapi('Async.SR.scan', sr_ref)
- session.wait_for_task(instance_id, task)
+ def scan_sr(cls, session, instance_id=None, sr_ref=None):
+ if sr_ref:
+ LOG.debug(_("Re-scanning SR %s"), sr_ref)
+ task = session.call_xenapi('Async.SR.scan', sr_ref)
+ session.wait_for_task(instance_id, task)
+ else:
+ sr_ref = cls.get_sr(session)
+ session.call_xen_api('SR.scan', sr_ref)
def get_rrd(host, uuid):
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 470b6ea8c..17d42d542 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -276,14 +276,17 @@ class VMOps(object):
def attach_disk(self, instance):
vm_ref = VMHelper.lookup(self._session, instance.name)
- params = { 'instance_id': instance.id }
- new_base_copy_uuid, new_cow_uuid = self._session.async_call_plugin(
- 'migration', 'move_vhds_into_sr',
+ new_base_copy_uuid = str(uuid.uuid4())
+
+ params = { 'instance_id': instance.id,
+ 'new_base_copy_uuid': new_base_copy_uuid,
+ 'new_cow_uuid': str(uuid.uuid4() }
+
+ self._session.async_call_plugin('migration', 'move_vhds_into_sr',
{'params': pickle.dumps(params)})
# Now we rescan the SR so we find the VHDs
- sr_ref = VMHelper.get_sr(self._session)
- VMHelper.scan_sr(self._session, instance.id, sr_ref)
+ VMHelper.scan_sr(self._session)
return new_base_copy_uuid
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration b/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration
index 71d4473c5..e73480445 100644
--- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration
+++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration
@@ -69,6 +69,9 @@ def move_vhds_into_sr(session, args):
params = pickle.dumps(args)
instance_id = params['instance_id']
+ new_base_copy_uuid = params['new_base_copy_uuid']
+ new_cow_uuid = params['new_cow_uuid']
+
sr_path = get_sr_path(session)
sr_temp_path = "%s/images/" % sr_path
@@ -78,8 +81,6 @@ def move_vhds_into_sr(session, args):
source_base_copy_path = "%s/base_copy.vhd" % source_image_path
source_cow_path = "%s/cow.vhd" % source_image_path
- new_base_copy_uuid = str(uuid.uuid4())
- new_cow_uuid = str(uuid.uuid4())
temp_vhd_path = "%s/instance%d/" % (sr_temp_path, instance_id)
new_base_copy_path = "%s/%s.vhd" % (temp_vhd_path, new_base_copy_uuid)
@@ -97,7 +98,7 @@ def move_vhds_into_sr(session, args):
shutil.move("%s/*.vhd" % temp_vhd_path, sr_path)
os.rmdir(temp_vhd_path)
- return (new_base_copy_uuid, new_cow_uuid)
+ return None
def transfer_vhd(session, args):