Lint: E302 expected 2 blank lines, found X

This commit is contained in:
2020-11-07 14:45:24 -05:00
parent e9643651f7
commit 260b39ebf2
36 changed files with 694 additions and 19 deletions

View File

@ -36,6 +36,7 @@ import daemon_lib.zkhandler as zkhandler
# Supplemental functions
###############################################################################
#
# Run a local OS command via shell
#
@ -64,6 +65,7 @@ def run_os_command(command_string, background=False, environment=None, timeout=N
stderr = ''
return retcode, stdout, stderr
#
# Validate a UUID
#
@ -74,6 +76,7 @@ def validateUUID(dom_uuid):
except Exception:
return False
#
# Connect and disconnect from Zookeeper
#
@ -89,10 +92,13 @@ def startZKConnection(zk_host):
exit(1)
return zk_conn
def stopZKConnection(zk_conn):
zk_conn.stop()
zk_conn.close()
return 0
#
# Parse a Domain XML object
#
@ -106,6 +112,7 @@ def getDomainXML(zk_conn, dom_uuid):
parsed_xml = lxml.objectify.fromstring(xml)
return parsed_xml
#
# Get the main details for a VM object from XML
#
@ -131,6 +138,7 @@ def getDomainMainDetails(parsed_xml):
return duuid, dname, ddescription, dmemory, dvcpu, dvcputopo
#
# Get long-format details
#
@ -143,6 +151,7 @@ def getDomainExtraDetails(parsed_xml):
return dtype, darch, dmachine, dconsole, demulator
#
# Get CPU features
#
@ -156,6 +165,7 @@ def getDomainCPUFeatures(parsed_xml):
return dfeatures
#
# Get disk devices
#
@ -200,6 +210,7 @@ def getDomainDisks(parsed_xml, stats_data):
return ddisks
#
# Get a list of disk devices
#
@ -211,6 +222,7 @@ def getDomainDiskList(zk_conn, dom_uuid):
return disk_list
#
# Get domain information from XML
#
@ -308,6 +320,7 @@ def getInformationFromXML(zk_conn, uuid):
return domain_information
#
# Get network devices
#
@ -362,6 +375,7 @@ def getDomainNetworks(parsed_xml, stats_data):
return dnets
#
# Get controller devices
#
@ -379,6 +393,7 @@ def getDomainControllers(parsed_xml):
return dcontrollers
#
# Verify node is valid in cluster
#
@ -388,6 +403,7 @@ def verifyNode(zk_conn, node):
else:
return False
#
# Get the primary coordinator node
#
@ -412,6 +428,7 @@ def getPrimaryNode(zk_conn):
return primary_node
#
# Find a migration target
#
@ -443,6 +460,7 @@ def findTargetNode(zk_conn, dom_uuid):
# Nothing was found
return None
# Get the list of valid target nodes
def getNodes(zk_conn, node_limit, dom_uuid):
valid_node_list = []
@ -469,6 +487,7 @@ def getNodes(zk_conn, node_limit, dom_uuid):
return valid_node_list
# via free memory (relative to allocated memory)
def findTargetNodeMem(zk_conn, node_limit, dom_uuid):
most_provfree = 0
@ -488,6 +507,7 @@ def findTargetNodeMem(zk_conn, node_limit, dom_uuid):
return target_node
# via load average
def findTargetNodeLoad(zk_conn, node_limit, dom_uuid):
least_load = 9999.0
@ -503,6 +523,7 @@ def findTargetNodeLoad(zk_conn, node_limit, dom_uuid):
return target_node
# via total vCPUs
def findTargetNodeVCPUs(zk_conn, node_limit, dom_uuid):
least_vcpus = 9999
@ -518,6 +539,7 @@ def findTargetNodeVCPUs(zk_conn, node_limit, dom_uuid):
return target_node
# via total VMs
def findTargetNodeVMs(zk_conn, node_limit, dom_uuid):
least_vms = 9999
@ -533,6 +555,7 @@ def findTargetNodeVMs(zk_conn, node_limit, dom_uuid):
return target_node
# Connect to the primary host and run a command
def runRemoteCommand(node, command, become=False):
import paramiko