Bug 721232

Summary: [virsh iface]:should prompt user destroy iface first before undefine it
Product: [Community] Virtualization Tools Reporter: zhe peng <zpeng>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DEFERRED QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: ajia, crobinso, cwei, dyuan, mzhan, rbalakri, ydu, zpeng
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-23 13:25:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description zhe peng 2011-07-14 06:16:42 UTC
Description of problem:
virsh iface:should prompt user destroy iface first before undefine it

Version-Release number of selected component (if applicable):
libvirt-0.9.3-1.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1.make sure interface eth0 active
 # virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
eth0                 active     1c:6f:65:06:ba:42
lo                   active     00:00:00:00:00:00

2. # virsh iface-undefine eth0
Interface eth0 undefined

3. # virsh iface-list --all
Name                 State      MAC Address
--------------------------------------------
lo                   active     00:00:00:00:00:00

4.# ls /etc/sysconfig/network-scripts/ifcfg-eth0
ls: cannot access /etc/sysconfig/network-scripts/ifcfg-eth0: No such file or directory

5.#ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 1C:6F:65:06:BA:42  
          inet addr:10.66.6.166  Bcast:10.66.7.255  Mask:255.255.252.0
          inet6 addr: fe80::1e6f:65ff:fe06:ba42/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1562 errors:0 dropped:0 overruns:0 frame:0
          TX packets:512 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:392939 (383.7 KiB)  TX bytes:70424 (68.7 KiB)
          Interrupt:16 Memory:fc300000-fc320000

6:# ifdown eth0
usage: ifdown <device name>

Actual results:
     ifcfg-eth0 file removed, but actually the interface eth0 exist and can't use ifdown/ifup
Expected results:
Should be a prompt before use iface-undefine an active interface like following.

# virsh iface-undefine eth0
error:Failed to undefine eth0
error:Requested operation is not valid: cannot delete active interface

Additional info:
in virsh man page:
 iface-undefine iface
           Undefine the configuration for an inactive host interface.

Comment 1 Alex Jia 2011-07-15 05:15:43 UTC
I have sent a patch to upstream, and wait for developers review:
https://www.redhat.com/archives/libvir-list/2011-July/msg00859.html

Alex

Comment 2 Michal Privoznik 2011-07-15 14:01:53 UTC
sent patch, waiting for review:

https://www.redhat.com/archives/libvir-list/2011-July/msg00966.html

Comment 4 Michal Privoznik 2012-05-25 14:39:44 UTC
Even though I've sent patch, now that I am re-thinking this over again I don't think this is okay with libvirt policy. I mean, it's possible to have persistent domain, start it and undefine while running (=> transfer to transient domain). Therefore in fact, we want to make undefine on active device/interface possible. But I must admit that libvirt doesn't know anything like transient interfaces yet. And that's where I see the fix should aim. Introducing transient interfaces to libvirt. Thoughts? Setting condNak design meanwhile.

Comment 6 Cole Robinson 2016-03-23 13:25:03 UTC
transient interfaces probably requires heavy netcf coordination, and given that netcf is basically maintenance mode at this point I doubt this will ever be fixed as suggested in Comment #5. closing