Commit 8f74f18e authored by Morten Knutsen's avatar Morten Knutsen

Add support for getting IPv6 addresses

parent 69e2788e
......@@ -335,15 +335,25 @@ class VMMClient(Client):
self._do_request(url, method="PATCH", reqdata=etree.tostring(entry))
def get_vm_addresses(self, stampid, vmid):
addresses = []
return self.get_all_vm_addresses['v4']
def get_vm_addresses_v6(self, stampid, vmid):
return self.get_all_vm_addresses['v6']
def get_all_vm_addresses(self, stampid, vmid):
addresses = {'v4': [], 'v6': []}
try:
guest_infos = self.query_collection("GuestInfos", query={"StampId": stampid, "VMId": vmid})
for guest_info in guest_infos:
addresses += guest_info.properties["IPv4Addresses"].split(";")
addresses['v4'] += guest_info.properties["IPv4Addresses"].split(";")
addresses['v6'] += guest_info.properties["IPv6Addresses"].split(";")
except:
pass
addresses = [a for a in addresses if a]
addresses = [a for a in addresses if a != "127.0.0.1"]
addresses['v4'] = [a for a in addresses['v4'] if a]
addresses['v4'] = [a for a in addresses['v4'] if a != "127.0.0.1"]
addresses['v6'] = [a for a in addresses['v6'] if a]
addresses['v6'] = [a for a in addresses['v6'] if a != "::1"]
return addresses
def get_job(self, stampid, jobid):
......
......@@ -8,7 +8,7 @@ requires = [
]
setup(name='scvmm-client-py',
version='0.8',
version='0.9',
description='',
author='',
author_email='',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment