summaryrefslogtreecommitdiffstats
path: root/juju
diff options
context:
space:
mode:
authorNarinder Gupta <narinder.gupta@canonical.com>2016-10-18 23:46:09 -0500
committerNarinder Gupta <narinder.gupta@canonical.com>2016-10-18 23:53:55 -0500
commitc47f8b6275db5fe659aad4967ea024ac6e7b4146 (patch)
tree0c9e9c6eb902e8877d90163686daa1638700923a /juju
parent08aff60e052b5b697d8b4e53ef55c6827611999f (diff)
modfiied to convert the openstack commands from nova api to
openstack. Change-Id: Ie6a59f69509d72cbd466c6657ab1134778cf6454 Signed-off-by: Narinder Gupta <narinder.gupta@canonical.com>
Diffstat (limited to 'juju')
-rwxr-xr-xjuju/configure-juju-on-openstack22
-rwxr-xr-xjuju/joid-configure-openstack38
2 files changed, 25 insertions, 35 deletions
diff --git a/juju/configure-juju-on-openstack b/juju/configure-juju-on-openstack
index 6458e6c2..8040e821 100755
--- a/juju/configure-juju-on-openstack
+++ b/juju/configure-juju-on-openstack
@@ -31,24 +31,24 @@ source ~/joid_config/admin-openrc
associated=0
#Create a floating IP for the instance
-if ( nova list | grep jumpserver2 >/dev/null )
+if ( openstack server list | grep jumpserver2 >/dev/null )
then
associated=1
- FLOAT_IP="$(nova list | grep jumpserver2 | awk '{ print $13 }')"
+ FLOAT_IP="$(openstack server list | grep jumpserver2 | awk '{ print $13 }')"
else
FLOAT_IP="$(openstack ip floating create ext-net -c ip -f value)"
fi
#Launch an instance
-NET_UUID="$(nova net-list | grep private | awk '{ print $2 }')"
-IMAGE_UUID="$(nova image-list | grep "Xenial x86_64" | awk '{ print $2 }')"
-IMAGE_LXD_UUID="$(nova image-list | grep "Xenial LXC x86_64" | awk '{ print $2 }')"
-nova list | grep jumpserver2 ||nova boot --flavor m1.small --key-name default --image $IMAGE_UUID --nic net-id=$NET_UUID --security-group default jumpserver2
+NET_UUID="$(openstack network list | grep private | awk '{ print $2 }')"
+IMAGE_UUID="$(openstack image list | grep "Xenial x86_64" | awk '{ print $2 }')"
+IMAGE_LXD_UUID="$(openstack image list | grep "Xenial LXC x86_64" | awk '{ print $2 }')"
+openstack server list | grep jumpserver2 ||openstack server create --flavor m1.small --key-name default --image $IMAGE_UUID --nic net-id=$NET_UUID --security-group default jumpserver2
# checking jumpserver2 state until active ..
-INST_STATE=` nova show jumpserver2 | grep status | awk '{print $4}'`
+INST_STATE=` openstack server show jumpserver2 | grep status | awk '{print $4}'`
while [ $INST_STATE != "ACTIVE" ];
do
- INST_STATE=` nova show jumpserver2 | grep status | awk '{print $4}'`
+ INST_STATE=` openstack server show jumpserver2 | grep status | awk '{print $4}'`
echo "Jumpserver2 instance state is: "$INST_STATE" waiting to be active"
sleep 1
done
@@ -56,7 +56,7 @@ sleep 6
#Associate the floating IP with the new instance
if [ "$associated" -eq "0" ]; then
- nova floating-ip-associate jumpserver2 $FLOAT_IP || true
+ openstack ip floating add $FLOAT_IP jumpserver2 || true
sleep 90
fi
@@ -109,8 +109,8 @@ $SSH mkdir -p juju-meta
for s in precise trusty xenial win2012r2
do
#Create juju metadata
- IMAGE_UUID="$(nova image-list | grep -i "$s x86_64" | awk '{ print $2 }')"
- IMAGE_LXC_UUID="$(nova image-list | grep -i "$s LXC x86_64" | awk '{ print $2 }')"
+ IMAGE_UUID="$(openstack image list | grep -i "$s x86_64" | awk '{ print $2 }')"
+ IMAGE_LXC_UUID="$(openstack image list | grep -i "$s LXC x86_64" | awk '{ print $2 }')"
[ -n "$IMAGE_UUID" ] && $SSH "juju metadata generate-image -a amd64 -u $OS_AUTH_URL -i $IMAGE_UUID -r $OS_REGION_NAME -d juju-meta/ -s $s"
done
diff --git a/juju/joid-configure-openstack b/juju/joid-configure-openstack
index 1f3b8876..6c872521 100755
--- a/juju/joid-configure-openstack
+++ b/juju/joid-configure-openstack
@@ -62,43 +62,33 @@ neutron security-group-rule-list | grep "3389/tcp" > /dev/null 2>&1 || neutron s
echo "Uploading default SSH key"
#Upload a default SSH key
-nova keypair-list | grep default > /dev/null 2>&1 || nova keypair-add --pub-key ~/.ssh/id_rsa.pub default > /dev/null 2>&1
+openstack keypair list | grep default > /dev/null 2>&1 || openstack keypair create --public-key ~/.ssh/id_rsa.pub default > /dev/null 2>&1
echo "Modifying the flavors to be better sized for the Orange Box"
#Modify the flavours to fit better on the OB
#nova flavor-create FLAVOR_NAME FLAVOR_ID RAM_IN_MB ROOT_DISK_IN_GB NUMBER_OF_VCPUS
-nova flavor-delete m1.tiny > /dev/null 2>&1
-nova flavor-delete m1.small > /dev/null 2>&1
-nova flavor-delete m1.medium > /dev/null 2>&1
-nova flavor-delete m1.large > /dev/null 2>&1
-nova flavor-delete m1.xlarge > /dev/null 2>&1
-nova flavor-create --is-public true m1.tiny auto 512 5 1 > /dev/null 2>&1
-nova flavor-create --is-public true m1.small auto 1024 10 1 > /dev/null 2>&1
-nova flavor-create --is-public true m1.medium auto 2048 10 2 > /dev/null 2>&1
-nova flavor-create --is-public true m1.large auto 3072 10 2 > /dev/null 2>&1
-## need extra for windows image (15g)
-nova flavor-create --is-public true m1.xlarge auto 8096 30 4 > /dev/null 2>&1
+openstack flavor delete m1.tiny > /dev/null 2>&1
+openstack flavor delete m1.small > /dev/null 2>&1
+openstack flavor delete m1.medium > /dev/null 2>&1
+openstack flavor delete m1.large > /dev/null 2>&1
+openstack flavor delete m1.xlarge > /dev/null 2>&1
+openstack flavor create --ram 512 --disk 5 --vcpus 1 --public m1.tiny > /dev/null 2>&1
+openstack flavor create --ram 1024 --disk 10 --vcpus 1 --public m1.small > /dev/null 2>&1
+openstack flavor create --ram 2048 --disk 10 --vcpus 2 --public m1.medium > /dev/null 2>&1
+openstack flavor create --ram 3072 --disk 10 --vcpus 2 --public m1.large > /dev/null 2>&1
+# need extra for windows image (15g)
+openstack flavor create --ram 8096 --disk 30 --vcpus 4 --public m1.xlarge > /dev/null 2>&1
echo "modifying default quotas for admin user"
#Modify quotas for the tenant to allow large deployments
-nova quota-update --instances 400 $TENANT_ID
-nova quota-update --cores 800 $TENANT_ID
-nova quota-update --ram 404800 $TENANT_ID
-nova quota-update --security-groups 4000 $TENANT_ID
-nova quota-update --floating-ips -1 $TENANT_ID
-nova quota-update --security-group-rules -1 $TENANT_ID
+openstack quota set --instances 400 --cores 800 --ram 404800 --secgroups 4000 --floating-ips -1 --secgroup-rules -1 $TENANT_ID
### need to find how to change quota for the project not the tenant
### modify default quota the same way..
-nova quota-class-update --instances 400 $TENANT_ID
-nova quota-class-update --cores 800 $TENANT_ID
-nova quota-class-update --ram 404800 $TENANT_ID
-nova quota-class-update --security-groups 4000 $TENANT_ID
-nova quota-class-update --floating-ips -1 $TENANT_ID
-nova quota-class-update --security-group-rules -1 $TENANT_ID
+openstack quota set --class --instances 400 --cores 800 --ram 404800 --secgroups 4000 --floating-ips -1 --secgroup-rules -1 $TENANT_ID
echo "Uploading images to glance"