2

I am using Salt to provision machines, both physical and virtual, for my company. It would be really nice if I could also use Salt (Salt-Virt) to manage the various virtual machines running on my hosts, as the number/complexity of VMs is growing quickly.

Here's where I am:

  • Followed this guide, changing packages for Ubuntu instead of RHL: http://docs.saltstack.com/en/latest/topics/tutorials/cloud_controller.html
  • Both the physical and virtual machines are running Ubuntu Server
  • I am able to run the salt-run virt.init test1 2 512 salt://BASE.img command to deploy the machine to the host.
  • The image is showing up on the minion in /srv/salt-images/test1/ as a .qcow2

But it seems that the host (hypervisor) has no idea that the VM exists. I am not getting any errors from Salt on the master or the minion.

  • On the host, virsh list brings back an empty list
  • On the Salt master, salt-run virt.start test1 returns the error: Failed to find vm test1 to start

Has anyone ever gotten Salt-Virt to work on Ubuntu? What am I missing?

3

I found the solution. Here are the steps:

  • Two machines, M1 and M2
  • On M1:
    • Install salt master
    • Move your virtual hard drive to this machine, place it in /srv/salt
      • For me, this was /srv/salt/base.vdi
    • Convert the virtual machine file to qcow2 format
      • For me, this was qemu-img -f vdi -O qcow2 base.vdi base.qcow2
  • On M2:
    • Install salt minion
    • Install libvirt-bin
    • Install python-libvirt
    • configure a bridged network interface called br0
      • This is important, because that is the default interface name to which salt-virt attaches VMs

Cool. The machines should be ready to go now.

On the master, run salt "*" virt.init <name_of_vm> <num_cores_for_vm> <mb_of_ram_for_vm> <path_to_image>

For me, this was salt "*" virt.init test_vm 2 512 salt://base.qcow2

Machine should spin up on M2.

Test using salt-run virt.query on the salt master

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.