Bug 1141119

Summary: virsh domif-getlink cmd gets "default" which is a invalid link state.
Product: Red Hat Enterprise Linux 7 Reporter: lcheng
Component: libvirtAssignee: Erik Skultety <eskultet>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.1CC: dyuan, honzhang, mzhan, pkrempa, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-1.2.14-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 05:46:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description lcheng 2014-09-12 09:13:31 UTC
Description of problem:
virsh domif-getlink cmd gets 'default' which is a invalid link state. Values for link state are 'up' or 'down' in virsh's manual and libvirt docs.

Version-Release number of selected component (if applicable):
libvirt-1.2.8-2.el7.x86_64
libvirt-docs-1.2.8-2.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
[root@localhost ~]# virsh dumpxml a | grep interface -A5
<interface type='network'>
<mac address='52:54:00:e9:4b:7a'/>
<source network='network'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

[root@localhost ~]# virsh domif-getlink a 52:54:00:e9:4b:7a
52:54:00:e9:4b:7a default

[root@localhost ~]# virsh domif-setlink a 52:54:00:e9:4b:7a default
error: invalid link state 'default'

[root@localhost ~]# man virsh
...
domif-setlink domain interface-device state [--config]
Modify link state of the domain's virtual interface. Possible values for state are "up" and "down.
...
domif-getlink domain interface-device [--config]
Query link state of the domain's virtual interface. If --config is specified, query the persistent configuration, for compatibility purposes, --persistent is alias of --config.
interface-device can be the interface's target name or the MAC address.
...

[root@localhost ~]# firefox file:///usr/share/doc/libvirt-docs-1.2.8/html/formatdomain.html#elementLink
...
Modifying virtual link state

This element provides means of setting state of the virtual network link. Possible values for attribute state are up and down. If down is specified as the value, the interface behaves as if it had the network cable disconnected. Default behavior if this element is unspecified is to have the link state up.

Actual results:
As description.

Expected results:
If link state element is unspecified in xml, virsh domif-getlink cmd should get 'up'.

Comment 2 dyuan 2014-09-15 09:33:29 UTC
Hi lcheng, please check the comment in bug 890483.
https://bugzilla.redhat.com/show_bug.cgi?id=890483#c4

Comment 4 lcheng 2014-09-15 10:15:23 UTC
> Hi lcheng, please check the comment in bug 890483.
> https://bugzilla.redhat.com/show_bug.cgi?id=890483#c4


Hi dyuan, if the domif-getlink returns 'default' which means 'up', it should be documented. Otherwise users will be confused.

Comment 5 Peter Krempa 2015-03-04 13:56:27 UTC
Fixed upstream:
commit d9c7f014ee7c23d25483acf4bce344fae169f1dd
Author: Erik Skultety <eskultet>
Date:   Tue Feb 24 17:25:55 2015 +0100

    virsh: tweak domif-getlink link state reporting message
    
    According to docs, we only support 2 link states for an interface
    up/down, 'up' being the default state if link state is unspecified in
    domain's XML, so the message when no link state is provided should be
    changed a little.

v1.2.13-55-gd9c7f01

Comment 8 hongming 2015-07-13 07:21:38 UTC
Verify it as follows. The result is expected. Move its status to VERIFIED.

# rpm -q libvirt
libvirt-1.2.17-1.el7.x86_64

# virsh dumpxml rhel7.0|grep /interface -B7
    <interface type='network'>
      <mac address='52:54:00:68:ce:60'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# virsh domif-getlink rhel7.0 52:54:00:68:ce:60
52:54:00:68:ce:60 up

# virsh domif-setlink rhel7.0 52:54:00:68:ce:60 down
Device updated successfully

# virsh domif-getlink rhel7.0 52:54:00:68:ce:60
52:54:00:68:ce:60 down

# virsh domif-setlink rhel7.0 52:54:00:68:ce:60 up
Device updated successfully

# virsh dumpxml rhel7.0|grep /interface -B7
      <mac address='52:54:00:68:ce:60'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <link state='up'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

Comment 10 errata-xmlrpc 2015-11-19 05:46:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2202.html