From c1fdaf8a80199d91b73abd54a43f1662667035cb Mon Sep 17 00:00:00 2001 From: Narinder Gupta Date: Fri, 11 Dec 2015 14:53:21 -0600 Subject: [PATCH] added support for virtual environment with KVM. Where installer will cerate two VMs along with bootstrap and MAAS and add into MAAS for further deployment. Change-Id: Ideb7b8ab2f46ddebc0abb05391bddf3c8bac8881 --- ci/02-maasdeploy.sh | 41 ++++++++++++++++++++++++++++++++++++-- ci/nosdn/01-deploybundle.sh | 9 +++++++++ ci/odl/01-deploybundle.sh | 10 ++++++++-- ci/opencontrail/01-deploybundle.sh | 10 ++++++++++ 4 files changed, 66 insertions(+), 4 deletions(-) diff --git a/ci/02-maasdeploy.sh b/ci/02-maasdeploy.sh index 9536eaa3..0fb88bbb 100755 --- a/ci/02-maasdeploy.sh +++ b/ci/02-maasdeploy.sh @@ -2,6 +2,8 @@ #placeholder for deployment script. set -ex +virtinstall=0 + case "$1" in 'intelpod5' ) cp maas/intel/pod5/deployment.yaml ./deployment.yaml @@ -19,6 +21,7 @@ case "$1" in cp maas/juniper/pod1/deployment.yaml ./deployment.yaml ;; * ) + virtinstall=1 cp maas/default/deployment.yaml ./deployment.yaml ;; esac @@ -47,6 +50,16 @@ sudo apt-get install openssh-server git maas-deployer juju juju-deployer maas-cl juju init -f cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys + +if [ $virtinstall ]; then + sudo virsh net-dumpxml default > default-net-org.xml + sudo sed -i '/dhcp/d' default-net-org.xml + sudo sed -i '/range/d' default-net-org.xml + sudo virsh net-define default-net-org.xml + sudo virsh net-destroy default + sudo virsh net-start default +fi + sudo maas-deployer -c deployment.yaml -d --force sudo chown $USER:$USER environments.yaml @@ -60,9 +73,33 @@ maas maas boot-source update 1 url="http://maas.ubuntu.com/images/ephemeral-v2/d #maas maas boot-source-selections create 1 os="ubuntu" release="precise" arches="amd64" subarches="*" labels="*" maas maas boot-resources import maas maas sshkeys new key="`cat $HOME/.ssh/id_rsa.pub`" -#maas maas sshkeys new key="`cat $HOME/.ssh/id_maas.pub`" + +#adding compute and control nodes VM to MAAS for deployment purpose. +if [ $virtinstall ]; then + # create two more VMs to do the deployment. + sudo virt-install --connect qemu:///system --name node1-control --ram 8192 --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node1-control + + sudo virt-install --connect qemu:///system --name node2-compute --ram 8192 --vcpus 4 --disk size=120,format=qcow2,bus=virtio,io=native,pool=default --network bridge=virbr0,model=virtio --boot network,hd,menu=off --noautoconsole --vnc --print-xml | tee node2-compute + + node1controlmac=`grep "mac address" node1-control | cut -d "'" -f 2` + node2computemac=`grep "mac address" node2-compute | cut -d "'" -f 2` + + sudo virsh -c qemu:///system define --file node1-control + sudo virsh -c qemu:///system define --file node2-compute + + maas maas tags new name='control' + maas maas tags new name='compute' + + controlnodeid=`maas maas nodes new autodetect_nodegroup='yes' name='node1-control' tags='control' hostname='node1-control' power_type='virsh' mac_addresses=$node1controlmac power_parameters_power_address='qemu+ssh://ubuntu@192.168.122.1/system' architecture='amd64/generic' power_parameters_power_id='node1-control' | grep system_id | cut -d '"' -f 4 ` + + maas maas tag update-nodes control add=$controlnodeid + + computenodeid=`maas maas nodes new autodetect_nodegroup='yes' name='node2-compute' tags='compute' hostname='node2-compute' power_type='virsh' mac_addresses=$node2computemac power_parameters_power_address='qemu+ssh://ubuntu@192.168.122.1/system' architecture='amd64/generic' power_parameters_power_id='node2-compute' | grep system_id | cut -d '"' -f 4 ` + + maas maas tag update-nodes compute add=$computenodeid + +fi #echo "... Deployment of opnfv release Started ...." #python deploy.py $maas_ip -#echo "... Deployment of opnfv release finished ...." diff --git a/ci/nosdn/01-deploybundle.sh b/ci/nosdn/01-deploybundle.sh index fb3c8143..a945050b 100755 --- a/ci/nosdn/01-deploybundle.sh +++ b/ci/nosdn/01-deploybundle.sh @@ -61,11 +61,20 @@ case "$3" in cp maas/att/virpod1/interfaces.host trusty/ubuntu-nodes-compute/network/interfaces.host cp maas/att/virpod1/lxc-add-more-interfaces trusty/ubuntu-nodes-controller/lxc/add-more-interfaces cp maas/att/virpod1/lxc-add-more-interfaces trusty/ubuntu-nodes-compute/lxc/add-more-interfaces + # As virtual environment does not need special treatment for interfaces. + sed -i -- 's/local:trusty\/ubuntu-nodes-controller/cs:trusty\/ubuntu/g' ./bundles.yaml + sed -i -- 's/local:trusty\/ubuntu-nodes-compute/cs:trusty\/ubuntu/g' ./bundles.yaml # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20 sed -i -- 's/10.4.1.1/192.168.10.1/g' ./bundles.yaml # Choose the external port to go out from gateway to use. sed -i -- 's/# "ext-port": "eth1"/ "ext-port": "eth1"/g' ./bundles.yaml ;; + 'default' ) + sed -i -- 's/local:trusty\/ubuntu-nodes-controller/cs:trusty\/ubuntu/g' ./bundles.yaml + sed -i -- 's/local:trusty\/ubuntu-nodes-compute/cs:trusty\/ubuntu/g' ./bundles.yaml + sed -i -- 's/10.4.1.1/192.168.122.1/g' ./bundles.yaml +# sed -i -- 's/# "ext-port": "eth1"/ "ext-port": "eth1"/g' ./bundles.yaml + ;; esac echo "... Deployment Started ...." diff --git a/ci/odl/01-deploybundle.sh b/ci/odl/01-deploybundle.sh index 19101257..cb42e00a 100755 --- a/ci/odl/01-deploybundle.sh +++ b/ci/odl/01-deploybundle.sh @@ -62,13 +62,19 @@ case "$3" in cp maas/att/virpod1/lxc-add-more-interfaces trusty/ubuntu-nodes-controller/lxc/add-more-interfaces cp maas/att/virpod1/lxc-add-more-interfaces trusty/ubuntu-nodes-compute/lxc/add-more-interfaces # As virtual environment does not need special treatment for interfaces. - sed -i -- 's/ubuntu-nodes-controller/ubuntu/g' ./bundles.yaml - sed -i -- 's/ubuntu-nodes-compute/ubuntu/g' ./bundles.yaml + sed -i -- 's/local:trusty\/ubuntu-nodes-controller/cs:trusty\/ubuntu/g' ./bundles.yaml + sed -i -- 's/local:trusty\/ubuntu-nodes-compute/cs:trusty\/ubuntu/g' ./bundles.yaml # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20 sed -i -- 's/10.4.1.1/192.168.10.1/g' ./bundles.yaml # Choose the external port to go out from gateway to use. sed -i -- 's/# "ext-port": "eth1"/ "ext-port": "eth1"/g' ./bundles.yaml ;; + 'default' ) + sed -i -- 's/local:trusty\/ubuntu-nodes-controller/cs:trusty\/ubuntu/g' ./bundles.yaml + sed -i -- 's/local:trusty\/ubuntu-nodes-compute/cs:trusty\/ubuntu/g' ./bundles.yaml + sed -i -- 's/10.4.1.1/192.168.122.1/g' ./bundles.yaml +# sed -i -- 's/# "ext-port": "eth1"/ "ext-port": "eth1"/g' ./bundles.yaml + ;; esac echo "... Deployment Started ...." diff --git a/ci/opencontrail/01-deploybundle.sh b/ci/opencontrail/01-deploybundle.sh index 90f43a9a..b105fa1d 100755 --- a/ci/opencontrail/01-deploybundle.sh +++ b/ci/opencontrail/01-deploybundle.sh @@ -61,11 +61,21 @@ case "$3" in cp maas/att/virpod1/interfaces.host trusty/ubuntu-nodes-compute/network/interfaces.host cp maas/att/virpod1/lxc-add-more-interfaces trusty/ubuntu-nodes-controller/lxc/add-more-interfaces cp maas/att/virpod1/lxc-add-more-interfaces trusty/ubuntu-nodes-compute/lxc/add-more-interfaces + # As virtual environment does not need special treatment for interfaces. + sed -i -- 's/local:trusty\/ubuntu-nodes-controller/cs:trusty\/ubuntu/g' ./bundles.yaml + sed -i -- 's/local:trusty\/ubuntu-nodes-compute/cs:trusty\/ubuntu/g' ./bundles.yaml # As per your lab vip address list be deafult uses 10.4.1.11 - 10.4.1.20 sed -i -- 's/10.4.1.1/192.168.10.1/g' ./bundles.yaml # Choose the external port to go out from gateway to use. sed -i -- 's/# "ext-port": "eth1"/ "ext-port": "eth1"/g' ./bundles.yaml ;; + 'default' ) + sed -i -- 's/local:trusty\/ubuntu-nodes-controller/cs:trusty\/ubuntu/g' ./bundles.yaml + sed -i -- 's/local:trusty\/ubuntu-nodes-compute/cs:trusty\/ubuntu/g' ./bundles.yaml + sed -i -- 's/10.4.1.1/192.168.122.1/g' ./bundles.yaml +# sed -i -- 's/# "ext-port": "eth1"/ "ext-port": "eth1"/g' ./bundles.yaml + ;; + esac echo "... Deployment Started ...." -- 2.16.6