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
This commit is contained in:
Drew Thorstensen 2015-08-05 09:37:57 -04:00
parent 7d96443eba
commit 6cc2a07f70
10 changed files with 50 additions and 50 deletions

View File

@ -230,5 +230,5 @@ class TestNPIVAdapter(test.TestCase):
self.vol_drv.instance.system_metadata = { self.vol_drv.instance.system_metadata = {
self.vol_drv._sys_meta_fabric_key('A'): 'phys1,a,b,phys2,c,d'} 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()) self.assertListEqual(['a', 'b', 'c', 'd'], self.vol_drv.wwpns())

View File

@ -288,7 +288,7 @@ class DiskAdapter(object):
must be at least as big as the image). Must be an must be at least as big as the image). Must be an
int. int.
:param image_type: the image type. See disk constants above. :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 pass
@ -300,7 +300,7 @@ class DiskAdapter(object):
:param disk_info: The pypowervm storage element returned from :param disk_info: The pypowervm storage element returned from
create_disk_from_image. Ex. VOptMedia, VDisk, LU, create_disk_from_image. Ex. VOptMedia, VDisk, LU,
or PV. 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 pass

View File

@ -160,7 +160,7 @@ class LocalStorage(disk_dvr.DiskAdapter):
must be at least as big as the image). Must be an must be at least as big as the image). Must be an
int. int.
:param image_type: the image type. See disk constants above. :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.')) LOG.info(_LI('Create disk.'))
@ -190,7 +190,7 @@ class LocalStorage(disk_dvr.DiskAdapter):
:param disk_info: The pypowervm storage element returned from :param disk_info: The pypowervm storage element returned from
create_disk_from_image. Ex. VOptMedia, VDisk, LU, create_disk_from_image. Ex. VOptMedia, VDisk, LU,
or PV. 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 # Add the mapping to the VIOS
tsk_map.add_vscsi_mapping(self.host_uuid, self._vios_uuid, lpar_uuid, tsk_map.add_vscsi_mapping(self.host_uuid, self._vios_uuid, lpar_uuid,

View File

@ -151,7 +151,7 @@ class SSPDiskAdapter(disk_drv.DiskAdapter):
must be at least as big as the image). Must be an must be at least as big as the image). Must be an
int. int.
:param image_type: The image type. See disk_drv.DiskType. :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 ' LOG.info(_LI('SSP: Create %(image_type)s disk from image %(image_id)s '
'for instance %(instance_uuid)s.'), 'for instance %(instance_uuid)s.'),
@ -211,7 +211,7 @@ class SSPDiskAdapter(disk_drv.DiskAdapter):
:param disk_info: The pypowervm storage element returned from :param disk_info: The pypowervm storage element returned from
create_disk_from_image. Ex. VOptMedia, VDisk, LU, create_disk_from_image. Ex. VOptMedia, VDisk, LU,
or PV. 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 # Create the LU structure
lu = pvm_stg.LU.bld_ref(self.adapter, disk_info.name, disk_info.udid) lu = pvm_stg.LU.bld_ref(self.adapter, disk_info.name, disk_info.udid)

View File

