mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Assign names to qemu NICs and network backends
We need these so that we can remove the devices via the monitor. * src/domain_conf.h: add nic_name and hostnet_name to virDomainNetDef * src/domain_conf.c: free nic_name and hostnet_name * src/qemu_conf.c: add qemuAssignNetNames(), use it if qemu has support for the param and pass the names on the command line * tests/qemuxml2argv*: add a test for this
This commit is contained in:
1
tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.args
Normal file
1
tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.args
Normal file
@@ -0,0 +1 @@
|
||||
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net nic,macaddr=00:11:22:33:44:55,vlan=0,name=nic.0 -net tap,script=/etc/qemu-ifup,vlan=0,name=tap.0 -net nic,macaddr=00:11:22:33:44:56,vlan=1,model=e1000,name=e1000.0 -net tap,script=/etc/qemu-ifup,vlan=1,name=tap.1 -serial none -parallel none -usb
|
||||
31
tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.xml
Normal file
31
tests/qemuxml2argvdata/qemuxml2argv-net-eth-names.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<domain type='qemu'>
|
||||
<name>QEMUGuest1</name>
|
||||
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
||||
<memory>219200</memory>
|
||||
<currentMemory>219200</currentMemory>
|
||||
<vcpu>1</vcpu>
|
||||
<os>
|
||||
<type arch='i686' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>destroy</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/bin/qemu</emulator>
|
||||
<disk type='block' device='disk'>
|
||||
<source dev='/dev/HostVG/QEMUGuest1'/>
|
||||
<target dev='hda' bus='ide'/>
|
||||
</disk>
|
||||
<interface type='ethernet'>
|
||||
<mac address='00:11:22:33:44:55'/>
|
||||
<script path='/etc/qemu-ifup'/>
|
||||
</interface>
|
||||
<interface type='ethernet'>
|
||||
<mac address='00:11:22:33:44:56'/>
|
||||
<script path='/etc/qemu-ifup'/>
|
||||
<model type='e1000'/>
|
||||
</interface>
|
||||
</devices>
|
||||
</domain>
|
||||
@@ -245,6 +245,7 @@ mymain(int argc, char **argv)
|
||||
DO_TEST("net-virtio", 0);
|
||||
DO_TEST("net-eth", 0);
|
||||
DO_TEST("net-eth-ifname", 0);
|
||||
DO_TEST("net-eth-names", QEMUD_CMD_FLAG_NET_NAME);
|
||||
|
||||
DO_TEST("serial-vc", 0);
|
||||
DO_TEST("serial-pty", 0);
|
||||
|
||||
Reference in New Issue
Block a user