[Libvirt-cim] [PATCH] [TEST] #2 Make sure network pool is created with a random IP
Kaitlin Rupert
kaitlin at linux.vnet.ibm.com
Fri Mar 13 19:02:58 UTC 2009
>> + n_list = net_list(server, virt)
>> + for _net_name in n_list:
>> + cmd = "virsh net-dumpxml %s | awk '/ip address/ {print}' | \
>> + cut -d ' ' -f 4 | sed 's/address=//'" % _net_name
>> + s, in_use_addr = utils.run_remote(server, cmd)
>> + in_use_addr = in_use_addr.strip("'")
>> + if in_use_addr == addr:
>> + logger.error("IP address is in use by a different
>> network")
>>
> break/ return None whichever suitable here once you find the IP is
> already in use.
>> +
>> + ip = self.add_sub_node(network, 'ip', address=addr,
>> netmask='255.255.255.0')
>> dhcp = self.add_sub_node(ip, 'dhcp')
>> - self.add_sub_node(dhcp, 'range', start=subnet+'2',
>> + range_addr = subnet+'%d' % (ip_base + 1)
>> + self.add_sub_node(dhcp, 'range', start=range_addr,
>> end=subnet+'254')
>>
> We should not continue here with assigning dhcp and other info if the IP
> that is generated is already in use?
Oops! Yes, good points.
--
Kaitlin Rupert
IBM Linux Technology Center
kaitlin at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list