Browse Source

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
changes/91/637991/4
Arijit Bose 3 months ago
parent
commit
83fe3e1682
1 changed files with 9 additions and 4 deletions
  1. 9
    4
      tools/multi_nodes_gate/airship_gate/lib/virsh.sh

+ 9
- 4
tools/multi_nodes_gate/airship_gate/lib/virsh.sh View File

@@ -96,7 +96,9 @@ net_clean() {
96 96
 net_declare() {
97 97
     if ! virsh net-list --name | grep ^airship_gate$ > /dev/null; then
98 98
         log Creating Airship gate network
99
-        virsh net-create "${XML_DIR}/network.xml" &>> "${LOG_FILE}"
99
+        virsh net-define "${XML_DIR}/network.xml" &>> "${LOG_FILE}"
100
+        virsh net-start airship_gate
101
+        virsh net-autostart airship_gate
100 102
     fi
101 103
 }
102 104
 
@@ -104,7 +106,9 @@ pool_declare() {
104 106
     log Validating virsh pool setup
105 107
     if ! virsh pool-uuid "${VIRSH_POOL}" &> /dev/null; then
106 108
         log Creating pool "${VIRSH_POOL}"
107
-        virsh pool-create-as --name "${VIRSH_POOL}" --type dir --target "${VIRSH_POOL_PATH}" &>> "${LOG_FILE}"
109
+        virsh pool-define-as --name "${VIRSH_POOL}" --type dir --target "${VIRSH_POOL_PATH}" &>> "${LOG_FILE}"
110
+        virsh pool-start "${VIRSH_POOL}"
111
+        virsh pool-autostart "${VIRSH_POOL}"
108 112
     fi
109 113
 }
110 114
 
@@ -166,8 +170,8 @@ vm_create() {
166 170
             --disk "vol=${VIRSH_POOL}/cloud-init-${NAME}.iso,device=cdrom" &>> "${LOG_FILE}"
167 171
 
168 172
         ssh_wait "${NAME}"
169
-	ssh_cmd "${NAME}" cloud-init status --wait
170
-	ssh_cmd "${NAME}" sync
173
+        ssh_cmd "${NAME}" cloud-init status --wait
174
+        ssh_cmd "${NAME}" sync
171 175
 
172 176
     else
173 177
         log Creating VM "${NAME}"
@@ -184,6 +188,7 @@ vm_create() {
184 188
             --import \
185 189
             --disk "vol=${VIRSH_POOL}/airship-gate-${NAME}.img,${DISK_OPTS}" &>> "${LOG_FILE}"
186 190
     fi
191
+    virsh autostart "${NAME}"
187 192
 }
188 193
 
189 194
 vm_create_validate() {

Loading…
Cancel
Save