diff --git a/api-daemon/pvcapid.py b/api-daemon/pvcapid.py index 8d0c1d3b..423ace3f 100755 --- a/api-daemon/pvcapid.py +++ b/api-daemon/pvcapid.py @@ -20,4 +20,4 @@ # ############################################################################### -import pvcapid.Daemon # noqa: F401 +import pvcapid.Daemon # noqa: F401 diff --git a/api-daemon/pvcapid/flaskapi.py b/api-daemon/pvcapid/flaskapi.py index 0cc1a3bb..a2c0ccd8 100755 --- a/api-daemon/pvcapid/flaskapi.py +++ b/api-daemon/pvcapid/flaskapi.py @@ -6135,13 +6135,13 @@ class API_Provisioner_Profile_Element(Resource): """ return api_provisioner.modify_profile( profile, - None, # Can't modify the profile type + None, # Can't modify the profile type reqargs.get('system_template', None), reqargs.get('network_template', None), reqargs.get('storage_template', None), reqargs.get('userdata', None), reqargs.get('script', None), - None, # Can't modify the OVA + None, # Can't modify the OVA reqargs.get('arg', []), ) diff --git a/api-daemon/pvcapid/provisioner.py b/api-daemon/pvcapid/provisioner.py index 72d9c57c..1d7cdb2a 100755 --- a/api-daemon/pvcapid/provisioner.py +++ b/api-daemon/pvcapid/provisioner.py @@ -1076,7 +1076,7 @@ def create_vm(self, vm_name, vm_profile, define_vm=True, start_vm=True, script_r if profile_data.get('profile_type') == 'ova': is_ova_install = True - is_script_install = False # By definition + is_script_install = False # By definition else: is_ova_install = False diff --git a/client-cli/pvc.py b/client-cli/pvc.py index 7491ebe9..1067821a 100755 --- a/client-cli/pvc.py +++ b/client-cli/pvc.py @@ -47,7 +47,7 @@ myhostname = socket.gethostname().split('.')[0] zk_host = '' default_store_data = { - 'cfgfile': '/etc/pvc/pvcapid.yaml' # pvc/api/listen_address, pvc/api/listen_port + 'cfgfile': '/etc/pvc/pvcapid.yaml' # pvc/api/listen_address, pvc/api/listen_port } # @@ -1442,7 +1442,7 @@ def net_acl(): @click.option( '--in/--out', 'direction', is_flag=True, - default=True, # inbound + default=True, # inbound help='Inbound or outbound ruleset.' ) @click.option( @@ -2306,7 +2306,7 @@ def provisioner_template_system_list(limit): @click.option( '--node-selector', 'node_selector', type=click.Choice(['mem', 'vcpus', 'vms', 'load'], case_sensitive=False), - default=None, # Use cluster default + default=None, # Use cluster default help='Use this selector to determine the optimal node during migrations.' ) @click.option( @@ -2317,7 +2317,7 @@ def provisioner_template_system_list(limit): @click.option( '--migration-method', 'migration_method', type=click.Choice(['none', 'live', 'shutdown'], case_sensitive=False), - default=None, # Use cluster default + default=None, # Use cluster default help='The preferred migration method of the VM between nodes' ) @cluster_req @@ -2393,7 +2393,7 @@ def provisioner_template_system_add(name, vcpus, vram, serial, vnc, vnc_bind, no @click.option( '--migration-method', 'migration_method', type=click.Choice(['none', 'live', 'shutdown'], case_sensitive=False), - default=None, # Use cluster default + default=None, # Use cluster default help='The preferred migration method of the VM between nodes' ) @cluster_req diff --git a/node-daemon/pvcnoded.py b/node-daemon/pvcnoded.py index 0bcb7c6c..dd6c79aa 100755 --- a/node-daemon/pvcnoded.py +++ b/node-daemon/pvcnoded.py @@ -20,4 +20,4 @@ # ############################################################################### -import pvcnoded.Daemon # noqa: F401 +import pvcnoded.Daemon # noqa: F401 diff --git a/node-daemon/pvcnoded/CephInstance.py b/node-daemon/pvcnoded/CephInstance.py index e82817e5..7e0845d4 100644 --- a/node-daemon/pvcnoded/CephInstance.py +++ b/node-daemon/pvcnoded/CephInstance.py @@ -247,7 +247,7 @@ def remove_osd(zk_conn, logger, osd_id, osd_obj): # 4. Determine the block devices retcode, stdout, stderr = common.run_os_command('readlink /var/lib/ceph/osd/ceph-{}/block'.format(osd_id)) - vg_name = stdout.split('/')[-2] # e.g. /dev/ceph-/osd-block- + vg_name = stdout.split('/')[-2] # e.g. /dev/ceph-/osd-block- retcode, stdout, stderr = common.run_os_command('vgs --separator , --noheadings -o pv_name {}'.format(vg_name)) pv_block = stdout.strip() diff --git a/node-daemon/pvcnoded/DNSAggregatorInstance.py b/node-daemon/pvcnoded/DNSAggregatorInstance.py index 37f6a7eb..1ae3e77a 100644 --- a/node-daemon/pvcnoded/DNSAggregatorInstance.py +++ b/node-daemon/pvcnoded/DNSAggregatorInstance.py @@ -84,30 +84,30 @@ class PowerDNSInstance(object): ) # Define the PowerDNS config dns_configuration = [ - # Option # Explanation + # Option # Explanation '--no-config', - '--daemon=no', # Start directly - '--guardian=yes', # Use a guardian - '--disable-syslog=yes', # Log only to stdout (which is then captured) - '--disable-axfr=no', # Allow AXFRs - '--allow-axfr-ips=0.0.0.0/0', # Allow AXFRs to anywhere + '--daemon=no', # Start directly + '--guardian=yes', # Use a guardian + '--disable-syslog=yes', # Log only to stdout (which is then captured) + '--disable-axfr=no', # Allow AXFRs + '--allow-axfr-ips=0.0.0.0/0', # Allow AXFRs to anywhere '--local-address={},{}'.format(self.vni_ipaddr, self.upstream_ipaddr), # Listen on floating IPs - '--local-port=53', # On port 53 - '--log-dns-details=on', # Log details - '--loglevel=3', # Log info - '--master=yes', # Enable master mode - '--slave=yes', # Enable slave mode - '--slave-renotify=yes', # Renotify out for our slaved zones - '--version-string=powerdns', # Set the version string - '--default-soa-name=dns.pvc.local', # Override dnsmasq's invalid name + '--local-port=53', # On port 53 + '--log-dns-details=on', # Log details + '--loglevel=3', # Log info + '--master=yes', # Enable master mode + '--slave=yes', # Enable slave mode + '--slave-renotify=yes', # Renotify out for our slaved zones + '--version-string=powerdns', # Set the version string + '--default-soa-name=dns.pvc.local', # Override dnsmasq's invalid name '--socket-dir={}'.format(self.config['pdns_dynamic_directory']), # Standard socket directory - '--launch=gpgsql', # Use the PostgreSQL backend + '--launch=gpgsql', # Use the PostgreSQL backend '--gpgsql-host={}'.format(self.config['pdns_postgresql_host']), # PostgreSQL instance '--gpgsql-port={}'.format(self.config['pdns_postgresql_port']), # Default port '--gpgsql-dbname={}'.format(self.config['pdns_postgresql_dbname']), # Database name '--gpgsql-user={}'.format(self.config['pdns_postgresql_user']), # User name '--gpgsql-password={}'.format(self.config['pdns_postgresql_password']), # User password - '--gpgsql-dnssec=no', # Do DNSSEC elsewhere + '--gpgsql-dnssec=no', # Do DNSSEC elsewhere ] # Start the pdns process in a thread self.dns_server_daemon = common.run_os_daemon( @@ -430,7 +430,7 @@ class AXFRDaemonInstance(object): self.logger.out('Old but not new: {}'.format(in_old_not_in_new), state='d', prefix='dns-aggregator') # Go through the old list - remove_records = list() # list of database IDs + remove_records = list() # list of database IDs for i in range(len(records_old)): record_id = records_old_ids[i] record = records_old[i] diff --git a/node-daemon/pvcnoded/Daemon.py b/node-daemon/pvcnoded/Daemon.py index 674902b6..60dd7b3c 100644 --- a/node-daemon/pvcnoded/Daemon.py +++ b/node-daemon/pvcnoded/Daemon.py @@ -772,13 +772,13 @@ d_network = dict() d_domain = dict() d_osd = dict() d_pool = dict() -d_volume = dict() # Dict of Dicts +d_volume = dict() # Dict of Dicts node_list = [] network_list = [] domain_list = [] osd_list = [] pool_list = [] -volume_list = dict() # Dict of Lists +volume_list = dict() # Dict of Lists if enable_networking: # Create an instance of the DNS Aggregator and Metadata API if we're a coordinator diff --git a/node-daemon/pvcnoded/NodeInstance.py b/node-daemon/pvcnoded/NodeInstance.py index d22c86a5..eb325229 100644 --- a/node-daemon/pvcnoded/NodeInstance.py +++ b/node-daemon/pvcnoded/NodeInstance.py @@ -323,12 +323,12 @@ class NodeInstance(object): self.logger.out('Acquiring write lock for synchronization phase A', state='i') lock.acquire() self.logger.out('Acquired write lock for synchronization phase A', state='o') - time.sleep(1) # Time for reader to acquire the lock + time.sleep(1) # Time fir reader to acquire the lock self.logger.out('Releasing write lock for synchronization phase A', state='i') zkhandler.writedata(self.zk_conn, {'/locks/primary_node': ''}) lock.release() self.logger.out('Released write lock for synchronization phase A', state='o') - time.sleep(0.1) # Time for new writer to acquire the lock + time.sleep(0.1) # Time fir new writer to acquire the lock # Synchronize nodes B (I am reader) lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node') @@ -344,7 +344,7 @@ class NodeInstance(object): self.logger.out('Acquiring write lock for synchronization phase C', state='i') lock.acquire() self.logger.out('Acquired write lock for synchronization phase C', state='o') - time.sleep(0.5) # Time for reader to acquire the lock + time.sleep(0.5) # Time fir reader to acquire the lock # 1. Add Upstream floating IP self.logger.out( 'Creating floating upstream IP {}/{} on interface {}'.format( @@ -365,7 +365,7 @@ class NodeInstance(object): self.logger.out('Acquiring write lock for synchronization phase D', state='i') lock.acquire() self.logger.out('Acquired write lock for synchronization phase D', state='o') - time.sleep(0.2) # Time for reader to acquire the lock + time.sleep(0.2) # Time fir reader to acquire the lock # 2. Add Cluster floating IP self.logger.out( 'Creating floating management IP {}/{} on interface {}'.format( @@ -386,7 +386,7 @@ class NodeInstance(object): self.logger.out('Acquiring write lock for synchronization phase E', state='i') lock.acquire() self.logger.out('Acquired write lock for synchronization phase E', state='o') - time.sleep(0.2) # Time for reader to acquire the lock + time.sleep(0.2) # Time fir reader to acquire the lock # 3. Add Metadata link-local IP self.logger.out( 'Creating Metadata link-local IP {}/{} on interface {}'.format( @@ -407,7 +407,7 @@ class NodeInstance(object): self.logger.out('Acquiring write lock for synchronization phase F', state='i') lock.acquire() self.logger.out('Acquired write lock for synchronization phase F', state='o') - time.sleep(0.2) # Time for reader to acquire the lock + time.sleep(0.2) # Time fir reader to acquire the lock # 4. Add gateway IPs for network in self.d_network: self.d_network[network].createGateways() @@ -421,7 +421,7 @@ class NodeInstance(object): self.logger.out('Acquiring write lock for synchronization phase G', state='i') lock.acquire() self.logger.out('Acquired write lock for synchronization phase G', state='o') - time.sleep(0.2) # Time for reader to acquire the lock + time.sleep(0.2) # Time fir reader to acquire the lock # 5. Transition Patroni primary self.logger.out('Setting Patroni leader to this node', state='i') tick = 1 @@ -498,7 +498,7 @@ class NodeInstance(object): """ Relinquish primary coordinator status to a peer node """ - time.sleep(0.2) # Initial delay for the first writer to grab the lock + time.sleep(0.2) # Initial delay for the first writer to grab the lock # Synchronize nodes A (I am reader) lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node') @@ -514,7 +514,7 @@ class NodeInstance(object): self.logger.out('Acquiring write lock for synchronization phase B', state='i') lock.acquire() self.logger.out('Acquired write lock for synchronization phase B', state='o') - time.sleep(0.2) # Time for reader to acquire the lock + time.sleep(0.2) # Time fir reader to acquire the lock # 1. Stop DNS aggregator self.dns_aggregator.stop_aggregator() # 2. Stop DHCP servers @@ -530,7 +530,7 @@ class NodeInstance(object): common.run_os_command("systemctl stop pvcapid.service") # 4. Stop metadata API self.metadata_api.stop() - time.sleep(0.1) # Time for new writer to acquire the lock + time.sleep(0.1) # Time fir new writer to acquire the lock # Synchronize nodes C (I am reader) lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node') @@ -605,7 +605,7 @@ class NodeInstance(object): lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node') self.logger.out('Acquiring read lock for synchronization phase G', state='i') try: - lock.acquire(timeout=60) # Don't wait forever and completely block us + lock.acquire(timeout=60) # Don't wait forever and completely block us self.logger.out('Acquired read lock for synchronization phase G', state='o') except Exception: pass diff --git a/node-daemon/pvcnoded/VMInstance.py b/node-daemon/pvcnoded/VMInstance.py index 07412441..b7c732c9 100644 --- a/node-daemon/pvcnoded/VMInstance.py +++ b/node-daemon/pvcnoded/VMInstance.py @@ -386,7 +386,7 @@ class VMInstance(object): migrate_lock_node.acquire() migrate_lock_state.acquire() - time.sleep(0.2) # Initial delay for the first writer to grab the lock + time.sleep(0.2) # Initial delay for the first writer to grab the lock # Don't try to migrate a node to itself, set back to start if self.node == self.lastnode or self.node == self.this_node.name: @@ -421,7 +421,7 @@ class VMInstance(object): self.logger.out('Acquiring write lock for synchronization phase B', state='i', prefix='Domain {}'.format(self.domuuid)) lock.acquire() self.logger.out('Acquired write lock for synchronization phase B', state='o', prefix='Domain {}'.format(self.domuuid)) - time.sleep(0.5) # Time for reader to acquire the lock + time.sleep(0.5) # Time fir reader to acquire the lock def migrate_live(): self.logger.out('Setting up live migration', state='i', prefix='Domain {}'.format(self.domuuid)) @@ -509,7 +509,7 @@ class VMInstance(object): self.logger.out('Acquiring write lock for synchronization phase C', state='i', prefix='Domain {}'.format(self.domuuid)) lock.acquire() self.logger.out('Acquired write lock for synchronization phase C', state='o', prefix='Domain {}'.format(self.domuuid)) - time.sleep(0.5) # Time for reader to acquire the lock + time.sleep(0.5) # Time fir reader to acquire the lock if do_migrate_shutdown: migrate_shutdown() @@ -558,11 +558,11 @@ class VMInstance(object): self.logger.out('Acquiring write lock for synchronization phase A', state='i', prefix='Domain {}'.format(self.domuuid)) lock.acquire() self.logger.out('Acquired write lock for synchronization phase A', state='o', prefix='Domain {}'.format(self.domuuid)) - time.sleep(0.5) # Time for reader to acquire the lock + time.sleep(0.5) # Time fir reader to acquire the lock self.logger.out('Releasing write lock for synchronization phase A', state='i', prefix='Domain {}'.format(self.domuuid)) lock.release() self.logger.out('Released write lock for synchronization phase A', state='o', prefix='Domain {}'.format(self.domuuid)) - time.sleep(0.1) # Time for new writer to acquire the lock + time.sleep(0.1) # Time fir new writer to acquire the lock # Synchronize nodes B (I am reader) lock = zkhandler.readlock(self.zk_conn, '/locks/domain_migrate/{}'.format(self.domuuid)) @@ -592,7 +592,7 @@ class VMInstance(object): self.logger.out('Acquiring write lock for synchronization phase D', state='i', prefix='Domain {}'.format(self.domuuid)) lock.acquire() self.logger.out('Acquired write lock for synchronization phase D', state='o', prefix='Domain {}'.format(self.domuuid)) - time.sleep(0.5) # Time for reader to acquire the lock + time.sleep(0.5) # Time fir reader to acquire the lock self.state = zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(self.domuuid)) self.dom = self.lookupByUUID(self.domuuid)