The virsh network and volume pool made persistent

1. The network pool persistent and autostarted
2. The volume pool made persistent and autostarted
3. The vms are made autostarted

Change-Id: Ie6c66a1862e002c5cf7e2911a39dc051b50faab3
This commit is contained in:
Arijit Bose 2019-02-19 14:29:13 -06:00
parent 683dfc8190
commit 83fe3e1682
1 changed files with 9 additions and 4 deletions

View File

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