Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Commit

Permalink
Add a reboot command
Browse files Browse the repository at this point in the history
  • Loading branch information
ripienaar committed Aug 23, 2011
1 parent 321cc75 commit b4f353e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion agent/libvirt/README.md
Expand Up @@ -79,7 +79,8 @@ kvm1.xx.net
Other available actions are:

* start
* stop
* stop (needs acpid in the domain)
* reboot (needs acpid in the domain)
* suspend
* resume
* destroy
Expand Down
2 changes: 1 addition & 1 deletion agent/libvirt/agent/libvirt.ddl
Expand Up @@ -240,7 +240,7 @@ action "undefinedomain", :description => "Undefines a domain" do
:display_as => "Status"
end

[:destroy, :shutdown, :suspend, :resume, :create, :start].each do |act|
[:destroy, :shutdown, :suspend, :resume, :create, :start, :reboot].each do |act|
action act.to_s, :description => "#{act.to_s.capitalize} a domain" do
display :ok

Expand Down
2 changes: 1 addition & 1 deletion agent/libvirt/agent/libvirt.rb
Expand Up @@ -158,7 +158,7 @@ class Libvirt<RPC::Agent
end
end

[:destroy, :shutdown, :suspend, :resume, :create].each do |act|
[:destroy, :shutdown, :suspend, :resume, :create, :reboot].each do |act|
action act do
validate :domain, String

Expand Down
6 changes: 5 additions & 1 deletion agent/libvirt/application/virt.rb
Expand Up @@ -5,7 +5,7 @@ class MCollective::Application::Virt<MCollective::Application
usage "Usage: mco virt info <domain>"
usage "Usage: mco virt xml <domain>"
usage "Usage: mco virt find <pattern>"
usage "Usage: mco virt [stop|start|suspend|resume|destroy] <domain>"
usage "Usage: mco virt [stop|start|reboot|suspend|resume|destroy] <domain>"
usage "Usage: mco virt domains"
usage "Usage: mco virt define <domain> <remote xml file> [permanent]"
usage "Usage: mco virt undefine <domain> [destroy]"
Expand Down Expand Up @@ -72,6 +72,10 @@ def domains_command
puts
end

def reboot_command
printrpc virtclient.reboot(:domain => configuration[:domain])
end

def start_command
printrpc virtclient.create(:domain => configuration[:domain])
end
Expand Down

0 comments on commit b4f353e

Please sign in to comment.