diff options
| author | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-04-09 15:34:19 +0000 |
|---|---|---|
| committer | Johannes Erdfelt <johannes.erdfelt@rackspace.com> | 2012-04-09 18:20:21 +0000 |
| commit | 93874bacf7ec60fbc218f7aba32691255b6ae8ce (patch) | |
| tree | 78b30c63937db64766ba2712dde3f24020377aaf | |
| parent | 1c47d8a9cfbe5f6925b040ce7a268b6d00354436 (diff) | |
Use 'root' instead of 'os' in XenAPI driver
Instance types define disk names as root, swap and ephemeral. The
XenAPI driver however uses os, swap and ephemeral. Standardize on
calling them 'root' disks instead of 'os' disks.
Change-Id: Ia34346d463d06cb971537c305602926ceb0dc175
| -rw-r--r-- | nova/tests/xenapi/stubs.py | 6 | ||||
| -rw-r--r-- | nova/virt/xenapi/vm_utils.py | 8 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 6 | ||||
| -rwxr-xr-x | plugins/xenserver/xenapi/etc/xapi.d/plugins/glance | 8 |
4 files changed, 14 insertions, 14 deletions
diff --git a/nova/tests/xenapi/stubs.py b/nova/tests/xenapi/stubs.py index c82820dcf..279eec65c 100644 --- a/nova/tests/xenapi/stubs.py +++ b/nova/tests/xenapi/stubs.py @@ -41,7 +41,7 @@ def stubout_firewall_driver(stubs, conn): def stubout_instance_snapshot(stubs): @classmethod def fake_fetch_image(cls, context, session, instance, image, type): - return [dict(vdi_type='os', vdi_uuid=_make_fake_vdi())] + return [dict(vdi_type='root', vdi_uuid=_make_fake_vdi())] stubs.Set(vm_utils.VMHelper, 'fetch_image', fake_fetch_image) @@ -192,7 +192,7 @@ class FakeSessionForVMTests(fake.SessionBase): def host_call_plugin(self, _1, _2, plugin, method, _5): if (plugin, method) == ('glance', 'download_vhd'): - return fake.as_json(dict(vdi_type='os', + return fake.as_json(dict(vdi_type='root', vdi_uuid=_make_fake_vdi())) elif (plugin, method) == ("xenhost", "iptables_config"): return fake.as_json(out=self._fake_iptables_save_output, @@ -203,7 +203,7 @@ class FakeSessionForVMTests(fake.SessionBase): def host_call_plugin_swap(self, _1, _2, plugin, method, _5): if (plugin, method) == ('glance', 'download_vhd'): - return fake.as_json(dict(vdi_type='os', + return fake.as_json(dict(vdi_type='root', vdi_uuid=_make_fake_vdi()), dict(vdi_type='swap', vdi_uuid=_make_fake_vdi())) diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py index 69be2b9a7..9311a2a65 100644 --- a/nova/virt/xenapi/vm_utils.py +++ b/nova/virt/xenapi/vm_utils.py @@ -119,7 +119,7 @@ class ImageType: KERNEL_STR = "kernel" RAMDISK_STR = "ramdisk" - DISK_STR = "os" + DISK_STR = "root" DISK_RAW_STR = "os_raw" DISK_VHD_STR = "vhd" DISK_ISO_STR = "iso" @@ -665,7 +665,7 @@ class VMHelper(xenapi.HelperBase): new_vdi_ref, "image-id") vdi_return_list.append(dict( - vdi_type=("os" if image_type == ImageType.DISK_VHD + vdi_type=("root" if image_type == ImageType.DISK_VHD else ImageType.to_string(image_type)), vdi_uuid=session.call_xenapi('VDI.get_uuid', new_vdi_ref), file=None)) @@ -755,7 +755,7 @@ class VMHelper(xenapi.HelperBase): # 'download_vhd' will return a list of dictionaries describing VDIs. # The dictionary will contain 'vdi_type' and 'vdi_uuid' keys. - # 'vdi_type' can be 'os' or 'swap' right now. + # 'vdi_type' can be 'root' or 'swap' right now. for vdi in vdis: LOG.debug(_("xapi 'download_vhd' returned VDI of " "type '%(vdi_type)s' with UUID '%(vdi_uuid)s'"), @@ -828,7 +828,7 @@ class VMHelper(xenapi.HelperBase): # VHD disk, it may be worth using the plugin for both VHD and RAW and # DISK restores image_type_str = ImageType.to_string(image_type) - LOG.debug(_("Fetching image %(image)s, type %(image_type_str)"), + LOG.debug(_("Fetching image %(image)s, type %(image_type_str)s"), locals(), instance=instance) if image_type == ImageType.DISK_ISO: diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index 07d5a8cc8..2c0e40792 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -214,7 +214,7 @@ class VMOps(object): self._resize_instance(instance, vdi_uuid) vm_ref = self._create_vm(context, instance, - [dict(vdi_type='os', vdi_uuid=vdi_uuid)], + [dict(vdi_type='root', vdi_uuid=vdi_uuid)], network_info, image_meta) # 5. Start VM @@ -243,7 +243,7 @@ class VMOps(object): disk_image_type) for vdi in vdis: - if vdi["vdi_type"] == "os": + if vdi["vdi_type"] == "root": self._resize_instance(instance, vdi["vdi_uuid"]) return vdis @@ -384,7 +384,7 @@ class VMOps(object): disk_image_type = VMHelper.determine_disk_image_type(image_meta) - # NOTE(jk0): Since vdi_type may contain either 'os' or 'swap', we + # NOTE(jk0): Since vdi_type may contain either 'root' or 'swap', we # need to ensure that the 'swap' VDI is not chosen as the mount # point for file injection. first_vdi_ref = None diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance index 0020ad5bd..daf4576bf 100755 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance @@ -186,11 +186,11 @@ def _import_vhds(sr_path, staging_path, uuid_stack): Returns: A list of VDIs. Each list element is a dictionary containing information about the VHD. Dictionary keys are: - 1. "vdi_type" - The type of VDI. Currently they can be "os_disk" or + 1. "vdi_type" - The type of VDI. Currently they can be "root" or "swap" 2. "vdi_uuid" - The UUID of the VDI - Example return: [{"vdi_type": "os_disk","vdi_uuid": "ffff-aaa..vhd"}, + Example return: [{"vdi_type": "root","vdi_uuid": "ffff-aaa..vhd"}, {"vdi_type": "swap","vdi_uuid": "ffff-bbb..vhd"}] """ def rename_with_uuid(orig_path): @@ -318,12 +318,12 @@ def _import_vhds(sr_path, staging_path, uuid_stack): # delete the base_copy since it is an unreferenced parent. paths_to_move.insert(0, 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])) + vdi_return_list.append(dict(vdi_type="root", vdi_uuid=snap_info[1])) else: validate_vdi_chain(image_info[0]) assert_vhd_not_hidden(image_info[0]) # If there's no snap, we return the image.vhd UUID - vdi_return_list.append(dict(vdi_type="os", vdi_uuid=image_info[1])) + vdi_return_list.append(dict(vdi_type="root", vdi_uuid=image_info[1])) swap_info = prepare_if_exists(staging_path, 'swap.vhd') if swap_info: |
