[libvirt] virsh edit not saving interface target specification

Hello: I am trying to set a target dev specification for one of my guests so I stopped the guest and the did virst edit, added the target specification, and saved the file. If I go back into virsh edit, the target specification is not being saved. I am using libvirt 0.6.3-20.el5 installed by yum on CentOS 5.4. Here is the XML file after I edited it: <domain type='kvm'> <name>jamm12a</name> <uuid>6452dcff-c20f-908b-d1ee-7dcf1406a3e0</uuid> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='pc'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='file' device='disk'> <source file='/var/lib/libvirt/images/jamm12a.img'/> <target dev='hda' bus='ide'/> </disk> <disk type='file' device='cdrom'> <target dev='hdc' bus='ide'/> <readonly/> </disk> <interface type='bridge'> <mac address='54:52:00:4f:83:67'/> <source bridge='br0'/> <target dev='vnet1'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target port='0'/> </console> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/> </devices> </domain> When I save the file and do virsh edit again, the <target dev='vnet1'/> line is not saved. Is this a bug in libvirt? Thanks, Neil -- Neil Aggarwal, (281)846-8957, www.JAMMConsulting.com Will your e-commerce site go offline if you have a DB server failure, fiber cut, flood, fire, or other disaster? If so, ask about our geographically redundant database system.

As i said in the kvm list, did you do virsh define /path/to/xml before launching the vm again ? ----- Original Message ----- From: "Neil Aggarwal" <neil@JAMMConsulting.com> To: libvir-list@redhat.com Sent: Sunday, October 25, 2009 4:18:16 PM Subject: [libvirt] virsh edit not saving interface target specification Hello: I am trying to set a target dev specification for one of my guests so I stopped the guest and the did virst edit, added the target specification, and saved the file. If I go back into virsh edit, the target specification is not being saved. I am using libvirt 0.6.3-20.el5 installed by yum on CentOS 5.4. Here is the XML file after I edited it: <domain type='kvm'> <name>jamm12a</name> <uuid>6452dcff-c20f-908b-d1ee-7dcf1406a3e0</uuid> <memory>1048576</memory> <currentMemory>1048576</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='pc'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='file' device='disk'> <source file='/var/lib/libvirt/images/jamm12a.img'/> <target dev='hda' bus='ide'/> </disk> <disk type='file' device='cdrom'> <target dev='hdc' bus='ide'/> <readonly/> </disk> <interface type='bridge'> <mac address='54:52:00:4f:83:67'/> <source bridge='br0'/> <target dev='vnet1'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target port='0'/> </console> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/> </devices> </domain> When I save the file and do virsh edit again, the <target dev='vnet1'/> line is not saved. Is this a bug in libvirt? Thanks, Neil -- Neil Aggarwal, (281)846-8957, www.JAMMConsulting.com Will your e-commerce site go offline if you have a DB server failure, fiber cut, flood, fire, or other disaster? If so, ask about our geographically redundant database system. -- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

Nikolai:
As i said in the kvm list, did you do virsh define /path/to/xml before launching the vm again ?
According to what I am seeing on the Internet, virsh edit is equivalent to dumping the xml, editing it, and calling define to update it so it should be the same thing. However, just to test it, I did the following: 1. Stopped the virtual machine 2. Added the target directive to the /etc/libvirt/qemu/jamm12a.xml file 3. Ran virsh define /etc/libvirt/qemu/jamm12a.xml If I look at the jamm12a.xml file after the define command, the target directive is no longer there. For some reason, libvirt is removing it. If I start the virtual machine, it attaches to vnet0 instead of vnet1. Thanks, Neil -- Neil Aggarwal, (281)846-8957, www.JAMMConsulting.com Will your e-commerce site go offline if you have a DB server failure, fiber cut, flood, fire, or other disaster? If so, ask about our geographically redundant database system.

On Sun, Oct 25, 2009 at 01:13:01PM -0500, Neil Aggarwal wrote:
Nikolai:
As i said in the kvm list, did you do virsh define /path/to/xml before launching the vm again ?
According to what I am seeing on the Internet, virsh edit is equivalent to dumping the xml, editing it, and calling define to update it so it should be the same thing.
However, just to test it, I did the following: 1. Stopped the virtual machine 2. Added the target directive to the /etc/libvirt/qemu/jamm12a.xml file 3. Ran virsh define /etc/libvirt/qemu/jamm12a.xml
If I look at the jamm12a.xml file after the define command, the target directive is no longer there. For some reason, libvirt is removing it.
If I start the virtual machine, it attaches to vnet0 instead of vnet1.
heh, surprisingly I stumbled on this today. target devices with the 'vnet' prefix are special: if you do not specify a target device, a device with the vnet prefix is created automatically. conversely, if libvirt sees a target device with that name, it assumes it's a remnant of an automatically-created device name. if you care about the name of the tap device, you must choose a more "original" name. but beware: anything but automatically-created names would cause collisions during migration in a multi-domain multi-host environment. Dan

if you care about the name of the tap device, you must choose a more "original" name.
So, all I have to do is name it something else that does not begin with vnet. I did that and it worked. Whaddya know. Thanks for the help! Neil -- Neil Aggarwal, (281)846-8957, www.JAMMConsulting.com Will your e-commerce site go offline if you have a DB server failure, fiber cut, flood, fire, or other disaster? If so, ask about our geographically redundant database system.

On Sun, Oct 25, 2009 at 09:18:16AM -0500, Neil Aggarwal wrote:
Hello:
I am trying to set a target dev specification for one of my guests so I stopped the guest and the did virst edit, added the target specification, and saved the file. If I go back into virsh edit, the target specification is not being saved.
<interface type='bridge'> <mac address='54:52:00:4f:83:67'/> <source bridge='br0'/> <target dev='vnet1'/> </interface>
Libvirt will ignore any request for an explicit target name starting in 'vnet' or 'vif' since those namespaces are both used for automatically assigned names. Pick a different target dev name and it should work Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (4)
-
Dan Kenigsberg
-
Daniel P. Berrange
-
Neil Aggarwal
-
Nikolai K. Bochev