Bug 1509870

Summary: Command "virsh set-lifecycle-action --help" raises abnormal error info
Product: Red Hat Enterprise Linux 7 Reporter: jiyan <jiyan>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: jiyan <jiyan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.5CC: bugproxy, dyuan, fjin, hannsj_uhl, jdenemar, jiyan, lmen, mprivozn, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-4.3.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 09:50:00 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:
Bug Depends On:    
Bug Blocks: 1507957, 1513404, 1577865    

Description jiyan 2017-11-06 09:08:04 UTC
Description of problem:
Command "virsh set-lifecycle-action --help" raises abnormal error info

Version-Release number of selected component (if applicable):
kernel-3.10.0-768.el7.x86_64
libvirt-3.9.0-1.el7.x86_64
qemu-kvm-rhev-2.10.0-4.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Run command 'virsh set-lifecycle-action --help'
# virsh set-lifecycle-action --help
  NAME
    set-lifecycle-action - change lifecycle actions

  SYNOPSIS
    set-lifecycle-action <domain> [--type <string>] [--action <string>] [--config] [--live] [--current]

  DESCRIPTION
    Change lifecycle actions for the guest domain.

  OPTIONS
    [--domain] <string>  domain name, id or uuid
error: internal error: bad options in command: 'set-lifecycle-action'

Actual results:
As step 1 shows

Expected results:
Display command detailed info normally

Additional info:
When verifying #BZ1460677, this command can change lifecycle actions normally
Bug 1460677 - [RFE] Enable dynamic configuration of powercycle event actions

Comment 2 Michal Privoznik 2017-11-16 12:01:24 UTC
I've pushed the patch upstream:

commit c7543a7286b2480c3ef6791dd6eba35f1534dd12
Author:     Julio Faracco <jcfaracco>
AuthorDate: Thu Nov 16 01:01:54 2017 -0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Nov 16 10:27:46 2017 +0100

    virsh: fixing wrong datatype of 'set-lifcycle-action' command options.
    
    The 'set-lifcycle-action' is throwing a weird error after executing it with
    the '--help' option. The command output is showing the options 'type' and
    'action' are as optional, but they aren't. Both are required.
    
    virsh # set-lifecycle-action --help
    ...
      SYNOPSIS
        set-lifecycle-action <domain> [--type <string>] [--action <string>] ...
    ...
      OPTIONS
        [--domain] <string>  domain name, id or uuid
    error: internal error: bad options in command: 'set-lifecycle-action'
    
    After applying this patch, both arguments are required now.
    
    virsh # set-lifecycle-action --help
    ...
      SYNOPSIS
        set-lifecycle-action <domain> <type> <action> [--config] ...
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1509870
    
    Signed-off-by: Julio Faracco <jcfaracco>

v3.9.0-137-gc7543a728

Comment 3 Jiri Denemark 2018-05-24 10:44:11 UTC
*** Bug 1577920 has been marked as a duplicate of this bug. ***

Comment 5 jiyan 2018-05-28 07:43:54 UTC
Verified this bug in libvirt-4.3.0-1.el7.x86_64

Version:
libvirt-4.3.0-1.el7.x86_64
qemu-kvm-rhev-2.10.0-21.el7_5.3.x86_64
kernel-3.10.0-893.el7.x86_64

Steps:
1. Run command 'virsh set-lifecycle-action --help'
# virsh set-lifecycle-action --help
  NAME
    set-lifecycle-action - change lifecycle actions

  SYNOPSIS
    set-lifecycle-action <domain> <type> <action> [--config] [--live] [--current]

  DESCRIPTION
    Change lifecycle actions for the guest domain.

  OPTIONS
    [--domain] <string>  domain name, id or uuid
    [--type] <string>  lifecycle type to modify
    [--action] <string>  lifecycle action to set
    --config         affect next boot
    --live           affect running domain
    --current        affect current domain

No error info raised.

The result is as expected, move this bug to be 'verified'.

Comment 7 errata-xmlrpc 2018-10-30 09:50:00 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://access.redhat.com/errata/RHSA-2018:3113