Move node_mem_allocated to inside try block

Addresses #17
This commit is contained in:
Joshua Boniface 2018-08-20 13:43:00 -04:00
parent 3b15f09ac7
commit 57b3c62fb0
1 changed files with 2 additions and 2 deletions

4
pvc.py
View File

@ -203,9 +203,9 @@ def getInformationFromNode(zk_conn, node_name, long_output):
try: try:
parsed_xml = getDomainXML(zk_conn, domain) parsed_xml = getDomainXML(zk_conn, domain)
duuid, dname, dmemory, dvcpu, dvcputopo = getDomainMainDetails(parsed_xml) duuid, dname, dmemory, dvcpu, dvcputopo = getDomainMainDetails(parsed_xml)
node_mem_allocated += int(dmemory)
except AttributeError: except AttributeError:
click.echo('Error: Domain {} does not exist.'.format(domain)) click.echo('Error: Domain {} does not exist.'.format(domain))
node_mem_allocated += int(dmemory)
if node_daemon_state == 'run': if node_daemon_state == 'run':
daemon_state_colour = ansiiprint.green() daemon_state_colour = ansiiprint.green()
@ -700,9 +700,9 @@ def node_list(limit):
try: try:
parsed_xml = getDomainXML(zk_conn, domain) parsed_xml = getDomainXML(zk_conn, domain)
duuid, dname, dmemory, dvcpu, dvcputopo = getDomainMainDetails(parsed_xml) duuid, dname, dmemory, dvcpu, dvcputopo = getDomainMainDetails(parsed_xml)
node_mem_allocated[node_name] += int(dmemory)
except AttributeError: except AttributeError:
click.echo('Error: Domain {} does not exist.'.format(domain)) click.echo('Error: Domain {} does not exist.'.format(domain))
node_mem_allocated[node_name] += int(dmemory)
# Determine optimal column widths # Determine optimal column widths
# Dynamic columns: node_name, hypervisor, migrated # Dynamic columns: node_name, hypervisor, migrated