Cloud Computing - Assignment

  • Programming Assignment 2 - Build your own auto-scaling client server application using the libvirt API

Solution Details and Results

  • Features:

    • Real time CPU utilization graph
    • Increase the number of server VM's in case of overload
    • Decrease the number of server VM's in case of low load
    • Inform the client program (which plays the role of load balancer) in case of VM failures
  • CPU utilization graph plotted in real time by the autoscaler

    • The part to the right of 0 on the x-axis is the deciding factor for the action taken by the autoscaler
  • To run/test the program

    1. Create a VM in Virtual Machine Manager and put the server.py code in it.
    2. Configure the VM to autostart the server.py program as soon as the OS boots.
    3. Create extra VM and follow a proper naming convention. The numbering should start from 0
      • Example: AnyPrefix-0000, AnyPrefix-0001
    4. Launch the first VM - AnyPrefix-0000
    5. Open terminal and run client.py, autoscaler.py
    6. View the realtime graph plotted by the autoscaler.py to get an insight into the working of the autoscaler

Useful Commands

# virsh is the main interface for managing virsh guest domains.
virsh -V
virsh -c qemu:///system list   # connect locally as root to the daemon supervising QEMU and KVM domains
virsh -c qemu:///session list  # connect locally as a normal user to his own set of QEMU and KVM domains

# ---

# libvirt internals
cd /var/lib/libvirt
ls -l images
ls -l /etc/libvirt/libvirt.conf
cp /etc/libvirt/libvirt.conf ~/.config/libvirt/

# ---

# Network commands
virsh dumpxml ubuntu18.04
virsh net-list
virsh net-dhcp-leases default
virsh domifaddr ubuntu18.04-1
route

References