Search code examples
openstackopenstack-nova

Setting Openstack compute node with a fake hypervisor


I'm trying to set up openstack compute nodes that mimics a real node, however never actually sets up the VMs on a physical host. In the openstack tests, there are usages of fake drivers (defined in nova/virt/fake.py) through a complex system of testing classes.

I wish to get such a node up and running not within a test (meaning, I don't want to use these classes to spawn the compute node), but on an actual VM/container, however, I cannot figure out how to get a compute process to run with this fake hypervisor (or more specifically, one that will be defined by me).

How do I inject this fake driver instead of the real driver in a compute node?

(also, I'm installing OS using devstack (latest))

For more clarification, my goal is to do stress testing of OS, running multiple fake compute nodes, not in all-in-one configuration. The usage of devstack to setup the controller node is for simplifying the process, but the system should be:

  • A controller node, running the core services (Nova, Glance, Keystone etc.).
  • Multiple compute nodes, using fake hypervisors on different machines.

Solution

  • When installing a new compute node, there is a configuration file nova-compute.conf that is being created automatically.

    It seems that in /etc/nova/nova-compute.conf there is an option:

    compute_driver = libvirt.LibvirtDriver
    

    That uses libvirt as the default hypervisor for a compute node. In addition to hyperv, vmwareapi and xenapi, according to the nova configuration documentation, one can choose using the fake driver by changing this option to:

    compute_driver = fake.FakeDriver
    

    In order to set the fake driver to our implementation, we may replace the fake driver written in fake.py with something else.