mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
change the NIC configuration accordingly after remove "nics=n"
otherwise, nics=-1 will be passed to device model and cause device model exiting. Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
This commit is contained in:
1 parent
d4895766cb
commit
e697c7e8ef
3 files changed
+8
-5
No files matched your search
@@ -238,9 +238,7 @@ class VmxImageHandler(ImageHandler):
|
||||
# xm config file
|
||||
def parseDeviceModelArgs(self, imageConfig, deviceConfig):
|
||||
dmargs = [ 'cdrom', 'boot', 'fda', 'fdb', 'ne2000',
|
||||
'localtime', 'serial', 'stdvga', 'isa', 'vcpus',
|
||||
'nics'
|
||||
]
|
||||
'localtime', 'serial', 'stdvga', 'isa', 'vcpus']
|
||||
ret = []
|
||||
for a in dmargs:
|
||||
v = sxp.child_value(imageConfig, a)
|
||||
@@ -262,6 +260,7 @@ class VmxImageHandler(ImageHandler):
|
||||
# Handle disk/network related options
|
||||
mac = None
|
||||
ret = ret + ["-domain-name", "%s" % self.vm.info['name']]
|
||||
nics = 0
|
||||
for (name, info) in deviceConfig:
|
||||
if name == 'vbd':
|
||||
uname = sxp.child_value(info, 'uname')
|
||||
@@ -283,6 +282,7 @@ class VmxImageHandler(ImageHandler):
|
||||
type = sxp.child_value(info, 'type')
|
||||
if type != 'ioemu':
|
||||
continue
|
||||
nics += 1
|
||||
if mac != None:
|
||||
continue
|
||||
mac = sxp.child_value(info, 'mac')
|
||||
@@ -299,6 +299,8 @@ class VmxImageHandler(ImageHandler):
|
||||
instance = sxp.child_value(info, 'pref_instance')
|
||||
ret.append("-instance")
|
||||
ret.append("%s" % instance)
|
||||
ret.append("-nics")
|
||||
ret.append("%d" % nics)
|
||||
return ret
|
||||
|
||||
def configVNC(self, config):
|
||||
|
||||
@@ -545,8 +545,7 @@ def configure_vmx(config_image, vals):
|
||||
"""
|
||||
args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
|
||||
'localtime', 'serial', 'stdvga', 'isa', 'nographic',
|
||||
'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic',
|
||||
'nics']
|
||||
'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic']
|
||||
for a in args:
|
||||
if (vals.__dict__[a]):
|
||||
config_image.append([a, vals.__dict__[a]])
|
||||
|
||||