From 0a533df573552e7200786db8dee1ea8483c1a86c Mon Sep 17 00:00:00 2001 From: Sudipta Biswas Date: Wed, 8 Jun 2016 12:12:29 +0530 Subject: [PATCH] get rid of the old _vhd methods This patchset gets rid of all the old download_vhd/upload_vhd code. The old _vhd calls won't work anymore since we won't send them the right parameters. Change-Id: I8c0b47a7e8a94ee4b20c888bd86c1a77920103b8 --- nova/tests/unit/virt/xenapi/stubs.py | 2 +- nova/virt/xenapi/fake.py | 1 - .../xenapi/etc/xapi.d/plugins/glance | 34 +------------------ 3 files changed, 2 insertions(+), 35 deletions(-) diff --git a/nova/tests/unit/virt/xenapi/stubs.py b/nova/tests/unit/virt/xenapi/stubs.py index af4ada335b6a..641f97adc81d 100644 --- a/nova/tests/unit/virt/xenapi/stubs.py +++ b/nova/tests/unit/virt/xenapi/stubs.py @@ -168,7 +168,7 @@ class FakeSessionForVMTests(fake.SessionBase): "# Completed on Sun Nov 6 22:49:02 2011\n") def host_call_plugin(self, _1, _2, plugin, method, _5): - if plugin == 'glance' and method in ('download_vhd', 'download_vhd2'): + if plugin == 'glance' and method in ('download_vhd2'): root_uuid = _make_fake_vdi() return pickle.dumps(dict(root=dict(uuid=root_uuid))) elif (plugin, method) == ("xenhost", "iptables_config"): diff --git a/nova/virt/xenapi/fake.py b/nova/virt/xenapi/fake.py index 3b04d6ae483c..d505a6151175 100644 --- a/nova/virt/xenapi/fake.py +++ b/nova/virt/xenapi/fake.py @@ -663,7 +663,6 @@ class SessionBase(object): assert vdi_ref return pickle.dumps(None) - _plugin_glance_upload_vhd = _plugin_pickle_noop _plugin_glance_upload_vhd2 = _plugin_pickle_noop _plugin_kernel_copy_vdi = _plugin_noop _plugin_kernel_create_kernel_ramdisk = _plugin_noop diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance index e50a4bd8d6fc..f2a8f90a7d06 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance @@ -397,24 +397,6 @@ def download_vhd2(session, image_id, endpoint, utils.cleanup_staging_area(staging_path) -def download_vhd(session, image_id, glance_host, glance_port, glance_use_ssl, - uuid_stack, sr_path, extra_headers): - """Download an image from Glance, unbundle it, and then deposit the VHDs - into the storage repository - """ - staging_path = utils.make_staging_area(sr_path) - try: - # Download tarball into staging area and extract it - _download_tarball( - sr_path, staging_path, image_id, glance_host, glance_port, - glance_use_ssl, extra_headers) - - # Move the VHDs from the staging area into the storage repository - return utils.import_vhds(sr_path, staging_path, uuid_stack) - finally: - utils.cleanup_staging_area(staging_path) - - def upload_vhd2(session, vdi_uuids, image_id, endpoint, sr_path, extra_headers, properties): """Bundle the VHDs comprising an image and then stream them into Glance. @@ -428,19 +410,5 @@ def upload_vhd2(session, vdi_uuids, image_id, utils.cleanup_staging_area(staging_path) -def upload_vhd(session, vdi_uuids, image_id, glance_host, glance_port, - glance_use_ssl, sr_path, extra_headers, properties): - """Bundle the VHDs comprising an image and then stream them into Glance. - """ - staging_path = utils.make_staging_area(sr_path) - try: - utils.prepare_staging_area(sr_path, staging_path, vdi_uuids) - _upload_tarball(staging_path, image_id, glance_host, glance_port, - glance_use_ssl, extra_headers, properties) - finally: - utils.cleanup_staging_area(staging_path) - - if __name__ == '__main__': - utils.register_plugin_calls(download_vhd, upload_vhd, - download_vhd2, upload_vhd2) + utils.register_plugin_calls(download_vhd2, upload_vhd2)