Bug 671050
| Summary: | Libvirt hot unplug the 1st guest nic silently when not specifying --mac | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | zhanghaiyan <yoyzhang> |
| Component: | libvirt | Assignee: | Michal Privoznik <mprivozn> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | low | ||
| Version: | 6.1 | CC: | berrange, crobinso, dallan, dyuan, eblake, jdenemar, jyang, llim, maurizio.antillon, mjenner, mzhan, veillard, xen-maint |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libvirt-0.8.7-4.el6 | Doc Type: | Bug Fix |
| Doc Text: |
If the "virsh detach-interface" command was used on a domain with multiple NICs, but a particular MAC address was not specified with "--mac", virsh detached the first interface without error. The "--mac" option is now required where a domain has multiple NICs, and an appropriate error message has been added.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-05-19 13:25:55 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Well I don't think it's a bug, it's a normal behaviour in some sense, you ask to remove a network device, don't specify which one and virsh just does it, just it decides which one to pick ! Actually libvirt API requires the user to give a precise definition for the interface, it's just virsh behaviour here which is questionable. I agree that --all is a good idea, and this could be fixed, but it's an upstream request for enhancement, not something to target for 6.1, Daniel Actually this is a bug IMHO. The virDomainDetachDevice API expects to receive an XML blob that matches one of the NICs in its existing XML. If the mac address was not included in that XML, then it should have rejected it as not matching since there was no unique identifier to match with. I agree with Daniel B. here. The current behavior is non-deterministic and I also think it should be rejected. The patch has already been posted to rhvirt-patches: http://post-office.corp.redhat.com/archives/rhvirt-patches/2011-January/msg01310.html It makes sense to me to just take it into 6.1 instead of waiting for 6.2. I updated BZ flags accordingly. I'm fine with that as long as it's been accepted upstream. Verified with Passed in below environment:
# uname -a
Linux dhcp-65-85.nay.redhat.com 2.6.32-99.el6.x86_64 #1 SMP Fri Jan 14 10:46:00
EST 2011 x86_64 x86_64 x86_64 GNU/Linux
libvirt-0.8.7-4.el6.x86_64
kernel-2.6.32-99.el6.x86_64
qemu-kvm-0.12.1.2-2.132.el6.x86_64
According to bug description, I also hotplug interface with network type for 3 times. When I hot unplug the interface without --mac, just like step 6, then libvirt reject to detach as following: And nothing will be changed for this guest interfaces.
# virsh detach-interface rhel6 --type network
error: Domain has 3 interfaces. Please specify which one to detach using --mac
# virsh dumpxml rhel6 |grep network
<interface type='network'>
<source network='default'/>
<interface type='network'>
<source network='default'/>
<interface type='network'>
<source network='default'/>
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
Cause:
detach-interface via virsh without mac being specified on domain with multiple NICs
Consequence:
virsh detached the first interface without error
Fix:
make --mac required in cases where domain have more than one NICs
Result:
virsh prints error message suggesting --mac
Technical note updated. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
Diffed Contents:
@@ -1,8 +1 @@
-Cause:
+If the "virsh detach-interface" command was used on a domain with multiple NICs, but a particular MAC address was not specified with "--mac", virsh detached the first interface without error. The "--mac" option is now required where a domain has multiple NICs, and an appropriate error message has been added.- detach-interface via virsh without mac being specified on domain with multiple NICs
-Consequence:
- virsh detached the first interface without error
-Fix:
- make --mac required in cases where domain have more than one NICs
-Result:
- virsh prints error message suggesting --mac
* The problem was: libvirt API requires to give full XML description on devices being detached. Virsh therefore got domain XML and tried to find those snippets which are the most close to given arguments. But this can result in many interfaces which can be distinguished by MAC. * Running virsh detach-interface against domain with multiple interfaces, but without any MAC specified, silently detached the domain's first interface. * When there are many interfaces left after elimination phase, require --mac, so exactly one interface is selected * Users gets error message suggesting --mac An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2011-0596.html |
Description of problem: Hot unplug 'network' type nic from guest without option --mac, libvirt detach the 1st nic silently, while multi nic are 'network' type. Version-Release number of selected component (if applicable): - 2.6.32-94.el6.x86_64 - libvirt-0.8.7-2.el6.x86_64 - qemu-kvm-0.12.1.2-2.129.el6.x86_64 How reproducible: 100% Steps to Reproduce: 1. Get a running guest named rhel6 2. # virsh attach-interface rhel6 --type network --source default Interface attached successfully 3. # virsh attach-interface rhel6 --type network --source default Interface attached successfully 4. # virsh attach-interface rhel6 --type network --source default Interface attached successfully 5. # virsh dumpxml rhel6 <domain type='kvm' id='6'> <name>rhel6</name> <uuid>a895bf3f-1354-68ac-5c49-c16af2c6a4d5</uuid> <memory>2097152</memory> <currentMemory>2097152</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='rhel6.0.0'>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'> <driver name='qemu' type='raw' cache='none'/> <source file='/tmp/rhel6-1.img'/> <target dev='hda' bus='ide'/> <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/1.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <controller type='ide' index='0'> <alias name='ide0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='network'> <mac address='52:54:00:2c:5b:92'/> <source network='default'/> <target dev='vnet0'/> <alias name='net0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </interface> <interface type='network'> <mac address='52:54:00:e3:b3:c6'/> <source network='default'/> <target dev='vnet1'/> <alias name='net1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </interface> <interface type='network'> <mac address='52:54:00:b5:a1:92'/> <source network='default'/> <target dev='vnet2'/> <alias name='net2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </interface> <serial type='pty'> <source path='/dev/pts/2'/> <target port='0'/> <alias name='serial0'/> </serial> <console type='pty' tty='/dev/pts/2'> <source path='/dev/pts/2'/> <target type='serial' port='0'/> <alias name='serial0'/> </console> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/> <video> <model type='cirrus' vram='9216' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </memballoon> </devices> <seclabel type='dynamic' model='selinux'> <label>system_u:system_r:svirt_t:s0:c365,c785</label> <imagelabel>system_u:object_r:svirt_image_t:s0:c365,c785</imagelabel> </seclabel> </domain> 6. # virsh detach-interface rhel6 --type network Interface detached successfully 7. # virsh dumpxml rhel6 <domain type='kvm' id='6'> <name>rhel6</name> <uuid>a895bf3f-1354-68ac-5c49-c16af2c6a4d5</uuid> <memory>2097152</memory> <currentMemory>2097152</currentMemory> <vcpu>1</vcpu> <os> <type arch='x86_64' machine='rhel6.0.0'>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'> <driver name='qemu' type='raw' cache='none'/> <source file='/tmp/rhel6-1.img'/> <target dev='hda' bus='ide'/> <alias name='ide0-0-0'/> <address type='drive' controller='0' bus='0' unit='0'/> </disk> <disk type='file' device='cdrom'> <driver name='qemu' type='raw'/> <source file='/var/lib/libvirt/images/1.iso'/> <target dev='hdc' bus='ide'/> <readonly/> <alias name='ide0-1-0'/> <address type='drive' controller='0' bus='1' unit='0'/> </disk> <controller type='ide' index='0'> <alias name='ide0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='network'> <mac address='52:54:00:e3:b3:c6'/> <source network='default'/> <target dev='vnet1'/> <alias name='net1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </interface> <interface type='network'> <mac address='52:54:00:b5:a1:92'/> <source network='default'/> <target dev='vnet2'/> <alias name='net2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </interface> <serial type='pty'> <source path='/dev/pts/2'/> <target port='0'/> <alias name='serial0'/> </serial> <console type='pty' tty='/dev/pts/2'> <source path='/dev/pts/2'/> <target type='serial' port='0'/> <alias name='serial0'/> </console> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='5900' autoport='yes' keymap='en-us'/> <video> <model type='cirrus' vram='9216' heads='1'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <alias name='balloon0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </memballoon> </devices> <seclabel type='dynamic' model='selinux'> <label>system_u:system_r:svirt_t:s0:c365,c785</label> <imagelabel>system_u:object_r:svirt_image_t:s0:c365,c785</imagelabel> </seclabel> </domain> 8. # virsh detach-interface rhel6 --type network Interface detached successfully 9. # virsh dumpxml rhel6 .... <interface type='network'> <mac address='52:54:00:b5:a1:92'/> <source network='default'/> <target dev='vnet2'/> <alias name='net2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </interface> ... Actual results: As execute detach-interface without --mac and multi nic are network type, libvirt detached the first nic each time Expected results: Provide another option "--all", if it's specifed, all the same type interfaces will be detached, and on the other hand, we should have doc to tell user if no "--mac" and "--all" is specified, the first interface will be detached by default. Additional info: