67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
+
|
continue
idx = line.find("address:")
if idx != -1:
url = line[idx+9:]
if url.startswith('*:'):
url = "localhost"+url[1:]
if url is None:
print >>sys.stderr, "ERROR parsing 'info spice' output:",output
return None
return "spice://" + url.rstrip('\r')
def list_bridges():
""" Return list of bridge network interfaces present in the system """
|
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
|
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
|
f["type"]=vmtype
sock = connect_vm(dirname + "/" + vmname)
if sock is None:
f.update({"state":"stopped","uri":"-","ip":"-"})
f.update(read_netinfo(dirname + "/" + vmname + "/start"))
else:
uri=spiceurl(sock)
if uri is None:
f.update({"state":"problem","uri":"None","ip":"-"})
f.update(read_netinfo(dirname + "/" + vmname + "/start"))
else:
f["uri"]=uri[uri.rindex(":")+1:]
f.update(get_netinfo(sock))
if "ip" not in f:
bridges.add(f["iface"])
sock.shutdown(socket.SHUT_RDWR)
sock.close()
f["state"] = "running"
f["uri"]=uri[uri.rindex(":")+1:]
f.update(get_netinfo(sock))
if "ip" not in f:
bridges.add(f["iface"])
sock.shutdown(socket.SHUT_RDWR)
sock.close()
f["state"] = "running"
vms.append(f)
arp_data={}
for bridge in bridges:
arp_data.update(parse_arp(bridge))
for f in sorted(vms,key=lambda x: x["name"]):
if "state" in f:
if "mac" in f and not "ip" in f:
|