summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-10-01 21:56:20 +0000
committerGerrit Code Review <review@openstack.org>2012-10-01 21:56:20 +0000
commitd399c755688c5c4d7f7aa5cb5fa8a55b4319f9ff (patch)
tree2f9a13bc50847ec240f291934cf6ec3863cc495e /nova/virt
parent14cfc19381b7f923b9c0e174038810a1a1aec5dc (diff)
parenta36288351af519ef62ad4f52b3e3e38601ba3f58 (diff)
Merge "xenapi: Removing legacy swap-in-image."
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/xenapi/vm_utils.py19
-rw-r--r--nova/virt/xenapi/vmops.py23
2 files changed, 3 insertions, 39 deletions
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py
index 2dc358f0f..47cbba6c4 100644
--- a/nova/virt/xenapi/vm_utils.py
+++ b/nova/virt/xenapi/vm_utils.py
@@ -848,12 +848,6 @@ def _create_cached_image(context, session, instance, name_label,
session.call_xenapi('VDI.add_to_other_config',
root_vdi_ref, 'image-id', str(image_id))
- swap_vdi = vdis.get('swap')
- if swap_vdi:
- session.call_xenapi(
- 'VDI.add_to_other_config', root_vdi_ref, 'swap-disk',
- str(swap_vdi['uuid']))
-
if FLAGS.use_cow_images and sr_type == 'ext':
new_vdi_ref = _clone_vdi(session, root_vdi_ref)
else:
@@ -868,19 +862,6 @@ def _create_cached_image(context, session, instance, name_label,
else ImageType.to_string(image_type))
vdi_uuid = session.call_xenapi('VDI.get_uuid', new_vdi_ref)
vdis[vdi_type] = dict(uuid=vdi_uuid, file=None)
-
- # Create a swap disk if the glance image had one associated with it.
- vdi_rec = session.call_xenapi('VDI.get_record', root_vdi_ref)
- if 'swap-disk' in vdi_rec['other_config']:
- swap_disk_uuid = vdi_rec['other_config']['swap-disk']
- swap_vdi_ref = session.call_xenapi('VDI.get_by_uuid',
- swap_disk_uuid)
- new_swap_vdi_ref = _safe_copy_vdi(
- session, sr_ref, instance, swap_vdi_ref)
- new_swap_vdi_uuid = session.call_xenapi('VDI.get_uuid',
- new_swap_vdi_ref)
- vdis['swap'] = dict(uuid=new_swap_vdi_uuid, file=None)
-
return vdis
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index cea5485ab..ae8efc5f3 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -57,11 +57,7 @@ xenapi_vmops_opts = [
'to go to running state'),
cfg.StrOpt('xenapi_vif_driver',
default='nova.virt.xenapi.vif.XenAPIBridgeDriver',
- help='The XenAPI VIF driver using XenServer Network APIs.'),
- cfg.BoolOpt('xenapi_generate_swap',
- default=False,
- help='Whether to generate swap '
- '(False means fetching it from OVA)'),
+ help='The XenAPI VIF driver using XenServer Network APIs.')
]
FLAGS = flags.FLAGS
@@ -425,6 +421,7 @@ class VMOps(object):
def _attach_disks(self, instance, vm_ref, name_label, disk_image_type,
vdis):
ctx = nova_context.get_admin_context()
+ instance_type = db.instance_type_get(ctx, instance['instance_type_id'])
# DISK_ISO needs two VBDs: the ISO disk and a blank RW disk
if disk_image_type == vm_utils.ImageType.DISK_ISO:
@@ -447,8 +444,6 @@ class VMOps(object):
if instance['auto_disk_config']:
LOG.debug(_("Auto configuring disk, attempting to "
"resize partition..."), instance=instance)
- instance_type = db.instance_type_get(ctx,
- instance['instance_type_id'])
vm_utils.auto_configure_disk(self._session,
root_vdi['ref'],
instance_type['root_gb'])
@@ -457,23 +452,11 @@ class VMOps(object):
DEVICE_ROOT, bootable=True)
# Attach (optional) swap disk
- swap_vdi = vdis.get('swap')
-
- instance_type = db.instance_type_get(ctx, instance['instance_type_id'])
swap_mb = instance_type['swap']
- generate_swap = swap_mb and FLAGS.xenapi_generate_swap
- if generate_swap:
+ if swap_mb:
vm_utils.generate_swap(self._session, instance, vm_ref,
DEVICE_SWAP, name_label, swap_mb)
- if swap_vdi:
- # We won't be using packaged swap VDI, so destroy it
- vm_utils.destroy_vdi(self._session, swap_vdi['ref'])
- elif swap_vdi:
- # Attach packaged swap VDI to VM
- vm_utils.create_vbd(self._session, vm_ref, swap_vdi['ref'],
- DEVICE_SWAP, bootable=False)
-
# Attach (optional) ephemeral disk
ephemeral_gb = instance_type['ephemeral_gb']
if ephemeral_gb: