11
2+
23def print_values (val , type ):
34 val_type = None
45 if type == 'ports' :
@@ -7,10 +8,12 @@ def print_values(val, type):
78 val_list = val ['networks' ]
89 if type == 'routers' :
910 val_list = val ['routers' ]
11+ if type == 'hypervisors' :
12+ val_list = val
1013 for p in val_list :
1114 for k , v in p .items ():
12- print "%s : %s" % (k , v )
13- print '\n '
15+ print ( "%s : %s" % (k , v ) )
16+ print ( '\n ' )
1417
1518
1619def print_values_server (val , server_id , type ):
@@ -27,5 +30,24 @@ def print_values_server(val, server_id, type):
2730 bool = True
2831 if bool :
2932 for k , v in p .items ():
30- print "%s : %s" % (k , v )
31- print '\n '
33+ print ("%s : %s" % (k , v ))
34+ print ('\n ' )
35+
36+
37+ def print_values_hypervisor (hyp_list ):
38+ hyp_dict_list = []
39+ for h in hyp_list :
40+ hyp = {}
41+ hyp ['id' ] = h .id
42+ hyp ['vcpus' ] = h .vcpus
43+ hyp ['local_gb' ] = h .local_gb
44+ hyp ['hypervisor_type' ] = h .hypervisor_type
45+ hyp ['hypervisor_version' ] = h .hypervisor_version
46+ hyp ['free_ram_mb' ] = h .free_ram_mb
47+ hyp ['free_disk_gb' ] = h .free_disk_gb
48+ hyp ['current_workload' ] = h .current_workload
49+ hyp ['running_vms' ] = h .running_vms
50+ hyp ['cpu_info' ] = h .cpu_info
51+ hyp ['disk_available_least' ] = h .disk_available_least
52+ hyp_dict_list .append (hyp )
53+ print (hyp_dict_list )
0 commit comments