Bug 998513

Summary: guestfish does not work when you mix --remote and --add options
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: acathrow, bfan, leiwang, mbooth, wshi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 996039 Environment:
Last Closed: 2013-08-19 13:18:57 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: 996039    

Description Richard W.M. Jones 2013-08-19 13:13:09 UTC
+++ This bug was initially created as a clone of Bug #996039 +++

Description of problem:

  eval `guestfish --listen`
  guestfish --remote --add test.img

The '--add' flag for the second command adds the disk to the second
local guestfs handle, not to the remote handle as you might expect.

You can prove this by adding -x options and running the two commands in
separate windows:

  t1$ guestfish --listen -x
  libguestfs: trace: set_pgroup true
  libguestfs: trace: set_pgroup = 0
  GUESTFISH_PID=20662; export GUESTFISH_PID

  t2$  GUESTFISH_PID=20668 guestfish --remote --add debian.img -x
  libguestfs: trace: set_pgroup true
  libguestfs: trace: set_pgroup = 0
  libguestfs: trace: add_drive "debian.img"   <-- note added here, not in t1$
  libguestfs: trace: add_drive = 0

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

libguestfs-1.20.10-2.el6.x86_64
Also happens upstream (1.23.17).

How reproducible:
100%

Steps to Reproduce:
1. create a disk
[root@intel-8400-8-2 home]# dd if=/dev/zero of=test.img bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB) copied, 0.0447178 s, 1.2 GB/s

2. guestfish remote control
[root@intel-8400-8-2 home]# eval "`guestfish --listen`"
[root@intel-8400-8-2 home]# guestfish --remote --add test.img

Welcome to guestfish, the libguestfs filesystem interactive shell for
editing virtual machine filesystems.

Type: 'help' for help on commands
      'man' to read the manual
      'quit' to quit the shell

><fs> quit
><fs> quit
guestfish: remote: looks like the server is not running
><fs> quit
guestfish: remote: looks like the server is not running
><fs>

We have to use "ctrl + d" to quit


Actual results:
guestfish does not work because of conflict


Expected results:
guestfish can work well with one method (remote or interactive)


Additional info:
Following is correct
1.
[root@intel-8400-8-2 home]# eval "`guestfish --listen`"
[root@intel-8400-8-2 home]# guestfish --remote -- add test.img

2.[root@intel-8400-8-2 home]# eval "`guestfish --listen`"
[root@intel-8400-8-2 home]# guestfish --remote add test.img

same issue in rhel7, libguestfs-1.22.5-3.el7.x86_64

Comment 1 Richard W.M. Jones 2013-08-19 13:14:15 UTC
This is tricky to fix.  I suspect we should just document it
for now.

Comment 2 Richard W.M. Jones 2013-08-19 13:18:57 UTC
Fixed (by documentation) upstream:
https://github.com/libguestfs/libguestfs/commit/7e396954611d827dc236a114ed22a781687c002d