Lint: E261 at least two spaces before inline comment
This commit is contained in:
parent
975b52ad8e
commit
7932be3948
|
@ -323,12 +323,12 @@ class NodeInstance(object):
|
||||||
self.logger.out('Acquiring write lock for synchronization phase A', state='i')
|
self.logger.out('Acquiring write lock for synchronization phase A', state='i')
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase A', state='o')
|
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')
|
self.logger.out('Releasing write lock for synchronization phase A', state='i')
|
||||||
zkhandler.writedata(self.zk_conn, {'/locks/primary_node': ''})
|
zkhandler.writedata(self.zk_conn, {'/locks/primary_node': ''})
|
||||||
lock.release()
|
lock.release()
|
||||||
self.logger.out('Released write lock for synchronization phase A', state='o')
|
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)
|
# Synchronize nodes B (I am reader)
|
||||||
lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node')
|
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')
|
self.logger.out('Acquiring write lock for synchronization phase C', state='i')
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase C', state='o')
|
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
|
# 1. Add Upstream floating IP
|
||||||
self.logger.out(
|
self.logger.out(
|
||||||
'Creating floating upstream IP {}/{} on interface {}'.format(
|
'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')
|
self.logger.out('Acquiring write lock for synchronization phase D', state='i')
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase D', state='o')
|
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
|
# 2. Add Cluster floating IP
|
||||||
self.logger.out(
|
self.logger.out(
|
||||||
'Creating floating management IP {}/{} on interface {}'.format(
|
'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')
|
self.logger.out('Acquiring write lock for synchronization phase E', state='i')
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase E', state='o')
|
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
|
# 3. Add Metadata link-local IP
|
||||||
self.logger.out(
|
self.logger.out(
|
||||||
'Creating Metadata link-local IP {}/{} on interface {}'.format(
|
'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')
|
self.logger.out('Acquiring write lock for synchronization phase F', state='i')
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase F', state='o')
|
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
|
# 4. Add gateway IPs
|
||||||
for network in self.d_network:
|
for network in self.d_network:
|
||||||
self.d_network[network].createGateways()
|
self.d_network[network].createGateways()
|
||||||
|
@ -421,7 +421,7 @@ class NodeInstance(object):
|
||||||
self.logger.out('Acquiring write lock for synchronization phase G', state='i')
|
self.logger.out('Acquiring write lock for synchronization phase G', state='i')
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase G', state='o')
|
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
|
# 5. Transition Patroni primary
|
||||||
self.logger.out('Setting Patroni leader to this node', state='i')
|
self.logger.out('Setting Patroni leader to this node', state='i')
|
||||||
tick = 1
|
tick = 1
|
||||||
|
@ -514,7 +514,7 @@ class NodeInstance(object):
|
||||||
self.logger.out('Acquiring write lock for synchronization phase B', state='i')
|
self.logger.out('Acquiring write lock for synchronization phase B', state='i')
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase B', state='o')
|
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
|
# 1. Stop DNS aggregator
|
||||||
self.dns_aggregator.stop_aggregator()
|
self.dns_aggregator.stop_aggregator()
|
||||||
# 2. Stop DHCP servers
|
# 2. Stop DHCP servers
|
||||||
|
@ -530,7 +530,7 @@ class NodeInstance(object):
|
||||||
common.run_os_command("systemctl stop pvcapid.service")
|
common.run_os_command("systemctl stop pvcapid.service")
|
||||||
# 4. Stop metadata API
|
# 4. Stop metadata API
|
||||||
self.metadata_api.stop()
|
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)
|
# Synchronize nodes C (I am reader)
|
||||||
lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node')
|
lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node')
|
||||||
|
|
|
@ -421,7 +421,7 @@ class VMInstance(object):
|
||||||
self.logger.out('Acquiring write lock for synchronization phase B', state='i', prefix='Domain {}'.format(self.domuuid))
|
self.logger.out('Acquiring write lock for synchronization phase B', state='i', prefix='Domain {}'.format(self.domuuid))
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase B', state='o', prefix='Domain {}'.format(self.domuuid))
|
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():
|
def migrate_live():
|
||||||
self.logger.out('Setting up live migration', state='i', prefix='Domain {}'.format(self.domuuid))
|
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))
|
self.logger.out('Acquiring write lock for synchronization phase C', state='i', prefix='Domain {}'.format(self.domuuid))
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase C', state='o', prefix='Domain {}'.format(self.domuuid))
|
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:
|
if do_migrate_shutdown:
|
||||||
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))
|
self.logger.out('Acquiring write lock for synchronization phase A', state='i', prefix='Domain {}'.format(self.domuuid))
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase A', state='o', prefix='Domain {}'.format(self.domuuid))
|
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))
|
self.logger.out('Releasing write lock for synchronization phase A', state='i', prefix='Domain {}'.format(self.domuuid))
|
||||||
lock.release()
|
lock.release()
|
||||||
self.logger.out('Released write lock for synchronization phase A', state='o', prefix='Domain {}'.format(self.domuuid))
|
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)
|
# Synchronize nodes B (I am reader)
|
||||||
lock = zkhandler.readlock(self.zk_conn, '/locks/domain_migrate/{}'.format(self.domuuid))
|
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))
|
self.logger.out('Acquiring write lock for synchronization phase D', state='i', prefix='Domain {}'.format(self.domuuid))
|
||||||
lock.acquire()
|
lock.acquire()
|
||||||
self.logger.out('Acquired write lock for synchronization phase D', state='o', prefix='Domain {}'.format(self.domuuid))
|
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.state = zkhandler.readdata(self.zk_conn, '/domains/{}/state'.format(self.domuuid))
|
||||||
self.dom = self.lookupByUUID(self.domuuid)
|
self.dom = self.lookupByUUID(self.domuuid)
|
||||||
|
|
Loading…
Reference in New Issue