Extending OpenStack
上QQ阅读APP看书,第一时间看更新

Empowering the compute service

In this section, we will add a new compute host to our first initial OpenStack environment using Ansible. The new compute node will have similar hardware requirements to the first compute node, as follows:

  • Memory: At least 4 GB RAM
  • Processor: At least 4 64-bit x86 CPUs 
  • Disk space: At least 40 GB free disk space
  • Network: At least two NICs

The following excerpt will be added to the vagrant file in our test environment:

    ...
    # Compute Node
    config.vm.define :cn02 do |cn02|
      cn02.vm.hostname= "cn02"
      cn02.vm.provider "virtualbox" do |vb|
              vb.customize ["modifyvm", :id, "--memory", "4096"]
              vb.customize ["modifyvm", :id, "--cpus", "4"]
                 vb.customize ["modifyvm", :id, "--nicpromic2", "allow-all"]
          end
    end 

The following steps will instruct the Ansible deployment host to add the new compute node to the pool as follows:

  1. Configure the target host to be reachable by ADH (an LXC-internal network). Make sure that you have properly configured the networking setup in VirtualBox. This can be applied by just running vagrant as follows:
# vagrant up

The vagrant file will launch a new virtual machine by installing the operating system within its required virtual hardware configuration.

  1. Before we start to deploy the new compute node, we will need to first go through the Ansible configuration files discussed in Chapter 1Inflating the OpenStack Setup. The following stanza will be added to the /etc/openstack_deploy/openstack_user_config.yml file to instruct Ansible to use the second compute node and run the nova-compute service:
    # Compute Hosts 
    compute_hosts:
    ... 
      compute-02: 
        ip: 172.16.0.105
  1. The last change can be committed to git as follows:
    # git add -A
    # git commit -a -m "Add Test Compute Node 02"
  1. Now we have a new host added to the list of compute nodes, we can start the deployment by running Ansible playbooks from ADH as follows:
    # cd /opt/openstack-ansible/playbooks
    # openstack-ansible setup-hosts.yml --limit compute-02 
The --limit option will only run the new updates described in the Ansible playbooks, configuration files. Using it will keep the infrastructure intact by only executing the latest version of the playbook scoped code.
  1. Updating the infrastructure using Ansible can be performed as follows:
# openstack-ansible os-nova-install.yml --skip-tags nova-key-distribute --limit compute-02 

This will reduce the task of deploying the whole OpenStack infrastructure to install only a new compute node. Additionally, it is essential to point out that using the --skip-tags flag is needed since the new keys in the additional compute nodes will not be initially collected for nova SSH authentication. As per using a --limit flag in the openstack-ansible command line, adding a new host to the host list can be performed as follows:

    # openstack-ansible setup-hosts --limit NEW_HOST_NAME  
  1. The next step is straightforward we will instruct Ansible to install the nova-compute service using the os-nova-install.yml playbook:
# openstack-ansible os-nova-install.yml --tags nova-key-create,nova-key-distribute

To list all tags defined for OpenStack, use the following command line under the playbook directory:

    # openstack-ansible openstack-setup.yml -list-tags
  1. As mentioned in our initial test environment layout depicted in Chapter 1Inflating the OpenStack Setup, a compute node will require us to run a Neutron agent. The following command line will run the Neutron agent playbook in the deployment host as follows:
    # openstack-ansible os-neutron-install.yml --limit compute-02
To ensure that the nova public key attribute has been successfully created, run the setup-openstack.yml playbook on all hosts.