carlasouza / puppet-virt Goto Github PK
View Code? Open in Web Editor NEWPuppet Module for Virtualization Management
Home Page: http://puppetlabs.com
Puppet Module for Virtualization Management
Home Page: http://puppetlabs.com
Puppet version: 0.25.4
Facter version: 1.5.8
Ruby version: 1.8.7
info: Retrieving plugin
notice: /File[/var/puppet/lib/puppet/feature]/ensure: created
notice: /File[/var/puppet/lib/puppet/feature/libvirt.rb]/ensure: content changed '{md5}3c6bbc5d7e9d7aeac9778bd2f5661b1e' to '{md5}3c6bbc5d7e9d7aeac9778bd2f5661b1e'
notice: /File[/var/puppet/lib/puppet/provider/virt]/ensure: created
notice: /File[/var/puppet/lib/puppet/provider/virt/libvirt.rb]/ensure: content changed '{md5}bedca1909c21bbd2114c5c7a9ae64726' to '{md5}bedca1909c21bbd2114c5c7a9ae64726'
notice: /File[/var/puppet/lib/puppet/type/virt.rb]/ensure: content changed '{md5}e7fb62c7f989cfdf6fa682d9f9e6096f' to '{md5}e7fb62c7f989cfdf6fa682d9f9e6096f'
info: Loading downloaded plugin /var/puppet/lib/puppet/feature/libvirt.rb
info: Loading downloaded plugin /var/puppet/lib/puppet/provider/virt/libvirt.rb
Could not autoload virt: undefined method newvalue' for Puppet::Type::Virt::ParameterPxe:Class err: Could not load downloaded file /var/puppet/lib/puppet/provider/virt/libvirt.rb: undefined method
provide' for nil:NilClass
info: Loading downloaded plugin /var/puppet/lib/puppet/type/virt.rb
info: Redefining virt in Puppet::Type
err: Could not load downloaded file /var/puppet/lib/puppet/type/virt.rb: undefined method `newvalue' for Puppet::Type::Virt::ParameterPxe:Class
Hello carlasouza,
first, thank you for this module ! :o)
The puppet fact "virt_domains_inactive" does not list inactive kvm-domains.
I guess the search fail, because inactive domains do not have an "domid"
See here:
root@kvm-host:~# virsh list --inactive
Id Name Status
----------------------------------------------------
- VM_01 switched-off
- VM_02 switched-off
- VM_03 switched-off
I`ve changed the search-base to "name", please see my diff from libvirt.rb:
< libvirt_connect.list_defined_domains.each do |domid|
< domains.concat([ libvirt_connect.lookup_domain_by_id(domid.to_i).name ])
< end
---
> libvirt_connect.list_defined_domains.each do |name|
> domains.concat([ name ])
> end
For my purposes this change works:
facter --puppet | grep virt_domains_inactive
virt_domains_inactive => VM_01,VM_02,VM_03
There are also other inactive objects in libvirt that have no ID,
but these should be recognized by this custom fact.
To reflect this there is a need to change from ID to Name at several places.
Best regards,
Stefan L.-S.
Hi Carla,
This module looks like a terrific piece of work and I would like to get actively involved, if I may. However I am having problems getting my first VM going using this module. Both my puppet master and client are running Fedora (16 and 15, respectively) and have had no problems creating VMs manually.
I have this in my node's class:
virt { 'test':
autoboot => false,
ensure => 'running',
memory => '1024',
os_template => 'fedora11',
os_type => 'linux',
provider => 'libvirt',
virt_path => '/var/lib/libvirt/images/test.img',
virt_type => 'kvm',
}
When I run my 'puppetd --test' for the first time, I get:
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload virt: Could not autoload /etc/puppet/modules/puppet-virt/lib/puppet/provider/virt/openvz.rb: Sorry, this provider is not supported for your Operation System, yet :) at /etc/puppet/modules/doubledog/manifests/classes/droopy-f15.pp:31 on node droopy-f15.doubledog.org
Repeated runs result in no errors, but no VM is created either. I am not sure why I only see the error just the first time -- unless I restart the puppetmaster service. However, I am most confused as to why openvz.rb is involved if libvirt is supposed to be my provider. Is this a bug or mistake/misunderstanding that I have? Any help would be most appreciated.
Module Version: bb33fa9
Puppet version: 2.6.2
OS: Debian GNU/Linux sqeeze
Installed Packages: libvirt-bin, libvirt0, python-libvirt, virt-viewer, virtinst, vzctl, vzquota
Seeing the following error during a puppet run:
debug: Failed to load library 'libvirt' for feature 'libvirt'
debug: Puppet::Type::Virt::ProviderLibvirt: feature libvirt is missing
err: Could not run Puppet configuration client: Could not find a default provider for virt
Addition information: The module is located in my source tree as modules/virt
Hi,
puppet: 2.7.18
ubuntu: 12.04 LTS
puppet-virt: git, today
I had a issue with virt/manifests/init.pp
"err: Could not retrieve catalog from remote server: Error 400 on SERVER: Duplicate declaration: Service[undef] is already declared in file /etc/puppet/modules/virt/manifests/init.pp at line 18; cannot redeclare at /etc/puppet/modules/virt/manifests/init.pp:23 on node example.com"
I solve this by changing "service { $servicename:" to "service { $virt::params::servicename:" in file /etc/puppet/modules/virt/manifests/init.pp.
Almost forgot, thnx for the work :)
I'd like to manage LXC. But unfortunately the current version at http://forge.puppetlabs.com/carlasouza/virt does not support it.
Do you know any work around or can yp update the module?
I tried to create a VM:
virt { guest-openvz2:
id => 102,
virt_type => 'openvz',
ensure => 'installed',
os_template => 'debian-7.0-x86_64-minimal',
memory => 512,
autoboot => true,
interfaces => ["br0"]
}
and somehow, the agent tries to obtain the value of memory size before creating the vm and the config file. I obtained the following backtrace:
Debug: Executing '/usr/sbin/vzlist -1 -a -N guest-openvz2'
Debug: Executing '/usr/sbin/vzctl status 102'
Debug: Executing '/usr/sbin/vzlist -1 -a -N guest-openvz2'
Debug: Executing '/usr/sbin/vzctl status 102'
Debug: Virt[guest-openvz2](provider=openvz): Getting parameter PRIVVMPAGES value
/var/lib/puppet/lib/puppet/provider/virt/openvz.rb:197: warning: class variable access from toplevel
Debug: Executing '/usr/sbin/vzlist -1 -a -N guest-openvz2'
Error: /Virt[guest-openvz2]: Could not evaluate: No such file or directory - /etc/vz/conf/102.conf
/usr/lib/ruby/1.9.1/open-uri.rb:35:in `initialize'
/usr/lib/ruby/1.9.1/open-uri.rb:35:in `open'
/usr/lib/ruby/1.9.1/open-uri.rb:35:in `open'
/var/lib/puppet/lib/puppet/provider/virt/openvz.rb:198:in `get_value'
/var/lib/puppet/lib/puppet/provider/virt/openvz.rb:233:in `memory'
/usr/lib/ruby/vendor_ruby/puppet/property.rb:471:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:1058:in `block in retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:1053:in `each'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:1053:in `retrieve'
/usr/lib/ruby/vendor_ruby/puppet/type.rb:1076:in `retrieve_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:236:in `from_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction/resource_harness.rb:19:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:204:in `apply'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:217:in `eval_resource'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `call'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block (2 levels) in evaluate'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:327:in `block in thinmark'
/usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:326:in `thinmark'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:147:in `block in evaluate'
/usr/lib/ruby/vendor_ruby/puppet/graph/relationship_graph.rb:118:in `traverse'
/usr/lib/ruby/vendor_ruby/puppet/transaction.rb:138:in `evaluate'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:169:in `block in apply'
/usr/lib/ruby/vendor_ruby/puppet/util/log.rb:149:in `with_destination'
/usr/lib/ruby/vendor_ruby/puppet/transaction/report.rb:112:in `as_logging_destination'
/usr/lib/ruby/vendor_ruby/puppet/resource/catalog.rb:168:in `apply'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:118:in `block in apply_catalog'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:161:in `block in benchmark'
/usr/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:160:in `benchmark'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:117:in `apply_catalog'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:224:in `run_internal'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:132:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/context.rb:64:in `override'
/usr/lib/ruby/vendor_ruby/puppet.rb:244:in `override'
/usr/lib/ruby/vendor_ruby/puppet/configurer.rb:131:in `run'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:47:in `block (4 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/agent/locker.rb:20:in `lock'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:47:in `block (3 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:117:in `with_client'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:44:in `block (2 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:82:in `run_in_fork'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:43:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:179:in `call'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:179:in `controlled_run'
/usr/lib/ruby/vendor_ruby/puppet/agent.rb:41:in `run'
/usr/lib/ruby/vendor_ruby/puppet/application/agent.rb:356:in `onetime'
/usr/lib/ruby/vendor_ruby/puppet/application/agent.rb:322:in `run_command'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:381:in `block (2 levels) in run'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:507:in `plugin_hook'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:381:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet/util.rb:488:in `exit_on_fail'
/usr/lib/ruby/vendor_ruby/puppet/application.rb:381:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:146:in `run'
/usr/lib/ruby/vendor_ruby/puppet/util/command_line.rb:92:in `execute'
/usr/bin/puppet:8:in `<main>'
I got this error message:
Error: /Virt[test-1]: Could not evaluate: Execution of '/usr/sbin/vzctl status Unable' returned 21: Bad CT ID Unable
Looking in puppet-virt/lib/puppet/provider/virt/openvz.rb I see:
# Returns all host's guests
def self.instances
guests = []
execpipe "#{vzlist} --no-header -a -o ctid" do |process|
process.collect do |line|
next unless options = parse(line)
guests << new(options)
end
end
guests
end
Unfortunately if I run:
$ sudo vzlist --no-header -a -o ctid
I get
Unable to open /proc/vz/veinfo: No such file or directory
Unable to open /proc/user_beancounters: No such file or directory
(as OpenVZ is not properly set up) Unfortunately vzlist does not return an error code in this case. Perhaps some validation of its output would solve this problem and prevent garbage spreading through the code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.