From 8f6cb9fd23275c5cc3bc7476982c25d3fc11a1dc Mon Sep 17 00:00:00 2001 From: yinym Date: Tue, 22 Jul 2014 14:30:05 +0800 Subject: [PATCH] Fix flake8 warning and error report All the flake8 issues have been resolved with this commit. Change-Id: I637f82c484b3dbecc4827731a13f79c2ba2b9240 Closes-Bug: #1346759 --- .../volume/driver/test_powervc_cinder.py | 28 +- .../logrotate.d/openstack-powervc-driver | 20 +- .../powervc/common/client/extensions/nova.py | 7 +- .../powervc/common/client/factory.py | 11 +- common-powervc/powervc/common/utils.py | 8 +- .../test/common/powervc_test_1.conf | 456 +++++++++--------- .../test/common/powervc_test_2.conf | 456 +++++++++--------- common-powervc/test/common/test_config.py | 35 +- .../powervc/glance/common/config.py | 12 +- .../powervc/glance/common/constants.py | 4 +- .../powervc/glance/manager/manager.py | 3 +- .../test/test_neutron_powervc_agent.py | 8 +- nova-powervc/.pydevproject | 12 +- .../nova/driver/virt/powervc/service.py | 6 +- .../driver/virt/powervc/sync/flavorsync.py | 1 + .../nova/driver/virt/powervc/test_driver.py | 20 +- 16 files changed, 548 insertions(+), 539 deletions(-) diff --git a/cinder-powervc/test/powervc/volume/driver/test_powervc_cinder.py b/cinder-powervc/test/powervc/volume/driver/test_powervc_cinder.py index 5119f10..559350b 100644 --- a/cinder-powervc/test/powervc/volume/driver/test_powervc_cinder.py +++ b/cinder-powervc/test/powervc/volume/driver/test_powervc_cinder.py @@ -72,11 +72,11 @@ class PowerVCDriverTestCase(unittest.TestCase): volume = Volume(vol) # fake volume after call creating volume from pvc ret_vol_after_created = {'id': 4321, - 'status': 'creating'} + 'status': 'creating'} ret_volume_after_created = Volume(ret_vol_after_created) # fake volume after call get volume from pvc ret_vol_get = {'id': 4321, - 'status': 'available'} + 'status': 'available'} ret_volume_get = Volume(ret_vol_get) # mock create volume restAPI @@ -90,8 +90,8 @@ class PowerVCDriverTestCase(unittest.TestCase): dic = self.powervc_cinder_driver.create_volume(volume) self.assertEqual({'status': 'available', - 'metadata': {'pvc:id': 4321}}, - dic, "return vol doesn't match") + 'metadata': {'pvc:id': 4321}}, + dic, "return vol doesn't match") def test_create_volume_failed(self): # local volume passed to driver @@ -100,11 +100,11 @@ class PowerVCDriverTestCase(unittest.TestCase): volume = Volume(vol) # fake volume after call creating volume from pvc ret_vol_after_created = {'id': 4321, - 'status': 'creating'} + 'status': 'creating'} ret_volume_after_created = Volume(ret_vol_after_created) # fake volume after call get volume from pvc ret_vol_get = {'id': 4321, - 'status': 'error'} + 'status': 'error'} ret_volume_get = Volume(ret_vol_get) # mock create volume restAPI @@ -119,7 +119,7 @@ class PowerVCDriverTestCase(unittest.TestCase): dic = self.powervc_cinder_driver.create_volume(volume) self.assertEqual({'status': 'error', 'metadata': {'pvc:id': 4321}}, - dic, "return vol doesn't match") + dic, "return vol doesn't match") def test_create_volume_not_found(self): # local volume passed to driver @@ -128,11 +128,11 @@ class PowerVCDriverTestCase(unittest.TestCase): volume = Volume(vol) # fake volume after call creating volume from pvc ret_vol_after_created = {'id': 4321, - 'status': 'creating'} + 'status': 'creating'} ret_volume_after_created = Volume(ret_vol_after_created) # fake volume after call get volume from pvc ret_vol_get = {'id': 4321, - 'status': 'error'} + 'status': 'error'} ret_volume_get = Volume(ret_vol_get) # mock create volume restAPI @@ -149,8 +149,8 @@ class PowerVCDriverTestCase(unittest.TestCase): dic = self.powervc_cinder_driver.create_volume(volume) self.assertEqual({'status': 'error', - 'metadata': {'pvc:id': 4321}}, - dic, "return vol doesn't match") + 'metadata': {'pvc:id': 4321}}, + dic, "return vol doesn't match") def test_delete_volume_success(self): #fake volume which will be passed to driver service @@ -169,7 +169,7 @@ class PowerVCDriverTestCase(unittest.TestCase): #mock rest API PowerVCService._client.volumes.get = \ mock.MagicMock(side_effect=[existed_volume_get, - after_delete_volume_get]) + after_delete_volume_get]) self.powervc_cinder_driver.delete_volume(volume) @@ -213,5 +213,5 @@ class PowerVCDriverTestCase(unittest.TestCase): ret_dic = self.powervc_cinder_driver.get_volume_stats(True) self.assertEqual(expected_ret_dic, - ret_dic, - "return stats should be matched") + ret_dic, + 'return stats should be matched') diff --git a/common-powervc/logrotate.d/openstack-powervc-driver b/common-powervc/logrotate.d/openstack-powervc-driver index fe35245..5c731be 100644 --- a/common-powervc/logrotate.d/openstack-powervc-driver +++ b/common-powervc/logrotate.d/openstack-powervc-driver @@ -1,10 +1,10 @@ -compress - -/var/log/powervc/*.log { - weekly - rotate 4 - missingok - compress - minsize 100k - size 50M -} +compress + +/var/log/powervc/*.log { + weekly + rotate 4 + missingok + compress + minsize 100k + size 50M +} diff --git a/common-powervc/powervc/common/client/extensions/nova.py b/common-powervc/powervc/common/client/extensions/nova.py index 609fb84..38a0ba6 100644 --- a/common-powervc/powervc/common/client/extensions/nova.py +++ b/common-powervc/powervc/common/client/extensions/nova.py @@ -2,7 +2,6 @@ import six import urllib -import base64 from novaclient import base as client_base from novaclient.v1_1 import servers from novaclient.v1_1 import hypervisors @@ -10,7 +9,6 @@ from novaclient.v1_1 import images from novaclient.v1_1 import flavors from novaclient.v1_1 import volumes from novaclient.v1_1.volume_types import VolumeType -from novaclient.openstack.common import strutils from powervc.common.client.extensions import base from powervc.common import utils import logging @@ -92,7 +90,6 @@ class PVCServerManager(servers.ServerManager): detail = "/detail" return self._list("/servers%s%s" % (detail, query_string), "servers") - # This function was copied from (/usr/lib/python2.6/site-packages/ # novaclient/v1_1/servers.py) before, but changes needed when activation # data contains userdata and files, because in a boot action, local OS @@ -372,7 +369,7 @@ class StorageConnectivityGroupManager(client_base.Manager): """ try: return self._list("/storage-connectivity-groups/%s/volumes" - % scgUUID, "volumes", volumes.Volume) + % scgUUID, "volumes", volumes.Volume) except Exception as e: LOG.error('A problem was encountered while getting a list of ' 'accessible volumes for scg %s: %s ' @@ -387,7 +384,7 @@ class StorageConnectivityGroupManager(client_base.Manager): """ try: return self._list("/storage-connectivity-groups/%s/volume-types" - % scgUUID, "volume-types", VolumeType) + % scgUUID, "volume-types", VolumeType) except Exception as e: LOG.error('A problem was encountered while getting a list of ' 'accessible volume types for scg %s: %s ' diff --git a/common-powervc/powervc/common/client/factory.py b/common-powervc/powervc/common/client/factory.py index 51bd6e8..8fb3d49 100644 --- a/common-powervc/powervc/common/client/factory.py +++ b/common-powervc/powervc/common/client/factory.py @@ -7,6 +7,7 @@ from powervc.common.client.config import CONF as CONF from powervc.common.client.config import OS_OPTS as OS_OPTS from powervc.common.client.config import PVC_OPTS as PVC_OPTS from powervc.common.constants import SERVICE_TYPES as SERVICE_TYPES +from powervc.common.gettextutils import _ """sample useage @@ -47,14 +48,14 @@ def initialize_local_servicecatalog(): return def new_local_servicecatalog(): - LOG.info(_("start to new local keystone client")) + LOG.info(_('start to new local keystone client')) keystone_version = CONF['openstack']['keystone_version'] keystone = service.KeystoneService(str(SERVICE_TYPES.identity), keystone_version, OS_OPTS['auth_url'], OS_OPTS, None).new_client() servicecatalog = service.ClientServiceCatalog(OS_OPTS, keystone) - LOG.info(_("finish to new local keystone client")) + LOG.info(_('finish to new local keystone client')) return servicecatalog count = 0 @@ -65,11 +66,11 @@ def initialize_local_servicecatalog(): LOCAL = new_local_servicecatalog() return except Exception, e: - LOG.info(_("Keystone service is not ready. " + str(e))) + LOG.info(_('Keystone service is not ready. ' + str(e))) count += 1 if count == CONF['openstack']['keystone_max_try_times']: - LOG.error(_("Keystone service is not ready eventually after" - " retries!")) + LOG.error(_('Keystone service is not ready eventually after' + ' retries!')) raise e time.sleep(CONF['openstack']['keystone_retry_interval']) diff --git a/common-powervc/powervc/common/utils.py b/common-powervc/powervc/common/utils.py index 8a78b8c..4412d4d 100644 --- a/common-powervc/powervc/common/utils.py +++ b/common-powervc/powervc/common/utils.py @@ -361,11 +361,13 @@ class Utils(object): if not scg: # If no scg, then it's a IVM based PowerVC, # return all servers - return self._novaclient.manager.list_all_servers(detailed, search_opts) + return self._novaclient.manager.list_all_servers( + detailed, search_opts) # accessible_storage_servers to return accessible_storage_servers = [] - all_servers = self._novaclient.manager.list_all_servers(detailed, search_opts) + all_servers = self._novaclient.manager.list_all_servers( + detailed, search_opts) # Filter the servers for the SCG for server in all_servers: @@ -566,7 +568,7 @@ class Utils(object): # If no scg, then it's a IVM based PowerVC, # return all volumes return (self._cinderclient.volume_types. - list_all_storage_templates()) + list_all_storage_templates()) # accessible_storage_templates to return accessible_storage_templates = [] diff --git a/common-powervc/test/common/powervc_test_1.conf b/common-powervc/test/common/powervc_test_1.conf index 495d4c1..de0e121 100644 --- a/common-powervc/test/common/powervc_test_1.conf +++ b/common-powervc/test/common/powervc_test_1.conf @@ -1,228 +1,228 @@ -# This file contains configuration properties that affects how the powervc driver functions and how it -# communicates with the PowerVC server. Most properties have default values based on a default -# PowerVC configuration. However, some connection properties, such as PowerVC host name -# do not have default values and must be configured prior to running the powervc driver. These -# properties are marked with the text INPUT REQUIRED. Also you may have to change other -# properties depending on your environment and how your PowerVC sever is configured. For -# more information, see the Smart Cloud Entry Administration Guide. - -[DEFAULT] -# The following group of properties needs to be configured -# in order for the PowerVC Driver to be able to authenticate with keystone -# and obtain information from it, that might be required to run background -# tasks (such as discovering a new image), or simply to connect to a -# secured Glance. -# When running secured Glance, make sure the 'auth_strategy' property in -# nova.conf is set to 'keystone'. - -# Log info messages -verbose = true - - -[openstack] -# Authentication url to authenticate with keystone (string value) -auth_url = http://localhost:5000/v2.0 - -# v2.0 or v3 -keystone_version = v2.0 - -# Tenant name for connecting to keystone in admin context (string value) -admin_tenant_name = demo - -# Username for connecting to keystone in admin context (string value) -admin_user = demo - -# Password for connecting to keystone in admin context (string value) -admin_password = openstack - -# For local SSL connections, specify the path and filename of the cacert file -#connection_cacert = - -http_insecure = True - -# -# Qpid connection information -# - -# Qpid broker hostname (string value) -qpid_hostname = host - -# Qpid broker port (integer value) -qpid_port = 5675 - -# Username for qpid connection (string value) -qpid_username = - -# Password for qpid connection (string value) -qpid_password = - -# Transport to use, either 'tcp'(default) or 'ssl' -qpid_protocol = tcp - -[powervc] - -# Full class name for the manager for PowerVC Manager Service (string value) -powervc_manager = powervc.nova.driver.compute.manager.PowerVCCloudManager - -# Full class name for the driver for PowerVC Driver Service (string value) -powervc_driver = powervc.nova.driver.virt.powervc.driver.PowerVCDriver - -# -# Connection information for PowerVC. -# - -# Authentication url of the PowerVC to connect to -# INPUT REQUIRED -# Provide 'host' portion by updating it to the hostname of the PowerVC system -#auth_url = https://host/powervc/openstack/identity/v3 - -# v2.0 or v3 -keystone_version = v3 - -# Username for PowerVC connection (string value) -admin_user = root - -# Password for PowerVC connection (string value) -admin_password = passw0rd - -# Tenant name for PowerVC connection (string value) -admin_tenant_name = ibm-default - -# For PowerVC SSL connections, specify the path and filename of the cacert file -# INPUT REQUIRED -# Provide the cacert file by copying it from its install location on the -# PowerVC host (e.g. /etc/pki/tls/certs/powervc.crt) to the local hosting -# Openstack system. -#connection_cacert = - -# Value of insecure option for PowerVC connections (Default=True) -# INPUT REQUIRED -# Change to False when using a secure connection and providing a cacert file. -http_insecure = True - -# Value of authorization token expiration stale duration (Default=3600) -# INPUT REQUIRED -# Due to PowerVC requirement, all the REST API customers need to pre-refresh -# authorization token at least 1 hour before expiration -expiration_stale_duration = 3600 - -# The names of the storage connectivity groups supported by our driver -# INPUT REQUIRED -# Provide the PowerVC storage connectivity group (SCG) names by getting the name -# from the PowerVC system, or using the PowerVC default SCG of "Any host, all VIOS". -# If there are more than one SCG you want to specify, just add more SCG values with -# more storage_connectivity_group -# Note: The value of this property must exactly match the value as specified on the -# PowerVC server, including case, punctuation, and spaces. -storage_connectivity_group = Any host, all VIOS -#storage_connectivity_group = - -# -# Qpid connection information for PowerVC -# - -# Qpid broker hostname (string value) -# INPUT REQUIRED -# Change 'host' to the hostname of the PowerVC system -qpid_hostname = host - -# Qpid broker port (integer value) - -# uncomment following line for non-ssl -# qpid_port = 5672 -qpid_port = 5679 - -# Username for qpid connection (string value) -#qpid_username = powervc_qpid - -# Password for qpid connection (string value) -# INPUT REQUIRED -# Provide the qpid connection password from the PowerVC system -# by using the cat command on the pw.file in the directory where -# PowerVC is installed (e.g. cat /opt/ibm/powervc/data/pw.file) -qpid_password = - -# Transport to use, either 'tcp'(default) or 'ssl' - -# uncomment following line for non-ssl -# qpid_protocol = tcp -qpid_protocol = ssl - -# -# Sync variables -# - -# The name of the staging project (string value) -# If not set defaults to 'Public'. If set the named project should exist and -# be accessible by the staging_user. -staging_project_name = Public - -# The name of the staging user (string value) -# If not set defaults to 'admin'. If set the user should exist and -# have access to the project identified by staging_project_name. -staging_user = admin - -# The prefix that will be added to the flavor name from PowerVC -# and stored (string value). This should be unique for every -# connection to help distinguish the flavors -flavor_prefix = PVC- - -# This is a list of PowerVC flavor names that should be synced. -# If no flavor name is specified, then all flavors are synced. -flavor_white_list = - -# This is a list of PowerVC flavor names that should not be synced. -flavor_black_list = - -# The periodic flavor sync interval in seconds. -flavor_sync_interval = 300 - -# Instance periodic sync interval specified in seconds -instance_sync_interval = 20 - -# How many instance sync intervals between full instance syncs. Only instances -# known to be out of sync are synced on the interval except after this many -# intervals when all instances are synced. -full_instance_sync_frequency = 30 - -# Image periodic sync interval specified in seconds. This is the time from the end -# of one successful image periodic sync operation to the start of the next. -image_periodic_sync_interval_in_seconds = 300 - -# The time in seconds between image sync retry attempts if an error was -# encountered during an image sync operation -image_sync_retry_interval_time_in_seconds = 60 - -# The maximum number of images to return. The default is 500 images. If your PowerVC -# has more than 500 images, this limit should be increased to include all images. -image_limit = 500 - -# Volume periodic sync interval specified in seconds -volume_sync_interval = 20 - -# How many volume sync intervals between full volume syncs. -# Only volumes known to be out of sync are synced on the interval -# except after this many intervals when all volumes are synced. -full_volume_sync_frequency = 30 - -# Volume type periodic sync interval specified in seconds -volume_type_sync_interval = 20 - -# How many volume type sync intervals between full volume type syncs. -# Only volumes known to be out of sync are synced on the interval -# except after this many intervals when all volumes are synced. -full_volume_type_sync_frequency = 30 - -# Ignore delete errors so an exception is not thrown during a -# delete. When set to true, this allows the volume to be deleted -# on the hosting OS even if an exception occurs. When set to false, -# exceptions during delete prevent the volume from being deleted -# on the hosting OS. -volume_driver_ignore_delete_error = False - -# The times to check whether attaching/detaching the volume succeed -volume_max_try_times = 12 - -# Minimum delay interval and initial delay seconds for long run tasks. -longrun_loop_interval = 7 -longrun_initial_delay = 10 +# This file contains configuration properties that affects how the powervc driver functions and how it +# communicates with the PowerVC server. Most properties have default values based on a default +# PowerVC configuration. However, some connection properties, such as PowerVC host name +# do not have default values and must be configured prior to running the powervc driver. These +# properties are marked with the text INPUT REQUIRED. Also you may have to change other +# properties depending on your environment and how your PowerVC sever is configured. For +# more information, see the Smart Cloud Entry Administration Guide. + +[DEFAULT] +# The following group of properties needs to be configured +# in order for the PowerVC Driver to be able to authenticate with keystone +# and obtain information from it, that might be required to run background +# tasks (such as discovering a new image), or simply to connect to a +# secured Glance. +# When running secured Glance, make sure the 'auth_strategy' property in +# nova.conf is set to 'keystone'. + +# Log info messages +verbose = true + + +[openstack] +# Authentication url to authenticate with keystone (string value) +auth_url = http://localhost:5000/v2.0 + +# v2.0 or v3 +keystone_version = v2.0 + +# Tenant name for connecting to keystone in admin context (string value) +admin_tenant_name = demo + +# Username for connecting to keystone in admin context (string value) +admin_user = demo + +# Password for connecting to keystone in admin context (string value) +admin_password = openstack + +# For local SSL connections, specify the path and filename of the cacert file +#connection_cacert = + +http_insecure = True + +# +# Qpid connection information +# + +# Qpid broker hostname (string value) +qpid_hostname = host + +# Qpid broker port (integer value) +qpid_port = 5675 + +# Username for qpid connection (string value) +qpid_username = + +# Password for qpid connection (string value) +qpid_password = + +# Transport to use, either 'tcp'(default) or 'ssl' +qpid_protocol = tcp + +[powervc] + +# Full class name for the manager for PowerVC Manager Service (string value) +powervc_manager = powervc.nova.driver.compute.manager.PowerVCCloudManager + +# Full class name for the driver for PowerVC Driver Service (string value) +powervc_driver = powervc.nova.driver.virt.powervc.driver.PowerVCDriver + +# +# Connection information for PowerVC. +# + +# Authentication url of the PowerVC to connect to +# INPUT REQUIRED +# Provide 'host' portion by updating it to the hostname of the PowerVC system +#auth_url = https://host/powervc/openstack/identity/v3 + +# v2.0 or v3 +keystone_version = v3 + +# Username for PowerVC connection (string value) +admin_user = root + +# Password for PowerVC connection (string value) +admin_password = passw0rd + +# Tenant name for PowerVC connection (string value) +admin_tenant_name = ibm-default + +# For PowerVC SSL connections, specify the path and filename of the cacert file +# INPUT REQUIRED +# Provide the cacert file by copying it from its install location on the +# PowerVC host (e.g. /etc/pki/tls/certs/powervc.crt) to the local hosting +# Openstack system. +#connection_cacert = + +# Value of insecure option for PowerVC connections (Default=True) +# INPUT REQUIRED +# Change to False when using a secure connection and providing a cacert file. +http_insecure = True + +# Value of authorization token expiration stale duration (Default=3600) +# INPUT REQUIRED +# Due to PowerVC requirement, all the REST API customers need to pre-refresh +# authorization token at least 1 hour before expiration +expiration_stale_duration = 3600 + +# The names of the storage connectivity groups supported by our driver +# INPUT REQUIRED +# Provide the PowerVC storage connectivity group (SCG) names by getting the name +# from the PowerVC system, or using the PowerVC default SCG of "Any host, all VIOS". +# If there are more than one SCG you want to specify, just add more SCG values with +# more storage_connectivity_group +# Note: The value of this property must exactly match the value as specified on the +# PowerVC server, including case, punctuation, and spaces. +storage_connectivity_group = Any host, all VIOS +#storage_connectivity_group = + +# +# Qpid connection information for PowerVC +# + +# Qpid broker hostname (string value) +# INPUT REQUIRED +# Change 'host' to the hostname of the PowerVC system +qpid_hostname = host + +# Qpid broker port (integer value) + +# uncomment following line for non-ssl +# qpid_port = 5672 +qpid_port = 5679 + +# Username for qpid connection (string value) +#qpid_username = powervc_qpid + +# Password for qpid connection (string value) +# INPUT REQUIRED +# Provide the qpid connection password from the PowerVC system +# by using the cat command on the pw.file in the directory where +# PowerVC is installed (e.g. cat /opt/ibm/powervc/data/pw.file) +qpid_password = + +# Transport to use, either 'tcp'(default) or 'ssl' + +# uncomment following line for non-ssl +# qpid_protocol = tcp +qpid_protocol = ssl + +# +# Sync variables +# + +# The name of the staging project (string value) +# If not set defaults to 'Public'. If set the named project should exist and +# be accessible by the staging_user. +staging_project_name = Public + +# The name of the staging user (string value) +# If not set defaults to 'admin'. If set the user should exist and +# have access to the project identified by staging_project_name. +staging_user = admin + +# The prefix that will be added to the flavor name from PowerVC +# and stored (string value). This should be unique for every +# connection to help distinguish the flavors +flavor_prefix = PVC- + +# This is a list of PowerVC flavor names that should be synced. +# If no flavor name is specified, then all flavors are synced. +flavor_white_list = + +# This is a list of PowerVC flavor names that should not be synced. +flavor_black_list = + +# The periodic flavor sync interval in seconds. +flavor_sync_interval = 300 + +# Instance periodic sync interval specified in seconds +instance_sync_interval = 20 + +# How many instance sync intervals between full instance syncs. Only instances +# known to be out of sync are synced on the interval except after this many +# intervals when all instances are synced. +full_instance_sync_frequency = 30 + +# Image periodic sync interval specified in seconds. This is the time from the end +# of one successful image periodic sync operation to the start of the next. +image_periodic_sync_interval_in_seconds = 300 + +# The time in seconds between image sync retry attempts if an error was +# encountered during an image sync operation +image_sync_retry_interval_time_in_seconds = 60 + +# The maximum number of images to return. The default is 500 images. If your PowerVC +# has more than 500 images, this limit should be increased to include all images. +image_limit = 500 + +# Volume periodic sync interval specified in seconds +volume_sync_interval = 20 + +# How many volume sync intervals between full volume syncs. +# Only volumes known to be out of sync are synced on the interval +# except after this many intervals when all volumes are synced. +full_volume_sync_frequency = 30 + +# Volume type periodic sync interval specified in seconds +volume_type_sync_interval = 20 + +# How many volume type sync intervals between full volume type syncs. +# Only volumes known to be out of sync are synced on the interval +# except after this many intervals when all volumes are synced. +full_volume_type_sync_frequency = 30 + +# Ignore delete errors so an exception is not thrown during a +# delete. When set to true, this allows the volume to be deleted +# on the hosting OS even if an exception occurs. When set to false, +# exceptions during delete prevent the volume from being deleted +# on the hosting OS. +volume_driver_ignore_delete_error = False + +# The times to check whether attaching/detaching the volume succeed +volume_max_try_times = 12 + +# Minimum delay interval and initial delay seconds for long run tasks. +longrun_loop_interval = 7 +longrun_initial_delay = 10 diff --git a/common-powervc/test/common/powervc_test_2.conf b/common-powervc/test/common/powervc_test_2.conf index 990681c..6883469 100644 --- a/common-powervc/test/common/powervc_test_2.conf +++ b/common-powervc/test/common/powervc_test_2.conf @@ -1,228 +1,228 @@ -# This file contains configuration properties that affects how the powervc driver functions and how it -# communicates with the PowerVC server. Most properties have default values based on a default -# PowerVC configuration. However, some connection properties, such as PowerVC host name -# do not have default values and must be configured prior to running the powervc driver. These -# properties are marked with the text INPUT REQUIRED. Also you may have to change other -# properties depending on your environment and how your PowerVC sever is configured. For -# more information, see the Smart Cloud Entry Administration Guide. - -[DEFAULT] -# The following group of properties needs to be configured -# in order for the PowerVC Driver to be able to authenticate with keystone -# and obtain information from it, that might be required to run background -# tasks (such as discovering a new image), or simply to connect to a -# secured Glance. -# When running secured Glance, make sure the 'auth_strategy' property in -# nova.conf is set to 'keystone'. - -# Log info messages -verbose = true - - -[openstack] -# Authentication url to authenticate with keystone (string value) -auth_url = http://localhost:5000/v2.0 - -# v2.0 or v3 -keystone_version = v2.0 - -# Tenant name for connecting to keystone in admin context (string value) -admin_tenant_name = demo - -# Username for connecting to keystone in admin context (string value) -admin_user = demo - -# Password for connecting to keystone in admin context (string value) -admin_password = openstack - -# For local SSL connections, specify the path and filename of the cacert file -#connection_cacert = - -http_insecure = True - -# -# Qpid connection information -# - -# Qpid broker hostname (string value) -qpid_hostname = monica - -# Qpid broker port (integer value) -qpid_port = 5675 - -# Username for qpid connection (string value) -qpid_username = - -# Password for qpid connection (string value) -qpid_password = - -# Transport to use, either 'tcp'(default) or 'ssl' -qpid_protocol = tcp - -[powervc] - -# Full class name for the manager for PowerVC Manager Service (string value) -powervc_manager = powervc.nova.driver.compute.manager.PowerVCCloudManager - -# Full class name for the driver for PowerVC Driver Service (string value) -powervc_driver = powervc.nova.driver.virt.powervc.driver.PowerVCDriver - -# -# Connection information for PowerVC. -# - -# Authentication url of the PowerVC to connect to -# INPUT REQUIRED -# Provide 'host' portion by updating it to the hostname of the PowerVC system -auth_url = https://host/powervc/openstack/identity/v3 - -# v2.0 or v3 -keystone_version = v3 - -# Username for PowerVC connection (string value) -admin_user = root - -# Password for PowerVC connection (string value) -admin_password = passw0rd - -# Tenant name for PowerVC connection (string value) -admin_tenant_name = ibm-default - -# For PowerVC SSL connections, specify the path and filename of the cacert file -# INPUT REQUIRED -# Provide the cacert file by copying it from its install location on the -# PowerVC host (e.g. /etc/pki/tls/certs/powervc.crt) to the local hosting -# Openstack system. -#connection_cacert = - -# Value of insecure option for PowerVC connections (Default=True) -# INPUT REQUIRED -# Change to False when using a secure connection and providing a cacert file. -http_insecure = True - -# Value of authorization token expiration stale duration (Default=3600) -# INPUT REQUIRED -# Due to PowerVC requirement, all the REST API customers need to pre-refresh -# authorization token at least 1 hour before expiration -expiration_stale_duration = 3600 - -# The names of the storage connectivity groups supported by our driver -# INPUT REQUIRED -# Provide the PowerVC storage connectivity group (SCG) names by getting the name -# from the PowerVC system, or using the PowerVC default SCG of "Any host, all VIOS". -# If there are more than one SCG you want to specify, just add more SCG values with -# more storage_connectivity_group -# Note: The value of this property must exactly match the value as specified on the -# PowerVC server, including case, punctuation, and spaces. -storage_connectivity_group = Any host, all VIOS -#storage_connectivity_group = - -# -# Qpid connection information for PowerVC -# - -# Qpid broker hostname (string value) -# INPUT REQUIRED -# Change 'host' to the hostname of the PowerVC system -qpid_hostname = host - -# Qpid broker port (integer value) - -# uncomment following line for non-ssl -# qpid_port = 5672 -qpid_port = 5678 - -# Username for qpid connection (string value) -qpid_username = powervc_qpid_2 - -# Password for qpid connection (string value) -# INPUT REQUIRED -# Provide the qpid connection password from the PowerVC system -# by using the cat command on the pw.file in the directory where -# PowerVC is installed (e.g. cat /opt/ibm/powervc/data/pw.file) -qpid_password = - -# Transport to use, either 'tcp'(default) or 'ssl' - -# uncomment following line for non-ssl -# qpid_protocol = tcp -qpid_protocol = ssl - -# -# Sync variables -# - -# The name of the staging project (string value) -# If not set defaults to 'Public'. If set the named project should exist and -# be accessible by the staging_user. -staging_project_name = Public - -# The name of the staging user (string value) -# If not set defaults to 'admin'. If set the user should exist and -# have access to the project identified by staging_project_name. -staging_user = admin - -# The prefix that will be added to the flavor name from PowerVC -# and stored (string value). This should be unique for every -# connection to help distinguish the flavors -flavor_prefix = PVC- - -# This is a list of PowerVC flavor names that should be synced. -# If no flavor name is specified, then all flavors are synced. -flavor_white_list = - -# This is a list of PowerVC flavor names that should not be synced. -flavor_black_list = - -# The periodic flavor sync interval in seconds. -flavor_sync_interval = 300 - -# Instance periodic sync interval specified in seconds -instance_sync_interval = 20 - -# How many instance sync intervals between full instance syncs. Only instances -# known to be out of sync are synced on the interval except after this many -# intervals when all instances are synced. -full_instance_sync_frequency = 30 - -# Image periodic sync interval specified in seconds. This is the time from the end -# of one successful image periodic sync operation to the start of the next. -image_periodic_sync_interval_in_seconds = 300 - -# The time in seconds between image sync retry attempts if an error was -# encountered during an image sync operation -image_sync_retry_interval_time_in_seconds = 60 - -# The maximum number of images to return. The default is 500 images. If your PowerVC -# has more than 500 images, this limit should be increased to include all images. -image_limit = 500 - -# Volume periodic sync interval specified in seconds -volume_sync_interval = 20 - -# How many volume sync intervals between full volume syncs. -# Only volumes known to be out of sync are synced on the interval -# except after this many intervals when all volumes are synced. -full_volume_sync_frequency = 30 - -# Volume type periodic sync interval specified in seconds -volume_type_sync_interval = 20 - -# How many volume type sync intervals between full volume type syncs. -# Only volumes known to be out of sync are synced on the interval -# except after this many intervals when all volumes are synced. -full_volume_type_sync_frequency = 30 - -# Ignore delete errors so an exception is not thrown during a -# delete. When set to true, this allows the volume to be deleted -# on the hosting OS even if an exception occurs. When set to false, -# exceptions during delete prevent the volume from being deleted -# on the hosting OS. -volume_driver_ignore_delete_error = False - -# The times to check whether attaching/detaching the volume succeed -volume_max_try_times = 12 - -# Minimum delay interval and initial delay seconds for long run tasks. -longrun_loop_interval = 7 -longrun_initial_delay = 10 +# This file contains configuration properties that affects how the powervc driver functions and how it +# communicates with the PowerVC server. Most properties have default values based on a default +# PowerVC configuration. However, some connection properties, such as PowerVC host name +# do not have default values and must be configured prior to running the powervc driver. These +# properties are marked with the text INPUT REQUIRED. Also you may have to change other +# properties depending on your environment and how your PowerVC sever is configured. For +# more information, see the Smart Cloud Entry Administration Guide. + +[DEFAULT] +# The following group of properties needs to be configured +# in order for the PowerVC Driver to be able to authenticate with keystone +# and obtain information from it, that might be required to run background +# tasks (such as discovering a new image), or simply to connect to a +# secured Glance. +# When running secured Glance, make sure the 'auth_strategy' property in +# nova.conf is set to 'keystone'. + +# Log info messages +verbose = true + + +[openstack] +# Authentication url to authenticate with keystone (string value) +auth_url = http://localhost:5000/v2.0 + +# v2.0 or v3 +keystone_version = v2.0 + +# Tenant name for connecting to keystone in admin context (string value) +admin_tenant_name = demo + +# Username for connecting to keystone in admin context (string value) +admin_user = demo + +# Password for connecting to keystone in admin context (string value) +admin_password = openstack + +# For local SSL connections, specify the path and filename of the cacert file +#connection_cacert = + +http_insecure = True + +# +# Qpid connection information +# + +# Qpid broker hostname (string value) +qpid_hostname = monica + +# Qpid broker port (integer value) +qpid_port = 5675 + +# Username for qpid connection (string value) +qpid_username = + +# Password for qpid connection (string value) +qpid_password = + +# Transport to use, either 'tcp'(default) or 'ssl' +qpid_protocol = tcp + +[powervc] + +# Full class name for the manager for PowerVC Manager Service (string value) +powervc_manager = powervc.nova.driver.compute.manager.PowerVCCloudManager + +# Full class name for the driver for PowerVC Driver Service (string value) +powervc_driver = powervc.nova.driver.virt.powervc.driver.PowerVCDriver + +# +# Connection information for PowerVC. +# + +# Authentication url of the PowerVC to connect to +# INPUT REQUIRED +# Provide 'host' portion by updating it to the hostname of the PowerVC system +auth_url = https://host/powervc/openstack/identity/v3 + +# v2.0 or v3 +keystone_version = v3 + +# Username for PowerVC connection (string value) +admin_user = root + +# Password for PowerVC connection (string value) +admin_password = passw0rd + +# Tenant name for PowerVC connection (string value) +admin_tenant_name = ibm-default + +# For PowerVC SSL connections, specify the path and filename of the cacert file +# INPUT REQUIRED +# Provide the cacert file by copying it from its install location on the +# PowerVC host (e.g. /etc/pki/tls/certs/powervc.crt) to the local hosting +# Openstack system. +#connection_cacert = + +# Value of insecure option for PowerVC connections (Default=True) +# INPUT REQUIRED +# Change to False when using a secure connection and providing a cacert file. +http_insecure = True + +# Value of authorization token expiration stale duration (Default=3600) +# INPUT REQUIRED +# Due to PowerVC requirement, all the REST API customers need to pre-refresh +# authorization token at least 1 hour before expiration +expiration_stale_duration = 3600 + +# The names of the storage connectivity groups supported by our driver +# INPUT REQUIRED +# Provide the PowerVC storage connectivity group (SCG) names by getting the name +# from the PowerVC system, or using the PowerVC default SCG of "Any host, all VIOS". +# If there are more than one SCG you want to specify, just add more SCG values with +# more storage_connectivity_group +# Note: The value of this property must exactly match the value as specified on the +# PowerVC server, including case, punctuation, and spaces. +storage_connectivity_group = Any host, all VIOS +#storage_connectivity_group = + +# +# Qpid connection information for PowerVC +# + +# Qpid broker hostname (string value) +# INPUT REQUIRED +# Change 'host' to the hostname of the PowerVC system +qpid_hostname = host + +# Qpid broker port (integer value) + +# uncomment following line for non-ssl +# qpid_port = 5672 +qpid_port = 5678 + +# Username for qpid connection (string value) +qpid_username = powervc_qpid_2 + +# Password for qpid connection (string value) +# INPUT REQUIRED +# Provide the qpid connection password from the PowerVC system +# by using the cat command on the pw.file in the directory where +# PowerVC is installed (e.g. cat /opt/ibm/powervc/data/pw.file) +qpid_password = + +# Transport to use, either 'tcp'(default) or 'ssl' + +# uncomment following line for non-ssl +# qpid_protocol = tcp +qpid_protocol = ssl + +# +# Sync variables +# + +# The name of the staging project (string value) +# If not set defaults to 'Public'. If set the named project should exist and +# be accessible by the staging_user. +staging_project_name = Public + +# The name of the staging user (string value) +# If not set defaults to 'admin'. If set the user should exist and +# have access to the project identified by staging_project_name. +staging_user = admin + +# The prefix that will be added to the flavor name from PowerVC +# and stored (string value). This should be unique for every +# connection to help distinguish the flavors +flavor_prefix = PVC- + +# This is a list of PowerVC flavor names that should be synced. +# If no flavor name is specified, then all flavors are synced. +flavor_white_list = + +# This is a list of PowerVC flavor names that should not be synced. +flavor_black_list = + +# The periodic flavor sync interval in seconds. +flavor_sync_interval = 300 + +# Instance periodic sync interval specified in seconds +instance_sync_interval = 20 + +# How many instance sync intervals between full instance syncs. Only instances +# known to be out of sync are synced on the interval except after this many +# intervals when all instances are synced. +full_instance_sync_frequency = 30 + +# Image periodic sync interval specified in seconds. This is the time from the end +# of one successful image periodic sync operation to the start of the next. +image_periodic_sync_interval_in_seconds = 300 + +# The time in seconds between image sync retry attempts if an error was +# encountered during an image sync operation +image_sync_retry_interval_time_in_seconds = 60 + +# The maximum number of images to return. The default is 500 images. If your PowerVC +# has more than 500 images, this limit should be increased to include all images. +image_limit = 500 + +# Volume periodic sync interval specified in seconds +volume_sync_interval = 20 + +# How many volume sync intervals between full volume syncs. +# Only volumes known to be out of sync are synced on the interval +# except after this many intervals when all volumes are synced. +full_volume_sync_frequency = 30 + +# Volume type periodic sync interval specified in seconds +volume_type_sync_interval = 20 + +# How many volume type sync intervals between full volume type syncs. +# Only volumes known to be out of sync are synced on the interval +# except after this many intervals when all volumes are synced. +full_volume_type_sync_frequency = 30 + +# Ignore delete errors so an exception is not thrown during a +# delete. When set to true, this allows the volume to be deleted +# on the hosting OS even if an exception occurs. When set to false, +# exceptions during delete prevent the volume from being deleted +# on the hosting OS. +volume_driver_ignore_delete_error = False + +# The times to check whether attaching/detaching the volume succeed +volume_max_try_times = 12 + +# Minimum delay interval and initial delay seconds for long run tasks. +longrun_loop_interval = 7 +longrun_initial_delay = 10 diff --git a/common-powervc/test/common/test_config.py b/common-powervc/test/common/test_config.py index 458434f..fcc146f 100644 --- a/common-powervc/test/common/test_config.py +++ b/common-powervc/test/common/test_config.py @@ -18,32 +18,37 @@ class PVCConfigTest(testtools.TestCase): del config.parse_power_config.power_config_loaded def test_parse_config_1(self): - p1 = mock.patch('oslo.config.cfg.find_config_files', - new=mock.MagicMock(return_value=["%s%s%s" % - (os.path.dirname(__file__), - os.sep, - "powervc_test_1.conf")])) + p1 = mock.patch( + 'oslo.config.cfg.find_config_files', + new=mock.MagicMock( + return_value=["%s%s%s" % (os.path.dirname(__file__), + os.sep, + "powervc_test_1.conf")] + ) + ) try: p1.start() config.parse_power_config([], "powervc-baseproject", None) # default value self.assertEqual(config.CONF.powervc.auth_url, - "http://localhost:5000/v2.0/") + "http://localhost:5000/v2.0/") # value in file self.assertEqual(config.CONF.powervc.qpid_port, 5679) finally: p1.stop() def test_parse_config_2(self): - p2 = mock.patch('oslo.config.cfg.find_config_files', - new=mock.MagicMock(side_effect=[["%s%s%s" % - (os.path.dirname(__file__), - os.sep, - "powervc_test_1.conf")], - ["%s%s%s" % - (os.path.dirname(__file__), - os.sep, - "powervc_test_2.conf")]])) + p2 = mock.patch( + 'oslo.config.cfg.find_config_files', + new=mock.MagicMock( + side_effect=[["%s%s%s" % (os.path.dirname(__file__), + os.sep, + "powervc_test_1.conf")], + ["%s%s%s" % (os.path.dirname(__file__), + os.sep, + "powervc_test_2.conf")]] + ) + ) try: p2.start() config.parse_power_config([], "baseproject", None) diff --git a/glance-powervc/powervc/glance/common/config.py b/glance-powervc/powervc/glance/common/config.py index e5e721d..7301b8d 100644 --- a/glance-powervc/powervc/glance/common/config.py +++ b/glance-powervc/powervc/glance/common/config.py @@ -6,6 +6,7 @@ PowerVC Driver ImageManager Configuration from oslo.config import cfg import powervc.common.config as common_config +from powervc.common.gettextutils import _ from powervc.glance.common import constants CONF = common_config.CONF @@ -33,11 +34,12 @@ CONF.register_opts(image_opts, group='powervc') Refer to the file glance/api/middleware/context.py , register the config option named 'owner_is_tenant' to default group. """ -CONF.register_opt(cfg.BoolOpt('owner_is_tenant', default=True, - help=_('When true, this option sets the owner of ' - 'an image to be the tenant. Otherwise, the' - ' owner of the image will be the ' - 'authenticated user issuing the request.'))) +CONF.register_opt( + cfg.BoolOpt('owner_is_tenant', default=True, + help=_('When true, this option sets the owner of ' + 'an image to be the tenant. Otherwise, the' + ' owner of the image will be the ' + 'authenticated user issuing the request.'))) def parse_config(*args, **kwargs): diff --git a/glance-powervc/powervc/glance/common/constants.py b/glance-powervc/powervc/glance/common/constants.py index 0b041cb..aaa2b58 100644 --- a/glance-powervc/powervc/glance/common/constants.py +++ b/glance-powervc/powervc/glance/common/constants.py @@ -39,7 +39,9 @@ IMAGE_UPDATE_PARAMS_FILTER = ['owner', 'location'] IMAGE_UNESCAPE_PROPERTIES = ['configuration_strategy'] # List of v2image update parameters to filter out -v2IMAGE_UPDATE_PARAMS_FILTER = IMAGE_UPDATE_PARAMS_FILTER + ['deleted', 'size', 'checksum'] +v2IMAGE_UPDATE_PARAMS_FILTER = IMAGE_UPDATE_PARAMS_FILTER + ['deleted', + 'size', + 'checksum'] # List of image properties to filter out during an update IMAGE_UPDATE_PROPERTIES_FILTER = [consts.POWERVC_UUID_KEY, diff --git a/glance-powervc/powervc/glance/manager/manager.py b/glance-powervc/powervc/glance/manager/manager.py index f0f780d..7f78a15 100644 --- a/glance-powervc/powervc/glance/manager/manager.py +++ b/glance-powervc/powervc/glance/manager/manager.py @@ -1403,7 +1403,8 @@ class PowerVCImageManager(service.Service): field_dict, update_field_dict = self._get_v1image_create_fields( src_image, image_owner, image_endpoint) # Community fix needs the property 'checksum' must be set - field_dict['checksum'] = self._get_image_checksum(src_image.to_dict()) + field_dict['checksum'] = self._get_image_checksum( + src_image.to_dict()) new_image = v1images.create(**field_dict) updated_image = None if len(update_field_dict) > 0: diff --git a/neutron-powervc/test/test_neutron_powervc_agent.py b/neutron-powervc/test/test_neutron_powervc_agent.py index 23015a8..c1b550b 100644 --- a/neutron-powervc/test/test_neutron_powervc_agent.py +++ b/neutron-powervc/test/test_neutron_powervc_agent.py @@ -62,7 +62,7 @@ class TestPowerVCNeutronAgent(unittest.TestCase): local_port = mock.MagicMock() local_port.get = mock.MagicMock( - return_value="network:router_interface") + return_value="network:router_interface") self.powervc_neutron_agent.pvc = mock.MagicMock() self.powervc_neutron_agent.pvc.create_port = mock.MagicMock() @@ -93,8 +93,7 @@ class TestPowerVCNeutronAgent(unittest.TestCase): local_port = mock.MagicMock() local_port.get = mock.MagicMock( - side_effect=[constants.STATUS_CREATING, - constants.STATUS_ACTIVE]) + side_effect=[constants.STATUS_CREATING, constants.STATUS_ACTIVE]) self.powervc_neutron_agent.db = mock.MagicMock() self.powervc_neutron_agent.db.get_port = mock.MagicMock( return_value=local_port) @@ -112,8 +111,7 @@ class TestPowerVCNeutronAgent(unittest.TestCase): local_port = mock.MagicMock() local_port.get = mock.MagicMock( - side_effect=[constants.STATUS_CREATING, - constants.STATUS_CREATING]) + side_effect=[constants.STATUS_CREATING, constants.STATUS_CREATING]) self.powervc_neutron_agent.db = mock.MagicMock() self.powervc_neutron_agent.db.get_port = mock.MagicMock( return_value=local_port) diff --git a/nova-powervc/.pydevproject b/nova-powervc/.pydevproject index 0e50999..effa869 100644 --- a/nova-powervc/.pydevproject +++ b/nova-powervc/.pydevproject @@ -1,7 +1,7 @@ - -Default -python 2.7 - -/nova-powervc - + +Default +python 2.7 + +/nova-powervc + \ No newline at end of file diff --git a/nova-powervc/powervc/nova/driver/virt/powervc/service.py b/nova-powervc/powervc/nova/driver/virt/powervc/service.py index 65a0876..2e8fe21 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/service.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/service.py @@ -175,8 +175,8 @@ class PowerVCService(object): else: vm_status_dict = {'vm_id': server.id, 'state': pvc_vm_states.ACTIVE} - LOG.debug("Service: VM %(vm_id)s successfully rebooted. " \ - "Current status: %(state)s" % vm_status_dict) + LOG.debug("Service: VM %(vm_id)s successfully rebooted. " + "Current status: %(state)s" % vm_status_dict) raise loopingcall.LoopingCallDone(True) def _wait_for_resize_state_change(self, context, migration, @@ -469,7 +469,7 @@ class PowerVCService(object): if (task_state == task_states.ACTIVATING): LOG.debug("The task status of the instance: %s" % task_state) - reason = _("The instance in the task status: %s can not" \ + reason = _("The instance in the task status: %s can not" " be stopped." % task_state) raise exception.InstanceUnacceptable(instance_id=server.id, diff --git a/nova-powervc/powervc/nova/driver/virt/powervc/sync/flavorsync.py b/nova-powervc/powervc/nova/driver/virt/powervc/sync/flavorsync.py index 72ef587..b733b2a 100644 --- a/nova-powervc/powervc/nova/driver/virt/powervc/sync/flavorsync.py +++ b/nova-powervc/powervc/nova/driver/virt/powervc/sync/flavorsync.py @@ -4,6 +4,7 @@ import re from eventlet import greenthread import powervc.common.config as cfg +from powervc.common.gettextutils import _ from nova.compute import flavors from nova import exception from nova import db diff --git a/nova-powervc/test/nova/driver/virt/powervc/test_driver.py b/nova-powervc/test/nova/driver/virt/powervc/test_driver.py index c44f63d..0893022 100644 --- a/nova-powervc/test/nova/driver/virt/powervc/test_driver.py +++ b/nova-powervc/test/nova/driver/virt/powervc/test_driver.py @@ -403,10 +403,10 @@ class PowerVCDriverTestCase(test.NoDBTestCase): pvc_driver.snapshot(context, instance, image_id, update_task_state) update_task_state.assert_any_call( - task_state=task_states.IMAGE_PENDING_UPLOAD) + task_state=task_states.IMAGE_PENDING_UPLOAD) update_task_state.assert_any_call( - task_state=task_states.IMAGE_UPLOADING, - expected_state=task_states.IMAGE_PENDING_UPLOAD) + task_state=task_states.IMAGE_UPLOADING, + expected_state=task_states.IMAGE_PENDING_UPLOAD) def tearDown(self): super(PowerVCDriverTestCase, self).tearDown() @@ -459,10 +459,10 @@ class TestDriver(unittest.TestCase): _update_local_instance_by_pvc_created_instance = \ mock.MagicMock() resultServer = self.powervc_driver.spawn(context, - instance, - image_meta, - injected_files, - admin_password) + instance, + image_meta, + injected_files, + admin_password) self.assertEquals(createFinished, resultServer, 'success') @@ -521,8 +521,8 @@ class TestDriver(unittest.TestCase): 'OS-EXT-STS:task_state', None) self.powervc_driver._service._manager.get = \ mock.MagicMock( - side_effect=[manager_get_server_from_instance, - manager_get_server_from_destroy_instance]) + side_effect=[manager_get_server_from_instance, + manager_get_server_from_destroy_instance]) self.powervc_driver._service._manager.delete = \ mock.MagicMock() self.powervc_driver._service._validate_response = \ @@ -562,7 +562,7 @@ class TestDriver(unittest.TestCase): self.powervc_driver._service._manager.get = \ mock.MagicMock( side_effect=[manager_get_server_from_instance, - manager_get_server_from_destroy_instance]) + manager_get_server_from_destroy_instance]) self.powervc_driver._service._manager.delete = mock.MagicMock() self.powervc_driver._service._validate_response = mock.MagicMock() self.assertRaises(exception.InstanceTerminationFailure,