diff options
| author | Sean Dague <sdague@linux.vnet.ibm.com> | 2013-01-04 15:46:18 -0500 |
|---|---|---|
| committer | Sean Dague <sdague@linux.vnet.ibm.com> | 2013-01-07 21:39:58 -0500 |
| commit | 37bfdd3b38b2d2c2f088f67e7bcc2f26c6e01c1c (patch) | |
| tree | f6a4d9354c3ea795fe5b270046a20fc6d21a12ca /nova/virt | |
| parent | 9279e0052f300eb0f64d63c970d34c050d744906 (diff) | |
fix N401 errors, stop ignoring all N4* errors
We had previously been ignoring all our custom N4xx hacking.py
errors. This fixes all the N401 errors "doc strings
should not start with a space" and reduces the ignore set down
to N402 only "single line docstrings should end with period".
It also fixes the N401 parser to catch only docstrings, and
not tripple quoted string blocks used later on in a function.
Clean up a few of the more crazy uses of """ in our code
Clean up additional funky comments to make indents a bit more
consistent, and pull in lines when possible.
Change-Id: I9040a1d2ca7efda83bd5e425b95d1408b5b63577
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/fake.py | 3 | ||||
| -rw-r--r-- | nova/virt/firewall.py | 2 | ||||
| -rw-r--r-- | nova/virt/hyperv/hostops.py | 4 | ||||
| -rw-r--r-- | nova/virt/hyperv/vmops.py | 6 | ||||
| -rw-r--r-- | nova/virt/hyperv/volumeutils.py | 4 | ||||
| -rw-r--r-- | nova/virt/hyperv/volumeutilsV2.py | 2 | ||||
| -rw-r--r-- | nova/virt/libvirt/driver.py | 9 | ||||
| -rw-r--r-- | nova/virt/libvirt/vif.py | 2 | ||||
| -rw-r--r-- | nova/virt/libvirt/volume_nfs.py | 4 | ||||
| -rw-r--r-- | nova/virt/xenapi/driver.py | 26 | ||||
| -rw-r--r-- | nova/virt/xenapi/firewall.py | 5 | ||||
| -rw-r--r-- | nova/virt/xenapi/vmops.py | 10 |
12 files changed, 36 insertions, 41 deletions
diff --git a/nova/virt/fake.py b/nova/virt/fake.py index 5d3b3c926..c044a9abf 100644 --- a/nova/virt/fake.py +++ b/nova/virt/fake.py @@ -349,7 +349,7 @@ class FakeDriver(driver.ComputeDriver): raise NotImplementedError('This method is supported only by libvirt.') def test_remove_vm(self, instance_name): - """ Removes the named VM, as if it crashed. For testing""" + """Removes the named VM, as if it crashed. For testing""" self.instances.pop(instance_name) def get_host_stats(self, refresh=False): @@ -386,7 +386,6 @@ class FakeDriver(driver.ComputeDriver): return 'disabled' def get_disk_available_least(self): - """ """ pass def get_volume_connector(self, instance): diff --git a/nova/virt/firewall.py b/nova/virt/firewall.py index d7a5cbc31..178d35882 100644 --- a/nova/virt/firewall.py +++ b/nova/virt/firewall.py @@ -50,7 +50,7 @@ def load_driver(default, *args, **kwargs): class FirewallDriver(object): - """ Firewall Driver base class. + """Firewall Driver base class. Defines methods that any driver providing security groups and provider firewall functionality should implement. diff --git a/nova/virt/hyperv/hostops.py b/nova/virt/hyperv/hostops.py index 8c501ab30..5cbe46c1c 100644 --- a/nova/virt/hyperv/hostops.py +++ b/nova/virt/hyperv/hostops.py @@ -39,7 +39,7 @@ class HostOps(baseops.BaseOps): self._stats = None def _get_cpu_info(self): - """ Get the CPU information. + """Get the CPU information. :returns: A dictionary containing the main properties of the central processor in the hypervisor. """ @@ -107,7 +107,7 @@ class HostOps(baseops.BaseOps): return total_gb, used_gb def _get_vcpu_used(self): - """ Get vcpu usage number of physical computer. + """Get vcpu usage number of physical computer. :returns: The total number of vcpu that currently used. """ #TODO(jordanrinke) figure out a way to count assigned VCPUs diff --git a/nova/virt/hyperv/vmops.py b/nova/virt/hyperv/vmops.py index 46fbd6cbc..680d57ce1 100644 --- a/nova/virt/hyperv/vmops.py +++ b/nova/virt/hyperv/vmops.py @@ -69,7 +69,7 @@ class VMOps(baseops.BaseOps): self._volumeops = volumeops def list_instances(self): - """ Return the names of all the instances known to Hyper-V. """ + """Return the names of all the instances known to Hyper-V. """ vms = [v.ElementName for v in self._conn.Msvm_ComputerSystem(['ElementName'], Caption="Virtual Machine")] @@ -118,7 +118,7 @@ class VMOps(baseops.BaseOps): def spawn(self, context, instance, image_meta, injected_files, admin_password, network_info, block_device_info=None): - """ Create a new VM and start it.""" + """Create a new VM and start it.""" vm = self._vmutils.lookup(self._conn, instance['name']) if vm is not None: raise exception.InstanceExists(name=instance['name']) @@ -271,7 +271,7 @@ class VMOps(baseops.BaseOps): LOG.debug(_('Set vcpus for vm %s...'), instance["name"]) def _create_scsi_controller(self, vm_name): - """ Create an iscsi controller ready to mount volumes """ + """Create an iscsi controller ready to mount volumes """ LOG.debug(_('Creating a scsi controller for %(vm_name)s for volume ' 'attaching') % locals()) vms = self._conn.MSVM_ComputerSystem(ElementName=vm_name) diff --git a/nova/virt/hyperv/volumeutils.py b/nova/virt/hyperv/volumeutils.py index 8ae437cf9..31c05b9ad 100644 --- a/nova/virt/hyperv/volumeutils.py +++ b/nova/virt/hyperv/volumeutils.py @@ -68,7 +68,7 @@ class VolumeUtils(basevolumeutils.BaseVolumeUtils): time.sleep(CONF.hyperv_wait_between_attach_retry) def logout_storage_target(self, target_iqn): - """ Logs out storage target through its session id """ + """Logs out storage target through its session id """ sessions = self._conn_wmi.query( "SELECT * FROM MSiSCSIInitiator_SessionClass \ @@ -77,5 +77,5 @@ class VolumeUtils(basevolumeutils.BaseVolumeUtils): self.execute_log_out(session.SessionId) def execute_log_out(self, session_id): - """ Executes log out of the session described by its session ID """ + """Executes log out of the session described by its session ID """ self.execute('iscsicli.exe ' + 'logouttarget ' + session_id) diff --git a/nova/virt/hyperv/volumeutilsV2.py b/nova/virt/hyperv/volumeutilsV2.py index 8d7c91862..03e3002f4 100644 --- a/nova/virt/hyperv/volumeutilsV2.py +++ b/nova/virt/hyperv/volumeutilsV2.py @@ -53,7 +53,7 @@ class VolumeUtilsV2(basevolumeutils.BaseVolumeUtils): time.sleep(CONF.hyperv_wait_between_attach_retry) def logout_storage_target(self, target_iqn): - """ Logs out storage target through its session id """ + """Logs out storage target through its session id """ target = self._conn_storage.MSFT_iSCSITarget( NodeAddress=target_iqn)[0] diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 6befe429e..da21fcf6b 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -2024,7 +2024,7 @@ class LibvirtDriver(driver.ComputeDriver): return stats['total'] / (1024 ** 3) def get_vcpu_used(self): - """ Get vcpu usage number of physical computer. + """Get vcpu usage number of physical computer. :returns: The total number of vcpu that currently used. @@ -2579,9 +2579,7 @@ class LibvirtDriver(driver.ComputeDriver): timer.start(interval=0.5).wait() def _fetch_instance_kernel_ramdisk(self, context, instance): - """ Download kernel and ramdisk for given instance in the given - instance directory. - """ + """Download kernel and ramdisk for instance in instance directory.""" instance_dir = os.path.join(CONF.instances_path, instance['name']) if instance['kernel_id']: libvirt_utils.fetch_image(context, @@ -3000,8 +2998,7 @@ class LibvirtDriver(driver.ComputeDriver): def get_diagnostics(self, instance): def get_io_devices(xml_doc): - """ get the list of io devices from the - xml document.""" + """get the list of io devices from the xml document.""" result = {"volumes": [], "ifaces": []} try: doc = etree.fromstring(xml_doc) diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py index a3071e0c9..f65fa4a7e 100644 --- a/nova/virt/libvirt/vif.py +++ b/nova/virt/libvirt/vif.py @@ -273,7 +273,7 @@ class LibvirtOpenVswitchVirtualPortDriver(LibvirtBaseVIFDriver): OVS virtual port XML (introduced in libvirt 0.9.11).""" def get_config(self, instance, network, mapping): - """ Pass data required to create OVS virtual port element""" + """Pass data required to create OVS virtual port element""" conf = super(LibvirtOpenVswitchVirtualPortDriver, self).get_config(instance, network, diff --git a/nova/virt/libvirt/volume_nfs.py b/nova/virt/libvirt/volume_nfs.py index 722760f0a..ebec36b6a 100644 --- a/nova/virt/libvirt/volume_nfs.py +++ b/nova/virt/libvirt/volume_nfs.py @@ -39,8 +39,8 @@ CONF.import_opt('state_path', 'nova.config') class NfsVolumeDriver(volume.LibvirtVolumeDriver): - """ Class implements libvirt part of volume driver for NFS - """ + """Class implements libvirt part of volume driver for NFS.""" + def __init__(self, *args, **kwargs): """Create back-end to nfs and check connection""" super(NfsVolumeDriver, self).__init__(*args, **kwargs) diff --git a/nova/virt/xenapi/driver.py b/nova/virt/xenapi/driver.py index d3047d364..a03e5eab1 100644 --- a/nova/virt/xenapi/driver.py +++ b/nova/virt/xenapi/driver.py @@ -189,7 +189,7 @@ class XenAPIDriver(driver.ComputeDriver): block_device_info) def snapshot(self, context, instance, image_id, update_task_state): - """ Create snapshot from a running VM instance """ + """Create snapshot from a running VM instance.""" self._vmops.snapshot(context, instance, image_id, update_task_state) def reboot(self, instance, network_info, reboot_type, @@ -515,24 +515,24 @@ class XenAPIDriver(driver.ComputeDriver): return self._vmops.unfilter_instance(instance_ref, network_info) def refresh_security_group_rules(self, security_group_id): - """ Updates security group rules for all instances - associated with a given security group - Invoked when security group rules are updated - """ + """Updates security group rules for all instances associated with a + given security group. + + Invoked when security group rules are updated.""" return self._vmops.refresh_security_group_rules(security_group_id) def refresh_security_group_members(self, security_group_id): - """ Updates security group rules for all instances - associated with a given security group - Invoked when instances are added/removed to a security group - """ + """Updates security group rules for all instances associated with a + given security group. + + Invoked when instances are added/removed to a security group.""" return self._vmops.refresh_security_group_members(security_group_id) def refresh_instance_security_rules(self, instance): - """ Updates security group rules for specified instance - Invoked when instances are added/removed to a security group - or when a rule is added/removed to a security group - """ + """Updates security group rules for specified instance. + + Invoked when instances are added/removed to a security group + or when a rule is added/removed to a security group.""" return self._vmops.refresh_instance_security_rules(instance) def refresh_provider_fw_rules(self): diff --git a/nova/virt/xenapi/firewall.py b/nova/virt/xenapi/firewall.py index e30465741..9c6a60d18 100644 --- a/nova/virt/xenapi/firewall.py +++ b/nova/virt/xenapi/firewall.py @@ -27,12 +27,11 @@ LOG = logging.getLogger(__name__) class Dom0IptablesFirewallDriver(firewall.IptablesFirewallDriver): - """ Dom0IptablesFirewallDriver class + """Dom0IptablesFirewallDriver class This class provides an implementation for nova.virt.Firewall using iptables. This class is meant to be used with the xenapi - backend and uses xenapi plugin to enforce iptables rules in dom0 - + backend and uses xenapi plugin to enforce iptables rules in dom0. """ def _plugin_execute(self, *cmd, **kwargs): # Prepare arguments for plugin call diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index fbf3e0599..06e950f43 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -1509,15 +1509,15 @@ class VMOps(object): self._session.call_xenapi('VM.remove_from_xenstore_data', vm_ref, key) def refresh_security_group_rules(self, security_group_id): - """ recreates security group rules for every instance """ + """recreates security group rules for every instance """ self.firewall_driver.refresh_security_group_rules(security_group_id) def refresh_security_group_members(self, security_group_id): - """ recreates security group rules for every instance """ + """recreates security group rules for every instance """ self.firewall_driver.refresh_security_group_members(security_group_id) def refresh_instance_security_rules(self, instance): - """ recreates security group rules for specified instance """ + """recreates security group rules for specified instance """ self.firewall_driver.refresh_instance_security_rules(instance) def refresh_provider_fw_rules(self): @@ -1600,8 +1600,8 @@ class VMOps(object): def check_can_live_migrate_source(self, ctxt, instance_ref, dest_check_data): - """ Check if it is possible to execute live migration - on the source side. + """Check if it's possible to execute live migration on the source side. + :param context: security context :param instance_ref: nova.db.sqlalchemy.models.Instance object :param dest_check_data: data returned by the check on the |
