pep8 error resolved

Removes the H405 pep8 exclusion.

Change-Id: I9cea7c3b1b05ed737f6dd65853a6247a8e58ca17
This commit is contained in:
skseeker
2016-02-03 22:52:13 +05:30
committed by Drew Thorstensen
parent ebbb9ec623
commit 9b35519f76
11 changed files with 55 additions and 23 deletions

View File

@@ -544,8 +544,7 @@ class TestPowerVMDriver(test.TestCase):
mock_update_lod_src, mock_get_flv, mock_cfg_drv, mock_update_lod_src, mock_get_flv, mock_cfg_drv,
mock_plug_vifs, mock_plug_mgmt_vif, mock_boot_from_vol, mock_plug_vifs, mock_plug_mgmt_vif, mock_boot_from_vol,
mock_crt_img, mock_save): mock_crt_img, mock_save):
"""Validates the PowerVM spawn to create an IBMi server. """Validates the PowerVM spawn to create an IBMi server."""
"""
# Set up the mocks to the tasks. # Set up the mocks to the tasks.
mock_get_flv.return_value = self.inst_ibmi.get_flavor() mock_get_flv.return_value = self.inst_ibmi.get_flavor()
mock_cfg_drv.return_value = False mock_cfg_drv.return_value = False
@@ -604,6 +603,7 @@ class TestPowerVMDriver(test.TestCase):
mock_plug_mgmt_vif, mock_boot_from_vol, mock_crt_disk_img, mock_plug_mgmt_vif, mock_boot_from_vol, mock_crt_disk_img,
mock_conn_vol, mock_crt_cfg_drv): mock_conn_vol, mock_crt_cfg_drv):
"""Validates the 'typical' spawn flow for IBMi """Validates the 'typical' spawn flow for IBMi
Perform an UT using an image with local disk, attaching networks Perform an UT using an image with local disk, attaching networks
and powering on. and powering on.
""" """

View File

