From a36288351af519ef62ad4f52b3e3e38601ba3f58 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Thu, 30 Aug 2012 18:37:47 +0000 Subject: xenapi: Removing legacy swap-in-image. This patch removes our legacy handling of swap in the image. Now that we're generating swap on-the-fly, this stop-gap solution can go away. Change-Id: Ied3198f77af8dabb6cfbf2ab9cfb3a4eb18e32ea --- .../xenserver/xenapi/etc/xapi.d/plugins/utils.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'plugins') diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py b/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py index 027d26a67..66f46a839 100644 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py @@ -221,6 +221,7 @@ def _validate_sequenced_vhds(staging_path): if not filename.endswith('.vhd'): continue + # Ignore legacy swap embedded in the image, generated on-the-fly now if filename == "swap.vhd": continue @@ -242,13 +243,11 @@ def import_vhds(sr_path, staging_path, uuid_stack): Returns: A dict of imported VHDs: - {'root': {'uuid': 'ffff-aaaa'}, - 'swap': {'uuid': 'ffff-bbbb'}} + {'root': {'uuid': 'ffff-aaaa'}} """ _handle_old_style_images(staging_path) _validate_sequenced_vhds(staging_path) - imported_vhds = {} files_to_move = [] # Collect sequenced VHDs and assign UUIDs to them @@ -286,26 +285,12 @@ def import_vhds(sr_path, staging_path, uuid_stack): _assert_vhd_not_hidden(leaf_vhd_path) _validate_vdi_chain(leaf_vhd_path) - imported_vhds["root"] = {"uuid": leaf_vhd_uuid} - - # Handle swap file if present - orig_swap_path = os.path.join(staging_path, "swap.vhd") - if os.path.exists(orig_swap_path): - # Rename swap.vhd -> aaaa-bbbb-cccc-dddd.vhd - vhd_uuid = uuid_stack.pop() - swap_path = os.path.join(staging_path, "%s.vhd" % vhd_uuid) - _rename(orig_swap_path, swap_path) - - _assert_vhd_not_hidden(swap_path) - - imported_vhds["swap"] = {"uuid": vhd_uuid} - files_to_move.append(swap_path) - # Move files into SR for orig_path in files_to_move: new_path = os.path.join(sr_path, os.path.basename(orig_path)) _rename(orig_path, new_path) + imported_vhds = dict(root=dict(uuid=leaf_vhd_uuid)) return imported_vhds -- cgit