Bug 961443

Summary: virsh fails to report --persistent parameter error or it is undocumented
Product: Red Hat Enterprise Linux 6 Reporter: Chris Evich <cevich>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.4CC: acathrow, bsarathy, dyuan, jdenemar, mzhan, pkrempa
Target Milestone: rcKeywords: Upstream
Target Release: 6.5   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-31 14:46:42 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 Chris Evich 2013-05-09 16:01:25 UTC
Description of problem:
virsh is either not reporting error as an invalid parameter, or parameter is valid but undocumented.

Version-Release number of selected component (if applicable):
0.10.2-18

How reproducible:
Very Easy

Steps to Reproduce:
1. Use virsh dumpxml to obtain some device XML and make small change
2. use virsh update-device command with --persistent parameter
  
Actual results:
[root@localhost virt]# virsh update-device vm1 asdf.xml --persistent --dogfood --error
error: command 'update-device' doesn't support option --dogfood
[root@localhost virt]# virsh update-device vm1 asdf.xml --persistent --error
error: command 'update-device' doesn't support option --error
[root@localhost virt]# virsh update-device vm1 asdf.xml --persistent
Device updated successfully

Expected results:
[root@localhost virt]# virsh update-device vm1 asdf.xml --persistent
error: command 'update-device' doesn't support option --persistent

Additional info:
This could just be a documentation bug since it is a valid option for later releases.

[root@localhost virt]# virsh help update-device
  NAME
    update-device - update device from an XML file

  SYNOPSIS
    update-device <domain> <file> [--config] [--force]

  DESCRIPTION
    Update device from an XML <file>.

  OPTIONS
    [--domain] <string>  domain name, id or uuid
    [--file] <string>  XML file
    --config         affect next boot
    --force          force device update

This does not appear to be a problem in later versions.

Comment 1 Jiri Denemark 2013-05-10 13:51:59 UTC
This bug report is a pretty strange one. It's filed against RHEL 5 but mentions libvirt 0.10.2-18, which is from RHEL 6.4. The latest RHEL 5 package is libvirt-0.8.2-29.el5_9.1. So what is the right RHEL release and libvirt version? Also you mention this is fixed in "later versions", what version do you mean exactly?

Comment 2 Chris Evich 2013-05-10 14:13:18 UTC
Terribly sorry, my fault.  You are correct, this is RHEL 6.4, I recently reinstalled the box but forgot.  I'll update the bug.

Comment 3 Chris Evich 2013-05-10 14:15:04 UTC
I marked this as 6.5 target, but I think it's probably very low priority (IMHO), so feel free to change it if 6.5 isn't practical.  Thanks.

Comment 5 Peter Krempa 2013-05-10 14:51:18 UTC
The --persistent flag was changed to be backcompat alias for --config and stopped to be documented (this was expected).

Since [1] the --persistent flag is documented again with slightly different semantics than it used to have. This should be backwards compatible with the previous semantics. Please see the man page for additional info about it's behavior.

[1]:
commit 69ce3ffa8d431e9810607c6e00b7cfcc481b491d
Author: Peter Krempa <pkrempa>
Date:   Fri Mar 15 17:11:28 2013 +0100

    virsh: Fix semantics of --config for "update-device" command
    
    The man page states that with --config the next boot is affected. This
    can be understood as if _only_ the next boot was affected. This isn't
    true if the machine is running.
    
    This patch adds the full --live, --config, --current infrastructure and
    tweaks stuff to correctly support the obsolete --persistent flag.
    
    Note that this patch changes the the behavior of the --config flag to match the
    use of this flag in rest of libvirt. This flag was mistakenly renamed from
    --persistent that originaly had different semantics.

Comment 6 Peter Krempa 2013-05-10 14:52:02 UTC
Moving to POST as I believe the commit mentioned above fixes the reported issue.

Comment 7 Chris Evich 2013-05-10 15:24:09 UTC
(In reply to comment #5)
> The --persistent flag was changed to be backcompat alias for --config and
> stopped to be documented (this was expected).

Are you meaning 'virsh help update-device' not mentioning --persistent was on purpose?


Yes, I do see what you describe is in the man page, that looks good.

Thanks.

Comment 8 Peter Krempa 2013-05-10 15:30:48 UTC
(In reply to comment #7)
> (In reply to comment #5)
> > The --persistent flag was changed to be backcompat alias for --config and
> > stopped to be documented (this was expected).
> 
> Are you meaning 'virsh help update-device' not mentioning --persistent was
> on purpose?

Yes, it was on purpose, introduced by commit:

commit 1e31b8356047f2275e772f79309e9e94e15dcc6e
Author: Osier Yang <jyang>
Date:   Thu Mar 8 19:38:57 2012 +0800

    virsh: Use option alias for outmoded "--persistent"
    
    Since VIR_DOMAIN_AFFECT_{LIVE,CONFIG,CURRENT} was created,
    all new virsh commands use "--config" to represents the
    persistent changing. This patch add "--config" option
    for the old commands which still use "--persistent",
    and "--persistent" is now alias of "--config".
    
    tools/virsh.c: (use "--config", and "--persistent" is
        alias of "--config" now).
        cmdDomIfSetLink, cmdDomIfGetLink, cmdAttachDevice,
        cmdDetachDevice, cmdUpdateDevice, cmdAttachInterface,
        cmdDetachInterface, cmdAttachDisk, cmdDetachDisk
    
    toos/virsh.pod: Update docs of the changed commands, and
        add some missed docs for "--config" (detach-interface,
        detach-disk, and detach-device).

Comment 9 Chris Evich 2013-05-10 15:49:07 UTC
Great, thanks.

Comment 13 Jiri Denemark 2014-03-31 14:46:42 UTC
The patch from comment #5 is for bug 921407.

*** This bug has been marked as a duplicate of bug 921407 ***