diff options
| author | Josh Kearney <josh@jk0.org> | 2011-09-08 11:43:43 -0500 |
|---|---|---|
| committer | Josh Kearney <josh@jk0.org> | 2011-09-08 11:43:43 -0500 |
| commit | 763bf3f1282e3d9723a356d4014a9599601637eb (patch) | |
| tree | 29f49c922d6ea5739bf143ddff8747958eb697a1 | |
| parent | bb3b61b61dc4b45fba4bdab7ead69af239eac40a (diff) | |
Do not attempt to mount the swap VDI for file injection.
| -rw-r--r-- | nova/tests/api/openstack/test_servers.py | 2 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 13 |
2 files changed, 11 insertions, 4 deletions
diff --git a/nova/tests/api/openstack/test_servers.py b/nova/tests/api/openstack/test_servers.py index 2ef687709..d063a60c2 100644 --- a/nova/tests/api/openstack/test_servers.py +++ b/nova/tests/api/openstack/test_servers.py @@ -3615,7 +3615,7 @@ class TestGetKernelRamdiskFromImage(test.TestCase): self.assertRaises(exception.NotFound, self._get_k_r, image_meta) def test_ami_no_ramdisk(self): - """If an ami is missing a ramdisk, return kernel ID and None for + """If an ami is missing a ramdisk, return kernel ID and None for ramdisk ID """ image_meta = {'id': 1, 'status': 'active', 'container_format': 'ami', diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index c5f105f40..bb53a52bc 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -188,9 +188,16 @@ class VMOps(object): ramdisk = VMHelper.fetch_image(context, self._session, instance, instance.ramdisk_id, instance.user_id, instance.project_id, ImageType.RAMDISK)[0] - # Create the VM ref and attach the first disk - first_vdi_ref = self._session.call_xenapi('VDI.get_by_uuid', - vdis[0]['vdi_uuid']) + + # NOTE(jk0): Since vdi_type may contain either 'os' or 'swap', we + # need to ensure that the 'swap' VDI is not chosen as the mount + # point for file injection. + first_vdi_ref = None + for vdi in vdis: + if vdi['vdi_type'] != 'swap': + # Create the VM ref and attach the first disk + first_vdi_ref = self._session.call_xenapi( + 'VDI.get_by_uuid', vdi['vdi_uuid']) vm_mode = instance.vm_mode and instance.vm_mode.lower() if vm_mode == 'pv': |
