Commit 503b97a9 authored by Guido Trotter's avatar Guido Trotter
Browse files

Xen: NIC parameters


Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent bef9c750
......@@ -455,11 +455,13 @@ class XenPvmHypervisor(XenHypervisor):
vif_data = []
for nic in instance.nics:
nic_str = "mac=%s, bridge=%s" % (nic.mac, nic.bridge)
nic_str = "mac=%s" % (nic.mac)
ip = getattr(nic, "ip", None)
if ip is not None:
nic_str += ", ip=%s" % ip
vif_data.append("'%s'" % nic_str)
if nic.nicparams[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED:
nic_str += ", bridge=%s" % nic.nicparams[constants.NIC_LINK]
config.write("vif = [%s]\n" % ",".join(vif_data))
config.write("disk = [%s]\n" % ",".join(
......@@ -575,11 +577,13 @@ class XenHvmHypervisor(XenHypervisor):
else:
nic_type_str = ", model=%s, type=ioemu" % nic_type
for nic in instance.nics:
nic_str = "mac=%s, bridge=%s%s" % (nic.mac, nic.bridge, nic_type_str)
nic_str = "mac=%s%s" % (nic.mac, nic_type_str)
ip = getattr(nic, "ip", None)
if ip is not None:
nic_str += ", ip=%s" % ip
vif_data.append("'%s'" % nic_str)
if nic.nicparams[constants.NIC_MODE] == constants.NIC_MODE_BRIDGED:
nic_str += ", bridge=%s" % nic.nicparams[constants.NIC_LINK]
config.write("vif = [%s]\n" % ",".join(vif_data))
disk_data = cls._GetConfigFileDiskData(instance.disk_template,
......
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