From c7b95f1cdee6d3df0577664ea511a746968add4a Mon Sep 17 00:00:00 2001
From: Narinder Gupta <narinder.gupta@canonical.com>
Date: Fri, 1 Sep 2017 17:30:42 -0500
Subject: modified to autostart the VMs created for bootstrap and virtual
 deployment.

Change-Id: I7afcc6e382f7575fbd2741cded3915763aafe6f6
Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
---
 ci/03-maasdeploy.sh      |  4 ++++
 ci/deploy.sh             | 14 +++++++++++++-
 ci/nosdn/fetch-charms.sh |  3 +++
 ci/openstack.sh          |  2 ++
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/ci/03-maasdeploy.sh b/ci/03-maasdeploy.sh
index 988ea839..668eab91 100755
--- a/ci/03-maasdeploy.sh
+++ b/ci/03-maasdeploy.sh
@@ -450,6 +450,8 @@ addnodes(){
         done
     fi
     virsh -c $VIRSHURL define --file bootstrap
+    virsh -c $VIRSHURL autostart bootstrap
+
     rm -f bootstrap
 
     sleep 60
@@ -476,6 +478,8 @@ addnodes(){
 
             nodemac=`grep  "mac address" $NODE_NAME | head -1 | cut -d '"' -f 2`
             virsh -c $VIRSHURL define --file $NODE_NAME
+            virsh -c $VIRSHURL autostart $NODE_NAME
+
             rm -f $NODE_NAME
             maas $PROFILE machines create autodetect_nodegroup='yes' name=$NODE_NAME \
                 tags='control compute' hostname=$NODE_NAME power_type='virsh' mac_addresses=$nodemac \
diff --git a/ci/deploy.sh b/ci/deploy.sh
index 85374e75..b722d2ae 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -136,6 +136,17 @@ createresource() {
     API_KEY=`sudo maas-region apikey --username=ubuntu`
     maas login $PROFILE $API_SERVER $API_KEY
 
+   # if we have a virshurl configuration we use it, else we use local
+    VIRSHURL=$(cat labconfig.json | jq -r '.opnfv.virshurl')
+    if ([ $VIRSHURL == "" ] || [ "$VIRSHURL" == "null" ]); then
+        VIRSHIP=$MAAS_IP
+        VIRSHURL="qemu+ssh://$USER@$VIRSHIP/system "
+        VIRSHHOST=""
+    else
+        VIRSHHOST=$(echo $VIRSHURL| cut -d\/ -f 3 | cut -d@ -f2)
+        VIRSHIP=""  # TODO: parse from $VIRSHURL if needed
+    fi
+
     for node in node3-control node4-control
     do
         node_id=$(maas $PROFILE machines read | \
@@ -149,7 +160,7 @@ createresource() {
                 --boot network,hd,menu=off \
                 --noautoconsole --vnc --print-xml | tee _node.xml
             node_mac=$(grep "mac address" _node.xml | head -1 | cut -d "'" -f 2)
-            sudo virsh -c qemu:///system define --file _node.xml
+            sudo virsh -c $VIRSHURL define --file _node.xml
             rm -f _node.xml
 
             maas $PROFILE nodes new autodetect_nodegroup='yes' name=$node \
@@ -157,6 +168,7 @@ createresource() {
                 mac_addresses=$node3controlmac \
                 power_parameters_power_address="qemu+ssh://$USER@192.168.122.1/system" \
                 architecture='amd64/generic' power_parameters_power_id='node3-control'
+            sudo virsh -c $VIRSHURL autostart $node
             node_id=$(maas $PROFILE machines read | \
                   jq -r ".[] | select(.hostname == \"$node\").system_id")
         fi
diff --git a/ci/nosdn/fetch-charms.sh b/ci/nosdn/fetch-charms.sh
index 10b492af..e5180af7 100755
--- a/ci/nosdn/fetch-charms.sh
+++ b/ci/nosdn/fetch-charms.sh
@@ -18,6 +18,9 @@ git clone https://github.com/openstack/charm-ceilometer-agent.git $distro/ceilom
 git clone https://github.com/openstack/charm-ceph-mon.git $distro/ceph-mon
 git clone https://github.com/openstack/charm-ceph-osd.git $distro/ceph-osd
 git clone https://github.com/openstack/charm-ceph-radosgw.git $distro/ceph-radosgw
+cd $distro/ceph-radosgw
+git pull https://git.openstack.org/openstack/charm-ceph-radosgw refs/changes/05/500205/1
+cd ../../
 git clone https://github.com/openstack/charm-cinder.git $distro/cinder
 git clone https://github.com/openstack/charm-cinder-ceph.git $distro/cinder-ceph
 git clone https://github.com/openstack/charm-glance.git $distro/glance
diff --git a/ci/openstack.sh b/ci/openstack.sh
index 9d7b7857..55f8186f 100755
--- a/ci/openstack.sh
+++ b/ci/openstack.sh
@@ -138,6 +138,8 @@ export OS_PROJECT_NAME=$3
 export OS_PASSWORD=$2
 export OS_IDENTITY_API_VERSION=3
 export OS_REGION_NAME=$5
+#export OS_INSECURE=true
+#export OS_CASSL=~/joid_config/ca.pem
 EOF
 }
 
-- 
cgit 1.2.3-korg