Lint: E261 at least two spaces before inline comment
This commit is contained in:
parent
975b52ad8e
commit
7932be3948
|
@ -20,4 +20,4 @@
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import pvcapid.Daemon # noqa: F401
|
import pvcapid.Daemon # noqa: F401
|
||||||
|
|
|
@ -6135,13 +6135,13 @@ class API_Provisioner_Profile_Element(Resource):
|
||||||
"""
|
"""
|
||||||
return api_provisioner.modify_profile(
|
return api_provisioner.modify_profile(
|
||||||
profile,
|
profile,
|
||||||
None, # Can't modify the profile type
|
None, # Can't modify the profile type
|
||||||
reqargs.get('system_template', None),
|
reqargs.get('system_template', None),
|
||||||
reqargs.get('network_template', None),
|
reqargs.get('network_template', None),
|
||||||
reqargs.get('storage_template', None),
|
reqargs.get('storage_template', None),
|
||||||
reqargs.get('userdata', None),
|
reqargs.get('userdata', None),
|
||||||
reqargs.get('script', None),
|
reqargs.get('script', None),
|
||||||
None, # Can't modify the OVA
|
None, # Can't modify the OVA
|
||||||
reqargs.get('arg', []),
|
reqargs.get('arg', []),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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':
|
if profile_data.get('profile_type') == 'ova':
|
||||||
is_ova_install = True
|
is_ova_install = True
|
||||||
is_script_install = False # By definition
|
is_script_install = False # By definition
|
||||||
else:
|
else:
|
||||||
is_ova_install = False
|
is_ova_install = False
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ myhostname = socket.gethostname().split('.')[0]
|
||||||
zk_host = ''
|
zk_host = ''
|
||||||
|
|
||||||
default_store_data = {
|
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(
|
@click.option(
|
||||||
'--in/--out', 'direction',
|
'--in/--out', 'direction',
|
||||||
is_flag=True,
|
is_flag=True,
|
||||||
default=True, # inbound
|
default=True, # inbound
|
||||||
help='Inbound or outbound ruleset.'
|
help='Inbound or outbound ruleset.'
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
|
@ -2306,7 +2306,7 @@ def provisioner_template_system_list(limit):
|
||||||
@click.option(
|
@click.option(
|
||||||
'--node-selector', 'node_selector',
|
'--node-selector', 'node_selector',
|
||||||
type=click.Choice(['mem', 'vcpus', 'vms', 'load'], case_sensitive=False),
|
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.'
|
help='Use this selector to determine the optimal node during migrations.'
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
|
@ -2317,7 +2317,7 @@ def provisioner_template_system_list(limit):
|
||||||
@click.option(
|
@click.option(
|
||||||
'--migration-method', 'migration_method',
|
'--migration-method', 'migration_method',
|
||||||
type=click.Choice(['none', 'live', 'shutdown'], case_sensitive=False),
|
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'
|
help='The preferred migration method of the VM between nodes'
|
||||||
)
|
)
|
||||||
@cluster_req
|
@cluster_req
|
||||||
|
@ -2393,7 +2393,7 @@ def provisioner_template_system_add(name, vcpus, vram, serial, vnc, vnc_bind, no
|
||||||
@click.option(
|
@click.option(
|
||||||
'--migration-method', 'migration_method',
|
'--migration-method', 'migration_method',
|
||||||
type=click.Choice(['none', 'live', 'shutdown'], case_sensitive=False),
|
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'
|
help='The preferred migration method of the VM between nodes'
|
||||||
)
|
)
|
||||||
@cluster_req
|
@cluster_req
|
||||||
|
|
|
@ -20,4 +20,4 @@
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import pvcnoded.Daemon # noqa: F401
|
import pvcnoded.Daemon # noqa: F401
|
||||||
|
|
|
@ -247,7 +247,7 @@ def remove_osd(zk_conn, logger, osd_id, osd_obj):
|
||||||
|
|
||||||
# 4. Determine the block devices
|
# 4. Determine the block devices
|
||||||
retcode, stdout, stderr = common.run_os_command('readlink /var/lib/ceph/osd/ceph-{}/block'.format(osd_id))
|
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-<uuid>/osd-block-<uuid>
|
vg_name = stdout.split('/')[-2] # e.g. /dev/ceph-<uuid>/osd-block-<uuid>
|
||||||
retcode, stdout, stderr = common.run_os_command('vgs --separator , --noheadings -o pv_name {}'.format(vg_name))
|
retcode, stdout, stderr = common.run_os_command('vgs --separator , --noheadings -o pv_name {}'.format(vg_name))
|
||||||
pv_block = stdout.strip()
|
pv_block = stdout.strip()
|
||||||
|
|
||||||
|
|
|
@ -84,30 +84,30 @@ class PowerDNSInstance(object):
|
||||||
)
|
)
|
||||||
# Define the PowerDNS config
|
# Define the PowerDNS config
|
||||||
dns_configuration = [
|
dns_configuration = [
|
||||||
# Option # Explanation
|
# Option # Explanation
|
||||||
'--no-config',
|
'--no-config',
|
||||||
'--daemon=no', # Start directly
|
'--daemon=no', # Start directly
|
||||||
'--guardian=yes', # Use a guardian
|
'--guardian=yes', # Use a guardian
|
||||||
'--disable-syslog=yes', # Log only to stdout (which is then captured)
|
'--disable-syslog=yes', # Log only to stdout (which is then captured)
|
||||||
'--disable-axfr=no', # Allow AXFRs
|
'--disable-axfr=no', # Allow AXFRs
|
||||||
'--allow-axfr-ips=0.0.0.0/0', # Allow AXFRs to anywhere
|
'--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-address={},{}'.format(self.vni_ipaddr, self.upstream_ipaddr), # Listen on floating IPs
|
||||||
'--local-port=53', # On port 53
|
'--local-port=53', # On port 53
|
||||||
'--log-dns-details=on', # Log details
|
'--log-dns-details=on', # Log details
|
||||||
'--loglevel=3', # Log info
|
'--loglevel=3', # Log info
|
||||||
'--master=yes', # Enable master mode
|
'--master=yes', # Enable master mode
|
||||||
'--slave=yes', # Enable slave mode
|
'--slave=yes', # Enable slave mode
|
||||||
'--slave-renotify=yes', # Renotify out for our slaved zones
|
'--slave-renotify=yes', # Renotify out for our slaved zones
|
||||||
'--version-string=powerdns', # Set the version string
|
'--version-string=powerdns', # Set the version string
|
||||||
'--default-soa-name=dns.pvc.local', # Override dnsmasq's invalid name
|
'--default-soa-name=dns.pvc.local', # Override dnsmasq's invalid name
|
||||||
'--socket-dir={}'.format(self.config['pdns_dynamic_directory']), # Standard socket directory
|
'--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-host={}'.format(self.config['pdns_postgresql_host']), # PostgreSQL instance
|
||||||
'--gpgsql-port={}'.format(self.config['pdns_postgresql_port']), # Default port
|
'--gpgsql-port={}'.format(self.config['pdns_postgresql_port']), # Default port
|
||||||
'--gpgsql-dbname={}'.format(self.config['pdns_postgresql_dbname']), # Database name
|
'--gpgsql-dbname={}'.format(self.config['pdns_postgresql_dbname']), # Database name
|
||||||
'--gpgsql-user={}'.format(self.config['pdns_postgresql_user']), # User name
|
'--gpgsql-user={}'.format(self.config['pdns_postgresql_user']), # User name
|
||||||
'--gpgsql-password={}'.format(self.config['pdns_postgresql_password']), # User password
|
'--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
|
# Start the pdns process in a thread
|
||||||
self.dns_server_daemon = common.run_os_daemon(
|
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')
|
self.logger.out('Old but not new: {}'.format(in_old_not_in_new), state='d', prefix='dns-aggregator')
|
||||||
|
|
||||||
# Go through the old list
|
# 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)):
|
for i in range(len(records_old)):
|
||||||
record_id = records_old_ids[i]
|
record_id = records_old_ids[i]
|
||||||
record = records_old[i]
|
record = records_old[i]
|
||||||
|
|
|
@ -772,13 +772,13 @@ d_network = dict()
|
||||||
d_domain = dict()
|
d_domain = dict()
|
||||||
d_osd = dict()
|
d_osd = dict()
|
||||||
d_pool = dict()
|
d_pool = dict()
|
||||||
d_volume = dict() # Dict of Dicts
|
d_volume = dict() # Dict of Dicts
|
||||||
node_list = []
|
node_list = []
|
||||||
network_list = []
|
network_list = []
|
||||||
domain_list = []
|
domain_list = []
|
||||||
osd_list = []
|
osd_list = []
|
||||||
pool_list = []
|
pool_list = []
|
||||||
volume_list = dict() # Dict of Lists
|
volume_list = dict() # Dict of Lists
|
||||||
|
|
||||||
if enable_networking:
|
if enable_networking:
|
||||||
# Create an instance of the DNS Aggregator and Metadata API if we're a coordinator
|
# Create an instance of the DNS Aggregator and Metadata API if we're a coordinator
|
||||||
|
|
|
@ -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
|
||||||
|
@ -498,7 +498,7 @@ class NodeInstance(object):
|
||||||
"""
|
"""
|
||||||
Relinquish primary coordinator status to a peer node
|
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)
|
# Synchronize nodes A (I am reader)
|
||||||
lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node')
|
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')
|
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')
|
||||||
|
@ -605,7 +605,7 @@ class NodeInstance(object):
|
||||||
lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node')
|
lock = zkhandler.readlock(self.zk_conn, '/locks/primary_node')
|
||||||
self.logger.out('Acquiring read lock for synchronization phase G', state='i')
|
self.logger.out('Acquiring read lock for synchronization phase G', state='i')
|
||||||
try:
|
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')
|
self.logger.out('Acquired read lock for synchronization phase G', state='o')
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -386,7 +386,7 @@ class VMInstance(object):
|
||||||
migrate_lock_node.acquire()
|
migrate_lock_node.acquire()
|
||||||
migrate_lock_state.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
|
# 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:
|
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))
|
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