Merge remote-tracking branch 'origin/master' into merge-branch
[netvirt.git] / resources / openstack / bootvm.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2013 Cisco Systems, Inc.
4 #
5 # This program and the accompanying materials are made available under the
6 # terms of the Eclipse Public License v1.0 which accompanies this distribution,
7 # and is available at http://www.eclipse.org/legal/epl-v10.html
8 #
9 # Authors : Thomas Bachman
10
11 #
12 # Script for booting VMs onto networks
13 #
14
15 #defaults
16 vm=`hostname`
17 net=private
18 image=cirros-0.3.1-x86_64-uec
19
20 nova hypervisor-list
21 echo -n "Enter the hypervisor name to use for new instance [$vm]: "
22 read -a entry
23 if [ "$entry" != "" ]; then
24     vm=$entry
25 fi
26
27 neutron net-list
28 echo -n "Enter the name of the network to use for the VM [$net]: "
29 read -a entry
30 if [ "$entry" != "" ]; then
31     net=$entry
32 fi
33
34 nova image-list
35 echo -n "Enter the name of the image to use for the VM [$image]: "
36 read -a entry
37 if [ "$entry" != "" ]; then
38     image=$entry
39 fi
40
41 nova boot --flavor m1.tiny --image $(nova image-list | grep "$image\s" | awk '{print $2}') --nic net-id=$(neutron net-list | grep $net | awk '{print $2}') admin-private --availability_zone=nova:$vm