Skip to content

Commit 415bfb7

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "virt: Add destroy_secrets kwarg to destroy and cleanup"
2 parents 9122cc2 + 1cc52fd commit 415bfb7

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

nova/virt/driver.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ def spawn(self, context, instance, image_meta, injected_files,
412412
raise NotImplementedError()
413413

414414
def destroy(self, context, instance, network_info, block_device_info=None,
415-
destroy_disks=True):
415+
destroy_disks=True, destroy_secrets=True):
416416
"""Destroy the specified instance from the Hypervisor.
417417
418418
If the instance is not found (for example if networking failed), this
@@ -425,11 +425,13 @@ def destroy(self, context, instance, network_info, block_device_info=None,
425425
:param block_device_info: Information about block devices that should
426426
be detached from the instance.
427427
:param destroy_disks: Indicates if disks should be destroyed
428+
:param destroy_secrets: Indicates if secrets should be destroyed
428429
"""
429430
raise NotImplementedError()
430431

431432
def cleanup(self, context, instance, network_info, block_device_info=None,
432-
destroy_disks=True, migrate_data=None, destroy_vifs=True):
433+
destroy_disks=True, migrate_data=None, destroy_vifs=True,
434+
destroy_secrets=True):
433435
"""Cleanup the instance resources .
434436
435437
Instance should have been destroyed from the Hypervisor before calling
@@ -442,6 +444,8 @@ def cleanup(self, context, instance, network_info, block_device_info=None,
442444
be detached from the instance.
443445
:param destroy_disks: Indicates if disks should be destroyed
444446
:param migrate_data: implementation specific params
447+
:param destroy_vifs: Indicates if vifs should be unplugged
448+
:param destroy_secrets: Indicates if secrets should be destroyed
445449
"""
446450
raise NotImplementedError()
447451

nova/virt/fake.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def resume(self, context, instance, network_info, block_device_info=None):
308308
pass
309309

310310
def destroy(self, context, instance, network_info, block_device_info=None,
311-
destroy_disks=True):
311+
destroy_disks=True, destroy_secrets=True):
312312
key = instance.uuid
313313
if key in self.instances:
314314
flavor = instance.flavor
@@ -323,7 +323,8 @@ def destroy(self, context, instance, network_info, block_device_info=None,
323323
'inst': self.instances}, instance=instance)
324324

325325
def cleanup(self, context, instance, network_info, block_device_info=None,
326-
destroy_disks=True, migrate_data=None, destroy_vifs=True):
326+
destroy_disks=True, migrate_data=None, destroy_vifs=True,
327+
destroy_secrets=True):
327328
# cleanup() should not be called when the guest has not been destroyed.
328329
if instance.uuid in self.instances:
329330
raise exception.InstanceExists(

nova/virt/hyperv/driver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,13 @@ def reboot(self, context, instance, network_info, reboot_type,
172172
self._vmops.reboot(instance, network_info, reboot_type)
173173

174174
def destroy(self, context, instance, network_info, block_device_info=None,
175-
destroy_disks=True):
175+
destroy_disks=True, destroy_secrets=True):
176176
self._vmops.destroy(instance, network_info, block_device_info,
177177
destroy_disks)
178178

179179
def cleanup(self, context, instance, network_info, block_device_info=None,
180-
destroy_disks=True, migrate_data=None, destroy_vifs=True):
180+
destroy_disks=True, migrate_data=None, destroy_vifs=True,
181+
destroy_secrets=True):
181182
"""Cleanup after instance being destroyed by Hypervisor."""
182183
self.unplug_vifs(instance, network_info)
183184

nova/virt/ironic/driver.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,8 @@ def _sync_remove_cache_entry():
12631263
_sync_remove_cache_entry()
12641264

12651265
def destroy(self, context, instance, network_info,
1266-
block_device_info=None, destroy_disks=True):
1266+
block_device_info=None, destroy_disks=True,
1267+
destroy_secrets=True):
12671268
"""Destroy the specified instance, if it can be found.
12681269
12691270
:param context: The security context.
@@ -1273,6 +1274,8 @@ def destroy(self, context, instance, network_info,
12731274
information. Ignored by this driver.
12741275
:param destroy_disks: Indicates if disks should be
12751276
destroyed. Ignored by this driver.
1277+
:param destroy_secrets: Indicates if secrets should be
1278+
destroyed. Ignored by this driver.
12761279
"""
12771280
LOG.debug('Destroy called for instance', instance=instance)
12781281
try:

nova/virt/libvirt/driver.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,7 +1405,7 @@ def _wait_for_destroy(expected_domid):
14051405
self._teardown_container(instance)
14061406

14071407
def destroy(self, context, instance, network_info, block_device_info=None,
1408-
destroy_disks=True):
1408+
destroy_disks=True, destroy_secrets=True):
14091409
self._destroy(instance)
14101410
# NOTE(gibi): if there was device detach in progress then we need to
14111411
# unblock the waiting threads and clean up.
@@ -1438,7 +1438,8 @@ def _undefine_domain(self, instance):
14381438
pass
14391439

14401440
def cleanup(self, context, instance, network_info, block_device_info=None,
1441-
destroy_disks=True, migrate_data=None, destroy_vifs=True):
1441+
destroy_disks=True, migrate_data=None, destroy_vifs=True,
1442+
destroy_secrets=True):
14421443
"""Cleanup the instance from the host.
14431444

14441445
Identify if the instance disks and instance path should be removed
@@ -1452,6 +1453,7 @@ def cleanup(self, context, instance, network_info, block_device_info=None,
14521453
:param destroy_disks: if local ephemeral disks should be destroyed
14531454
:param migrate_data: optional migrate_data object
14541455
:param destroy_vifs: if plugged vifs should be unplugged
1456+
:param destroy_secrets: Indicates if secrets should be destroyed
14551457
"""
14561458
cleanup_instance_dir = False
14571459
cleanup_instance_disks = False

nova/virt/vmwareapi/driver.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ def _register_openstack_extension(self):
225225
LOG.debug('Extension %s already exists.', constants.EXTENSION_KEY)
226226

227227
def cleanup(self, context, instance, network_info, block_device_info=None,
228-
destroy_disks=True, migrate_data=None, destroy_vifs=True):
228+
destroy_disks=True, migrate_data=None, destroy_vifs=True,
229+
destroy_secrets=True):
229230
"""Cleanup after instance being destroyed by Hypervisor."""
230231
pass
231232

@@ -594,7 +595,7 @@ def _detach_instance_volumes(self, instance, block_device_info):
594595
instance=instance)
595596

596597
def destroy(self, context, instance, network_info, block_device_info=None,
597-
destroy_disks=True):
598+
destroy_disks=True, destroy_secrets=True):
598599
"""Destroy VM instance."""
599600

600601
# Destroy gets triggered when Resource Claim in resource_tracker

0 commit comments

Comments
 (0)