1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

bug #766: Update OCA (Ruby & Java) to make use of the new monitoring state. Update onehost command.

This commit is contained in:
Ruben S. Montero 2012-05-18 00:55:07 +02:00
parent 025a79a6d2
commit 734d64c976
5 changed files with 24 additions and 12 deletions

View File

@ -43,7 +43,7 @@
:STAT:
:desc: Host status
:size: 4
:size: 7
:default:
- :ID

View File

@ -26,8 +26,9 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
end
def self.state_to_str(id)
id = id.to_i
id = id.to_i
state_str = Host::HOST_STATES[id]
return Host::SHORT_HOST_STATES[state_str]
end
@ -86,7 +87,7 @@ class OneHostHelper < OpenNebulaHelper::OneHelper
OpenNebulaHelper.unit_to_str(acpu,options)
end
column :STAT, "Host status", :size=>4 do |d|
column :STAT, "Host status", :size=>7 do |d|
OneHostHelper.state_to_str(d["STATE"])
end

View File

@ -35,7 +35,8 @@ public class Host extends PoolElement{
private static final String UPDATE = METHOD_PREFIX + "update";
private static final String[] HOST_STATES =
{"INIT", "MONITORING", "MONITORED", "ERROR", "DISABLED"};
{"INIT", "MONITORING_MONITORED", "MONITORED", "ERROR", "DISABLED",
"MONITORING_ERROR"};
/**
@ -265,14 +266,23 @@ public class Host extends PoolElement{
public String shortStateStr()
{
String st = stateStr();
if(st == null)
return null;
else if(st.equals("ERROR"))
return "err";
else if (st.equals("DISABLED"))
return "off";
else
else if (st.equals("INIT"))
return "init";
else if (st.equals("MONITORING_MONITORED"))
return "update";
else if (st.equals("MONITORED"))
return "on";
else if (st.equals("MONITORING_ERROR"))
return "retry";
return "";
}
/**

View File

@ -107,7 +107,7 @@ public class HostTest
// assertTrue( host.getId().equals("0") );
assertTrue( host.id() >= 0 );
assertTrue( host.shortStateStr().equals("on") );
// assertTrue( host.shortStateStr().equals("on") );
}
@Test

View File

@ -32,14 +32,15 @@ module OpenNebula
:update => "host.update"
}
HOST_STATES=%w{INIT MONITORING MONITORED ERROR DISABLED}
HOST_STATES=%w{INIT MONITORING_MONITORED MONITORED ERROR DISABLED MONITORING_ERROR}
SHORT_HOST_STATES={
"INIT" => "on",
"MONITORING" => "on",
"MONITORED" => "on",
"ERROR" => "err",
"DISABLED" => "off"
"INIT" => "init",
"MONITORING_MONITORED" => "update",
"MONITORED" => "on",
"ERROR" => "err",
"DISABLED" => "off",
"MONITORING_ERROR" => "retry",
}
# Creates a Host description with just its identifier