From 6cc2a07f70ab4e99c490dd4ec66b9da9a7232f8c Mon Sep 17 00:00:00 2001 From: Drew Thorstensen Date: Wed, 5 Aug 2015 09:37:57 -0400 Subject: [PATCH] Minor spelling/consistency updates This change set fixes some minor formatting issues. In general, the following. - Have a consistent return doc string - Have param be format :param xyz: instead of :param: xyz: - A couple spelling issues - Some doc string consolidation Change-Id: I1967c06398a0d1d233f5b1a64203c5fdc7f12126 --- .../tests/virt/powervm/volume/test_npiv.py | 2 +- nova_powervm/virt/powervm/disk/driver.py | 4 +-- nova_powervm/virt/powervm/disk/localdisk.py | 4 +-- nova_powervm/virt/powervm/disk/ssp.py | 4 +-- nova_powervm/virt/powervm/driver.py | 26 +++++++++---------- nova_powervm/virt/powervm/fake_driver.py | 8 +++--- nova_powervm/virt/powervm/vm.py | 21 +++++++-------- nova_powervm/virt/powervm/volume/driver.py | 10 +++---- nova_powervm/virt/powervm/volume/npiv.py | 13 ++++++---- nova_powervm/virt/powervm/volume/vscsi.py | 8 +++--- 10 files changed, 50 insertions(+), 50 deletions(-) diff --git a/nova_powervm/tests/virt/powervm/volume/test_npiv.py b/nova_powervm/tests/virt/powervm/volume/test_npiv.py index 955335ca..0ffb716e 100644 --- a/nova_powervm/tests/virt/powervm/volume/test_npiv.py +++ b/nova_powervm/tests/virt/powervm/volume/test_npiv.py @@ -230,5 +230,5 @@ class TestNPIVAdapter(test.TestCase): self.vol_drv.instance.system_metadata = { self.vol_drv._sys_meta_fabric_key('A'): 'phys1,a,b,phys2,c,d'} - # Invole and Verify + # Invoke and Verify self.assertListEqual(['a', 'b', 'c', 'd'], self.vol_drv.wwpns()) diff --git a/nova_powervm/virt/powervm/disk/driver.py b/nova_powervm/virt/powervm/disk/driver.py index 6bd67285..70311979 100644 --- a/nova_powervm/virt/powervm/disk/driver.py +++ b/nova_powervm/virt/powervm/disk/driver.py @@ -288,7 +288,7 @@ class DiskAdapter(object): must be at least as big as the image). Must be an int. :param image_type: the image type. See disk constants above. - :returns: The backing pypowervm storage object that was created. + :return: The backing pypowervm storage object that was created. """ pass @@ -300,7 +300,7 @@ class DiskAdapter(object): :param disk_info: The pypowervm storage element returned from create_disk_from_image. Ex. VOptMedia, VDisk, LU, or PV. - :param: lpar_uuid: The pypowervm UUID that corresponds to the VM. + :param lpar_uuid: The pypowervm UUID that corresponds to the VM. """ pass diff --git a/nova_powervm/virt/powervm/disk/localdisk.py b/nova_powervm/virt/powervm/disk/localdisk.py index edd35eaf..d945aaaf 100644 --- a/nova_powervm/virt/powervm/disk/localdisk.py +++ b/nova_powervm/virt/powervm/disk/localdisk.py @@ -160,7 +160,7 @@ class LocalStorage(disk_dvr.DiskAdapter): must be at least as big as the image). Must be an int. :param image_type: the image type. See disk constants above. - :returns: The backing pypowervm storage object that was created. + :return: The backing pypowervm storage object that was created. """ LOG.info(_LI('Create disk.')) @@ -190,7 +190,7 @@ class LocalStorage(disk_dvr.DiskAdapter): :param disk_info: The pypowervm storage element returned from create_disk_from_image. Ex. VOptMedia, VDisk, LU, or PV. - :param: lpar_uuid: The pypowervm UUID that corresponds to the VM. + :param lpar_uuid: The pypowervm UUID that corresponds to the VM. """ # Add the mapping to the VIOS tsk_map.add_vscsi_mapping(self.host_uuid, self._vios_uuid, lpar_uuid, diff --git a/nova_powervm/virt/powervm/disk/ssp.py b/nova_powervm/virt/powervm/disk/ssp.py index 0bf2b21f..f2e42b19 100644 --- a/nova_powervm/virt/powervm/disk/ssp.py +++ b/nova_powervm/virt/powervm/disk/ssp.py @@ -151,7 +151,7 @@ class SSPDiskAdapter(disk_drv.DiskAdapter): must be at least as big as the image). Must be an int. :param image_type: The image type. See disk_drv.DiskType. - :returns: The backing pypowervm LU storage object that was created. + :return: The backing pypowervm LU storage object that was created. """ LOG.info(_LI('SSP: Create %(image_type)s disk from image %(image_id)s ' 'for instance %(instance_uuid)s.'), @@ -211,7 +211,7 @@ class SSPDiskAdapter(disk_drv.DiskAdapter): :param disk_info: The pypowervm storage element returned from create_disk_from_image. Ex. VOptMedia, VDisk, LU, or PV. - :param: lpar_uuid: The pypowervm UUID that corresponds to the VM. + :param lpar_uuid: The pypowervm UUID that corresponds to the VM. """ # Create the LU structure lu = pvm_stg.LU.bld_ref(self.adapter, disk_info.name, disk_info.udid) diff --git a/nova_powervm/virt/powervm/driver.py b/nova_powervm/virt/powervm/driver.py index 5691e1a1..8f06ff5b 100644 --- a/nova_powervm/virt/powervm/driver.py +++ b/nova_powervm/virt/powervm/driver.py @@ -276,8 +276,8 @@ class PowerVMDriver(driver.ComputeDriver): :param block_device_info: The block device info from the compute manager. - :returns: True if the root device is in block_device_info and False if - it is not. + :return: True if the root device is in block_device_info and False if + it is not. """ root_bdm = block_device.get_root_bdm( driver.block_device_info_get_mapping(block_device_info)) @@ -604,7 +604,7 @@ class PowerVMDriver(driver.ComputeDriver): :param nodename: node which the caller want to get resources from a driver that manages only one node can safely ignore this - :returns: Dictionary describing resources + :return: Dictionary describing resources """ resp = self.adapter.read(pvm_ms.System.schema_type, @@ -880,7 +880,7 @@ class PowerVMDriver(driver.ComputeDriver): :param dst_compute_info: destination host information :param block_migration: if true, prepare for block migration :param disk_over_commit: if true, allow disk over commit - :returns dest_check_data: dictionary containing destination data + :return: dictionary containing destination data """ # dest_check_data = \ # TODO(IBM): Implement live migration check @@ -897,7 +897,7 @@ class PowerVMDriver(driver.ComputeDriver): :param instance: nova.db.sqlalchemy.models.Instance :param dest_check_data: result of check_can_live_migrate_destination :param block_device_info: result of _get_instance_block_device_info - :returns: a dict containing migration info (hypervisor-dependent) + :return: a dict containing migration info (hypervisor-dependent) """ # migrate_data = \ # TODO(IBM): Implement live migration check @@ -1028,7 +1028,7 @@ class PowerVMDriver(driver.ComputeDriver): :param context: security context :param instance: nova.objects.instance.Instance - :returns an instance of console.type.ConsoleVNC + :return: An instance of console.type.ConsoleVNC """ self._log_operation('get_vnc_console', instance) lpar_uuid = vm.get_pvm_uuid(instance) @@ -1047,11 +1047,11 @@ class PowerVMDriver(driver.ComputeDriver): :param instance: Nova instance for which the volume adapter is needed. :param conn_info: BDM connection information of the instance to get the volume adapter type (vSCSI/NPIV) requested. - :returns: Returns the volume adapter, if conn_info is not passed then - returns the volume adapter based on the CONF - fc_attach_strategy property (npiv/vscsi). Otherwise returns - the adapter based on the connection-type of - connection_info. + :return: Returns the volume adapter, if conn_info is not passed then + returns the volume adapter based on the CONF + fc_attach_strategy property (npiv/vscsi). Otherwise returns + the adapter based on the connection-type of + connection_info. """ adp_type = vol_attach.FC_STRATEGY_MAPPING[ CONF.powervm.fc_attach_strategy] @@ -1070,8 +1070,8 @@ def _inst_dict(input_dict): :param input_dict: A dictionary with keys, whose values are class names. - :returns: A dictionary with the same keys. But the values are instances - of the class. No parameters are passed in to the init methods. + :return: A dictionary with the same keys. But the values are instances + of the class. No parameters are passed in to the init methods. """ response = dict() diff --git a/nova_powervm/virt/powervm/fake_driver.py b/nova_powervm/virt/powervm/fake_driver.py index e5a5e38e..90925f1a 100644 --- a/nova_powervm/virt/powervm/fake_driver.py +++ b/nova_powervm/virt/powervm/fake_driver.py @@ -162,7 +162,7 @@ class FakePowerVMDriver(driver.ComputeDriver): :param nodename: node which the caller want to get resources from a driver that manages only one node can safely ignore this - :returns: Dictionary describing resources + :return: Dictionary describing resources """ data = self._fake.get_available_resource(nodename) @@ -215,7 +215,7 @@ class FakePowerVMDriver(driver.ComputeDriver): :param dst_compute_info: destination host information :param block_migration: if true, prepare for block migration :param disk_over_commit: if true, allow disk over commit - :returns dest_check_data: dictionary containing destination data + :return: dictionary containing destination data """ dest_check_data = \ self._fake.check_can_live_migrate_destination( @@ -231,8 +231,8 @@ class FakePowerVMDriver(driver.ComputeDriver): :param context: security context :param instance_ref: instance to be migrated :param dest_check_data: results from check_can_live_migrate_destination - :returns migrate_data: dictionary containing source and - destination data for migration + :return: dictionary containing source and destination data for + migration """ migrate_data = \ self._fake.check_can_live_migrate_source(ctxt, diff --git a/nova_powervm/virt/powervm/vm.py b/nova_powervm/virt/powervm/vm.py index 127ea2ed..52794a7e 100644 --- a/nova_powervm/virt/powervm/vm.py +++ b/nova_powervm/virt/powervm/vm.py @@ -73,7 +73,7 @@ def _translate_vm_state(pvm_state): """Find the current state of the lpar and convert it to the appropriate nova.compute.power_state - :returns: The appropriate integer state value from power_state + :return: The appropriate integer state value from power_state """ if pvm_state is None: @@ -222,7 +222,7 @@ class VMBuilder(object): :param instance: the VM instance :param flavor: The Nova instance flavor. - :returns: a dict that can be used by the LPAR builder + :return: a dict that can be used by the LPAR builder """ # The attrs are what is sent to pypowervm to convert the lpar. attrs = {} @@ -377,7 +377,7 @@ def get_instance_wrapper(adapter, instance, host_uuid): :param adapter: The adapter for the pypowervm API :param instance: The nova instance. :param host_uuid: (TEMPORARY) The host UUID - :returns: The pypowervm logical_partition wrapper. + :return: The pypowervm logical_partition wrapper. """ pvm_inst_uuid = get_pvm_uuid(instance) resp = adapter.read(pvm_ms.System.schema_type, root_id=host_uuid, @@ -392,7 +392,7 @@ def instance_exists(adapter, instance, host_uuid): :param adapter: The adapter for the pypowervm API :param instance: The nova instance. :param host_uuid: The host UUID - :returns: boolean, whether the instance exists. + :return: boolean, whether the instance exists. """ try: # If we're able to get the property, then it exists. @@ -407,7 +407,7 @@ def get_vm_id(adapter, lpar_uuid): :param adapter: The pypowervm adapter. :param lpar_uuid: The UUID for the LPAR. - :returns: The system id (an integer value). + :return: The system id (an integer value). """ return get_vm_qp(adapter, lpar_uuid, qprop='PartitionID') @@ -443,7 +443,7 @@ def crt_lpar(adapter, host_wrapper, instance, flavor): :param host_wrapper: The host wrapper :param instance: The nova instance. :param flavor: The nova flavor. - :returns: The LPAR response from the API. + :return: The LPAR response from the API. """ lpar_b = VMBuilder(host_wrapper, adapter).lpar_builder(instance, flavor) lpar_w = lpar_b.build().create(parent_type=pvm_ms.System, @@ -532,7 +532,7 @@ def get_pvm_uuid(instance): UUID. :param instance: nova.objects.instance.Instance - :returns: pvm_uuid. + :return: pvm_uuid. """ return pvm_uuid.convert_uuid_to_pvm(instance.uuid).upper() @@ -544,8 +544,7 @@ def get_cnas(adapter, instance, host_uuid): :param adapter: The pypowervm adapter. :param instance: The nova instance. :param host_uuid: The host system UUID. - :returns The CNA wrappers that represent the ClientNetworkAdapters on the - VM. + :return The CNA wrappers that represent the ClientNetworkAdapters on the VM """ cna_resp = adapter.read(pvm_lpar.LPAR.schema_type, root_id=get_pvm_uuid(instance), @@ -606,8 +605,8 @@ def norm_mac(mac): have colons added. :param mac: A pypowervm mac address. Ex. 1234567890AB - :returns: A mac that matches the standard neutron format. - Ex. 12:34:56:78:90:ab + :return: A mac that matches the standard neutron format. + Ex. 12:34:56:78:90:ab """ mac = mac.lower().replace(':', '') return ':'.join(mac[i:i + 2] for i in range(0, len(mac), 2)) diff --git a/nova_powervm/virt/powervm/volume/driver.py b/nova_powervm/virt/powervm/volume/driver.py index 5fc7cf87..6286054e 100644 --- a/nova_powervm/virt/powervm/volume/driver.py +++ b/nova_powervm/virt/powervm/volume/driver.py @@ -47,13 +47,11 @@ class PowerVMVolumeAdapter(object): self.vm_uuid = vm.get_pvm_uuid(instance) def connect_volume(self): - """Connects the volume. - """ + """Connects the volume.""" raise NotImplementedError() def disconnect_volume(self): - """Disconnect the volume. - """ + """Disconnect the volume.""" raise NotImplementedError() @@ -69,13 +67,13 @@ class FibreChannelVolumeAdapter(PowerVMVolumeAdapter): def wwpns(self): """Builds the WWPNs of the adapters that will connect the ports. - :returns: The list of WWPNs that need to be included in the zone set. + :return: The list of WWPNs that need to be included in the zone set. """ raise NotImplementedError() def host_name(self): """Derives the host name that should be used for the storage device. - :returns: The host name. + :return: The host name. """ raise NotImplementedError() diff --git a/nova_powervm/virt/powervm/volume/npiv.py b/nova_powervm/virt/powervm/volume/npiv.py index 4748b052..fcd81c0c 100644 --- a/nova_powervm/virt/powervm/volume/npiv.py +++ b/nova_powervm/virt/powervm/volume/npiv.py @@ -194,15 +194,16 @@ class NPIVVolumeAdapter(v_driver.FibreChannelVolumeAdapter): def host_name(self): """Derives the host name that should be used for the storage device. - :returns: The host name. + :return: The host name. """ return self.instance.name def _set_fabric_state(self, fabric, state): """Sets the fabric state into the instance's system metadata. :param fabric: The name of the fabric - :param state: state of the fabric whicn needs to be set - Possible Valid States:- + :param state: state of the fabric which needs to be set + + Possible Valid States: FS_UNMAPPED: Initial state unmapped. FS_MGMT_MAPPED: Fabric is mapped with the management partition FS_INST_MAPPED: Fabric is mapped with the nova instance. @@ -215,9 +216,11 @@ class NPIVVolumeAdapter(v_driver.FibreChannelVolumeAdapter): def _get_fabric_state(self, fabric): """Gets the fabric state from the instance's system metadata. + :param fabric: The name of the fabric - :Returns state: state of the fabric whicn needs to be set - Possible Valid States:- + :return: The state of the fabric which needs to be set + + Possible Valid States: FS_UNMAPPED: Initial state unmapped. FS_MGMT_MAPPED: Fabric is mapped with the management partition FS_INST_MAPPED: Fabric is mapped with the nova instance. diff --git a/nova_powervm/virt/powervm/volume/vscsi.py b/nova_powervm/virt/powervm/volume/vscsi.py index 4b951fa5..0cab93cc 100644 --- a/nova_powervm/virt/powervm/volume/vscsi.py +++ b/nova_powervm/virt/powervm/volume/vscsi.py @@ -42,7 +42,7 @@ def _build_udid_key(vios_uuid, volume_id): :param vios_uuid: The UUID of the vios for the pypowervm adapter. :param volume_id: The lun volume id - :returns: The udid dictionary key + :return: The udid dictionary key """ return vios_uuid + volume_id @@ -209,7 +209,7 @@ class VscsiVolumeAdapter(v_driver.FibreChannelVolumeAdapter): def wwpns(self): """Builds the WWPNs of the adapters that will connect the ports. - :returns: The list of WWPNs that need to be included in the zone set. + :return: The list of WWPNs that need to be included in the zone set. """ if self._pfc_wwpns is None: self._pfc_wwpns = vios.get_physical_wwpns(self.adapter, @@ -219,7 +219,7 @@ class VscsiVolumeAdapter(v_driver.FibreChannelVolumeAdapter): def host_name(self): """Derives the host name that should be used for the storage device. - :returns: The host name. + :return: The host name. """ return CONF.host @@ -263,7 +263,7 @@ class VscsiVolumeAdapter(v_driver.FibreChannelVolumeAdapter): :param vios_uuid: The UUID of the vios for the pypowervm adapter. :param volume_id: The lun volume id - :returns: The target_udid associated with the hdisk + :return: The target_udid associated with the hdisk """ try: udid_key = _build_udid_key(vios_uuid, volume_id)