Merge "The virsh network and volume pool made persistent"

This commit is contained in:
Zuul 2019-02-21 16:42:56 +00:00 committed by Gerrit Code Review
commit 564c262065
1 changed files with 9 additions and 4 deletions

View File

@ -96,7 +96,9 @@ net_clean() {
net_declare() { net_declare() {
if ! virsh net-list --name | grep ^airship_gate$ > /dev/null; then if ! virsh net-list --name | grep ^airship_gate$ > /dev/null; then
log Creating Airship gate network log Creating Airship gate network
virsh net-create "${XML_DIR}/network.xml" &>> "${LOG_FILE}" virsh net-define "${XML_DIR}/network.xml" &>> "${LOG_FILE}"
virsh net-start airship_gate
virsh net-autostart airship_gate
fi fi
} }
@ -104,7 +106,9 @@ pool_declare() {
log Validating virsh pool setup log Validating virsh pool setup
if ! virsh pool-uuid "${VIRSH_POOL}" &> /dev/null; then if ! virsh pool-uuid "${VIRSH_POOL}" &> /dev/null; then
log Creating pool "${VIRSH_POOL}" log Creating pool "${VIRSH_POOL}"
virsh pool-create-as --name "${VIRSH_POOL}" --type dir --target "${VIRSH_POOL_PATH}" &>> "${LOG_FILE}" virsh pool-define-as --name "${VIRSH_POOL}" --type dir --target "${VIRSH_POOL_PATH}" &>> "${LOG_FILE}"
virsh pool-start "${VIRSH_POOL}"
virsh pool-autostart "${VIRSH_POOL}"
fi fi
} }
@ -166,8 +170,8 @@ vm_create() {
--disk "vol=${VIRSH_POOL}/cloud-init-${NAME}.iso,device=cdrom" &>> "${LOG_FILE}" --disk "vol=${VIRSH_POOL}/cloud-init-${NAME}.iso,device=cdrom" &>> "${LOG_FILE}"
ssh_wait "${NAME}" ssh_wait "${NAME}"
ssh_cmd "${NAME}" cloud-init status --wait ssh_cmd "${NAME}" cloud-init status --wait
ssh_cmd "${NAME}" sync ssh_cmd "${NAME}" sync
else else
log Creating VM "${NAME}" log Creating VM "${NAME}"
@ -184,6 +188,7 @@ vm_create() {
--import \ --import \
--disk "vol=${VIRSH_POOL}/airship-gate-${NAME}.img,${DISK_OPTS}" &>> "${LOG_FILE}" --disk "vol=${VIRSH_POOL}/airship-gate-${NAME}.img,${DISK_OPTS}" &>> "${LOG_FILE}"
fi fi
virsh autostart "${NAME}"
} }
vm_create_validate() { vm_create_validate() {