This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1306666 - Failure when disk contains an LV with activationskip=y
Failure when disk contains an LV with activationskip=y
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: libguestfs (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Richard W.M. Jones
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-11 09:40 EST by Fabian Deutsch
Modified: 2016-02-22 20:24 EST (History)
4 users (show)

See Also:
Fixed In Version: libguestfs-1.30.6-2.fc22 libguestfs-1.32.2-2.fc23
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1343167 (view as bug list)
Environment:
Last Closed: 2016-02-22 15:49:45 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Fabian Deutsch 2016-02-11 09:40:39 EST
Description of problem:
guestfish -ia … fails with:
libguestfs: Fehler: internal_parse_mountable: internal_parse_mountable_stub: /dev/centos_installed/ovirt-node-ng-1.0-0.0: No such file or directory

When there is an LV inside the disk image which has activationskip=y set.

Version-Release number of selected component (if applicable):
$ rpm -q libguestfs
libguestfs-1.30.5-2.fc22.x86_64


How reproducible:
Always

Steps to Reproduce:
1. Install Fedora with LVm inside a disk image
2. inside the image: Create another volume
3. inside the image: lvchange -k y <other-vol>
4. guestfish -ia <disk-image>

Actual results:
libguestfs: Fehler: internal_parse_mountable: internal_parse_mountable_stub: /dev/centos_installed/ovirt-node-ng-1.0-0.0: No such file or directory

Expected results:
No failure

Additional info:
Comment 1 Richard W.M. Jones 2016-02-11 09:42:33 EST
The problem is not the activationskip flag, but that libguestfs
needs to be robust and ignore LVs which were not activated.  (It's
also possible that we could activate them anyway, but there may be
other reasons why that's not a good idea).
Comment 2 Richard W.M. Jones 2016-02-11 09:49:29 EST
Something like this (untested):

diff --git a/daemon/lvm.c b/daemon/lvm.c
index 8bef4d5..529e20d 100644
--- a/daemon/lvm.c
+++ b/daemon/lvm.c
@@ -157,6 +157,10 @@ filter_convert_old_lvs_output (char *out)
     if (lv_attr[0] == 't')
       goto skip_line;
 
+    /* Ignore activationskip (RHBZ#1306666). */
+    if (strlen (lv_attr) >= 10 && lv_attr[9] == 'k')
+      goto skip_line;
+
     /* Ignore "unknown device" message (RHBZ#1054761). */
     if (STRNEQ (p, "unknown device")) {
       char buf[256];
@@ -260,7 +264,7 @@ do_lvs (void)
     r = command (&out, &err,
                  str_lvm, "lvs",
                  "-o", "vg_name,lv_name",
-                 "-S", "lv_role=public",
+                 "-S", "lv_role=public && lv_active=active",
                  "--noheadings",
                  "--separator", "/", NULL);
     if (r == -1) {
Comment 3 Richard W.M. Jones 2016-02-12 08:42:06 EST
My reproducer for this is a bit involved, but here goes:

$ virt-builder fedora-23
$ truncate -s 20G bigger.img
$ virt-resize fedora-23.img bigger.img
$ virt-rescue bigger.img
><rescue> pvcreate /dev/sda4
><rescue> vgcreate VG /dev/sda4
><rescue> lvcreate -L 2G -n LV1 VG
><rescue> lvcreate -L 2G -n LV2 VG
><rescue> lvcreate -L 2G -n LV3 VG
><rescue> exit

# The following command works as expected:
$ virt-inspector bigger.img

# Now we set the activationskip flag:
$ virt-rescue bigger.img
><rescue> lvchange -k y /dev/VG/LV1
><rescue> lvs -o lv_attr,lv_name,vg_name 
  Attr       LV   VG  
  -wi-a----k LV1  VG  <--- notice the 'k' flag
  -wi-a----- LV2  VG  
  -wi-a----- LV3  VG  
><rescue> exit

# Now the following command will fail:
$ virt-inspector bigger.img
libguestfs: error: internal_parse_mountable: internal_parse_mountable_stub: /dev/VG/LV1: No such file or directory
virt-inspector: no operating system could be detected inside this disk image.
Comment 4 Richard W.M. Jones 2016-02-12 08:44:56 EST
Patch posted:
https://www.redhat.com/archives/libguestfs/2016-February/msg00089.html
Comment 6 Fedora Update System 2016-02-12 12:50:30 EST
libguestfs-1.32.2-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-0a73d084ca
Comment 7 Fedora Update System 2016-02-12 16:26:17 EST
libguestfs-1.30.6-2.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2016-c491f221e5
Comment 8 Fedora Update System 2016-02-14 23:52:41 EST
libguestfs-1.30.6-2.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-c491f221e5
Comment 9 Fedora Update System 2016-02-15 00:24:36 EST
libguestfs-1.32.2-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-0a73d084ca
Comment 10 Fabian Deutsch 2016-02-17 03:23:32 EST
$ guestfish -a ovirt-node-ng-image.installed.qcow2

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

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

><fs> run
><fs> list-filesystems
/dev/sda1: unknown
/dev/sda2: ext4
/dev/centos_installed/ovirt-node-ng-1.0-0.0: ext4
/dev/centos_installed/ovirt-node-ng-1.0-0.0+1: ext4
/dev/centos_installed/root: ext4
/dev/centos_installed/swap: swap
/dev/centos_installed/var: ext4

This works for me.
Comment 11 Fabian Deutsch 2016-02-17 03:26:09 EST
In comment 10 there was actually no k used - but I rechecked with k=y and it works as well:

…
><fs> sh "lvchange -k y centos_installed/ovirt-node-ng-1.0-0.0"
  Logical volume "ovirt-node-ng-1.0-0.0" changed.

><fs> sh "lvs"
  LV                      VG               Attr       LSize  Pool   Origin                Data%  Meta%  Move Log Cpy%Sync Convert
  ovirt-node-ng-1.0-0.0   centos_installed Vwi-a-tz-k 14.50g pool00 root                  12.46                                  
  ovirt-node-ng-1.0-0.0+1 centos_installed Vwi-aotz-- 14.50g pool00 ovirt-node-ng-1.0-0.0 12.78                                  
  pool00                  centos_installed twi-aotz-- 14.52g                              15.33  8.72                            
  root                    centos_installed Vwi-a-tz-- 14.50g pool00                       12.46                                  
  swap                    centos_installed -wi-a-----  2.04g                                                                     
  var                     centos_installed Vwi-a-tz--  4.00g pool00                       6.23                                   

><fs> 


------------


$ guestfish -a ovirt-node-ng-image.installed.qcow2

Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

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

><fs> run
><fs> list-filesystems
/dev/sda1: unknown
/dev/sda2: ext4
/dev/centos_installed/ovirt-node-ng-1.0-0.0+1: ext4
/dev/centos_installed/root: ext4
/dev/centos_installed/swap: swap
/dev/centos_installed/var: ext4




/dev/centos_installed/ovirt-node-ng-1.0-0.0 is nto there, this is correct
Comment 12 Fedora Update System 2016-02-22 15:49:41 EST
libguestfs-1.30.6-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report.
Comment 13 Fedora Update System 2016-02-22 20:24:28 EST
libguestfs-1.32.2-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.

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