@ -276,8 +276,8 @@ class PowerVMDriver(driver.ComputeDriver):
:param block_device_info: The block device info from the compute :param block_device_info: The block device info from the compute
manager. manager.
:returns: True if the root device is in block_device_info and False if :return: True if the root device is in block_device_info and False if
it is not. it is not.
""" """
root_bdm = block_device.get_root_bdm( root_bdm = block_device.get_root_bdm(
driver.block_device_info_get_mapping(block_device_info)) driver.block_device_info_get_mapping(block_device_info))
@ -604,7 +604,7 @@ class PowerVMDriver(driver.ComputeDriver):
:param nodename: :param nodename:
node which the caller want to get resources from node which the caller want to get resources from
a driver that manages only one node can safely ignore this 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, 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 dst_compute_info: destination host information
:param block_migration: if true, prepare for block migration :param block_migration: if true, prepare for block migration
:param disk_over_commit: if true, allow disk over commit :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 = \ # dest_check_data = \
# TODO(IBM): Implement live migration check # TODO(IBM): Implement live migration check
@ -897,7 +897,7 @@ class PowerVMDriver(driver.ComputeDriver):
:param instance: nova.db.sqlalchemy.models.Instance :param instance: nova.db.sqlalchemy.models.Instance
:param dest_check_data: result of check_can_live_migrate_destination :param dest_check_data: result of check_can_live_migrate_destination
:param block_device_info: result of _get_instance_block_device_info :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 = \ # migrate_data = \
# TODO(IBM): Implement live migration check # TODO(IBM): Implement live migration check
@ -1028,7 +1028,7 @@ class PowerVMDriver(driver.ComputeDriver):
:param context: security context :param context: security context
:param instance: nova.objects.instance.Instance :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) self._log_operation('get_vnc_console', instance)
lpar_uuid = vm.get_pvm_uuid(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 instance: Nova instance for which the volume adapter is needed.
:param conn_info: BDM connection information of the instance to :param conn_info: BDM connection information of the instance to
get the volume adapter type (vSCSI/NPIV) requested. get the volume adapter type (vSCSI/NPIV) requested.
:returns: Returns the volume adapter, if conn_info is not passed then :return: Returns the volume adapter, if conn_info is not passed then
returns the volume adapter based on the CONF returns the volume adapter based on the CONF
fc_attach_strategy property (npiv/vscsi). Otherwise returns fc_attach_strategy property (npiv/vscsi). Otherwise returns
the adapter based on the connection-type of the adapter based on the connection-type of
connection_info. connection_info.
""" """
adp_type = vol_attach.FC_STRATEGY_MAPPING[ adp_type = vol_attach.FC_STRATEGY_MAPPING[
CONF.powervm.fc_attach_strategy] 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 :param input_dict: A dictionary with keys, whose values are class
names. names.
:returns: A dictionary with the same keys. But the values are instances :return: A dictionary with the same keys. But the values are instances
of the class. No parameters are passed in to the init methods. of the class. No parameters are passed in to the init methods.
""" """
response = dict() response = dict()

View File

@ -162,7 +162,7 @@ class FakePowerVMDriver(driver.ComputeDriver):
:param nodename: :param nodename:
node which the caller want to get resources from node which the caller want to get resources from
a driver that manages only one node can safely ignore this 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) data = self._fake.get_available_resource(nodename)
@ -215,7 +215,7 @@ class FakePowerVMDriver(driver.ComputeDriver):
:param dst_compute_info: destination host information :param dst_compute_info: destination host information
:param block_migration: if true, prepare for block migration :param block_migration: if true, prepare for block migration
:param disk_over_commit: if true, allow disk over commit :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 = \ dest_check_data = \
self._fake.check_can_live_migrate_destination( self._fake.check_can_live_migrate_destination(
@ -231,8 +231,8 @@ class FakePowerVMDriver(driver.ComputeDriver):
:param context: security context :param context: security context
:param instance_ref: instance to be migrated :param instance_ref: instance to be migrated
:param dest_check_data: results from check_can_live_migrate_destination :param dest_check_data: results from check_can_live_migrate_destination
:returns migrate_data: dictionary containing source and :return: dictionary containing source and destination data for
destination data for migration migration
""" """
migrate_data = \ migrate_data = \
self._fake.check_can_live_migrate_source(ctxt, self._fake.check_can_live_migrate_source(ctxt,

View File

@ -73,7 +73,7 @@ def _translate_vm_state(pvm_state):
"""Find the current state of the lpar and convert it to """Find the current state of the lpar and convert it to
the appropriate nova.compute.power_state 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: if pvm_state is None:
@ -222,7 +222,7 @@ class VMBuilder(object):
:param instance: the VM instance :param instance: the VM instance
:param flavor: The Nova instance flavor. :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. # The attrs are what is sent to pypowervm to convert the lpar.
attrs = {} attrs = {}
@ -377,7 +377,7 @@ def get_instance_wrapper(adapter, instance, host_uuid):
:param adapter: The adapter for the pypowervm API :param adapter: The adapter for the pypowervm API
:param instance: The nova instance. :param instance: The nova instance.
:param host_uuid: (TEMPORARY) The host UUID :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) pvm_inst_uuid = get_pvm_uuid(instance)
resp = adapter.read(pvm_ms.System.schema_type, root_id=host_uuid, 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 adapter: The adapter for the pypowervm API
:param instance: The nova instance. :param instance: The nova instance.
:param host_uuid: The host UUID :param host_uuid: The host UUID
:returns: boolean, whether the instance exists. :return: boolean, whether the instance exists.
""" """
try: try:
# If we're able to get the property, then it exists. # 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 adapter: The pypowervm adapter.
:param lpar_uuid: The UUID for the LPAR. :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') 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 host_wrapper: The host wrapper
:param instance: The nova instance. :param instance: The nova instance.
:param flavor: The nova flavor. :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_b = VMBuilder(host_wrapper, adapter).lpar_builder(instance, flavor)
lpar_w = lpar_b.build().create(parent_type=pvm_ms.System, lpar_w = lpar_b.build().create(parent_type=pvm_ms.System,
@ -532,7 +532,7 @@ def get_pvm_uuid(instance):
UUID. UUID.
:param instance: nova.objects.instance.Instance :param instance: nova.objects.instance.Instance
:returns: pvm_uuid. :return: pvm_uuid.
""" """
return pvm_uuid.convert_uuid_to_pvm(instance.uuid).upper() 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 adapter: The pypowervm adapter.
:param instance: The nova instance. :param instance: The nova instance.
:param host_uuid: The host system UUID. :param host_uuid: The host system UUID.
:returns The CNA wrappers that represent the ClientNetworkAdapters on the :return The CNA wrappers that represent the ClientNetworkAdapters on the VM
VM.
""" """
cna_resp = adapter.read(pvm_lpar.LPAR.schema_type, cna_resp = adapter.read(pvm_lpar.LPAR.schema_type,
root_id=get_pvm_uuid(instance), root_id=get_pvm_uuid(instance),
@ -606,8 +605,8 @@ def norm_mac(mac):
have colons added. have colons added.
:param mac: A pypowervm mac address. Ex. 1234567890AB :param mac: A pypowervm mac address. Ex. 1234567890AB
:returns: A mac that matches the standard neutron format. :return: A mac that matches the standard neutron format.
Ex. 12:34:56:78:90:ab Ex. 12:34:56:78:90:ab
""" """
mac = mac.lower().replace(':', '') mac = mac.lower().replace(':', '')
return ':'.join(mac[i:i + 2] for i in range(0, len(mac), 2)) return ':'.join(mac[i:i + 2] for i in range(0, len(mac), 2))

View File

@ -47,13 +47,11 @@ class PowerVMVolumeAdapter(object):
self.vm_uuid = vm.get_pvm_uuid(instance) self.vm_uuid = vm.get_pvm_uuid(instance)
def connect_volume(self): def connect_volume(self):
"""Connects the volume. """Connects the volume."""
"""
raise NotImplementedError() raise NotImplementedError()
def disconnect_volume(self): def disconnect_volume(self):
"""Disconnect the volume. """Disconnect the volume."""
"""
raise NotImplementedError() raise NotImplementedError()
@ -69,13 +67,13 @@ class FibreChannelVolumeAdapter(PowerVMVolumeAdapter):
def wwpns(self): def wwpns(self):
"""Builds the WWPNs of the adapters that will connect the ports. """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() raise NotImplementedError()
def host_name(self): def host_name(self):
"""Derives the host name that should be used for the storage device. """Derives the host name that should be used for the storage device.
:returns: The host name. :return: The host name.
""" """
raise NotImplementedError() raise NotImplementedError()

View File

@ -194,15 +194,16 @@ class NPIVVolumeAdapter(v_driver.FibreChannelVolumeAdapter):
def host_name(self): def host_name(self):
"""Derives the host name that should be used for the storage device. """Derives the host name that should be used for the storage device.
:returns: The host name. :return: The host name.
""" """
return self.instance.name return self.instance.name
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 whicn needs to be set :param state: state of the fabric which needs to be set
Possible Valid States:-
Possible Valid States:
FS_UNMAPPED: Initial state unmapped. FS_UNMAPPED: Initial state unmapped.
FS_MGMT_MAPPED: Fabric is mapped with the management partition FS_MGMT_MAPPED: Fabric is mapped with the management partition
FS_INST_MAPPED: Fabric is mapped with the nova instance. 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): def _get_fabric_state(self, fabric):
"""Gets the fabric state from the instance's system metadata. """Gets the fabric state from the instance's system metadata.
:param fabric: The name of the fabric :param fabric: The name of the fabric
:Returns state: state of the fabric whicn needs to be set :return: The state of the fabric which needs to be set
Possible Valid States:-
Possible Valid States:
FS_UNMAPPED: Initial state unmapped. FS_UNMAPPED: Initial state unmapped.
FS_MGMT_MAPPED: Fabric is mapped with the management partition FS_MGMT_MAPPED: Fabric is mapped with the management partition
FS_INST_MAPPED: Fabric is mapped with the nova instance. FS_INST_MAPPED: Fabric is mapped with the nova instance.

View File

@ -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 vios_uuid: The UUID of the vios for the pypowervm adapter.
:param volume_id: The lun volume id :param volume_id: The lun volume id
:returns: The udid dictionary key :return: The udid dictionary key
""" """
return vios_uuid + volume_id return vios_uuid + volume_id
@ -209,7 +209,7 @@ class VscsiVolumeAdapter(v_driver.FibreChannelVolumeAdapter):
def wwpns(self): def wwpns(self):
"""Builds the WWPNs of the adapters that will connect the ports. """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: if self._pfc_wwpns is None:
self._pfc_wwpns = vios.get_physical_wwpns(self.adapter, self._pfc_wwpns = vios.get_physical_wwpns(self.adapter,
@ -219,7 +219,7 @@ class VscsiVolumeAdapter(v_driver.FibreChannelVolumeAdapter):
def host_name(self): def host_name(self):
"""Derives the host name that should be used for the storage device. """Derives the host name that should be used for the storage device.
:returns: The host name. :return: The host name.
""" """
return CONF.host 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 vios_uuid: The UUID of the vios for the pypowervm adapter.
:param volume_id: The lun volume id :param volume_id: The lun volume id
:returns: The target_udid associated with the hdisk :return: The target_udid associated with the hdisk
""" """
try: try:
udid_key = _build_udid_key(vios_uuid, volume_id) udid_key = _build_udid_key(vios_uuid, volume_id)