mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-08 21:16:39 +09:00
Feature #1631: Change history reasons to be only 3: none, user, error
This commit is contained in:
1 parent
3ddbef0a18
commit
72d3ea9471
8 files changed
+24
-31
No files matched your search
+5
-8
@@ -28,16 +28,13 @@ using namespace std;
|
||||
class History:public ObjectSQL, public ObjectXML
|
||||
{
|
||||
public:
|
||||
enum MigrationReason
|
||||
enum EndReason
|
||||
{
|
||||
NONE, /** < Normal termination in host */
|
||||
ERROR, /** < The VM was migrated because of an error */
|
||||
STOP_RESUME,/** < The VM was migrated because of a stop/resume request*/
|
||||
USER, /** < The VM was migrated because of an explicit request */
|
||||
CANCEL /** < The VM was migrated because of an explicit cancel */
|
||||
NONE, /** < History record is not closed yet */
|
||||
ERROR, /** < History record was closed because of an error */
|
||||
USER /** < History record was closed because of a user action */
|
||||
};
|
||||
|
||||
|
||||
enum VMAction
|
||||
{
|
||||
MIGRATE_ACTION,
|
||||
@@ -292,7 +289,7 @@ private:
|
||||
time_t epilog_stime;
|
||||
time_t epilog_etime;
|
||||
|
||||
MigrationReason reason;
|
||||
EndReason reason;
|
||||
|
||||
VMAction action;
|
||||
|
||||
|
||||
@@ -500,7 +500,7 @@ public:
|
||||
* Returns the reason that closed the history record in the previous host
|
||||
* @return the reason to close the history record in the previous host
|
||||
*/
|
||||
const History::MigrationReason get_previous_reason() const
|
||||
const History::EndReason get_previous_reason() const
|
||||
{
|
||||
return previous_history->reason;
|
||||
};
|
||||
@@ -642,7 +642,7 @@ public:
|
||||
* Sets the reason that closed the history record
|
||||
* @param _reason reason to close the history record
|
||||
*/
|
||||
void set_reason(History::MigrationReason _reason)
|
||||
void set_reason(History::EndReason _reason)
|
||||
{
|
||||
history->reason=_reason;
|
||||
};
|
||||
@@ -651,7 +651,7 @@ public:
|
||||
* Sets the reason that closed the history record in the previous host
|
||||
* @param _reason reason to close the history record in the previous host
|
||||
*/
|
||||
void set_previous_reason(History::MigrationReason _reason)
|
||||
void set_previous_reason(History::EndReason _reason)
|
||||
{
|
||||
previous_history->reason=_reason;
|
||||
};
|
||||
|
||||
@@ -48,12 +48,14 @@ void LifeCycleManager::deploy_action(int vid)
|
||||
|
||||
if (vm->hasPreviousHistory())
|
||||
{
|
||||
if (vm->get_previous_reason() == History::STOP_RESUME)
|
||||
if (vm->get_previous_history_action() == History::STOP_ACTION)
|
||||
{
|
||||
vm_state = VirtualMachine::PROLOG_RESUME;
|
||||
tm_action = TransferManager::PROLOG_RESUME;
|
||||
}
|
||||
else if (vm->get_previous_reason() == History::NONE)
|
||||
else if (
|
||||
vm->get_previous_history_action() == History::UNDEPLOY_ACTION ||
|
||||
vm->get_previous_history_action() == History::UNDEPLOY_HARD_ACTION)
|
||||
{
|
||||
vm_state = VirtualMachine::PROLOG_UNDEPLOY;
|
||||
tm_action = TransferManager::PROLOG_RESUME;
|
||||
|
||||
@@ -93,7 +93,7 @@ void LifeCycleManager::save_success_action(int vid)
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vm->set_reason(History::STOP_RESUME);
|
||||
vm->set_reason(History::USER);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
|
||||
@@ -121,7 +121,7 @@ void LifeCycleManager::save_success_action(int vid)
|
||||
|
||||
vm->set_running_etime(the_time);
|
||||
|
||||
vm->set_reason(History::STOP_RESUME);
|
||||
vm->set_reason(History::USER);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
|
||||
@@ -434,7 +434,7 @@ void LifeCycleManager::deploy_failure_action(int vid)
|
||||
|
||||
vm->set_running_etime(the_time);
|
||||
|
||||
vm->set_reason(History::STOP_RESUME);
|
||||
vm->set_reason(History::ERROR);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
|
||||
@@ -510,7 +510,7 @@ void LifeCycleManager::shutdown_success_action(int vid)
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vm->set_reason(History::STOP_RESUME);
|
||||
vm->set_reason(History::USER);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
|
||||
@@ -720,7 +720,7 @@ void LifeCycleManager::prolog_failure_action(int vid)
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vm->set_reason(History::STOP_RESUME);
|
||||
vm->set_reason(History::ERROR);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
|
||||
@@ -953,7 +953,7 @@ void LifeCycleManager::cancel_success_action(int vid)
|
||||
|
||||
vmpool->update(vm);
|
||||
|
||||
vm->set_reason(History::CANCEL);
|
||||
vm->set_reason(History::USER);
|
||||
|
||||
vm->set_epilog_stime(the_time);
|
||||
|
||||
@@ -1119,7 +1119,7 @@ void LifeCycleManager::monitor_suspend_action(int vid)
|
||||
|
||||
vm->set_vm_info();
|
||||
|
||||
vm->set_reason(History::STOP_RESUME);
|
||||
vm->set_reason(History::ERROR);
|
||||
|
||||
vmpool->update_history(vm);
|
||||
|
||||
|
||||
@@ -103,14 +103,12 @@ module OpenNebula
|
||||
"PROLOG_UNDEPLOY" => "prol"
|
||||
}
|
||||
|
||||
MIGRATE_REASON=%w{NONE ERROR STOP_RESUME USER CANCEL}
|
||||
MIGRATE_REASON=%w{NONE ERROR USER}
|
||||
|
||||
SHORT_MIGRATE_REASON={
|
||||
"NONE" => "none",
|
||||
"ERROR" => "erro",
|
||||
"STOP_RESUME" => "stop",
|
||||
"USER" => "user",
|
||||
"CANCEL" => "canc"
|
||||
"USER" => "user"
|
||||
}
|
||||
|
||||
# Creates a VirtualMachine description with just its identifier
|
||||
|
||||
@@ -125,9 +125,7 @@ var oZones = {
|
||||
case "vm_migrate_reason":
|
||||
state = tr(["NONE",
|
||||
"ERROR",
|
||||
"STOP_RESUME",
|
||||
"USER",
|
||||
"CANCEL"][value]);
|
||||
"USER"][value]);
|
||||
break;
|
||||
default:
|
||||
return value;
|
||||
|
||||
@@ -133,9 +133,7 @@ var OpenNebula = {
|
||||
case "vm_migrate_reason":
|
||||
state = tr(["NONE",
|
||||
"ERROR",
|
||||
"STOP_RESUME",
|
||||
"USER",
|
||||
"CANCEL"][value]);
|
||||
"USER"][value]);
|
||||
break;
|
||||
default:
|
||||
return value;
|
||||
|
||||
+1
-1
@@ -352,7 +352,7 @@ int History::rebuild_attributes()
|
||||
rc += xpath(int_reason , "/HISTORY/REASON", 0);
|
||||
rc += xpath(int_action , "/HISTORY/ACTION", 0);
|
||||
|
||||
reason = static_cast<MigrationReason>(int_reason);
|
||||
reason = static_cast<EndReason>(int_reason);
|
||||
action = static_cast<VMAction>(int_action);
|
||||
|
||||
non_persistent_data();
|
||||
|
||||
Reference in new issue
Block a user