diff options
| author | Rick Harris <rconradharris@gmail.com> | 2011-09-16 00:22:31 +0000 |
|---|---|---|
| committer | Rick Harris <rconradharris@gmail.com> | 2011-09-16 00:22:31 +0000 |
| commit | 6f3ae6e1e5453330e14807348f6e3f6587877946 (patch) | |
| tree | b086f33a5a4b3f8a2e6e347bfac00fb940b2a14c /plugins | |
| parent | e0cf82323ab19bbcbad88aa75045b3e55692f071 (diff) | |
| download | nova-6f3ae6e1e5453330e14807348f6e3f6587877946.tar.gz nova-6f3ae6e1e5453330e14807348f6e3f6587877946.tar.xz nova-6f3ae6e1e5453330e14807348f6e3f6587877946.zip | |
Allowing resizes to the same machine
Diffstat (limited to 'plugins')
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/glance | 6 | ||||
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/migration | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance index 1a9ac37e9..49601b1cd 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance @@ -211,7 +211,11 @@ def _import_vhds(sr_path, staging_path, uuid_stack): snap_info = prepare_if_exists(staging_path, 'snap.vhd', image_info[0]) if snap_info: - paths_to_move.append(snap_info[0]) + # NOTE(sirp): this is an insert rather than an append since the + # 'snapshot' vhd needs to be copied into the SR before the base copy. + # If it doesn't, then there is a possibliity that snapwatchd will + # delete the base_copy since it is an unreferenced parent. + paths_to_move.insert(snap_info[0]) # We return this snap as the VDI instead of image.vhd vdi_return_list.append(dict(vdi_type="os", vdi_uuid=snap_info[1])) else: diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration b/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration index ac1c50ad9..4ec3dc7af 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/migration @@ -48,7 +48,7 @@ def move_vhds_into_sr(session, args): # Discover the copied VHDs locally, and then set up paths to copy # them to under the SR - source_image_path = "%s/instance%d" % ('/images/', instance_id) + source_image_path = "/images/instance%d" % instance_id source_base_copy_path = "%s/%s.vhd" % (source_image_path, old_base_copy_uuid) source_cow_path = "%s/%s.vhd" % (source_image_path, old_cow_uuid) @@ -74,9 +74,12 @@ def move_vhds_into_sr(session, args): (new_cow_path, new_base_copy_path)) subprocess.call(shlex.split('/usr/sbin/vhd-util modify -n %s -p %s' % (new_cow_path, new_base_copy_path))) + logging.debug('Moving VHDs into SR %s' % sr_path) - shutil.move("%s/%s.vhd" % (temp_vhd_path, new_base_copy_uuid), sr_path) - shutil.move("%s/%s.vhd" % (temp_vhd_path, new_cow_uuid), sr_path) + # NOTE(sirp): COW should be copied before base_copy to avoid snapwatchd + # GC'ing an unreferenced base copy VDI + shutil.move(new_cow_path, sr_path) + shutil.move(new_base_copy_path, sr_path) logging.debug('Cleaning up temporary SR path %s' % temp_vhd_path) os.rmdir(temp_vhd_path) @@ -93,7 +96,7 @@ def transfer_vhd(session, args): vhd_path = "%s.vhd" % vdi_uuid source_path = "%s/%s" % (sr_path, vhd_path) - dest_path = '%s:%sinstance%d/' % (host, '/images/', instance_id) + dest_path = '%s:/images/instance%d/' % (host, instance_id) logging.debug("Preparing to transmit %s to %s" % (source_path, dest_path)) |
