Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Basic management of Libvirt Hypervisors and domains


An mco application is included that wraps arond the basic capabilities of the agent for full details see mco virt --help

You need the ruby libvirt bindings installed, tested with version 0.3.0

Hypervisor / Domain Information:

% mco virt info
                Max VCPUs: 16
                  Secrets: 0
                     Type: QEMU
                  Version: 12001
           Active Domains: ["dev2_devco", "dev3_devco", "dev4_devco", "dev5_devco"]
                      MHz: 1297
          Active Networks: 1
         Inactive Domains: 0
         Inactive Domains: []
   Inactive Storage Pools: 0
                  Sockets: 1
           Active Domains: 4
     Active Storage Pools: 1
                    Cores: 2
                    Model: x86_64
      Inactive Interfaces: 0
               Numa Nodes: 1
                      URI: qemu:///system
             Node Devices: 49
        Active Interfaces: 2
                   Memory: 8063656
          Network Filters: 15
              Free Memory: 3993661440
                     CPUs: 2
        Inactive Networks: 0
                  Threads: 1
% mco virt info dev2_devco
                  UUID: ca74dc32-0f09-7265-b67e-151b4fb5dd90
            State Code: 1
             Autostart: false
               OS Type: 0
                 VCPUs: 1
             Snapshots: []
            Max Memory: 524288
            Persistent: true
   Number of Snapshots: 0
              CPU Time: 5594920000000
                Memory: 524288
      Current Snapshot: false
                 State: Running
          Managed Save: false

Manage a Domain:

% mco virt stop dev4_devco
   State: 5
   State: Shut off

Other available actions are:

  • start
  • stop (needs acpid in the domain)
  • reboot (needs acpid in the domain)
  • suspend
  • resume
  • destroy

Create a Domain:

This requires you to have created the XML that describes the domain on the node already. The permanent argument is optional and is the difference between virsh define and virsh create.

% mco virt define dev4 /srv/kvm/etc/dev4.xml permanent

   State Code: 1
        State: Running

Undefine a Domain:

This undefines a domain, you can optionally destroy the domain before undefining it else the request will fail.

% mco virt undefine dev4 destroy

List all Domains:

% mco virt domains

     Domain-0, devco_net
     dev2_devco, dev3_devco, dev4_devco, dev5_devco
     Domain-0, dev1_devco

Find a Domain:

Searches for a domain based on a ruby pattern:

% mco virt find devco

     dev2_devco, dev3_devco, dev4_devco, dev5_devco


  • More stats so that full feature auto provisioning can be built


R.I.Pienaar / / / @ripienaar