Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added vserver-infoall api call #8

Merged
merged 1 commit into from Sep 7, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/solusvm/server.rb
Expand Up @@ -61,5 +61,10 @@ def info(vid, reboot = false)
perform_request(:action => 'vserver-info', :vserverid => vid, :reboot => reboot)
returned_parameters
end

def info_all(vid)
perform_request(:action => 'vserver-infoall', :vserverid => vid)
returned_parameters
end
end
end
13 changes: 13 additions & 0 deletions test/fixtures/server_infoall_success.txt
@@ -0,0 +1,13 @@
<status>success</status>
<statusmsg></statusmsg>
<node>tydeus</node>
<state>online</state>
<mainipaddress>123.123.123.123</mainipaddress>
<ipaddresses>123.123.123.123</ipaddresses>
<type>openvz</type>
<bandwidth>16106127360000,5370261749139,10735865610861,33</bandwidth>.
<memory>1073741824,187097088,886644736,17</memory>.
<hdd>236223201280,103640707072,132582494208,44</hdd>.
<trafficgraph>/graphs/9/214/214-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png</trafficgraph>.
<loadgraph>/graphs/9/214/214-load-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png</loadgraph>.
<memorygraph>/graphs/9/214/214-mem-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png</memorygraph>
16 changes: 15 additions & 1 deletion test/test_server.rb
Expand Up @@ -109,5 +109,19 @@ def test_info
assert_equal 'swp', info['swap-burst']
assert_equal 'xenhvm', info['type']
end


def test_info_all
FakeWeb.register_uri(:get, "#{base_uri}&action=vserver-infoall&vserverid=1", :body => load_response('server_infoall_success'))
info = @server.info_all(1)
assert_equal "success", info["status"]
assert_equal "123.123.123.123", info["mainipaddress"]
assert_equal "tydeus", info["node"]
assert_equal "openvz", info["type"]
assert_equal "16106127360000,5370261749139,10735865610861,33", info["bandwidth"]
assert_equal "1073741824,187097088,886644736,17", info["memory"]
assert_equal "236223201280,103640707072,132582494208,44", info["hdd"]
assert_equal "/graphs/9/214/214-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png", info["trafficgraph"]
assert_equal "/graphs/9/214/214-load-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png", info["loadgraph"]
assert_equal "/graphs/9/214/214-mem-8f7daef90bc75037489af4217af674a67df545ba05c8a6bcd5341d5894f2f905bf23976f52c0104415c1694135d51f204ddfd7b11bbe87c195a5de4a-86400.png", info["memorygraph"]
end
end