[libvirt] [PATCHv2] Ignore thin pool LVM devices.

This should resolve: https://bugzilla.redhat.com/show_bug.cgi?id=924672 For BZ 924672 the problem stems from the fact that thin pool logical volume devices show up in /sbin/lvs output just like normal logical volumes do. Libvirt incorrectly assumes they are just normal logical volumes and that they will have a corresponding /dev/vgname/lvname device that has been created by udev and tries to use this device. To illustrate here is an example of the /dev/vgname/ directory and the lvs output for a normal lv, thin lv, and thin pool: LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert lv vgguests -wi-a---- 1.00g pool vgguests twi-a-tz- 11.00g 0.00 thinlv vgguests Vwi-a-tz- 1.00g pool 0.00 total 0 lrwxrwxrwx. 1 root root 7 Oct 8 19:35 lv -> ../dm-7 lrwxrwxrwx. 1 root root 7 Oct 8 19:37 thinlv -> ../dm-6 This patch modifies virStorageBackendLogicalMakeVol() to ignore thin pool devices. --- src/storage/storage_backend_logical.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index a1a37a1..81ee4a4 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -85,6 +85,14 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool, if (attrs[4] != 'a') return 0; + /* + * Skip thin pools(t). These show up in normal lvs output + * but do not have a corresponding /dev/$vg/$lv device that + * is created by udev. This breaks assumptions in later code. + */ + if (attrs[0] == 't') + return 0; + /* See if we're only looking for a specific volume */ if (data != NULL) { vol = data; -- 1.8.3.1

On 10/08/2013 11:51 PM, Dusty Mabe wrote:
This should resolve:
https://bugzilla.redhat.com/show_bug.cgi?id=924672
For BZ 924672 the problem stems from the fact that thin pool logical volume devices show up in /sbin/lvs output just like normal logical volumes do. Libvirt incorrectly assumes they are just normal logical volumes and that they will have a corresponding /dev/vgname/lvname device that has been created by udev and tries to use this device.
To illustrate here is an example of the /dev/vgname/ directory and the lvs output for a normal lv, thin lv, and thin pool:
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert lv vgguests -wi-a---- 1.00g pool vgguests twi-a-tz- 11.00g 0.00 thinlv vgguests Vwi-a-tz- 1.00g pool 0.00 total 0 lrwxrwxrwx. 1 root root 7 Oct 8 19:35 lv -> ../dm-7 lrwxrwxrwx. 1 root root 7 Oct 8 19:37 thinlv -> ../dm-6
This patch modifies virStorageBackendLogicalMakeVol() to ignore thin pool devices.
--- src/storage/storage_backend_logical.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index a1a37a1..81ee4a4 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -85,6 +85,14 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool, if (attrs[4] != 'a') return 0;
+ /* + * Skip thin pools(t). These show up in normal lvs output + * but do not have a corresponding /dev/$vg/$lv device that + * is created by udev. This breaks assumptions in later code. + */ + if (attrs[0] == 't') + return 0; + /* See if we're only looking for a specific volume */ if (data != NULL) { vol = data;
ACK (but I'll let someone else ACK and push since I haven't historically pushed contributer patches) - Cole

On 10/09/2013 08:26 AM, Cole Robinson wrote:
On 10/08/2013 11:51 PM, Dusty Mabe wrote:
This should resolve:
https://bugzilla.redhat.com/show_bug.cgi?id=924672
For BZ 924672 the problem stems from the fact that thin pool logical volume devices show up in /sbin/lvs output just like normal logical volumes do. Libvirt incorrectly assumes they are just normal logical volumes and that they will have a corresponding /dev/vgname/lvname device that has been created by udev and tries to use this device.
To illustrate here is an example of the /dev/vgname/ directory and the lvs output for a normal lv, thin lv, and thin pool:
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert lv vgguests -wi-a---- 1.00g pool vgguests twi-a-tz- 11.00g 0.00 thinlv vgguests Vwi-a-tz- 1.00g pool 0.00 total 0 lrwxrwxrwx. 1 root root 7 Oct 8 19:35 lv -> ../dm-7 lrwxrwxrwx. 1 root root 7 Oct 8 19:37 thinlv -> ../dm-6
This patch modifies virStorageBackendLogicalMakeVol() to ignore thin pool devices.
--- src/storage/storage_backend_logical.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index a1a37a1..81ee4a4 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -85,6 +85,14 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool, if (attrs[4] != 'a') return 0;
+ /* + * Skip thin pools(t). These show up in normal lvs output + * but do not have a corresponding /dev/$vg/$lv device that + * is created by udev. This breaks assumptions in later code. + */ + if (attrs[0] == 't') + return 0; + /* See if we're only looking for a specific volume */ if (data != NULL) { vol = data;
ACK
I've pushed this now. - Cole
participants (2)
-
Cole Robinson
-
Dusty Mabe