Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 795322 - add_ro should return error if not running in a config state
add_ro should return error if not running in a config state
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs (Show other bugs)
6.3
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
: Regression
: 796523 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-20 03:59 EST by Mohua Li
Modified: 2012-06-20 03:00 EDT (History)
4 users (show)

See Also:
Fixed In Version: libguestfs-1.16.6-1.el6
Doc Type: Bug Fix
Doc Text:
No Documentation needed.
Story Points: ---
Clone Of:
: 796523 (view as bug list)
Environment:
Last Closed: 2012-06-20 03:00:40 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2012:0774 normal SHIPPED_LIVE Low: libguestfs security, bug fix, and enhancement update 2012-06-19 15:29:50 EDT

  None (edit)
Description Mohua Li 2012-02-20 03:59:58 EST
Description of problem:

run add_ro in a ready state(after launch), didn't return an error, which might quite confused, as it didn't really added the disk to the applicance, you could get the info from qemu-kvm cmdline(file=/tmp/test1.img etc), 

so better to retrun an error if add_ro not running in a config state



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

How reproducible:
always

Steps to Reproduce:
1.guestfish -xv -N fs
2.add-ro rhevh.img 
3.list-filesystems
  
Actual results:
add-ro not running in a config state, didn't return an error 

Expected results:
add-ro not running in a config state, return an error 

Additional info:
Comment 1 Qixiang Wan 2012-02-20 04:45:43 EST
There are many other commands working like this, so it sounds reasonable to find a good solution to make it work for other commands too.

And there is another reason to get this fixed, the commands like 'add-ro' won't take effect after launch, but the original parameters can be lost if we want to check that. for example:

# guestfish -a /dev/null
[...]
><fs> run
><fs> get-smp 
1
><fs> set-smp 4
><fs> get-smp 
4
><fs> 

Actually, we're expecting to get 1 rather than 4, because there is only one vcpu assigned to the appliance, and it's impossible for the appliance to get 4 virtual vcpus now.
Comment 2 Richard W.M. Jones 2012-02-20 06:10:00 EST
I see what's happened here is a subtle regression in
this commit:

https://github.com/libguestfs/libguestfs/commit/f1041e912b72116d66274d2f15e50ce34a9531fd

The old path used to call guestfs__add_drive_opts ->
guestfs__config -> add_cmdline, and add_cmdline contains
this check:

  if (g->state != CONFIG) {
    error (g,
        _("command line cannot be altered after qemu subprocess launched"));
    return -1;
  }

However after that commit, guestfs__add_drive_opts
adds the drive to an internal list of drives and
doesn't immediately call add_cmdline.  Thus the
error check above is never performed.

Therefore this bug is a regression from RHEL 6.2.
Comment 3 Richard W.M. Jones 2012-02-20 06:10:49 EST
(In reply to comment #1)
> There are many other commands working like this, so it sounds reasonable to
> find a good solution to make it work for other commands too.
> 
> And there is another reason to get this fixed, the commands like 'add-ro' won't
> take effect after launch, but the original parameters can be lost if we want to
> check that. for example:
> 
> # guestfish -a /dev/null
> [...]
> ><fs> run
> ><fs> get-smp 
> 1
> ><fs> set-smp 4
> ><fs> get-smp 
> 4
> ><fs> 
> 
> Actually, we're expecting to get 1 rather than 4, because there is only one
> vcpu assigned to the appliance, and it's impossible for the appliance to get 4
> virtual vcpus now.

Just to note this is a separate issue and requires a new BZ.
Comment 5 Wanlong Gao 2012-02-23 00:25:43 EST
(In reply to comment #1)
> There are many other commands working like this, so it sounds reasonable to
> find a good solution to make it work for other commands too.
> 
> And there is another reason to get this fixed, the commands like 'add-ro' won't
> take effect after launch, but the original parameters can be lost if we want to
> check that. for example:
> 
> # guestfish -a /dev/null
> [...]
> ><fs> run
> ><fs> get-smp 
> 1
> ><fs> set-smp 4
> ><fs> get-smp 
> 4
> ><fs> 
> 
> Actually, we're expecting to get 1 rather than 4, because there is only one
> vcpu assigned to the appliance, and it's impossible for the appliance to get 4
> virtual vcpus now.

A fix patch has sent against upstream.
https://www.redhat.com/archives/libguestfs/2012-February/msg00082.html
Comment 6 Wanlong Gao 2012-02-23 00:53:53 EST
(In reply to comment #3)
> (In reply to comment #1)
> > There are many other commands working like this, so it sounds reasonable to
> > find a good solution to make it work for other commands too.
> > 
> > And there is another reason to get this fixed, the commands like 'add-ro' won't
> > take effect after launch, but the original parameters can be lost if we want to
> > check that. for example:
> > 
> > # guestfish -a /dev/null
> > [...]
> > ><fs> run
> > ><fs> get-smp 
> > 1
> > ><fs> set-smp 4
> > ><fs> get-smp 
> > 4
> > ><fs> 
> > 
> > Actually, we're expecting to get 1 rather than 4, because there is only one
> > vcpu assigned to the appliance, and it's impossible for the appliance to get 4
> > virtual vcpus now.
> 
> Just to note this is a separate issue and requires a new BZ.

New BZ created to https://bugzilla.redhat.com/show_bug.cgi?id=796523
Comment 7 Richard W.M. Jones 2012-03-01 11:40:51 EST
*** Bug 796523 has been marked as a duplicate of this bug. ***
Comment 10 Richard W.M. Jones 2012-04-26 09:44:57 EDT
    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:
No Documentation needed.
Comment 12 errata-xmlrpc 2012-06-20 03:00:40 EDT
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.

http://rhn.redhat.com/errata/RHSA-2012-0774.html

Note You need to log in before you can comment on or make changes to this bug.