diff --git a/tools/deployment/common/heat-basic-vm-deployment.yaml b/tools/deployment/common/heat-basic-vm-deployment.yaml index 0fda03e1cf..18c246c6a8 100644 --- a/tools/deployment/common/heat-basic-vm-deployment.yaml +++ b/tools/deployment/common/heat-basic-vm-deployment.yaml @@ -1,4 +1,4 @@ -heat_template_version: '2016-10-14' +heat_template_version: '2021-04-16' parameters: public_net: @@ -15,10 +15,10 @@ parameters: cidr: type: string - default: 10.11.11.0/24 + default: 192.168.128.0/24 dns_nameserver: - type: comma_delimited_list + type: string description: address of a dns nameserver reachable in your environment default: 8.8.8.8 @@ -30,26 +30,56 @@ parameters: - enabled - disabled + is_ubuntu: + type: string + default: "false" + constraints: + - allowed_values: + - "true" + - "false" + conditions: dpdk_enable: {equals: [{get_param: dpdk}, "enabled"]} + is_ubuntu: {equals: [{get_param: is_ubuntu}, "true"]} resources: flavor: type: OS::Nova::Flavor properties: - disk: 1 - ram: 128 - vcpus: 1 + disk: 3 + ram: 1024 + vcpus: 2 flavor_dpdk: type: OS::Nova::Flavor properties: - disk: 1 + disk: 3 ram: 2048 - vcpus: 1 + vcpus: 2 extra_specs: "hw:mem_page_size": "2MB" + ubuntu_cloud_config: + type: OS::Heat::CloudConfig + properties: + cloud_config: + package_update: true + packages: + - iputils-ping + write_files: + - path: /etc/resolv.conf + content: + str_replace: + template: | + nameserver $nameserver + params: + $nameserver: {get_param: dns_nameserver} + owner: root:root + permissions: '0644' + runcmd: + - systemctl stop systemd-resolved + - systemctl disable systemd-resolved + server: type: OS::Nova::Server properties: @@ -62,6 +92,7 @@ resources: - port: get_resource: server_port user_data_format: RAW + user_data: {if: [is_ubuntu, {get_resource: ubuntu_cloud_config}, ""]} router: type: OS::Neutron::Router @@ -89,7 +120,7 @@ resources: cidr: get_param: cidr dns_nameservers: - get_param: dns_nameserver + - {get_param: dns_nameserver} port_security_group: type: OS::Neutron::SecurityGroup diff --git a/tools/deployment/common/heat-subnet-pool-deployment.yaml b/tools/deployment/common/heat-subnet-pool-deployment.yaml index dc8aac5e68..71952ee905 100644 --- a/tools/deployment/common/heat-subnet-pool-deployment.yaml +++ b/tools/deployment/common/heat-subnet-pool-deployment.yaml @@ -8,7 +8,7 @@ parameters: subnet_pool_prefixes: type: comma_delimited_list default: - - 10.0.0.0/8 + - 192.168.128.0/20 subnet_pool_default_prefix_length: type: number diff --git a/tools/deployment/common/use-it.sh b/tools/deployment/common/use-it.sh index 080b4d3ba4..a0097c0b31 100755 --- a/tools/deployment/common/use-it.sh +++ b/tools/deployment/common/use-it.sh @@ -51,7 +51,7 @@ openstack stack show "heat-public-net-deployment" || \ -t ${HEAT_DIR}/heat-public-net-deployment.yaml \ heat-public-net-deployment -: ${OSH_PRIVATE_SUBNET_POOL:="10.0.0.0/8"} +: ${OSH_PRIVATE_SUBNET_POOL:="192.168.128.0/20"} : ${OSH_PRIVATE_SUBNET_POOL_NAME:="shared-default-subnetpool"} : ${OSH_PRIVATE_SUBNET_POOL_DEF_PREFIX:="24"} openstack stack show "heat-subnet-pool-deployment" || \ @@ -64,16 +64,19 @@ openstack stack show "heat-subnet-pool-deployment" || \ : ${OSH_EXT_NET_NAME:="public"} : ${OSH_VM_KEY_STACK:="heat-vm-key"} -: ${OSH_PRIVATE_SUBNET:="10.0.0.0/24"} -# NOTE(portdirect): We do this fancy, and seemingly pointless, footwork to get -# the full image name for the cirros Image without having to be explicit. -IMAGE_NAME=$(openstack image show -f value -c name \ - $(openstack image list -f csv | awk -F ',' '{ print $2 "," $1 }' | \ - grep "^\"Cirros" | head -1 | awk -F ',' '{ print $2 }' | tr -d '"')) +: ${OSH_PRIVATE_SUBNET:="192.168.128.0/24"} + + +if [[ ${USE_UBUNTU_IMAGE:="false"} == "true" ]]; then + IMAGE_ID=$(openstack image list -f value | grep -i "ubuntu" | head -1 | awk '{ print $1 }') + IMAGE_USER=ubuntu +else + IMAGE_ID=$(openstack image list -f value | grep -i "cirros" | head -1 | awk '{ print $1 }') + IMAGE_USER=cirros +fi # Setup SSH Keypair in Nova mkdir -p ${SSH_DIR} - openstack keypair show "${OSH_VM_KEY_STACK}" || \ openstack keypair create --private-key ${SSH_DIR}/osh_key ${OSH_VM_KEY_STACK} sudo chown $(id -un) ${SSH_DIR}/osh_key @@ -82,7 +85,8 @@ chmod 600 ${SSH_DIR}/osh_key openstack stack show "heat-basic-vm-deployment" || \ openstack stack create --wait \ --parameter public_net=${OSH_EXT_NET_NAME} \ - --parameter image="${IMAGE_NAME}" \ + --parameter image="${IMAGE_ID}" \ + --parameter is_ubuntu=${USE_UBUNTU_IMAGE} \ --parameter ssh_key=${OSH_VM_KEY_STACK} \ --parameter cidr=${OSH_PRIVATE_SUBNET} \ --parameter dns_nameserver=${OSH_BR_EX_ADDR%/*} \ @@ -102,51 +106,52 @@ INSTANCE_ID=$(openstack stack output show \ openstack server show ${INSTANCE_ID} -function wait_for_ssh_port { - # Default wait timeout is 300 seconds - set +x - end=$(date +%s) - if ! [ -z $2 ]; then - end=$((end + $2)) - else - end=$((end + 300)) - fi - while true; do - # Use Nmap as its the same on Ubuntu and RHEL family distros - nmap -Pn -p22 $1 | awk '$1 ~ /22/ {print $2}' | grep -q 'open' && \ - break || true - sleep 1 - now=$(date +%s) - [ $now -gt $end ] && echo "Could not connect to $1 port 22 in time" && exit -1 - done - set -x -} -wait_for_ssh_port $FLOATING_IP - -# accept diffie-hellman-group1-sha1 algo for SSH (cirros image should probably be updated to replace this) +# accept diffie-hellman-group1-sha1 algo for SSH (for compatibility with older images) sudo tee -a /etc/ssh/ssh_config <> ~/.ssh/known_hosts -ssh -o "StrictHostKeyChecking no" -i ${SSH_DIR}/osh_key cirros@${FLOATING_IP} ping -q -c 1 -W 2 ${OSH_BR_EX_ADDR%/*} +ssh -o "StrictHostKeyChecking no" -i ${SSH_DIR}/osh_key ${IMAGE_USER}@${FLOATING_IP} ping -q -c 1 -W 2 ${OSH_BR_EX_ADDR%/*} # Check the VM can reach the metadata server -ssh -i ${SSH_DIR}/osh_key cirros@${FLOATING_IP} curl --verbose --connect-timeout 5 169.254.169.254 +ssh -i ${SSH_DIR}/osh_key ${IMAGE_USER}@${FLOATING_IP} curl --verbose --connect-timeout 5 169.254.169.254 # Check the VM can reach the keystone server -ssh -i ${SSH_DIR}/osh_key cirros@${FLOATING_IP} curl --verbose --connect-timeout 5 keystone.openstack.svc.cluster.local +ssh -i ${SSH_DIR}/osh_key ${IMAGE_USER}@${FLOATING_IP} curl --verbose --connect-timeout 5 keystone.openstack.svc.cluster.local # Check to see if cinder has been deployed, if it has then perform a volume attach. if openstack service list -f value -c Type | grep -q "^volume"; then # Get the devices that are present on the instance DEVS_PRE_ATTACH=$(mktemp) - ssh -i ${SSH_DIR}/osh_key cirros@${FLOATING_IP} lsblk > ${DEVS_PRE_ATTACH} + ssh -i ${SSH_DIR}/osh_key ${IMAGE_USER}@${FLOATING_IP} lsblk > ${DEVS_PRE_ATTACH} openstack stack list show "heat-vm-volume-attach" || \ # Create and attach a block device to the instance @@ -157,7 +162,7 @@ if openstack service list -f value -c Type | grep -q "^volume"; then # Get the devices that are present on the instance DEVS_POST_ATTACH=$(mktemp) - ssh -i ${SSH_DIR}/osh_key cirros@${FLOATING_IP} lsblk > ${DEVS_POST_ATTACH} + ssh -i ${SSH_DIR}/osh_key ${IMAGE_USER}@${FLOATING_IP} lsblk > ${DEVS_POST_ATTACH} # Check that we have the expected number of extra devices on the instance post attach if ! [ "$(comm -13 ${DEVS_PRE_ATTACH} ${DEVS_POST_ATTACH} | wc -l)" -eq "1" ]; then diff --git a/tools/deployment/component/compute-kit/compute-kit.sh b/tools/deployment/component/compute-kit/compute-kit.sh index 27d8569e86..ed27e52b42 100755 --- a/tools/deployment/component/compute-kit/compute-kit.sh +++ b/tools/deployment/component/compute-kit/compute-kit.sh @@ -35,25 +35,14 @@ helm upgrade --install placement ${OSH_HELM_REPO}/placement --namespace=openstac #NOTE: Deploy nova : ${OSH_EXTRA_HELM_ARGS:=""} -if [ "x$(systemd-detect-virt)" == "xnone" ] || [ "x$(systemd-detect-virt)" == "xkvm" ]; then - echo 'OSH is not being deployed in virtualized environment' - helm upgrade --install nova ${OSH_HELM_REPO}/nova \ - --namespace=openstack \ - --set bootstrap.wait_for_computes.enabled=true \ - --set conf.ceph.enabled=${CEPH_ENABLED} \ - ${OSH_EXTRA_HELM_ARGS:=} \ - ${OSH_EXTRA_HELM_ARGS_NOVA} -else - echo 'OSH is being deployed in virtualized environment, using qemu for nova' - helm upgrade --install nova ${OSH_HELM_REPO}/nova \ - --namespace=openstack \ - --set bootstrap.wait_for_computes.enabled=true \ - --set conf.ceph.enabled=${CEPH_ENABLED} \ - --set conf.nova.libvirt.virt_type=qemu \ - --set conf.nova.libvirt.cpu_mode=none \ - ${OSH_EXTRA_HELM_ARGS:=} \ - ${OSH_EXTRA_HELM_ARGS_NOVA} -fi +helm upgrade --install nova ${OSH_HELM_REPO}/nova \ + --namespace=openstack \ + --set bootstrap.wait_for_computes.enabled=true \ + --set conf.ceph.enabled=${CEPH_ENABLED} \ + --set conf.nova.libvirt.virt_type=qemu \ + --set conf.nova.libvirt.cpu_mode=none \ + ${OSH_EXTRA_HELM_ARGS:=} \ + ${OSH_EXTRA_HELM_ARGS_NOVA} #NOTE: Deploy neutron tee /tmp/neutron.yaml << EOF diff --git a/tools/deployment/component/glance/glance.sh b/tools/deployment/component/glance/glance.sh index 0b4c80215a..d7e082c586 100755 --- a/tools/deployment/component/glance/glance.sh +++ b/tools/deployment/component/glance/glance.sh @@ -24,20 +24,23 @@ set -xe #NOTE: Deploy command tee /tmp/glance.yaml <