@@ -97,8 +97,9 @@ class PowerVMDriver(driver.ComputeDriver):
super(PowerVMDriver, self).__init__(virtapi) super(PowerVMDriver, self).__init__(virtapi)
def init_host(self, host): def init_host(self, host):
"""Initialize anything that is necessary for the driver to function, """Initialize anything that is necessary for the driver to function.
including catching up with currently running VM's on the given host.
Includes catching up with currently running VM's on the given host.
""" """
# Live migrations # Live migrations
@@ -121,8 +122,9 @@ class PowerVMDriver(driver.ComputeDriver):
LOG.info(_LI("The compute driver has been initialized.")) LOG.info(_LI("The compute driver has been initialized."))
def cleanup_host(self, host): def cleanup_host(self, host):
"""Clean up anything that is necessary for the driver gracefully stop, """Clean up anything that is necessary for the driver gracefully stop.
including ending remote sessions. This is optional.
Includes ending remote sessions. This is optional.
""" """
# Stop listening for events # Stop listening for events
try: try:
@@ -162,8 +164,7 @@ class PowerVMDriver(driver.ComputeDriver):
@staticmethod @staticmethod
def _log_operation(op, instance): def _log_operation(op, instance):
"""Log entry point of driver operations """Log entry point of driver operations."""
"""
LOG.info(_LI('Operation: %(op)s. Virtual machine display name: ' LOG.info(_LI('Operation: %(op)s. Virtual machine display name: '
'%(display_name)s, name: %(name)s, UUID: %(uuid)s'), '%(display_name)s, name: %(name)s, UUID: %(uuid)s'),
{'op': op, 'display_name': instance.display_name, {'op': op, 'display_name': instance.display_name,
@@ -233,8 +234,9 @@ class PowerVMDriver(driver.ComputeDriver):
return {'memory_mb': overhead} return {'memory_mb': overhead}
def list_instances(self): def list_instances(self):
"""Return the names of all the instances known to the virtualization """Return the names of all the instances known to the virt host.
layer, as a list.
:return: VM Names as a list.
""" """
lpar_list = vm.get_lpar_names(self.adapter) lpar_list = vm.get_lpar_names(self.adapter)
return lpar_list return lpar_list
@@ -943,13 +945,11 @@ class PowerVMDriver(driver.ComputeDriver):
return [self.host_wrapper.mtms.mtms_str] return [self.host_wrapper.mtms.mtms_str]
def legacy_nwinfo(self): def legacy_nwinfo(self):
"""Indicate if the driver requires the legacy network_info format. """Indicate if the driver requires the legacy network_info format."""
"""
return False return False
def get_host_ip_addr(self): def get_host_ip_addr(self):
"""Retrieves the IP address of the dom0 """Retrieves the IP address of the Host."""
"""
# This code was pulled from the libvirt driver. # This code was pulled from the libvirt driver.
ips = compute_utils.get_machine_ips() ips = compute_utils.get_machine_ips()
if CONF.my_ip not in ips: if CONF.my_ip not in ips:

View File

@@ -391,7 +391,9 @@ class LiveMigrationSrc(LiveMigration):
raise exception.MigrationPreCheckError(reason=msg) raise exception.MigrationPreCheckError(reason=msg)
def migration_abort(self): def migration_abort(self):
"""Abort the migration if the operation exceeds the configured timeout. """Abort the migration.
Invoked if the operation exceeds the configured timeout.
""" """
LOG.debug("Abort migration.", instance=self.instance) LOG.debug("Abort migration.", instance=self.instance)
try: try:

View File

@@ -72,8 +72,9 @@ class ConfigDrivePowerVM(object):
def _create_cfg_dr_iso(self, instance, injected_files, network_info, def _create_cfg_dr_iso(self, instance, injected_files, network_info,
admin_pass=None): admin_pass=None):
"""Creates an ISO file that contains the injected files. Used for """Creates an ISO file that contains the injected files.
config drive.
Used for config drive.
:param instance: The VM instance from OpenStack. :param instance: The VM instance from OpenStack.
:param injected_files: A list of file paths that will be injected into :param injected_files: A list of file paths that will be injected into

View File

@@ -24,6 +24,7 @@ LOG = logging.getLogger(__name__)
class UpdateTaskState(task.Task): class UpdateTaskState(task.Task):
def __init__(self, update_task_state, task_state, expected_state=None): def __init__(self, update_task_state, task_state, expected_state=None):
"""Invoke the update_task_state callback with the desired arguments. """Invoke the update_task_state callback with the desired arguments.
@@ -49,7 +50,9 @@ class UpdateTaskState(task.Task):
class StreamToGlance(task.Task): class StreamToGlance(task.Task):
"""Task around streaming a block device to glance.""" """Task around streaming a block device to glance."""
def __init__(self, context, image_api, image_id, instance): def __init__(self, context, image_api, image_id, instance):
"""Initialize the flow for streaming a block device to glance. """Initialize the flow for streaming a block device to glance.

View File

@@ -34,6 +34,7 @@ CONF = cfg.CONF
class VirtualInterfaceUnplugException(exception.NovaException): class VirtualInterfaceUnplugException(exception.NovaException):
"""Indicates that a VIF unplug failed.""" """Indicates that a VIF unplug failed."""
# TODO(thorst) symmetrical to the exception in base Nova. Evaluate # TODO(thorst) symmetrical to the exception in base Nova. Evaluate
# moving to Nova core. # moving to Nova core.
@@ -41,6 +42,7 @@ class VirtualInterfaceUnplugException(exception.NovaException):
class UnplugVifs(task.Task): class UnplugVifs(task.Task):
"""The task to unplug Virtual Network Interfaces from a VM.""" """The task to unplug Virtual Network Interfaces from a VM."""
def __init__(self, adapter, instance, network_info, host_uuid): def __init__(self, adapter, instance, network_info, host_uuid):
@@ -112,6 +114,7 @@ class UnplugVifs(task.Task):
class PlugVifs(task.Task): class PlugVifs(task.Task):
"""The task to plug the Virtual Network Interfaces to a VM.""" """The task to plug the Virtual Network Interfaces to a VM."""
def __init__(self, virt_api, adapter, instance, network_info, host_uuid): def __init__(self, virt_api, adapter, instance, network_info, host_uuid):
@@ -239,6 +242,7 @@ class PlugVifs(task.Task):
class PlugMgmtVif(task.Task): class PlugMgmtVif(task.Task):
"""The task to plug the Management VIF into a VM.""" """The task to plug the Management VIF into a VM."""
def __init__(self, adapter, instance, host_uuid): def __init__(self, adapter, instance, host_uuid):

View File

@@ -31,6 +31,7 @@ LOG = logging.getLogger(__name__)
class ConnectVolume(task.Task): class ConnectVolume(task.Task):
"""The task to connect a volume to an instance.""" """The task to connect a volume to an instance."""
def __init__(self, vol_drv): def __init__(self, vol_drv):
@@ -76,6 +77,7 @@ class ConnectVolume(task.Task):
class DisconnectVolume(task.Task): class DisconnectVolume(task.Task):
"""The task to disconnect a volume from an instance.""" """The task to disconnect a volume from an instance."""
def __init__(self, vol_drv): def __init__(self, vol_drv):
@@ -121,6 +123,7 @@ class DisconnectVolume(task.Task):
class CreateDiskForImg(task.Task): class CreateDiskForImg(task.Task):
"""The Task to create the disk from an image in the storage.""" """The Task to create the disk from an image in the storage."""
def __init__(self, disk_dvr, context, instance, image_meta, disk_size=0, def __init__(self, disk_dvr, context, instance, image_meta, disk_size=0,
@@ -171,6 +174,7 @@ class CreateDiskForImg(task.Task):
class ConnectDisk(task.Task): class ConnectDisk(task.Task):
"""The task to connect the disk to the instance.""" """The task to connect the disk to the instance."""
def __init__(self, disk_dvr, context, instance, stg_ftsk=None): def __init__(self, disk_dvr, context, instance, stg_ftsk=None):
@@ -211,6 +215,7 @@ class ConnectDisk(task.Task):
class InstanceDiskToMgmt(task.Task): class InstanceDiskToMgmt(task.Task):
"""Connect an instance's disk to the management partition, discover it. """Connect an instance's disk to the management partition, discover it.
We do these two pieces together because their reversion doesn't happen in We do these two pieces together because their reversion doesn't happen in
@@ -293,6 +298,7 @@ class InstanceDiskToMgmt(task.Task):
class RemoveInstanceDiskFromMgmt(task.Task): class RemoveInstanceDiskFromMgmt(task.Task):
"""Unmap and remove an instance's boot disk from the mgmt partition.""" """Unmap and remove an instance's boot disk from the mgmt partition."""
def __init__(self, disk_dvr, instance): def __init__(self, disk_dvr, instance):
@@ -341,6 +347,7 @@ class RemoveInstanceDiskFromMgmt(task.Task):
class CreateAndConnectCfgDrive(task.Task): class CreateAndConnectCfgDrive(task.Task):
"""The task to create the configuration drive.""" """The task to create the configuration drive."""
def __init__(self, adapter, host_uuid, instance, injected_files, def __init__(self, adapter, host_uuid, instance, injected_files,
@@ -398,6 +405,7 @@ class CreateAndConnectCfgDrive(task.Task):
class DeleteVOpt(task.Task): class DeleteVOpt(task.Task):
"""The task to delete the virtual optical.""" """The task to delete the virtual optical."""
def __init__(self, adapter, host_uuid, instance, lpar_uuid, def __init__(self, adapter, host_uuid, instance, lpar_uuid,
@@ -428,6 +436,7 @@ class DeleteVOpt(task.Task):
class DetachDisk(task.Task): class DetachDisk(task.Task):
"""The task to detach the disk storage from the instance.""" """The task to detach the disk storage from the instance."""
def __init__(self, disk_dvr, context, instance, stg_ftsk=None, def __init__(self, disk_dvr, context, instance, stg_ftsk=None,
@@ -465,6 +474,7 @@ class DetachDisk(task.Task):
class DeleteDisk(task.Task): class DeleteDisk(task.Task):
"""The task to delete the backing storage.""" """The task to delete the backing storage."""
def __init__(self, disk_dvr, context, instance): def __init__(self, disk_dvr, context, instance):
@@ -490,6 +500,7 @@ class DeleteDisk(task.Task):
class SaveBDM(task.Task): class SaveBDM(task.Task):
"""Task to save an updated block device mapping.""" """Task to save an updated block device mapping."""
def __init__(self, bdm, instance): def __init__(self, bdm, instance):
@@ -510,6 +521,7 @@ class SaveBDM(task.Task):
class FindDisk(task.Task): class FindDisk(task.Task):
"""The Task to find a disk and provide information to downstream tasks.""" """The Task to find a disk and provide information to downstream tasks."""
def __init__(self, disk_dvr, context, instance, disk_type): def __init__(self, disk_dvr, context, instance, disk_type):
@@ -543,6 +555,7 @@ class FindDisk(task.Task):
class ExtendDisk(task.Task): class ExtendDisk(task.Task):
"""Task to extend a disk.""" """Task to extend a disk."""
def __init__(self, disk_dvr, context, instance, disk_info, size): def __init__(self, disk_dvr, context, instance, disk_info, size):

View File

@@ -28,6 +28,7 @@ LOG = logging.getLogger(__name__)
class Get(task.Task): class Get(task.Task):
"""The task for getting a VM entry.""" """The task for getting a VM entry."""
def __init__(self, adapter, host_uuid, instance): def __init__(self, adapter, host_uuid, instance):
@@ -50,6 +51,7 @@ class Get(task.Task):
class Create(task.Task): class Create(task.Task):
"""The task for creating a VM.""" """The task for creating a VM."""
def __init__(self, adapter, host_wrapper, instance, flavor, stg_ftsk): def __init__(self, adapter, host_wrapper, instance, flavor, stg_ftsk):
@@ -90,6 +92,7 @@ class Create(task.Task):
class Resize(task.Task): class Resize(task.Task):
"""The task for resizing an existing VM.""" """The task for resizing an existing VM."""
def __init__(self, adapter, host_wrapper, instance, flavor, name=None): def __init__(self, adapter, host_wrapper, instance, flavor, name=None):
@@ -122,6 +125,7 @@ class Resize(task.Task):
class Rename(task.Task): class Rename(task.Task):
"""The task for renaming an existing VM.""" """The task for renaming an existing VM."""
def __init__(self, adapter, host_uuid, instance, name): def __init__(self, adapter, host_uuid, instance, name):
@@ -150,6 +154,7 @@ class Rename(task.Task):
class PowerOn(task.Task): class PowerOn(task.Task):
"""The task to power on the instance.""" """The task to power on the instance."""
def __init__(self, adapter, host_uuid, instance, pwr_opts=None, def __init__(self, adapter, host_uuid, instance, pwr_opts=None,
@@ -193,6 +198,7 @@ class PowerOn(task.Task):
class PowerOff(task.Task): class PowerOff(task.Task):
"""The task to power off a VM.""" """The task to power off a VM."""
def __init__(self, adapter, host_uuid, lpar_uuid, instance, def __init__(self, adapter, host_uuid, lpar_uuid, instance,
@@ -219,6 +225,7 @@ class PowerOff(task.Task):
class Delete(task.Task): class Delete(task.Task):
"""The task to delete the instance from the system.""" """The task to delete the instance from the system."""
def __init__(self, adapter, lpar_uuid, instance): def __init__(self, adapter, lpar_uuid, instance):
@@ -240,6 +247,7 @@ class Delete(task.Task):
class UpdateIBMiSettings(task.Task): class UpdateIBMiSettings(task.Task):
"""The task to update settings of an ibmi instance.""" """The task to update settings of an ibmi instance."""
def __init__(self, adapter, instance, host_uuid, boot_type): def __init__(self, adapter, instance, host_uuid, boot_type):

View File

@@ -127,8 +127,9 @@ def translate_event(pvm_state, pwr_state):
def _translate_vm_state(pvm_state): def _translate_vm_state(pvm_state):
"""Find the current state of the lpar and convert it to """Find the current state of the lpar.
the appropriate nova.compute.power_state
State is converted to the appropriate nova.compute.power_state
:return: The appropriate integer state value from power_state :return: The appropriate integer state value from power_state
""" """

View File

@@ -460,6 +460,7 @@ class NPIVVolumeAdapter(v_driver.FibreChannelVolumeAdapter):
def _set_fabric_state(self, fabric, state): def _set_fabric_state(self, fabric, state):
"""Sets the fabric state into the instance's system metadata. """Sets the fabric state into the instance's system metadata.
:param fabric: The name of the fabric :param fabric: The name of the fabric
:param state: state of the fabric which needs to be set :param state: state of the fabric which needs to be set
@@ -600,8 +601,7 @@ class NPIVVolumeAdapter(v_driver.FibreChannelVolumeAdapter):
return pvm_cfg.NPIV_FABRIC_WWPNS[fabric_name] return pvm_cfg.NPIV_FABRIC_WWPNS[fabric_name]
def _ports_per_fabric(self): def _ports_per_fabric(self):
"""Returns the number of virtual ports that should be used per fabric. """Returns the number of virtual ports to be used per fabric."""
"""
return CONF.powervm.ports_per_fabric return CONF.powervm.ports_per_fabric
def _get_num_keys(self, port_map): def _get_num_keys(self, port_map):

View File

@@ -33,8 +33,8 @@ commands =
whitelist_externals = bash whitelist_externals = bash
[flake8] [flake8]
ignore = E125,H405 ignore = E125
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
[hacking] [hacking]
local-check-factory = nova_powervm.hacking.checks.factory local-check-factory = nova_powervm.hacking.checks.factory