0

I have cloned a module for virtual machines, but when I try to apply a virtual machine to a node, I get Error: Could not find a suitable provider for virt, which is understandable given that the contents of init.pp specify that a virtualization-capable kernel should already be running (a Xen or OpenVZ kernel).

However, with the included init.pp, I'd expect a failure message somewhere when running puppet agent --test --debug on the node:

class virt {

  fail "testfail"

  case $::virtual {
    /^xen/: { include virt::xen }
    #/^kvm/: { include virt::kvm }
    /^openvzhn/: { include virt::openvz }
  }
}

But it fails with the error above, Error: Could not find a suitable provider for virt. My node definition:

node 'hostname' {

  # common is a custom module including SSH keys, works fine
  include common

  virt { "1001":
    memory => 1024,
    cpus => 4,
    tmpl_cache => "debian-6.0-x86_64",
    ensure => running,
    virt_type => "openvz"
  }
}
Zsub
  • 361
  • 1
  • 3
  • 15

1 Answers1

3

In the node definition, you are not using the class virt, but the custom type virt.

You'll find it in modulename/lib/puppet/type.

It needs a provider, (modulename/lib/puppet/provider) but cannot find one suitable for your system.

To include the class virt, you could use one of the following:

include virt or class ( 'virt': }

The reason it's not working; you are probably missing one of these binaries: (taken from provider)

commands :virtinstall => "/usr/bin/virt-install"
commands :virsh => "/usr/bin/virsh"
commands :grep => "/bin/grep"
commands :ip => "/sbin/ip"

That; or you don't have this:

confine :feature => :libvirt
Ger Apeldoorn
  • 565
  • 3
  • 10
  • The reason it's not working; you are probably missing one of these binaries: commands :virtinstall => "/usr/bin/virt-install" commands :virsh => "/usr/bin/virsh" commands :grep => "/bin/grep" commands :ip => "/sbin/ip" # The provider is chosen by virt_type, not by operating system confine :feature => :libvirt – Ger Apeldoorn Apr 14 '13 at 14:24
  • I now realize what I did wrong, thank you so much! I have been banging my head on this for days. – Zsub Apr 14 '13 at 18:12
  • I included virt in the node definition – Zsub Apr 18 '13 at 17:44