Skip to content

Commit

Permalink
Merge pull request #15 from sbates130272/dev/pool
Browse files Browse the repository at this point in the history
virt-install-ubuntu: Add create_pool() function
  • Loading branch information
sbates130272 committed Oct 31, 2022
2 parents 29d9a67 + 7cb66dc commit a63fa7a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libvirt/virt-install-ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,16 @@ EOF
cloud-localds -v --network-config=network-config-${NAME}.cfg \
${NAME}-seed.qcow2 cloud-config-${NAME}

create_pool() {
rc=0
`virsh pool-info $1 > /dev/null 2>&1` || rc=$?
if [[ $rc -ne 0 ]]; then
virsh pool-define-as $1 dir --target /var/lib/libvirt/images/
virsh pool-autostart $1
virsh pool-start $1
fi
}

remove_vol() {
rc=0
`virsh vol-info --pool default $1 > /dev/null 2>&1` || rc=$?
Expand All @@ -154,6 +164,8 @@ remove_vol() {
fi
}

create_pool default

remove_vol ${NAME}.qcow2
virsh vol-create-as default ${NAME}.qcow2 ${SIZE}G --format qcow2
virsh vol-upload --pool default ${NAME}.qcow2 ${NAME}.qcow2
Expand Down

0 comments on commit a63fa7a

Please sign in to comment.