def destroy_all_instances(self): """ Destroy all instances and delete tenant networks for all users. """ for instance in self.all_instances(): self.admin_driver.destroy_instance(instance) logger.debug('Destroyed instance %s' % instance) os_driver = OSAccountDriver() for username in os_driver.list_usergroup_names(): tenant_name = username os_driver.network_manager.delete_tenant_network(username, tenant_name) return True
def destroy_all_instances(self): """ Destroy all instances and delete tenant networks for all users. """ for instance in self.all_instances(): self.admin_driver.destroy_instance(instance) logger.debug('Destroyed instance %s' % instance) os_driver = OSAccountDriver() for username in os_driver.list_usergroup_names(): tenant_name = username os_driver.network_manager.delete_tenant_network( username, tenant_name) return True
def stop_all_instances(self, destroy=False): """ Stop all instances and delete tenant networks for all users. To destroy instances instead of stopping them use the destroy keyword (destroy=True). """ for instance in self.all_instances(): if destroy: self.admin_driver.destroy_instance(instance) logger.debug('Destroyed instance %s' % instance) else: if instance.get_status() == 'active': self.admin_driver.stop_instance(instance) logger.debug('Stopped instance %s' % instance) os_driver = OSAccountDriver() if destroy: for username in os_driver.list_usergroup_names(): tenant_name = username os_driver.network_manager.delete_tenant_network(username, tenant_name) return True
def stop_all_instances(self, destroy=False): """ Stop all instances and delete tenant networks for all users. To destroy instances instead of stopping them use the destroy keyword (destroy=True). """ for instance in self.all_instances(): if destroy: self.admin_driver.destroy_instance(instance) logger.debug('Destroyed instance %s' % instance) else: if instance.get_status() == 'active': self.admin_driver.stop_instance(instance) logger.debug('Stopped instance %s' % instance) os_driver = OSAccountDriver() if destroy: for username in os_driver.list_usergroup_names(): tenant_name = username os_driver.network_manager.delete_tenant_network( username, tenant_name) return True