Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libvirt] added display attributes and allowed to change display of a…
… running server
- Loading branch information
Showing
7 changed files
with
66 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Fog | ||
module Compute | ||
class Libvirt | ||
class Real | ||
def update_display(options = { }) | ||
raise ArgumentError, "uuid is a required parameter" unless options.has_key? :uuid | ||
display = { } | ||
display[:type] = options[:type] || 'vnc' | ||
display[:port] = (options[:port] || -1).to_s | ||
display[:listen] = options[:listen].to_s if options[:listen] | ||
display[:passwd] = options[:password].to_s if options[:password] | ||
display[:autoport] = 'yes' if display[:port] == '-1' | ||
|
||
builder = Nokogiri::XML::Builder.new { graphics_ (display) } | ||
xml = Nokogiri::XML(builder.to_xml).root.to_s | ||
|
||
client.lookup_domain_by_uuid(options[:uuid]).update_device(xml, 0) | ||
# if we got no exceptions, then we're good' | ||
true | ||
end | ||
end | ||
|
||
class Mock | ||
def update_display(options = { }) | ||
raise ArgumentError, "uuid is a required parameter" unless options.has_key? :uuid | ||
true | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
:domain_type, | ||
:uuid, | ||
:autostart, | ||
:vnc_port, | ||
:display, | ||
:nics, | ||
:volumes, | ||
:active, | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Shindo.tests('Fog::Compute[:libvirt] | update_display request', ['libvirt']) do | ||
|
||
compute = Fog::Compute[:libvirt] | ||
|
||
reconfig_target = 'f74d728a-5b62-7e2f-1f84-239aead298ca' | ||
display_spec = {:password => 'ssaaa'} | ||
|
||
tests('The response should') do | ||
response = compute.update_display(:uuid => reconfig_target).merge(display_spec) | ||
test('should be true').succeeds { response } | ||
end | ||
|
||
end |