create-nodes failure for customised pool

Bug #1393304 reported by Leslie Wang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Leslie Wang

Bug Description

when setting LIBVIRT_VOL_POOL, such as "triple", create-nodes always report below failure

error: Failed to define pool tripleo
error: operation failed: Storage source conflict with pool: 'default'

Revision history for this message
Leslie Wang (wqyuwss) wrote :

I have below fix, please assign to me if it is appropriate.

diff --git a/scripts/create-nodes b/scripts/create-nodes
index f6cf35c..fba0b65 100755
--- a/scripts/create-nodes
+++ b/scripts/create-nodes
@@ -24,11 +24,19 @@ BRIDGE=${9:-""}

 LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"virtio"}
 LIBVIRT_VOL_POOL=${LIBVIRT_VOL_POOL:-"default"}
+LIBVIRT_VOL_POOL_DIR=${LIBVIRT_VOL_POOL:-"/var/lib/libvirt/images/"$LIBVIRT_VOL

 # define the default storage pool if its not there yet
-(virsh pool-list --all --persistent | grep -q $LIBVIRT_VOL_POOL) || (
- virsh pool-define-as --name $LIBVIRT_VOL_POOL dir --target /var/lib/libvirt/im
+if [ virsh pool-list --all --persistent | grep -q $LIBVIRT_VOL_POOL ]; then
+ if [ ! -d $LIBVIRT_VOL_POOL_DIR ]; then
+ sudo mkdir $LIBVIRT_VOL_POOL_DIR
+ fi
+ virsh pool-define-as --name $LIBVIRT_VOL_POOL dir --target $LIBVIRT_VOL_POOL_
+ virsh pool-autostart $LIBVIRT_VOL_POOL >& 2
+ virsh pool-start $LIBVIRT_VOL_POOL >& 2
+fi

Revision history for this message
Leslie Wang (wqyuwss) wrote :

small modification. Change should be

diff --git a/scripts/create-nodes b/scripts/create-nodes
index f6cf35c..51e9c4f 100755
--- a/scripts/create-nodes
+++ b/scripts/create-nodes
@@ -24,10 +24,18 @@ BRIDGE=${9:-""}

 LIBVIRT_NIC_DRIVER=${LIBVIRT_NIC_DRIVER:-"virtio"}
 LIBVIRT_VOL_POOL=${LIBVIRT_VOL_POOL:-"default"}
+LIBVIRT_VOL_POOL_DIR=${LIBVIRT_VOL_POOL_DIR:-"/var/lib/libvirt/images/$LIBVIRT_

 # define the default storage pool if its not there yet
-(virsh pool-list --all --persistent | grep -q $LIBVIRT_VOL_POOL) || (
- virsh pool-define-as --name $LIBVIRT_VOL_POOL dir --target /var/lib/libvirt/im
+if [ ! `virsh pool-list --all --persistent | grep -q $LIBVIRT_VOL_POOL` ]; then
+ if [ ! -d $LIBVIRT_VOL_POOL_DIR ]; then
+ sudo mkdir $LIBVIRT_VOL_POOL_DIR
+ sudo chmod 766 $LIBVIRT_VOL_POOL_DIR
+ fi
+ virsh pool-define-as --name $LIBVIRT_VOL_POOL dir --target $LIBVIRT_VOL_POOL_
+ virsh pool-autostart $LIBVIRT_VOL_POOL >& 2
+ virsh pool-start $LIBVIRT_VOL_POOL >& 2
+fi

Revision history for this message
James Polley (tchaypo) wrote :

Thanks Leslie

I've assigned the bug to you. Please feel free to ping people in #tripleo if you have trouble getting the patch submitted to gerrit.

Changed in tripleo:
assignee: nobody → Leslie Wang (wqyuwss)
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Michele Baldessari (michele) wrote :

This was fixed via Change-Id: I85d51457fbd8b747f55091f3ecdc6ca921b70b84

Changed in tripleo:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.