Created
April 30, 2013 11:53
-
-
Save jiphex/5488237 to your computer and use it in GitHub Desktop.
Thing to add the missing method "create_snapshot" to the libvirt ruby domain bindings. Both the libvirt and builder libraries are in debian packages (apt-get install ruby-{libvirt,builder})
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'libvirt' | |
require 'builder' | |
class Libvirt::Domain | |
def create_snapshot(sdesc=nil) | |
builder = Builder::XmlMarkup.new | |
snapshot_xml = builder.domainsnapshot do |ds| | |
if sdesc | |
ds.description(sdesc) | |
end | |
end | |
self.snapshot_create_xml(snapshot_xml) | |
end | |
end | |
c = Libvirt::open('qemu:///system') | |
d = c.lookup_domain_by_name 'jeff' | |
d.create_snapshot("Testing123") | |
p d.list_snapshots |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment