Simple to use ruby interface to libvirt.
Libvirt is located at libvirt.org/ruby
-
Fork the project
-
Start a feature/bugfix branch
-
Commit and push until you are happy with your contribution
-
Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.
-
Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
for full API please visit rdoc.info/github/ohadlevy/virt
uri = "qemu:///system" # libvirt running locally uri = "qemu:/fqdn//system" # used for QEMU+TLS connection uri = "qemu+ssh:/user@fqdn//system" # used for SSH connection uri = "qemu+tcp:/fqdn//system" # used for non secured tcp connection
conn = Virt.connect(uri)
host = conn.host
host.running_guests
host.defined_guests
host.guests
guest=Virt::Guest.new({:name => "test123"}) guest.vcpu = 2 guest.volume.size = 10 # in GB guest.save guest.start puts guest.mac guest.shutdown # initiate a shutdown guest.poweroff # forces a shutdown
Many more options exists, make sure checkout the api/tests
host.interfaces # physical interfaces host.networks # virtual / NAT interfaces
host.storage_pools host.volumes
Copyright © 2011 Ohad Levy
This program and entire repository is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>.