allow 2 dns servers to be specified on network create

This commit is contained in:
Jason Koelker
2011-07-21 12:45:53 -05:00
parent c29885a454
commit fbcfc8967a
2 changed files with 14 additions and 3 deletions

View File

@@ -566,12 +566,14 @@ class NetworkCommands(object):
def create(self, label=None, fixed_range=None, num_networks=None,
network_size=None, multi_host=None, vlan_start=None,
vpn_start=None, fixed_range_v6=None, gateway_v6=None,
flat_network_bridge=None, bridge_interface=None):
flat_network_bridge=None, bridge_interface=None,
dns=None, dns2=None):
"""Creates fixed ips for host by range
arguments: label, fixed_range, [num_networks=FLAG],
[network_size=FLAG], [multi_host=FLAG], [vlan_start=FLAG],
[vpn_start=FLAG], [fixed_range_v6=FLAG], [gateway_v6=FLAG],
[flat_network_bridge=FLAG], [bridge_interface=FLAG]
[dns=FLAG], [dns2]
If you wish to use a later argument fill in the gaps with ""s
Ex: network create private 10.0.0.0/8 1 16 T "" "" "" "" xenbr1 eth1
network create private 10.0.0.0/8 1 16
@@ -605,6 +607,8 @@ class NetworkCommands(object):
bridge_interface = FLAGS.flat_interface or FLAGS.vlan_interface
if not gateway_v6:
gateway_v6 = FLAGS.gateway_v6
if not dns:
dns = FLAGS.flat_network_dns
net_manager = utils.import_object(FLAGS.network_manager)
try:
@@ -619,17 +623,21 @@ class NetworkCommands(object):
cidr_v6=fixed_range_v6,
gateway_v6=gateway_v6,
bridge=flat_network_bridge,
bridge_interface=bridge_interface)
bridge_interface=bridge_interface,
dns=dns,
dns2=dns2)
except ValueError, e:
print e
raise e
def list(self):
"""List all created networks"""
print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % (_('network'),
print "%-18s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s\t%-15s" % (
_('network'),
_('netmask'),
_('start address'),
_('DNS'),
_('DNS2'),
_('VlanID'),
'project')
for network in db.network_get_all(context.get_admin_context()):
@@ -637,6 +645,7 @@ class NetworkCommands(object):
network.netmask,
network.dhcp_start,
network.dns,
network.dns2,
network.vlan,
network.project_id)

View File

@@ -56,6 +56,7 @@ networks = [{'id': 0,
'gateway': '192.168.0.1',
'broadcast': '192.168.0.255',
'dns': '192.168.0.1',
'dns2': '192.168.0.2',
'vlan': None,
'host': None,
'project_id': 'fake_project',
@@ -74,6 +75,7 @@ networks = [{'id': 0,
'gateway': '192.168.1.1',
'broadcast': '192.168.1.255',
'dns': '192.168.0.1',
'dns2': '192.168.0.2',
'vlan': None,
'host': None,
'project_id': 'fake_project',