From: Aline Manera <alinefm(a)br.ibm.com>
While trying to extend a logical pool I got the following error message:
"/dev/vdb is not a valid disk/partition. Could not add it to the pool
my-logical-pool"
But the same partition "/dev/vdb" is listed on GET /host/partitions.
Then I realized the "blkid" is not the correct command to check a
partition exists for raw disks.
From blkid man page:
It can determine the type of content (e.g.
filesystem or swap) that a block
device holds, and also attributes (tokens, NAME=value pairs) from the
content metadata (e.g. LABEL or UUID fields).
Which is not useful for a raw disk.
From lsblk man page:
lsblk lists information about all or
the specified block devices.
So use "lsblk" command instead of "blkid" to verify the disk exists
in
the system.
Signed-off-by: Aline Manera <alinefm(a)br.ibm.com>
---
src/kimchi/model/storagepools.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py
index 76ab2d6..d012ca9 100644
--- a/src/kimchi/model/storagepools.py
+++ b/src/kimchi/model/storagepools.py
@@ -254,7 +254,7 @@ class StoragePoolModel(object):
def _update_lvm_disks(self, pool_name, disks):
# check if all the disks/partitions exists in the host
for disk in disks:
- blkid_cmd = ['blkid', disk]
+ blkid_cmd = ['lsblk', disk]
output, error, returncode = run_command(blkid_cmd)
if returncode != 0:
kimchi_log.error('%s is not a valid disk/partition. Could not '
@@ -281,6 +281,7 @@ class StoragePoolModel(object):
pool.setAutostart(1)
else:
pool.setAutostart(0)
+
if 'disks' in params:
# check if pool is type 'logical'
xml = pool.XMLDesc(0)
--
1.7.10.4