This patch use same expression as vif for vmx guest but has a distinguish "type=ioemu"

just like block device.
e.g. vif=['type=ioemu, mac=01:00:00:00:00:33, bridge=xenbr0']
type=ioemu to specify for vmx NIC device.
nics=4 can specify 4 vmx NIC now.
bridge is passed to device model now.
With this patch, the error
"Error: Device 0 (vif) could not be connected."
will not happen for creating vmx guest
currently, it happens on some linux distribution.

Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com>
This commit is contained in:
Xiaofeng Ling committed 2005-11-10 17:07:13 +01:00
1 parent 67b5c8dbca
commit 05fbb602ad
6 files changed
+37 -10

No files matched your search

+11
View File
@@ -258,6 +258,7 @@ class VmxImageHandler(ImageHandler):
log.debug("args: %s, val: %s" % (a,v))
# Handle disk/network related options
mac = None
for (name, info) in deviceConfig:
if name == 'vbd':
uname = sxp.child_value(info, 'uname')
@@ -276,11 +277,21 @@ class VmxImageHandler(ImageHandler):
ret.append("-%s" % vbddev)
ret.append("%s" % vbdparam)
if name == 'vif':
type = sxp.child_value(info, 'type')
if type != 'ioemu':
continue
if mac != None:
continue
mac = sxp.child_value(info, 'mac')
bridge = sxp.child_value(info, 'bridge')
if mac == None:
mac = randomMAC()
if bridge == None:
bridge = 'xenbr0'
ret.append("-macaddr")
ret.append("%s" % mac)
ret.append("-bridge")
ret.append("%s" % bridge)
if name == 'vtpm':
instance = sxp.child_value(info, 'instance')
ret.append("-instance")
+3
View File
@@ -71,6 +71,9 @@ class NetifController(DevController):
script = os.path.join(xroot.network_script_dir,
sxp.child_value(config, 'script',
xroot.get_vif_script()))
type = sxp.child_value(config, 'type')
if type == 'ioemu':
return (None,{},{})
bridge = sxp.child_value(config, 'bridge')
mac = sxp.child_value(config, 'mac')
ipaddr = _get_config_ipaddr(config)
+8 -7
View File
@@ -255,10 +255,11 @@ gopts.var('ipaddr', val="IPADDR",
fn=append_value, default=[],
use="Add an IP address to the domain.")
gopts.var('vif', val="mac=MAC,be_mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM,vifname=NAME",
gopts.var('vif', val="type=TYPE,mac=MAC,be_mac=MAC,bridge=BRIDGE,script=SCRIPT,backend=DOM,vifname=NAME",
fn=append_value, default=[],
use="""Add a network interface with the given MAC address and bridge.
The vif is configured by calling the given configuration script.
If type is not specified, default is netfront not ioemu device.
If mac is not specified a random MAC address is used.
The MAC address of the backend interface can be selected with be_mac.
If not specified then the network backend chooses it's own MAC address.
@@ -356,10 +357,6 @@ gopts.var('cdrom', val='FILE',
fn=set_value, default='',
use="Path to cdrom")
gopts.var('macaddr', val='MACADDR',
fn=set_value, default='',
use="Macaddress of the first network interface")
gopts.var('boot', val="a|b|c|d",
fn=set_value, default='c',
use="Default boot device")
@@ -512,6 +509,7 @@ def configure_vifs(config_devs, vals):
backend = d.get('backend')
ip = d.get('ip')
vifname = d.get('vifname')
type = d.get('type')
else:
mac = None
be_mac = None
@@ -520,6 +518,7 @@ def configure_vifs(config_devs, vals):
backend = None
ip = None
vifname = None
type = None
config_vif = ['vif']
if mac:
config_vif.append(['mac', mac])
@@ -535,6 +534,8 @@ def configure_vifs(config_devs, vals):
config_vif.append(['backend', backend])
if ip:
config_vif.append(['ip', ip])
if type:
config_vif.append(['type', type])
config_devs.append(['device', config_vif])
def configure_vfr(config, vals):
@@ -549,7 +550,7 @@ def configure_vmx(config_image, vals):
"""Create the config for VMX devices.
"""
args = [ 'device_model', 'vcpus', 'cdrom', 'boot', 'fda', 'fdb',
'localtime', 'serial', 'macaddr', 'stdvga', 'isa', 'nographic',
'localtime', 'serial', 'stdvga', 'isa', 'nographic',
'vnc', 'vncviewer', 'sdl', 'display', 'ne2000', 'lapic']
for a in args:
if (vals.__dict__[a]):
@@ -662,7 +663,7 @@ def preprocess_vifs(vals):
(k, v) = b.strip().split('=', 1)
k = k.strip()
v = v.strip()
if k not in ['mac', 'be_mac', 'bridge', 'script', 'backend', 'ip', 'vifname']:
if k not in ['type', 'mac', 'be_mac', 'bridge', 'script', 'backend', 'ip', 'vifname']:
err('Invalid vif specifier: ' + vif)
d[k] = v
vifs.append(d)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.