From a942853917fceb37409843531d4f59c83f157bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 3 Apr 2013 16:18:50 +0200 Subject: [PATCH 01/40] Feature #1631: Add a new ACTION filed to each History --- include/History.h | 185 ++++++++++++++++++++++++++++++++++++ include/VirtualMachine.h | 40 ++++++-- src/lcm/LifeCycleActions.cc | 32 +++++++ src/lcm/LifeCycleStates.cc | 12 +++ src/vm/History.cc | 9 +- 5 files changed, 270 insertions(+), 8 deletions(-) diff --git a/include/History.h b/include/History.h index 942f8068b6..51e774ba91 100644 --- a/include/History.h +++ b/include/History.h @@ -37,6 +37,189 @@ public: CANCEL /** < The VM was migrated because of an explicit cancel */ }; + + enum VMAction + { + MIGRATE_ACTION, + LIVE_MIGRATE_ACTION, + SHUTDOWN_ACTION, + SHUTDOWN_HARD_ACTION, + UNDEPLOY_ACTION, + UNDEPLOY_HARD_ACTION, + HOLD_ACTION, + RELEASE_ACTION, + STOP_ACTION, + SUSPEND_ACTION, + RESUME_ACTION, + BOOT_ACTION, + DESTROY_ACTION, + DESTROY_RECREATE_ACTION, + REBOOT_ACTION, + REBOOT_HARD_ACTION, + RESCHED_ACTION, + UNRESCHED_ACTION, + POWEROFF_ACTION, + NONE_ACTION + }; + + string action_to_str(VMAction action) + { + string st; + + switch (action) + { + case MIGRATE_ACTION: + st = "migrate"; + break; + case LIVE_MIGRATE_ACTION: + st = "migrate-live"; + break; + case SHUTDOWN_ACTION: + st = "shutdown"; + break; + case SHUTDOWN_HARD_ACTION: + st = "shutdown-hard"; + break; + case UNDEPLOY_ACTION: + st = "undeploy"; + break; + case UNDEPLOY_HARD_ACTION: + st = "undeploy-hard"; + break; + case HOLD_ACTION: + st = "hold"; + break; + case RELEASE_ACTION: + st = "release"; + break; + case STOP_ACTION: + st = "stop"; + break; + case SUSPEND_ACTION: + st = "suspend"; + break; + case RESUME_ACTION: + st = "resume"; + break; + case BOOT_ACTION: + st = "boot"; + break; + case DESTROY_ACTION: + st = "destroy"; + break; + case DESTROY_RECREATE_ACTION: + st = "destroy-recreate"; + break; + case REBOOT_ACTION: + st = "reboot"; + break; + case REBOOT_HARD_ACTION: + st = "reboot-hard"; + break; + case RESCHED_ACTION: + st = "resched"; + break; + case UNRESCHED_ACTION: + st = "unresched"; + break; + case POWEROFF_ACTION: + st = "poweroff"; + break; + case NONE_ACTION: + st = "none"; + break; + } + + return st; + }; + + int action_from_str(string& st, VMAction& action) + { + if (st == "migrate") + { + action = MIGRATE_ACTION; + } + else if (st == "migrate-live") + { + action = LIVE_MIGRATE_ACTION; + } + else if (st == "shutdown") + { + action = SHUTDOWN_ACTION; + } + else if (st == "shutdown-hard") + { + action = SHUTDOWN_HARD_ACTION; + } + else if (st == "undeploy") + { + action = UNDEPLOY_ACTION; + } + else if (st == "undeploy-hard") + { + action = UNDEPLOY_HARD_ACTION; + } + else if (st == "hold") + { + action = HOLD_ACTION; + } + else if (st == "release") + { + action = RELEASE_ACTION; + } + else if (st == "stop") + { + action = STOP_ACTION; + } + else if (st == "suspend") + { + action = SUSPEND_ACTION; + } + else if (st == "resume") + { + action = RESUME_ACTION; + } + else if (st == "boot") + { + action = BOOT_ACTION; + } + else if (st == "destroy") + { + action = DESTROY_ACTION; + } + else if (st == "destroy-recreate") + { + action = DESTROY_RECREATE_ACTION; + } + else if (st == "reboot") + { + action = REBOOT_ACTION; + } + else if (st == "reboot-hard") + { + action = REBOOT_HARD_ACTION; + } + else if (st == "resched") + { + action = RESCHED_ACTION; + } + else if (st == "unresched") + { + action = UNRESCHED_ACTION; + } + else if (st == "poweroff") + { + action = POWEROFF_ACTION; + } + else + { + action = NONE_ACTION; + return -1; + } + + return 0; + }; + History(int oid, int _seq = -1); History( @@ -111,6 +294,8 @@ private: MigrationReason reason; + VMAction action; + string vm_info; // ------------------------------------------------------------------------- diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 0a51e86d05..345eeb699a 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -497,14 +497,23 @@ public: }; /** - * Returns the reason that originated the VM migration in the previous host - * @return the migration reason to leave this host + * 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 { return previous_history->reason; }; + /** + * Returns the action that closed the history record in the previous host + * @return the action that closed the history record in the previous host + */ + const History::VMAction get_previous_history_action() const + { + return previous_history->action; + }; + /** * Get host id where the VM is or is going to execute. The hasHistory() * function MUST be called before this one. @@ -630,8 +639,8 @@ public: }; /** - * Sets the reason that originated the VM migration - * @param _reason migration reason to leave this host + * Sets the reason that closed the history record + * @param _reason reason to close the history record */ void set_reason(History::MigrationReason _reason) { @@ -639,14 +648,33 @@ public: }; /** - * Sets the reason that originated the VM migration in the previous host - * @param _reason migration reason to leave this host + * 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) { previous_history->reason=_reason; }; + /** + * Sets the action that closed the history record + * @param action that closed the history record + */ + void set_history_action(History::VMAction action) + { + history->action = action; + }; + + /** + * Sets the action that closed the history record in the previous host + * @param action that closed the history record in the previous host + */ +/* + void set_previous_history_action(History::VMAction action) + { + previous_history->action = action; + }; +*/ // ------------------------------------------------------------------------ // Template // ------------------------------------------------------------------------ diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 4f0ed150e3..42574fd30b 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -120,6 +120,10 @@ void LifeCycleManager::suspend_action(int vid) vmpool->update(vm); + vm->set_history_action(History::SUSPEND_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "New VM state is SAVE_SUSPEND"); //---------------------------------------------------- @@ -166,6 +170,10 @@ void LifeCycleManager::stop_action(int vid) vmpool->update(vm); + vm->set_history_action(History::STOP_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "New VM state is SAVE_STOP"); //---------------------------------------------------- @@ -215,6 +223,8 @@ void LifeCycleManager::migrate_action(int vid) vm->set_stime(time(0)); + vm->set_history_action(History::MIGRATE_ACTION); + vmpool->update_history(vm); vm->get_requirements(cpu,mem,disk); @@ -271,6 +281,8 @@ void LifeCycleManager::live_migrate_action(int vid) vm->set_stime(time(0)); + vm->set_history_action(History::LIVE_MIGRATE_ACTION); + vmpool->update_history(vm); vm->get_requirements(cpu,mem,disk); @@ -323,6 +335,10 @@ void LifeCycleManager::shutdown_action(int vid) vmpool->update(vm); + vm->set_history_action(History::SHUTDOWN_ACTION); + + vmpool->update_history(vm); + vm->log("LCM",Log::INFO,"New VM state is SHUTDOWN"); //---------------------------------------------------- @@ -375,12 +391,18 @@ void LifeCycleManager::undeploy_action(int vid, bool hard) if (hard) { + vm->set_history_action(History::UNDEPLOY_HARD_ACTION); + vmm->trigger(VirtualMachineManager::CANCEL,vid); } else { + vm->set_history_action(History::UNDEPLOY_ACTION); + vmm->trigger(VirtualMachineManager::SHUTDOWN,vid); } + + vmpool->update_history(vm); } else { @@ -423,6 +445,10 @@ void LifeCycleManager::poweroff_action(int vid) vmpool->update(vm); + vm->set_history_action(History::POWEROFF_ACTION); + + vmpool->update_history(vm); + vm->log("LCM",Log::INFO,"New VM state is SHUTDOWN_POWEROFF"); //---------------------------------------------------- @@ -525,6 +551,10 @@ void LifeCycleManager::cancel_action(int vid) vmpool->update(vm); + vm->set_history_action(History::SHUTDOWN_HARD_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "New state is CANCEL"); //---------------------------------------------------- @@ -786,10 +816,12 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& imag if (dispose) { vm->set_state(VirtualMachine::CLEANUP_DELETE); + vm->set_history_action(History::DESTROY_ACTION); } else { vm->set_state(VirtualMachine::CLEANUP_RESUBMIT); + vm->set_history_action(History::DESTROY_RECREATE_ACTION); } vm->set_resched(false); diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index 3c96f3b50d..6429610102 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -222,6 +222,10 @@ void LifeCycleManager::save_failure_action(int vid) vmpool->update(vm); + vm->set_history_action(History::NONE_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "Fail to save VM state." " Assuming that the VM is still RUNNING (will poll VM)."); @@ -577,6 +581,10 @@ void LifeCycleManager::shutdown_failure_action(int vid) vmpool->update(vm); + vm->set_history_action(History::NONE_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "Fail to shutdown VM." " Assuming that the VM is still RUNNING (will poll VM)."); @@ -1021,6 +1029,10 @@ void LifeCycleManager::cancel_failure_action(int vid) vmpool->update(vm); + vm->set_history_action(History::NONE_ACTION); + + vmpool->update_history(vm); + vm->log("LCM", Log::INFO, "Fail to cancel VM." " Assuming that the VM is still RUNNING (will poll VM)."); diff --git a/src/vm/History.cc b/src/vm/History.cc index 6eaa31e983..2509b5b6e7 100644 --- a/src/vm/History.cc +++ b/src/vm/History.cc @@ -56,6 +56,7 @@ History::History( epilog_stime(0), epilog_etime(0), reason(NONE), + action(NONE_ACTION), vm_info(""){}; /* -------------------------------------------------------------------------- */ @@ -89,6 +90,7 @@ History::History( epilog_stime(0), epilog_etime(0), reason(NONE), + action(NONE_ACTION), vm_info(_vm_info) { non_persistent_data(); @@ -307,7 +309,8 @@ string& History::to_xml(string& xml, bool database) const "" << running_etime << ""<< "" << epilog_stime << ""<< "" << epilog_etime << ""<< - "" << reason << ""; + "" << reason << ""<< + "" << action << ""; if ( database ) { @@ -327,7 +330,7 @@ string& History::to_xml(string& xml, bool database) const int History::rebuild_attributes() { - int int_reason; + int int_reason, int_action; int rc = 0; rc += xpath(seq , "/HISTORY/SEQ", -1); @@ -347,8 +350,10 @@ int History::rebuild_attributes() rc += xpath(epilog_stime , "/HISTORY/ESTIME", 0); rc += xpath(epilog_etime , "/HISTORY/EETIME", 0); rc += xpath(int_reason , "/HISTORY/REASON", 0); + rc += xpath(int_action , "/HISTORY/ACTION", 0); reason = static_cast(int_reason); + action = static_cast(int_action); non_persistent_data(); From 3ddbef0a18a3b022c1a89f995af64bc4b41b0c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 3 Apr 2013 16:43:02 +0200 Subject: [PATCH 02/40] Feature #1631: Use enum type in RM one.vm.action --- include/History.h | 4 +- src/rm/RequestManagerVirtualMachine.cc | 158 ++++++++++++++----------- 2 files changed, 88 insertions(+), 74 deletions(-) diff --git a/include/History.h b/include/History.h index 51e774ba91..744881bdbc 100644 --- a/include/History.h +++ b/include/History.h @@ -62,7 +62,7 @@ public: NONE_ACTION }; - string action_to_str(VMAction action) + static string action_to_str(VMAction action) { string st; @@ -133,7 +133,7 @@ public: return st; }; - int action_from_str(string& st, VMAction& action) + static int action_from_str(string& st, VMAction& action) { if (st == "migrate") { diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index 66c9acb70d..b949438623 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -299,10 +299,10 @@ int RequestManagerVirtualMachine::add_history(VirtualMachine * vm, void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, RequestAttributes& att) { - string action = xmlrpc_c::value_string(paramList.getString(1)); - int id = xmlrpc_c::value_int(paramList.getInt(2)); + string action_st = xmlrpc_c::value_string(paramList.getString(1)); + int id = xmlrpc_c::value_int(paramList.getInt(2)); - int rc = -3; + int rc; Nebula& nd = Nebula::instance(); DispatchManager * dm = nd.get_dm(); @@ -310,8 +310,33 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, ostringstream oss; AuthRequest::Operation op = auth_op; + History::VMAction action; - if (action == "resched" || action == "unresched") + // Compatibility with 3.8 + if (action_st == "cancel") + { + action_st = "shutdown-hard"; + } + else if (action_st == "restart") + { + action_st = "boot"; + } + else if (action_st == "finalize") + { + action_st = "destroy"; + } + else if (action_st == "resubmit") + { + action_st = "destroy-recreate"; + } + else if (action_st == "reset") + { + action_st = "reboot-hard"; + } + + History::action_from_str(action_st, action); + + if (action == History::RESCHED_ACTION || action == History::UNRESCHED_ACTION) { op = AuthRequest::ADMIN; } @@ -321,73 +346,62 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, return; } - if (action == "shutdown") + switch (action) { - rc = dm->shutdown(id); - } - else if (action == "hold") - { - rc = dm->hold(id); - } - else if (action == "release") - { - rc = dm->release(id); - } - else if (action == "stop") - { - rc = dm->stop(id); - } - else if (action == "shutdown-hard" || action == "cancel") - { - rc = dm->cancel(id); - } - else if (action == "suspend") - { - rc = dm->suspend(id); - } - else if (action == "resume") - { - rc = dm->resume(id); - } - else if (action == "boot" || action == "restart") - { - rc = dm->restart(id); - } - else if (action == "destroy" || action == "finalize") - { - rc = dm->finalize(id); - } - else if (action == "destroy-recreate" || action == "resubmit") - { - rc = dm->resubmit(id); - } - else if (action == "reboot") - { - rc = dm->reboot(id); - } - else if (action == "resched") - { - rc = dm->resched(id, true); - } - else if (action == "unresched") - { - rc = dm->resched(id, false); - } - else if (action == "reboot-hard" || action == "reset") - { - rc = dm->reset(id); - } - else if (action == "poweroff") - { - rc = dm->poweroff(id); - } - else if (action == "undeploy") - { - rc = dm->undeploy(id, false); - } - else if (action == "undeploy-hard") - { - rc = dm->undeploy(id, true); + case History::SHUTDOWN_ACTION: + rc = dm->shutdown(id); + break; + case History::HOLD_ACTION: + rc = dm->hold(id); + break; + case History::RELEASE_ACTION: + rc = dm->release(id); + break; + case History::STOP_ACTION: + rc = dm->stop(id); + break; + case History::SHUTDOWN_HARD_ACTION: + rc = dm->cancel(id); + break; + case History::SUSPEND_ACTION: + rc = dm->suspend(id); + break; + case History::RESUME_ACTION: + rc = dm->resume(id); + break; + case History::BOOT_ACTION: + rc = dm->restart(id); + break; + case History::DESTROY_ACTION: + rc = dm->finalize(id); + break; + case History::DESTROY_RECREATE_ACTION: + rc = dm->resubmit(id); + break; + case History::REBOOT_ACTION: + rc = dm->reboot(id); + break; + case History::RESCHED_ACTION: + rc = dm->resched(id, true); + break; + case History::UNRESCHED_ACTION: + rc = dm->resched(id, false); + break; + case History::REBOOT_HARD_ACTION: + rc = dm->reset(id); + break; + case History::POWEROFF_ACTION: + rc = dm->poweroff(id); + break; + case History::UNDEPLOY_ACTION: + rc = dm->undeploy(id, false); + break; + case History::UNDEPLOY_HARD_ACTION: + rc = dm->undeploy(id, true); + break; + default: + rc = -3; + break; } switch (rc) @@ -401,14 +415,14 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, att); break; case -2: - oss << "Wrong state to perform action \"" << action << "\""; + oss << "Wrong state to perform action \"" << action_st << "\""; failure_response(ACTION, request_error(oss.str(),""), att); break; case -3: - oss << "Virtual machine action \"" << action + oss << "Virtual machine action \"" << action_st << "\" is not supported"; failure_response(ACTION, From 72d3ea947173feda490dfd909936509375bc7d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 3 Apr 2013 17:38:06 +0200 Subject: [PATCH 03/40] Feature #1631: Change history reasons to be only 3: none, user, error --- include/History.h | 13 +++++-------- include/VirtualMachine.h | 6 +++--- src/lcm/LifeCycleActions.cc | 6 ++++-- src/lcm/LifeCycleStates.cc | 14 +++++++------- src/oca/ruby/opennebula/virtual_machine.rb | 6 ++---- src/ozones/Server/public/js/ozones.js | 4 +--- src/sunstone/public/js/opennebula.js | 4 +--- src/vm/History.cc | 2 +- 8 files changed, 24 insertions(+), 31 deletions(-) diff --git a/include/History.h b/include/History.h index 744881bdbc..9efdabe03f 100644 --- a/include/History.h +++ b/include/History.h @@ -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; diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 345eeb699a..e0bce0dce0 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -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; }; diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 42574fd30b..f933274d64 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -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; diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index 6429610102..139c12a805 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -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); diff --git a/src/oca/ruby/opennebula/virtual_machine.rb b/src/oca/ruby/opennebula/virtual_machine.rb index 905a7e83e8..23bdf977b6 100644 --- a/src/oca/ruby/opennebula/virtual_machine.rb +++ b/src/oca/ruby/opennebula/virtual_machine.rb @@ -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 diff --git a/src/ozones/Server/public/js/ozones.js b/src/ozones/Server/public/js/ozones.js index e8661caccd..ee70bb595c 100644 --- a/src/ozones/Server/public/js/ozones.js +++ b/src/ozones/Server/public/js/ozones.js @@ -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; diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 9b3d5dcb18..38d535d00a 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -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; diff --git a/src/vm/History.cc b/src/vm/History.cc index 2509b5b6e7..5e2ba19dfe 100644 --- a/src/vm/History.cc +++ b/src/vm/History.cc @@ -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(int_reason); + reason = static_cast(int_reason); action = static_cast(int_action); non_persistent_data(); From b483b8bb2570fbddfe5efe33e17ac80a24ca103c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 3 Apr 2013 18:20:20 +0200 Subject: [PATCH 04/40] Feature #1631: Fix merge --- include/History.h | 8 ++++++++ src/lcm/LifeCycleActions.cc | 10 ++++++---- src/lcm/LifeCycleStates.cc | 2 +- src/rm/RequestManagerVirtualMachine.cc | 5 ++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/History.h b/include/History.h index 9efdabe03f..5e79ace5a8 100644 --- a/include/History.h +++ b/include/History.h @@ -56,6 +56,7 @@ public: RESCHED_ACTION, UNRESCHED_ACTION, POWEROFF_ACTION, + POWEROFF_HARD_ACTION, NONE_ACTION }; @@ -122,6 +123,9 @@ public: case POWEROFF_ACTION: st = "poweroff"; break; + case POWEROFF_HARD_ACTION: + st = "poweroff-hard"; + break; case NONE_ACTION: st = "none"; break; @@ -208,6 +212,10 @@ public: { action = POWEROFF_ACTION; } + else if (st == "poweroff-hard") + { + action = POWEROFF_HARD_ACTION; + } else { action = NONE_ACTION; diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 51174bce2e..95516cd110 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -463,22 +463,24 @@ void LifeCycleManager::poweroff_action(int vid, bool hard) vmpool->update(vm); - vm->set_history_action(History::POWEROFF_ACTION); - - vmpool->update_history(vm); - vm->log("LCM",Log::INFO,"New VM state is SHUTDOWN_POWEROFF"); //---------------------------------------------------- if (hard) { + vm->set_history_action(History::POWEROFF_HARD_ACTION); + vmm->trigger(VirtualMachineManager::CANCEL,vid); } else { + vm->set_history_action(History::POWEROFF_ACTION); + vmm->trigger(VirtualMachineManager::SHUTDOWN,vid); } + + vmpool->update_history(vm); } else { diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index b4528e071b..26ba3576a0 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -1010,7 +1010,7 @@ void LifeCycleManager::cancel_success_action(int vid) vm->set_vm_info(); - vm->set_reason(History::STOP_RESUME); + vm->set_reason(History::NONE); vmpool->update_history(vm); diff --git a/src/rm/RequestManagerVirtualMachine.cc b/src/rm/RequestManagerVirtualMachine.cc index b949438623..638019728f 100644 --- a/src/rm/RequestManagerVirtualMachine.cc +++ b/src/rm/RequestManagerVirtualMachine.cc @@ -391,7 +391,10 @@ void VirtualMachineAction::request_execute(xmlrpc_c::paramList const& paramList, rc = dm->reset(id); break; case History::POWEROFF_ACTION: - rc = dm->poweroff(id); + rc = dm->poweroff(id, false); + break; + case History::POWEROFF_HARD_ACTION: + rc = dm->poweroff(id, true); break; case History::UNDEPLOY_ACTION: rc = dm->undeploy(id, false); From 3e99db4a03f69621100db2e90f586858186244e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 3 Apr 2013 18:24:09 +0200 Subject: [PATCH 05/40] Feature #1631: Set USER reason for any operation initiated by the user --- src/lcm/LifeCycleStates.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index 26ba3576a0..58eff2d1b4 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -534,7 +534,7 @@ void LifeCycleManager::shutdown_success_action(int vid) vm->set_running_etime(the_time); - vm->set_reason(History::NONE); + vm->set_reason(History::USER); vmpool->update_history(vm); @@ -753,7 +753,7 @@ void LifeCycleManager::prolog_failure_action(int vid) vm->set_vm_info(); - vm->set_reason(History::NONE); + vm->set_reason(History::ERROR); vmpool->update_history(vm); @@ -984,7 +984,7 @@ void LifeCycleManager::cancel_success_action(int vid) vm->set_running_etime(the_time); - vm->set_reason(History::NONE); + vm->set_reason(History::USER); vmpool->update_history(vm); @@ -1010,7 +1010,7 @@ void LifeCycleManager::cancel_success_action(int vid) vm->set_vm_info(); - vm->set_reason(History::NONE); + vm->set_reason(History::USER); vmpool->update_history(vm); From dd516424ccb54b61c2fa3f8e81cb7eddd5382d69 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Wed, 3 Apr 2013 20:03:21 +0200 Subject: [PATCH 06/40] Add new undeploy action to Sunstone --- .../OpenNebulaJSON/VirtualMachineJSON.rb | 11 ++- src/sunstone/public/js/opennebula.js | 23 ++++++- src/sunstone/public/js/plugins/vms-tab.js | 66 +++++++++++++++--- src/sunstone/public/js/sunstone.js | 68 ++++++++++++++----- 4 files changed, 139 insertions(+), 29 deletions(-) diff --git a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb index f8a6e28aad..cb2ac8ecb0 100644 --- a/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb +++ b/src/sunstone/models/OpenNebulaJSON/VirtualMachineJSON.rb @@ -61,7 +61,7 @@ module OpenNebulaJSON when "snapshot_delete" then self.snapshot_delete(action_hash['params']) when "shutdown" then self.shutdown when "reboot" then self.reboot - when "poweroff" then self.poweroff + when "poweroff" then self.poweroff(action_hash['params']) when "resubmit" then self.resubmit when "chown" then self.chown(action_hash['params']) when "chmod" then self.chmod_octet(action_hash['params']) @@ -72,6 +72,7 @@ module OpenNebulaJSON when "detachnic" then self.detachnic(action_hash['params']) when "update" then self.update(action_hash['params']) when "rename" then self.rename(action_hash['params']) + when "undeploy" then self.undeploy(action_hash['params']) else error_msg = "#{action_hash['perform']} action not " << " available for this resource" @@ -87,6 +88,14 @@ module OpenNebulaJSON super(params['host_id']) end + def undeploy(params=Hash.new) + super(params['hard']) + end + + def poweroff(params=Hash.new) + super(params['hard']) + end + def migrate(params=Hash.new, live=false, enforce=false) # TODO add enforce parameter super(params['host_id'], live) diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 9b3d5dcb18..0c14195973 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -83,7 +83,8 @@ var OpenNebula = { "SUSPENDED", "DONE", "FAILED", - "POWEROFF"][value]); + "POWEROFF", + "UNDEPLOYED"][value]); break; case "VM_LCM": case "vm_lcm": @@ -115,7 +116,10 @@ var OpenNebula = { "HOTPLUG_NIC", "HOTPLUG_SAVEAS", "HOTPLUG_SAVEAS_POWEROFF", - "HOTPLUG_SAVEAS_SUSPENDED"][value]); + "HOTPLUG_SAVEAS_SUSPENDED", + "SHUTDOWN_UNDEPLOY", + "EPILOG_UNDEPLOY", + "PROLOG_UNDEPLOY"][value]); break; case "IMAGE": case "image": @@ -664,7 +668,20 @@ var OpenNebula = { OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"resubmit"); }, "poweroff" : function(params){ - OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"poweroff"); + var action_obj = {"hard": false}; + OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"poweroff", action_obj); + }, + "poweroff_hard" : function(params){ + var action_obj = {"hard": true}; + OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"poweroff", action_obj); + }, + "undeploy" : function(params){ + var action_obj = {"hard": false}; + OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"undeploy", action_obj); + }, + "undeploy_hard" : function(params){ + var action_obj = {"hard": true}; + OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"undeploy", action_obj); }, "reboot" : function(params){ OpenNebula.Action.simple_action(params,OpenNebula.VM.resource,"reboot"); diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 9cba9de762..dfa400ef92 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -371,6 +371,33 @@ var vm_actions = { notify: true }, + "VM.poweroff_hard" : { + type: "multiple", + call: OpenNebula.VM.poweroff_hard, + callback: vmShow, + elements: vmElements, + error: onError, + notify: true + }, + + "VM.undeploy" : { + type: "multiple", + call: OpenNebula.VM.undeploy, + callback: vmShow, + elements: vmElements, + error: onError, + notify: true + }, + + "VM.undeploy_hard" : { + type: "multiple", + call: OpenNebula.VM.undeploy_hard, + callback: vmShow, + elements: vmElements, + error: onError, + notify: true + }, + "VM.saveas" : { type: "single", call: OpenNebula.VM.saveas, @@ -754,45 +781,63 @@ var vm_buttons = { "VM.suspend" : { type: "confirm", text: tr("Suspend"), - layout: "vmsstopresume_buttons", + layout: "vmspause_buttons", tip: tr("This will suspend selected machines") }, "VM.resume" : { type: "confirm", - text: tr("Resume"), - layout: "vmsstopresume_buttons", + text: '', + layout: "vmsplay_buttons", tip: tr("This will resume selected stopped or suspended VMs") }, "VM.stop" : { type: "confirm", text: tr("Stop"), - layout: "vmsstopresume_buttons", + layout: "vmsstop_buttons", tip: tr("This will stop selected VMs") }, "VM.restart" : { type: "confirm", text: tr("Boot"), - layout: "vmsoneoff_buttons", + layout: "vmsplanification_buttons", tip: tr("This will redeploy selected VMs (in UNKNOWN or BOOT state)") }, "VM.reboot" : { type : "confirm", text: tr("Reboot"), - layout: "vmsoneoff_buttons", + layout: "vmsrepeat_buttons", tip: tr("This will send a reboot action to running VMs") }, "VM.reset" : { type: "confirm", text: tr("Reboot") + ' hard', - layout: "vmsoneoff_buttons", + layout: "vmsrepeat_buttons", tip: tr("This will perform a hard reboot on selected VMs") }, "VM.poweroff" : { type : "confirm", text: tr("Power Off"), - layout: "vmsoneoff_buttons", + layout: "vmspause_buttons", tip: tr("This will send a power off signal to running VMs. They can be restarted later.") }, + "VM.poweroff_hard" : { + type : "confirm", + text: tr("Power Off") + ' hard', + layout: "vmspause_buttons", + tip: tr("This will send a power off signal to running VMs. They can be restarted later.") + }, + "VM.undeploy" : { + type : "confirm", + text: tr("Undeploy"), + layout: "vmsstop_buttons", + tip: tr("Shuts down the given VM. The VM is saved in the system Datastore.") + }, + "VM.undeploy_hard" : { + type : "confirm", + text: tr("Undeploy") + ' hard', + layout: "vmsstop_buttons", + tip: tr("Shuts down the given VM. The VM is saved in the system Datastore.") + }, "VM.shutdown" : { type: "confirm", text: tr("Shutdown"), @@ -815,7 +860,7 @@ var vm_buttons = { "VM.resubmit" : { type: "confirm", text: tr("Destroy") + ' recreate', - layout: "vmsdelete_buttons", + layout: "vmsrepeat_buttons", tip: tr("This will resubmits VMs to PENDING state") }, @@ -1459,6 +1504,9 @@ function printActionsTable(vm_info) \ \ \ + \ + \ + \ \ \ \ diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 0069a7c118..7a49b5f844 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -582,19 +582,21 @@ function insertButtonsInTab(tab_name){ "
"+ '
'+ '
    '+ - '
  • '+ + '
  • '+ "
    "+ ""+ "
    "+ '
  • '+ - '
  • '+ + '
'+ + '
    '+ + '
  • '+ "
    "+ ""+ @@ -609,15 +611,34 @@ function insertButtonsInTab(tab_name){ "
    "+ "
"+ ''+ - '
  • '+ + ''+ + '
      '+ + '
    • '+ + "
      "+ + "
      "+ + "
      "+ + "
      "+ + '
    • '+ + '
    • '+ "
      "+ ""+ "
      "+ '
    • '+ + '
    • '+ + "
      "+ + ""+ + "
      "+ + '
    • '+ + '
    '+ + '
      '+ '
    • '+ "
      "+ "
        "+ @@ -703,13 +724,24 @@ function insertButtonsInTab(tab_name){ str_class.push("secondary", "button", "small", "radius"); button_code = '
      • '; break; - case "vmsstopresume_buttons": - context = $("#vmsstopresume_buttons ul", buttons_row); + case "vmsplay_buttons": + context = $("#vmsplay_buttons", buttons_row); + text = button.text; + str_class.push("secondary", "button", "small", "radius"); + button_code = ''; + break; + case "vmspause_buttons": + context = $("#vmspause_buttons ul", buttons_row); text = button.text; button_code = '
      • '+text+'
      • '; break; - case "vmsplanification_buttons": - context = $("#vmsplanification_buttons ul", buttons_row); + case "vmsstop_buttons": + context = $("#vmsstop_buttons ul", buttons_row); + text = button.text; + button_code = '
      • '+text+'
      • '; + break; + case "vmsrepeat_buttons": + context = $("#vmsrepeat_buttons ul", buttons_row); text = button.text; button_code = '
      • '+text+'
      • '; break; @@ -718,8 +750,8 @@ function insertButtonsInTab(tab_name){ text = button.text; button_code = '
      • '+text+'
      • '; break; - case "vmsoneoff_buttons": - context = $("#vmsoneoff_buttons ul", buttons_row); + case "vmsplanification_buttons": + context = $("#vmsplanification_buttons ul", buttons_row); text = button.text; button_code = '
      • '+text+'
      • '; break; @@ -769,12 +801,16 @@ function insertButtonsInTab(tab_name){ $("#vmsdelete_buttons", action_block).remove() } - if ($("#vmsoneoff_buttons ul li", action_block).length == 0 ) { - $("#vmsoneoff_buttons", action_block).remove() + if ($("#vmsstop_buttons ul li", action_block).length == 0 ) { + $("#vmsstop_buttons", action_block).remove() } - if ($("#vmsstopresume_buttons ul li", action_block).length == 0 ) { - $("#vmsstopresume_buttons", action_block).remove() + if ($("#vmspause_buttons ul li", action_block).length == 0 ) { + $("#vmspause_buttons", action_block).remove() + } + + if ($("#vmsrepeat_buttons ul li", action_block).length == 0 ) { + $("#vmsrepeat_buttons", action_block).remove() } if ($("#user_buttons ul li", action_block).length == 0 ) { From 4095acb7cc3864468b4d109edc4cba5381cfb6ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 11:34:20 +0200 Subject: [PATCH 07/40] Feature #1631: Fix history reason for migrate. --- include/VirtualMachine.h | 3 +-- src/lcm/LifeCycleActions.cc | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index e0bce0dce0..3caa17335e 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -669,12 +669,11 @@ public: * Sets the action that closed the history record in the previous host * @param action that closed the history record in the previous host */ -/* void set_previous_history_action(History::VMAction action) { previous_history->action = action; }; -*/ + // ------------------------------------------------------------------------ // Template // ------------------------------------------------------------------------ diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 95516cd110..0ef0f49511 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -225,7 +225,7 @@ void LifeCycleManager::migrate_action(int vid) vm->set_stime(time(0)); - vm->set_history_action(History::MIGRATE_ACTION); + vm->set_previous_history_action(History::MIGRATE_ACTION); vmpool->update_history(vm); From 07e08deb43c53b05310e88af15c197fa62193d50 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 4 Apr 2013 11:45:15 +0200 Subject: [PATCH 08/40] Fix login error message --- src/sunstone/public/css/app.css | 73 +++++++++++++------------- src/sunstone/public/css/login.css | 52 ++++++++++++++---- src/sunstone/public/js/login.js | 8 +-- src/sunstone/public/sass/app.scss | 3 +- src/sunstone/views/_login_standard.erb | 7 +-- src/sunstone/views/_login_x509.erb | 11 ++-- 6 files changed, 93 insertions(+), 61 deletions(-) diff --git a/src/sunstone/public/css/app.css b/src/sunstone/public/css/app.css index 8ec1dc2f7a..88ba623478 100644 --- a/src/sunstone/public/css/app.css +++ b/src/sunstone/public/css/app.css @@ -3734,7 +3734,6 @@ ul.tabs-content.contained.vertical > li { div.alert-box { display: block; padding: 6px 7px 7px; - font-weight: bold; font-size: 14px; color: white; background-color: #2ba6cb; @@ -3747,6 +3746,7 @@ div.alert-box { border-radius: 3px; text-shadow: 0 -1px rgba(0, 0, 0, 0.3); position: relative; + font-family: Arial, Helvetica, sans-serif; } /* line 29, ../../../../../../../.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/zurb-foundation-3.2.5/scss/foundation/components/modules/_ui.scss */ div.alert-box.success { @@ -6655,40 +6655,41 @@ small { /* line 616, ../sass/app.scss */ .button.dropdown.small::after { - border-color: #2f2f2f transparent transparent transparent; + border-color: #9f9f9f transparent transparent transparent; + border-width: 4px; } -/* line 620, ../sass/app.scss */ +/* line 621, ../sass/app.scss */ .footer-opennebula { font-size: 10px; color: #b6b6b6 !important; } -/* line 625, ../sass/app.scss */ +/* line 626, ../sass/app.scss */ a.footer.button { margin: 5px; } -/* line 630, ../sass/app.scss */ +/* line 631, ../sass/app.scss */ .user-login { float: right; } -/* line 634, ../sass/app.scss */ +/* line 635, ../sass/app.scss */ .user-login i.header-icon { color: #6f6f6f; font-weight: 300; font-size: 23px; } -/* line 640, ../sass/app.scss */ +/* line 641, ../sass/app.scss */ .user-login .button { color: #6f6f6f; font-size: 60%; line-height: 0; } -/* line 646, ../sass/app.scss */ +/* line 647, ../sass/app.scss */ .user-login .button.secondary { background: #f2f2f2; border: 0px; @@ -6696,88 +6697,88 @@ a.footer.button { font-weight: 300; } -/* line 654, ../sass/app.scss */ +/* line 655, ../sass/app.scss */ .user-login .button.secondary:hover, .user-login .button.secondary:focus { background-color: #d0d0d0; color: #6f6f6f; } -/* line 659, ../sass/app.scss */ +/* line 660, ../sass/app.scss */ .user-login .button.dropdown.tiny::after { border: solid 5px; border-color: #b6b6b6 transparent transparent transparent; right: 7px; } -/* line 665, ../sass/app.scss */ +/* line 666, ../sass/app.scss */ .header-resource { text-align: center; } -/* line 669, ../sass/app.scss */ +/* line 670, ../sass/app.scss */ .header-resource { float: left; } -/* line 673, ../sass/app.scss */ +/* line 674, ../sass/app.scss */ .header { text-align: center; } -/* line 677, ../sass/app.scss */ +/* line 678, ../sass/app.scss */ .button.dropdown.tiny ul.no-hover.show-dropdown { top: 34px !important; } -/* line 681, ../sass/app.scss */ +/* line 682, ../sass/app.scss */ .graph_legend { text-align: center; } -/* line 685, ../sass/app.scss */ +/* line 686, ../sass/app.scss */ .graph_legend table { background: inherit; border: 0px; width: 100%; } -/* line 691, ../sass/app.scss */ +/* line 692, ../sass/app.scss */ .graph_legend h3 { margin-top: 0px; } -/* line 695, ../sass/app.scss */ +/* line 696, ../sass/app.scss */ .graph_legend .subheader { margin-bottom: 5px; } -/* line 699, ../sass/app.scss */ +/* line 700, ../sass/app.scss */ .dashboard hr { margin: 0; margin-bottom: 8px; } -/* line 704, ../sass/app.scss */ +/* line 705, ../sass/app.scss */ .graph { margin-bottom: 15px !important; } -/* line 708, ../sass/app.scss */ +/* line 709, ../sass/app.scss */ .dashboard-panel { height: 450px; } -/* line 712, ../sass/app.scss */ +/* line 713, ../sass/app.scss */ .vm_log_error { color: #ff8d81; } -/* line 716, ../sass/app.scss */ +/* line 717, ../sass/app.scss */ .noUiSlider { margin: 10px; } -/* line 720, ../sass/app.scss */ +/* line 721, ../sass/app.scss */ .log-tab { background: #6f6f6f; color: #f2f2f2; @@ -6785,12 +6786,12 @@ a.footer.button { padding: 20px; } -/* line 727, ../sass/app.scss */ +/* line 728, ../sass/app.scss */ .reveal-modal ul.tabs-content { margin: 0 0 0px; } -/* line 731, ../sass/app.scss */ +/* line 732, ../sass/app.scss */ .reveal-body { max-height: 360px; overflow-y: auto; @@ -6798,7 +6799,7 @@ a.footer.button { padding: 5px; } -/* line 741, ../sass/app.scss */ +/* line 742, ../sass/app.scss */ div.time-picker { position: absolute; height: 191px; @@ -6811,20 +6812,20 @@ div.time-picker { margin: 0; } -/* line 751, ../sass/app.scss */ +/* line 752, ../sass/app.scss */ div.time-picker-12hours { width: 6em; /* needed for IE */ } -/* line 755, ../sass/app.scss */ +/* line 756, ../sass/app.scss */ div.time-picker ul { list-style-type: none; margin: 0; padding: 0; } -/* line 760, ../sass/app.scss */ +/* line 761, ../sass/app.scss */ div.time-picker li { cursor: pointer; height: 20px; @@ -6832,36 +6833,36 @@ div.time-picker li { padding: 4px 3px; } -/* line 766, ../sass/app.scss */ +/* line 767, ../sass/app.scss */ div.time-picker li.selected { background: #0063CE; color: #fff; } -/* line 772, ../sass/app.scss */ +/* line 773, ../sass/app.scss */ .timepicker { float: left; width: 50px !important; } -/* line 777, ../sass/app.scss */ +/* line 778, ../sass/app.scss */ .jdpicker { float: left; width: 90px !important; } -/* line 782, ../sass/app.scss */ +/* line 783, ../sass/app.scss */ .columns { line-height: 2; } -/* line 786, ../sass/app.scss */ +/* line 787, ../sass/app.scss */ .transparent_table, .transparent_table tr { background: none !important; border: 0px !important; } -/* line 791, ../sass/app.scss */ +/* line 792, ../sass/app.scss */ form { margin: 0 !important; } diff --git a/src/sunstone/public/css/login.css b/src/sunstone/public/css/login.css index a91e7d89a5..58e2d30dd1 100644 --- a/src/sunstone/public/css/login.css +++ b/src/sunstone/public/css/login.css @@ -150,16 +150,6 @@ div#login input#login_btn:hover { background: url(../images/login_over.png) no-repeat center ; } -.error_message { - display: none; - position: relative; - width:400px; - margin-left: auto; - margin-right: auto; - top: 80px; - font-size:1.0em; - padding: 2px 15px; -} #login_spinner { left: 22px; @@ -187,3 +177,45 @@ div#login input#login_btn:hover { margin-top: 35px; margin-left:0px; } + +div.alert-box { + display: block; + padding: 6px 7px 7px; + font-size: 14px; + color: white; + background-color: #2ba6cb; + border: 1px solid rgba(0, 0, 0, 0.1); + margin-bottom: 12px; + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + -ms-border-radius: 3px; + -o-border-radius: 3px; + border-radius: 3px; + text-shadow: 0 -1px rgba(0, 0, 0, 0.3); + position: relative; + font-family: Arial, Helvetica, sans-serif; +} + +div.alert-box.alert { + background-color: #c0392b; + color: #fff; + text-shadow: 0 -1px rgba(0, 0, 0, 0.3); +} + +div.alert-box a.close { + color: #333; + position: absolute; + right: 4px; + top: -1px; + font-size: 17px; + opacity: 0.2; + padding: 4px; +} +/* line 34, ../../../../../../../.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/zurb-foundation-3.2.5/scss/foundation/components/modules/_ui.scss */ +div.alert-box a.close:hover, div.alert-box a.close:focus { + opacity: 0.4; +} + +#error_box { + margin-top:70px; +} \ No newline at end of file diff --git a/src/sunstone/public/js/login.js b/src/sunstone/public/js/login.js index 645c6207fe..b681add977 100644 --- a/src/sunstone/public/js/login.js +++ b/src/sunstone/public/js/login.js @@ -24,16 +24,16 @@ function auth_error(req, error){ switch (status){ case 401: - $("#error_box").text("Invalid username or password"); + $("#error_message").text("Invalid username or password"); break; case 500: - $("#error_box").text("OpenNebula is not running or there was a server exception. Please check the server logs."); + $("#error_message").text("OpenNebula is not running or there was a server exception. Please check the server logs."); break; case 0: - $("#error_box").text("No answer from server. Is it running?"); + $("#error_message").text("No answer from server. Is it running?"); break; default: - $("#error_box").text("Unexpected error. Status "+status+". Check the server logs."); + $("#error_message").text("Unexpected error. Status "+status+". Check the server logs."); }; $("#error_box").fadeIn("slow"); $("#login_spinner").hide(); diff --git a/src/sunstone/public/sass/app.scss b/src/sunstone/public/sass/app.scss index e69d9d6d3e..d9a893949e 100644 --- a/src/sunstone/public/sass/app.scss +++ b/src/sunstone/public/sass/app.scss @@ -614,7 +614,8 @@ small { .button.dropdown.small::after { - border-color: #2f2f2f transparent transparent transparent; + border-color: #9f9f9f transparent transparent transparent; + border-width: 4px; } .footer-opennebula { diff --git a/src/sunstone/views/_login_standard.erb b/src/sunstone/views/_login_standard.erb index da26dc91da..50af211cfe 100644 --- a/src/sunstone/views/_login_standard.erb +++ b/src/sunstone/views/_login_standard.erb @@ -2,8 +2,7 @@
        -
        -
        +
        @@ -17,8 +16,10 @@ retrieving -
        +
  • diff --git a/src/sunstone/views/_login_x509.erb b/src/sunstone/views/_login_x509.erb index 96150cd191..1e19ba1582 100644 --- a/src/sunstone/views/_login_x509.erb +++ b/src/sunstone/views/_login_x509.erb @@ -2,13 +2,6 @@
    -
    - Invalid username or password -
    -
    - OpenNebula is not running -
    -
    @@ -17,6 +10,10 @@
    +
    From 1f3505f20b6166dd3de4577323950a59ba4f4546 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 4 Apr 2013 12:00:21 +0200 Subject: [PATCH 09/40] bug #1862: Fix model field in vm template creation form --- src/sunstone/public/js/plugins/templates-tab.js | 8 ++++---- src/sunstone/public/js/sunstone.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 9436f989b3..906283fc94 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -1150,7 +1150,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ '
    '+ ''+ '
    '+ - '
    '+ + '
    '+ ''+ '
    '+ '
    '+ @@ -1163,7 +1163,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ '
    '+ ''+ '
    '+ - '
    '+ + '
    '+ ''+ '
    '+ '
    '+ @@ -1193,7 +1193,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ ''+ '
    '+ '
    '+ - '
    '+tr("A list of ports separated by commas or a ranges separated by semilocolons, e.g.: 22,80,5900:6000")+'
    '+ + '
    '+tr("A list of ports separated by commas or a ranges separated by semicolons, e.g.: 22,80,5900:6000")+'
    '+ '
    '+ '
    '+ ''+ @@ -1218,7 +1218,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ ''+ '
    '+ '
    '+ - '
    '+tr("A list of ports separated by commas or a ranges separated by semilocolons, e.g.: 22,80,5900:6000")+'
    '+ + '
    '+tr("A list of ports separated by commas or a ranges separated by semicolons, e.g.: 22,80,5900:6000")+'
    '+ '
    '+ '
    '+ ''+ diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 7a49b5f844..5f55039387 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -916,7 +916,7 @@ function setupConfirmDialogs(){
    \
    \ \ - \ + \
    \ ×\ '); @@ -956,7 +956,7 @@ function setupConfirmDialogs(){
    \
    \ \ - \ + \
    \ ×\ '); From ce61d6ee17f0e28684f050ad4257bff194df1dfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 12:12:30 +0200 Subject: [PATCH 10/40] Feature #1631: Add history close action to onevm show and oneacct output --- src/cli/etc/oneacct.yaml | 5 +++++ src/cli/one_helper.rb | 12 ++++++++++++ src/cli/one_helper/oneacct_helper.rb | 6 +++++- src/cli/one_helper/onevm_helper.rb | 20 ++++++++++++-------- src/oca/ruby/opennebula/virtual_machine.rb | 9 +++++++++ 5 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/cli/etc/oneacct.yaml b/src/cli/etc/oneacct.yaml index 0e79bf3db1..d7e487aa83 100644 --- a/src/cli/etc/oneacct.yaml +++ b/src/cli/etc/oneacct.yaml @@ -12,6 +12,11 @@ :size: 15 :left: true +:ACTION: + :desc: VM state change action + :size: 16 + :left: true + :REASON: :desc: VM state change reason :size: 4 diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb index 1ce49a1c73..093fd285b8 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -608,6 +608,18 @@ EOT end end + def OpenNebulaHelper.short_period_to_str(time, print_seconds=true) + seconds=time.to_i + minutes, seconds=seconds.divmod(60) + hours, minutes=minutes.divmod(60) + + if print_seconds + "%3dh%02dm%02ds" % [hours, minutes, seconds] + else + "%3dh%02dm" % [hours, minutes] + end + end + BinarySufix = ["K", "M", "G", "T" ] def OpenNebulaHelper.unit_to_str(value, options, unit="K") diff --git a/src/cli/one_helper/oneacct_helper.rb b/src/cli/one_helper/oneacct_helper.rb index 385c1f7921..f5c78b99a6 100644 --- a/src/cli/one_helper/oneacct_helper.rb +++ b/src/cli/one_helper/oneacct_helper.rb @@ -112,6 +112,10 @@ class AcctHelper < OpenNebulaHelper::OneHelper d["HOSTNAME"] end + column :"ACTION", "VM state change action", :left, :size=>16 do |d| + VirtualMachine.get_history_action d["ACTION"] + end + column :REASON, "VM state change reason", :left, :size=>4 do |d| VirtualMachine.get_reason d["REASON"] end @@ -142,7 +146,7 @@ class AcctHelper < OpenNebulaHelper::OneHelper OpenNebulaHelper.unit_to_str(d["VM"]["NET_TX"].to_i / 1024.0, {}) end - default :VID, :HOSTNAME, :REASON, :START_TIME, :END_TIME, :MEMORY, :CPU, :NET_RX, :NET_TX + default :VID, :HOSTNAME, :ACTION, :REASON, :START_TIME, :END_TIME, :MEMORY, :CPU, :NET_RX, :NET_TX end def self.print_start_end_time_header(start_time, end_time) diff --git a/src/cli/one_helper/onevm_helper.rb b/src/cli/one_helper/onevm_helper.rb index db06cedb50..b40a147c34 100644 --- a/src/cli/one_helper/onevm_helper.rb +++ b/src/cli/one_helper/onevm_helper.rb @@ -531,15 +531,19 @@ class OneVMHelper < OpenNebulaHelper::OneHelper def format_history(vm) table=CLIHelper::ShowTable.new(nil, self) do - column :SEQ, "Sequence number", :size=>4 do |d| + column :SEQ, "Sequence number", :size=>3 do |d| d["SEQ"] end - column :HOST, "Host name of the VM container", :left, :size=>20 do |d| + column :HOST, "Host name of the VM container", :left, :size=>15 do |d| d["HOSTNAME"] end - column :REASON, "VM state change reason", :left, :size=>6 do |d| + column :"ACTION", "VM state change action", :left, :size=>16 do |d| + VirtualMachine.get_history_action d["ACTION"] + end + + column :REASON, "VM state change reason", :left, :size=>4 do |d| VirtualMachine.get_reason d["REASON"] end @@ -547,14 +551,14 @@ class OneVMHelper < OpenNebulaHelper::OneHelper OpenNebulaHelper.time_to_str(d['STIME']) end - column :TIME, "Total time in this state", :size=>15 do |d| + column :TIME, "Total time in this state", :size=>11 do |d| stime = d["STIME"].to_i etime = d["ETIME"]=="0" ? Time.now.to_i : d["ETIME"].to_i dtime = etime-stime - OpenNebulaHelper.period_to_str(dtime) + OpenNebulaHelper.period_to_str(dtime, false) end - column :PROLOG_TIME, "Prolog time for this state", :size=>15 do |d| + column :PROLOG, "Prolog time for this state", :size=>10 do |d| stime = d["PSTIME"].to_i if d["PSTIME"]=="0" etime=0 @@ -562,10 +566,10 @@ class OneVMHelper < OpenNebulaHelper::OneHelper etime = d["PETIME"]=="0" ? Time.now.to_i: d["PETIME"].to_i end dtime = etime-stime - OpenNebulaHelper.period_to_str(dtime) + OpenNebulaHelper.short_period_to_str(dtime) end - default :SEQ, :HOST, :REASON, :START, :TIME, :PROLOG_TIME + default :SEQ, :HOST, :ACTION, :REASON, :START, :TIME, :PROLOG end vm_hash=vm.to_hash diff --git a/src/oca/ruby/opennebula/virtual_machine.rb b/src/oca/ruby/opennebula/virtual_machine.rb index 06538cee7e..37f27c76a0 100644 --- a/src/oca/ruby/opennebula/virtual_machine.rb +++ b/src/oca/ruby/opennebula/virtual_machine.rb @@ -111,6 +111,11 @@ module OpenNebula "USER" => "user" } + HISTORY_ACTION=%w{migrate migrate-live shutdown shutdown-hard undeploy + undeploy-hard hold release stop suspend resume boot destroy + destroy-recreate reboot reboot-hard resched unresched poweroff + poweroff-hard none} + # Creates a VirtualMachine description with just its identifier # this method should be used to create plain VirtualMachine objects. # +id+ the id of the vm @@ -135,6 +140,10 @@ module OpenNebula reason_str end + def VirtualMachine.get_history_action(action) + return HISTORY_ACTION[action.to_i] + end + # Class constructor def initialize(xml, client) super(xml,client) From 2cca4c56764c267ed9d39cc6d6bd1b9c50597fb0 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Thu, 4 Apr 2013 12:33:44 +0200 Subject: [PATCH 11/40] feature #1859: start/stop/restart actions for scheduler --- share/pkgs/CentOS/opennebula | 33 ++++++++++++++++ share/pkgs/Debian/opennebula | 26 +++++++++++++ share/pkgs/Ubuntu/opennebula | 26 +++++++++++++ share/scripts/one | 75 +++++++++++++++++++++++++----------- 4 files changed, 138 insertions(+), 22 deletions(-) diff --git a/share/pkgs/CentOS/opennebula b/share/pkgs/CentOS/opennebula index 65f9a1147c..6727ddbbf9 100755 --- a/share/pkgs/CentOS/opennebula +++ b/share/pkgs/CentOS/opennebula @@ -63,11 +63,41 @@ stop() { return $RETVAL } +start-sched() { + echo -n $"Starting OpenNebula scheduler: " + daemon --user oneadmin $ONE_BIN start-sched + RETVAL=$? + + [ $RETVAL -eq 0 ] && success || failure + echo + [ $RETVAL -eq 0 ] && rm -f $LOCKFILE + + return $RETVAL +} + +stop-sched() { + echo -n $"Stopping OpenNebula scheduler: " + daemon --user oneadmin $ONE_BIN stop-sched + RETVAL=$? + + [ $RETVAL -eq 0 ] && success || failure + echo + [ $RETVAL -eq 0 ] && rm -f $LOCKFILE + + return $RETVAL +} + restart() { stop start } +restart-sched() { + stop-sched + sleep 1 + start-sched +} + case "$1" in start) @@ -79,6 +109,9 @@ stop) restart) restart ;; +restart-sched) + restart-sched + ;; status) status $prog RETVAL=$? diff --git a/share/pkgs/Debian/opennebula b/share/pkgs/Debian/opennebula index 2d98d6ceb8..36a34e56e1 100755 --- a/share/pkgs/Debian/opennebula +++ b/share/pkgs/Debian/opennebula @@ -47,6 +47,16 @@ do_stop() su oneadmin -s /bin/sh -c 'one stop' } +do_start_sched() +{ + su oneadmin -s /bin/sh -c 'one start-sched' +} + +do_stop_sched() +{ + su oneadmin -s /bin/sh -c 'one stop-sched' +} + case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" @@ -87,6 +97,22 @@ case "$1" in # Failed to stop log_end_msg 1 ;; + restart-sched) + log_daemon_msg "Restarting scheduler" + do_stop_sched + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; esac ;; *) diff --git a/share/pkgs/Ubuntu/opennebula b/share/pkgs/Ubuntu/opennebula index 2d98d6ceb8..36a34e56e1 100755 --- a/share/pkgs/Ubuntu/opennebula +++ b/share/pkgs/Ubuntu/opennebula @@ -47,6 +47,16 @@ do_stop() su oneadmin -s /bin/sh -c 'one stop' } +do_start_sched() +{ + su oneadmin -s /bin/sh -c 'one start-sched' +} + +do_stop_sched() +{ + su oneadmin -s /bin/sh -c 'one stop-sched' +} + case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" @@ -87,6 +97,22 @@ case "$1" in # Failed to stop log_end_msg 1 ;; + restart-sched) + log_daemon_msg "Restarting scheduler" + do_stop_sched + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; esac ;; *) diff --git a/share/scripts/one b/share/scripts/one index 503cec61c6..9625b64a84 100755 --- a/share/scripts/one +++ b/share/scripts/one @@ -74,6 +74,13 @@ setup() # Function that stops the daemons #------------------------------------------------------------------------------ stop() +{ + stop_oned + + stop_sched +} + +stop_oned() { if [ -f $ONE_PID ]; then PID=$(cat $ONE_PID) @@ -91,7 +98,10 @@ stop() rm -f $ONE_PID > /dev/null 2>&1 fi +} +stop_sched() +{ if [ -f $ONE_SCHEDPID ]; then kill `cat $ONE_SCHEDPID` > /dev/null 2>&1 rm -f $ONE_SCHEDPID > /dev/null 2>&1 @@ -130,30 +140,10 @@ start() fi # Start the one daemon - $ONED -f 2>&1 & - - LASTRC=$? - LASTPID=$! - - if [ $LASTRC -ne 0 ]; then - echo "Error executing $ONED" - exit 1 - else - echo $LASTPID > $ONE_PID - fi + start_oned # Start the scheduler - $ONE_SCHEDULER& - - LASTRC=$? - LASTPID=$! - - if [ $LASTRC -ne 0 ]; then - echo "Error executing $ONE_SCHEDULER" - exit 1 - else - echo $LASTPID > $ONE_SCHEDPID - fi + start_sched # Wait for the daemons to warm up sleep 2 @@ -180,6 +170,36 @@ start() fi } +start_oned() +{ + $ONED -f 2>&1 & + + LASTRC=$? + LASTPID=$! + + if [ $LASTRC -ne 0 ]; then + echo "Error executing $ONED" + exit 1 + else + echo $LASTPID > $ONE_PID + fi +} + +start_sched() +{ + $ONE_SCHEDULER& + + LASTRC=$? + LASTPID=$! + + if [ $LASTRC -ne 0 ]; then + echo "Error executing $ONE_SCHEDULER" + exit 1 + else + echo $LASTPID > $ONE_SCHEDPID + fi +} + #------------------------------------------------------------------------------ #------------------------------------------------------------------------------ @@ -197,6 +217,17 @@ case "$1" in stop echo "oned and scheduler stopped" ;; + start-sched) + start_sched + ;; + stop-sched) + stop_sched + ;; + restart-sched) + stop_sched + sleep 1 + start_sched + ;; *) echo "Usage: one [-f] {start|stop}" >&2 echo "Options:" >&2 From b1273baec978f16612ced116423444e63e521d15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 14:44:20 +0200 Subject: [PATCH 12/40] Feature #1631: Add migrator to 4.0.0 --- install.sh | 1 + src/onedb/3.9.80_to_4.0.0.rb | 99 ++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 src/onedb/3.9.80_to_4.0.0.rb diff --git a/install.sh b/install.sh index ed3207a5b5..9b13e86262 100755 --- a/install.sh +++ b/install.sh @@ -1026,6 +1026,7 @@ ONEDB_MIGRATOR_FILES="src/onedb/2.0_to_2.9.80.rb \ src/onedb/3.8.2_to_3.8.3.rb \ src/onedb/3.8.3_to_3.8.4.rb \ src/onedb/3.8.4_to_3.9.80.rb \ + src/onedb/3.9.80_to_4.0.0.rb \ src/onedb/fsck.rb \ src/onedb/onedb.rb \ src/onedb/onedb_backend.rb" diff --git a/src/onedb/3.9.80_to_4.0.0.rb b/src/onedb/3.9.80_to_4.0.0.rb new file mode 100644 index 0000000000..2aa9a717e8 --- /dev/null +++ b/src/onedb/3.9.80_to_4.0.0.rb @@ -0,0 +1,99 @@ +# -------------------------------------------------------------------------- # +# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs # +# # +# Licensed under the Apache License, Version 2.0 (the "License"); you may # +# not use this file except in compliance with the License. You may obtain # +# a copy of the License at # +# # +# http://www.apache.org/licenses/LICENSE-2.0 # +# # +# Unless required by applicable law or agreed to in writing, software # +# distributed under the License is distributed on an "AS IS" BASIS, # +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # +# See the License for the specific language governing permissions and # +# limitations under the License. # +#--------------------------------------------------------------------------- # + +require "rexml/document" +include REXML + +module Migrator + def db_version + "4.0.0" + end + + def one_version + "OpenNebula 4.0.0" + end + + def up + + ######################################################################## + # Feature #1631: Add ACTION to history entries + ######################################################################## + + @db.run "ALTER TABLE vm_pool RENAME TO old_vm_pool;" + @db.run "CREATE TABLE vm_pool (oid INTEGER PRIMARY KEY, name VARCHAR(128), body MEDIUMTEXT, uid INTEGER, gid INTEGER, last_poll INTEGER, state INTEGER, lcm_state INTEGER, owner_u INTEGER, group_u INTEGER, other_u INTEGER);" + + @db.fetch("SELECT * FROM old_vm_pool") do |row| + doc = Document.new(row[:body]) + + doc.root.each_element("HISTORY_RECORDS/HISTORY") do |e| + update_history(e) + end + + @db[:vm_pool].insert( + :oid => row[:oid], + :name => row[:name], + :body => doc.root.to_s, + :uid => row[:uid], + :gid => row[:gid], + :last_poll => row[:last_poll], + :state => row[:state], + :lcm_state => row[:lcm_state], + :owner_u => row[:owner_u], + :group_u => row[:group_u], + :other_u => row[:other_u]) + end + + @db.run "DROP TABLE old_vm_pool;" + + @db.run "ALTER TABLE history RENAME TO old_history;" + @db.run "CREATE TABLE history (vid INTEGER, seq INTEGER, body MEDIUMTEXT, stime INTEGER, etime INTEGER,PRIMARY KEY(vid,seq));" + + @db.fetch("SELECT * FROM old_history") do |row| + doc = Document.new(row[:body]) + + doc.root.each_element("/HISTORY") do |e| + update_history(e) + end + + @db[:history].insert( + :vid => row[:vid], + :seq => row[:seq], + :body => doc.root.to_s, + :stime => row[:stime], + :etime => row[:etime]) + end + + @db.run "DROP TABLE old_history;" + + + return true + end + + def update_history(history_elem) + history_elem.add_element("ACTION").text = "20" # NONE_ACTION + + # History reason enum has changed from + # NONE, ERROR, STOP_RESUME, USER, CANCEL to + # NONE, ERROR, USER + history_elem.each_element("REASON") do |reason_e| + reason = reason_e.text.to_i + + if reason > 1 # STOP_RESUME, USER, CANCEL + reason_e.text = "2" # USER + end + end + end +end From 4abedb3dd9eabcc1330c0cf2261af76411d0186c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 15:06:14 +0200 Subject: [PATCH 13/40] Feature #1631: Add new action element to xsd files --- share/doc/xsd/acct.xsd | 33 ++++++++++++++++++++++++++++----- share/doc/xsd/vm.xsd | 33 ++++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 10 deletions(-) diff --git a/share/doc/xsd/acct.xsd b/share/doc/xsd/acct.xsd index f7c7d29381..4273d8c84d 100644 --- a/share/doc/xsd/acct.xsd +++ b/share/doc/xsd/acct.xsd @@ -31,14 +31,37 @@ + + + diff --git a/share/doc/xsd/vm.xsd b/share/doc/xsd/vm.xsd index fa5babf322..511b6f74f3 100644 --- a/share/doc/xsd/vm.xsd +++ b/share/doc/xsd/vm.xsd @@ -118,13 +118,36 @@ + + + From 002ec7e915a1177a8fe3ec4539e7a57fff2c169a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 15:28:35 +0200 Subject: [PATCH 14/40] Feature #1631: Rearrange History Actions so NONE is 0 --- include/History.h | 4 +-- include/Nebula.h | 2 +- share/doc/xsd/acct.xsd | 42 +++++++++++----------- share/doc/xsd/vm.xsd | 42 +++++++++++----------- src/oca/ruby/opennebula/virtual_machine.rb | 6 ++-- src/onedb/3.9.80_to_4.0.0.rb | 2 +- 6 files changed, 49 insertions(+), 49 deletions(-) diff --git a/include/History.h b/include/History.h index 5e79ace5a8..ce852c3a32 100644 --- a/include/History.h +++ b/include/History.h @@ -37,6 +37,7 @@ public: enum VMAction { + NONE_ACTION, MIGRATE_ACTION, LIVE_MIGRATE_ACTION, SHUTDOWN_ACTION, @@ -56,8 +57,7 @@ public: RESCHED_ACTION, UNRESCHED_ACTION, POWEROFF_ACTION, - POWEROFF_HARD_ACTION, - NONE_ACTION + POWEROFF_HARD_ACTION }; static string action_to_str(VMAction action) diff --git a/include/Nebula.h b/include/Nebula.h index ddcf3c41e1..9c8df5539d 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -345,7 +345,7 @@ public: static string db_version() { - return "3.9.80"; + return "4.0.0"; } /** diff --git a/share/doc/xsd/acct.xsd b/share/doc/xsd/acct.xsd index 4273d8c84d..04241e57ab 100644 --- a/share/doc/xsd/acct.xsd +++ b/share/doc/xsd/acct.xsd @@ -38,27 +38,27 @@ diff --git a/share/doc/xsd/vm.xsd b/share/doc/xsd/vm.xsd index 511b6f74f3..f35f1296d4 100644 --- a/share/doc/xsd/vm.xsd +++ b/share/doc/xsd/vm.xsd @@ -125,27 +125,27 @@ diff --git a/src/oca/ruby/opennebula/virtual_machine.rb b/src/oca/ruby/opennebula/virtual_machine.rb index 37f27c76a0..dd20814372 100644 --- a/src/oca/ruby/opennebula/virtual_machine.rb +++ b/src/oca/ruby/opennebula/virtual_machine.rb @@ -111,10 +111,10 @@ module OpenNebula "USER" => "user" } - HISTORY_ACTION=%w{migrate migrate-live shutdown shutdown-hard undeploy - undeploy-hard hold release stop suspend resume boot destroy + HISTORY_ACTION=%w{none migrate migrate-live shutdown shutdown-hard + undeploy undeploy-hard hold release stop suspend resume boot destroy destroy-recreate reboot reboot-hard resched unresched poweroff - poweroff-hard none} + poweroff-hard} # Creates a VirtualMachine description with just its identifier # this method should be used to create plain VirtualMachine objects. diff --git a/src/onedb/3.9.80_to_4.0.0.rb b/src/onedb/3.9.80_to_4.0.0.rb index 2aa9a717e8..5c38ad50d3 100644 --- a/src/onedb/3.9.80_to_4.0.0.rb +++ b/src/onedb/3.9.80_to_4.0.0.rb @@ -83,7 +83,7 @@ module Migrator end def update_history(history_elem) - history_elem.add_element("ACTION").text = "20" # NONE_ACTION + history_elem.add_element("ACTION").text = "0" # NONE_ACTION # History reason enum has changed from # NONE, ERROR, STOP_RESUME, USER, CANCEL to From 68e48b0d1f5e1763d7436cccabc5a61e1bd0a196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 15:47:24 +0200 Subject: [PATCH 15/40] Feature #1631: Fix change made for testing --- include/Nebula.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/Nebula.h b/include/Nebula.h index 9c8df5539d..ddcf3c41e1 100644 --- a/include/Nebula.h +++ b/include/Nebula.h @@ -345,7 +345,7 @@ public: static string db_version() { - return "4.0.0"; + return "3.9.80"; } /** From e53d97a5ad5e4b64f8d271590405589e5a149117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 16:07:10 +0200 Subject: [PATCH 16/40] Feature #1797: The action to wake up a poweroff VM is now 'resume' --- share/doc/states/states-complete.dot | 6 +++--- share/doc/states/states-simple.dot | 2 +- src/cli/onevm | 6 +++--- src/dm/DispatchManagerActions.cc | 16 +++++++++++----- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/share/doc/states/states-complete.dot b/share/doc/states/states-complete.dot index e34c972deb..ed5dafa4a5 100644 --- a/share/doc/states/states-complete.dot +++ b/share/doc/states/states-complete.dot @@ -91,6 +91,9 @@ digraph OpenNebula { suspended -> boot_suspended [label="resume"]; boot_suspended -> running [style="dashed"]; + poweroff -> boot_poweroff [label="resume"]; + boot_poweroff -> running [style="dashed"]; + # destroy ANY -> done [label="destroy"]; @@ -101,10 +104,7 @@ digraph OpenNebula { boot -> boot [label="boot"]; boot_suspended -> boot_suspended [label="boot"]; boot_stopped -> boot_stopped [label="boot"]; - - poweroff -> boot_poweroff [label="boot"]; boot_poweroff -> boot_poweroff [label="boot"]; - boot_poweroff -> running [style="dashed"]; unknown -> boot_unknown [label="boot"]; boot_unknown -> boot_unknown [label="boot"]; diff --git a/share/doc/states/states-simple.dot b/share/doc/states/states-simple.dot index f3ac7e7e69..65a567e25e 100644 --- a/share/doc/states/states-simple.dot +++ b/share/doc/states/states-simple.dot @@ -69,6 +69,7 @@ digraph OpenNebula { # resume stopped -> pending [label="resume"]; suspended -> boot [label="resume"]; + poweroff -> boot [label="resume"]; # delete ANY -> done [label="destroy"]; @@ -76,7 +77,6 @@ digraph OpenNebula { # restart unknown -> boot [label="boot"]; boot -> boot [label="boot"]; - poweroff -> boot [label="boot"]; # reboot running -> running [label="reboot"]; diff --git a/src/cli/onevm b/src/cli/onevm index eb3f0ad6d4..02de1522fb 100755 --- a/src/cli/onevm +++ b/src/cli/onevm @@ -344,7 +344,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do poweroff_desc = <<-EOT.unindent Powers off the given VM. The VM will remain in the poweroff state, and - can be powered on with the 'onevm boot' command. + can be powered on with the 'onevm resume' command. States: RUNNING EOT @@ -432,7 +432,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do boot_desc = <<-EOT.unindent Boots the given VM. - States: UNKNOWN, BOOT, POWEROFF + States: UNKNOWN, BOOT EOT command :boot, boot_desc, [:range,:vmid_list], @@ -487,7 +487,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do resume_desc = <<-EOT.unindent Resumes the execution of the a saved VM - States: STOPPED, SUSPENDED + States: STOPPED, SUSPENDED, UNDEPLOYED, POWEROFF EOT command :resume, resume_desc, [:range,:vmid_list], diff --git a/src/dm/DispatchManagerActions.cc b/src/dm/DispatchManagerActions.cc index 35e2d2a11d..4c6fdeaebb 100644 --- a/src/dm/DispatchManagerActions.cc +++ b/src/dm/DispatchManagerActions.cc @@ -572,12 +572,19 @@ int DispatchManager::resume( Nebula& nd = Nebula::instance(); LifeCycleManager * lcm = nd.get_lcm(); - vmpool->update(vm); - vm->log("DiM", Log::INFO, "New VM state is ACTIVE."); lcm->trigger(LifeCycleManager::RESTORE,vid); } + else if (vm->get_state() == VirtualMachine::POWEROFF) + { + Nebula& nd = Nebula::instance(); + LifeCycleManager * lcm = nd.get_lcm(); + + vm->log("DiM", Log::INFO, "New VM state is ACTIVE."); + + lcm->trigger(LifeCycleManager::RESTART,vid); + } else { goto error; @@ -614,14 +621,13 @@ int DispatchManager::restart(int vid) oss << "Restarting VM " << vid; NebulaLog::log("DiM",Log::DEBUG,oss); - if ((vm->get_state() == VirtualMachine::ACTIVE && + if (vm->get_state() == VirtualMachine::ACTIVE && (vm->get_lcm_state() == VirtualMachine::UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT || vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF || vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED || vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED)) - || vm->get_state() == VirtualMachine::POWEROFF ) { Nebula& nd = Nebula::instance(); LifeCycleManager * lcm = nd.get_lcm(); @@ -914,7 +920,7 @@ int DispatchManager::resubmit(int vid) { case VirtualMachine::POWEROFF: NebulaLog::log("DiM",Log::ERROR, - "Cannot resubmit a powered off VM. Restart it first"); + "Cannot resubmit a powered off VM. Resume it first"); rc = -2; break; From 3281cae4f6d6e55f7013fd62390aab6b27346db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 16:42:53 +0200 Subject: [PATCH 17/40] onevm show now lists the hostname for vms in poweroff --- src/cli/one_helper/onevm_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/one_helper/onevm_helper.rb b/src/cli/one_helper/onevm_helper.rb index db06cedb50..83fcf5d143 100644 --- a/src/cli/one_helper/onevm_helper.rb +++ b/src/cli/one_helper/onevm_helper.rb @@ -247,7 +247,7 @@ class OneVMHelper < OpenNebulaHelper::OneHelper puts str % ["RESCHED", OpenNebulaHelper.boolean_to_str(vm['RESCHED'])] puts str % ["HOST", vm['/VM/HISTORY_RECORDS/HISTORY[last()]/HOSTNAME']] if - %w{ACTIVE SUSPENDED}.include? vm.state_str + %w{ACTIVE SUSPENDED POWEROFF}.include? vm.state_str puts str % ["START TIME", OpenNebulaHelper.time_to_str(vm['/VM/STIME'])] puts str % ["END TIME", From 24a4aeb6ff716565c7b6999c20d167c3ef4a13cd Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Thu, 4 Apr 2013 17:38:33 +0200 Subject: [PATCH 18/40] feature #1643: add IPv6 support to RPM context packages --- .../base_deb/etc/one-context.d/00-network | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/share/scripts/context-packages/base_deb/etc/one-context.d/00-network b/share/scripts/context-packages/base_deb/etc/one-context.d/00-network index 0a5fbd2f5e..92ff47eab3 100755 --- a/share/scripts/context-packages/base_deb/etc/one-context.d/00-network +++ b/share/scripts/context-packages/base_deb/etc/one-context.d/00-network @@ -103,7 +103,6 @@ upcase() { gen_iface_conf() { cat < Date: Thu, 4 Apr 2013 17:29:16 +0200 Subject: [PATCH 19/40] Feature #1839: Add new state BOOT_UNDEPLOY to handle a deploy failure from UNDEPLOYED --- include/VirtualMachine.h | 3 +- src/dm/DispatchManagerActions.cc | 3 +- src/lcm/LifeCycleActions.cc | 7 ++-- src/lcm/LifeCycleStates.cc | 35 ++++++++++++++++++- .../opennebula/client/vm/VirtualMachine.java | 3 +- src/oca/ruby/opennebula/virtual_machine.rb | 6 ++-- src/sunstone/OpenNebulaVNC.rb | 3 +- src/sunstone/public/js/opennebula.js | 3 +- 8 files changed, 53 insertions(+), 10 deletions(-) diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 0a51e86d05..3791f0fbe9 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -98,7 +98,8 @@ public: HOTPLUG_SAVEAS_SUSPENDED = 28, SHUTDOWN_UNDEPLOY = 29, EPILOG_UNDEPLOY = 30, - PROLOG_UNDEPLOY = 31 + PROLOG_UNDEPLOY = 31, + BOOT_UNDEPLOY = 32 }; // ------------------------------------------------------------------------- diff --git a/src/dm/DispatchManagerActions.cc b/src/dm/DispatchManagerActions.cc index 4c6fdeaebb..8187b57906 100644 --- a/src/dm/DispatchManagerActions.cc +++ b/src/dm/DispatchManagerActions.cc @@ -627,7 +627,8 @@ int DispatchManager::restart(int vid) vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF || vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED || - vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED)) + vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED || + vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY)) { Nebula& nd = Nebula::instance(); LifeCycleManager * lcm = nd.get_lcm(); diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index a247ecec55..d4b86f79d1 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -584,7 +584,8 @@ void LifeCycleManager::restart_action(int vid) vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF || vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED || - vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED)) + vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED || + vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY)) ||vm->get_state() == VirtualMachine::POWEROFF) { Nebula& nd = Nebula::instance(); @@ -599,7 +600,8 @@ void LifeCycleManager::restart_action(int vid) vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF || vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED || - vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED)) + vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED || + vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY)) { vm->log("LCM", Log::INFO, "Sending BOOT command to VM again"); } @@ -845,6 +847,7 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& imag case VirtualMachine::BOOT_POWEROFF: case VirtualMachine::BOOT_SUSPENDED: case VirtualMachine::BOOT_STOPPED: + case VirtualMachine::BOOT_UNDEPLOY: case VirtualMachine::RUNNING: case VirtualMachine::UNKNOWN: case VirtualMachine::SHUTDOWN: diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index f08d759ec1..79cbdfabf0 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -290,7 +290,8 @@ void LifeCycleManager::deploy_success_action(int vid) vm->get_lcm_state() == VirtualMachine::BOOT_POWEROFF || vm->get_lcm_state() == VirtualMachine::BOOT_UNKNOWN || vm->get_lcm_state() == VirtualMachine::BOOT_SUSPENDED|| - vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED ) + vm->get_lcm_state() == VirtualMachine::BOOT_STOPPED || + vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY ) { vm->set_state(VirtualMachine::RUNNING); @@ -440,6 +441,34 @@ void LifeCycleManager::deploy_failure_action(int vid) tm->trigger(TransferManager::EPILOG_STOP,vid); } + else if (vm->get_lcm_state() == VirtualMachine::BOOT_UNDEPLOY) + { + Nebula& nd = Nebula::instance(); + TransferManager * tm = nd.get_tm(); + time_t the_time = time(0); + + //---------------------------------------------------- + // EPILOG_UNDEPLOY STATE FROM BOOT + //---------------------------------------------------- + + vm->set_state(VirtualMachine::EPILOG_UNDEPLOY); + + vmpool->update(vm); + + vm->set_epilog_stime(the_time); + + vm->set_running_etime(the_time); + + vm->set_reason(History::ERROR); + + vmpool->update_history(vm); + + vm->log("LCM", Log::INFO, "Fail to boot VM. New VM state is EPILOG_UNDEPLOY"); + + //---------------------------------------------------- + + tm->trigger(TransferManager::EPILOG_STOP,vid); + } else { vm->log("LCM",Log::ERROR,"deploy_failure_action, VM in a wrong state"); @@ -641,6 +670,10 @@ void LifeCycleManager::prolog_success_action(int vid) { vm->set_state(VirtualMachine::BOOT_STOPPED); } + else if ( lcm_state == VirtualMachine::PROLOG_UNDEPLOY ) + { + vm->set_state(VirtualMachine::BOOT_UNDEPLOY); + } else // PROLOG || PROLOG_MIGRATE { vm->set_state(VirtualMachine::BOOT); diff --git a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java index b8e941b532..5781b9a214 100644 --- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java +++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java @@ -107,7 +107,8 @@ public class VirtualMachine extends PoolElement{ "HOTPLUG_SAVEAS_SUSPENDED", "SHUTDOWN_UNDEPLOY", "EPILOG_UNDEPLOY", - "PROLOG_UNDEPLOY" }; + "PROLOG_UNDEPLOY", + "BOOT_UNDEPLOY" }; private static final String[] SHORT_LCM_STATES = { diff --git a/src/oca/ruby/opennebula/virtual_machine.rb b/src/oca/ruby/opennebula/virtual_machine.rb index 52a98b00f9..1b65e5c5b1 100644 --- a/src/oca/ruby/opennebula/virtual_machine.rb +++ b/src/oca/ruby/opennebula/virtual_machine.rb @@ -54,7 +54,8 @@ module OpenNebula SHUTDOWN CANCEL FAILURE CLEANUP_RESUBMIT UNKNOWN HOTPLUG SHUTDOWN_POWEROFF BOOT_UNKNOWN BOOT_POWEROFF BOOT_SUSPENDED BOOT_STOPPED CLEANUP_DELETE HOTPLUG_SNAPSHOT HOTPLUG_NIC HOTPLUG_SAVEAS HOTPLUG_SAVEAS_POWEROFF - HOTPLUG_SAVEAS_SUSPENDED SHUTDOWN_UNDEPLOY EPILOG_UNDEPLOY PROLOG_UNDEPLOY} + HOTPLUG_SAVEAS_SUSPENDED SHUTDOWN_UNDEPLOY EPILOG_UNDEPLOY + PROLOG_UNDEPLOY BOOT_UNDEPLOY} SHORT_VM_STATES={ "INIT" => "init", @@ -100,7 +101,8 @@ module OpenNebula "HOTPLUG_SAVEAS_SUSPENDED" => "hotp", "SHUTDOWN_UNDEPLOY" => "shut", "EPILOG_UNDEPLOY" => "epil", - "PROLOG_UNDEPLOY" => "prol" + "PROLOG_UNDEPLOY" => "prol", + "BOOT_UNDEPLOY" => "boot" } MIGRATE_REASON=%w{NONE ERROR STOP_RESUME USER CANCEL} diff --git a/src/sunstone/OpenNebulaVNC.rb b/src/sunstone/OpenNebulaVNC.rb index 051ba191d2..1219c0b46a 100644 --- a/src/sunstone/OpenNebulaVNC.rb +++ b/src/sunstone/OpenNebulaVNC.rb @@ -56,7 +56,8 @@ VNC_STATES = [ 28, #HOTPLUG_SAVEAS_SUSPENDED 29 #SHUTDOWN_UNDEPLOY #30, #EPILOG_UNDEPLOY - #31 #PROLOG_UNDEPLOY + #31, #PROLOG_UNDEPLOY + #32 #BOOT_UNDEPLOY ] class OpenNebulaVNC diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 0c14195973..233296bf19 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -119,7 +119,8 @@ var OpenNebula = { "HOTPLUG_SAVEAS_SUSPENDED", "SHUTDOWN_UNDEPLOY", "EPILOG_UNDEPLOY", - "PROLOG_UNDEPLOY"][value]); + "PROLOG_UNDEPLOY", + "BOOT_UNDEPLOY"][value]); break; case "IMAGE": case "image": From 98c8f9fb6c6eb3f37a2421219ac22429e79476e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 17:58:20 +0200 Subject: [PATCH 20/40] Feature #1839: Document new state BOOT_UNDEPLOY --- share/doc/states/states-complete.dot | 23 +++++++++++++++++++---- share/doc/states/states-simple.dot | 14 ++++++++++---- share/doc/xsd/acct.xsd | 7 ++++++- share/doc/xsd/vm.xsd | 7 ++++++- 4 files changed, 41 insertions(+), 10 deletions(-) diff --git a/share/doc/states/states-complete.dot b/share/doc/states/states-complete.dot index ed5dafa4a5..62835d80e2 100644 --- a/share/doc/states/states-complete.dot +++ b/share/doc/states/states-complete.dot @@ -19,14 +19,13 @@ digraph OpenNebula { "ANY \\ {suspended,poweroff,done}" [ shape="box" ]; subgraph { rank = min; user} - subgraph { rank = same; boot; boot_stopped boot_suspended; boot_unknown; boot_poweroff; unknown; color="white"} + subgraph { rank = same; boot; boot_stopped; boot_undeploy; boot_suspended; boot_unknown; boot_poweroff; unknown; color="white"} subgraph { rank = same; pending; hold; color="white"} subgraph { rank = same; prolog; prolog_resume; prolog_migrate; color="white" } // subgraph { rank = same; prolog; prolog_resume; prolog_migrate; save_migrate; color="white" } subgraph { rank = max; suspended; done; failure; - stopped; poweroff; ANY; color="white" } -// stopped; poweroff; color="white" } + stopped; undeployed; poweroff; ANY; color="white" } # create user -> pending [label="create"]; @@ -35,6 +34,9 @@ digraph OpenNebula { pending -> prolog_resume [label="deploy\n(from stopped)"]; prolog_resume -> boot_stopped [style="dashed"]; + pending -> prolog_undeploy [label="deploy\n(from undeployed)"]; + prolog_undeploy -> boot_undeploy [style="dashed"]; + pending -> prolog [label="deploy"]; prolog -> boot [style="dashed"]; boot -> running [style="dashed"]; @@ -52,7 +54,7 @@ digraph OpenNebula { cancel -> running [style="dotted"]; # poweroff - running -> shutdown_poweroff [label="poweroff"]; + running -> shutdown_poweroff [label="poweroff [--hard]"]; shutdown_poweroff -> poweroff [style="dashed"]; shutdown_poweroff -> running [style="dotted"]; @@ -79,6 +81,12 @@ digraph OpenNebula { save_stop -> running [style="dotted"]; epilog_stop -> stopped [style="dashed"]; +# undeploy + running -> shutdown_undeploy [label="undeploy [--hard]"]; + shutdown_undeploy -> epilog_undeploy [style="dashed"]; + shutdown_undeploy -> running [style="dotted"]; + epilog_undeploy -> undeployed [style="dashed"]; + # suspend running -> save_suspend [label="suspend"]; save_suspend -> suspended [style="dashed"]; @@ -88,6 +96,9 @@ digraph OpenNebula { stopped -> pending [label="resume"]; boot_stopped -> running [style="dashed"]; + undeployed -> pending [label="resume"]; + boot_undeploy -> running [style="dashed"]; + suspended -> boot_suspended [label="resume"]; boot_suspended -> running [style="dashed"]; @@ -105,6 +116,7 @@ digraph OpenNebula { boot_suspended -> boot_suspended [label="boot"]; boot_stopped -> boot_stopped [label="boot"]; boot_poweroff -> boot_poweroff [label="boot"]; + boot_undeploy -> boot_undeploy [label="boot"]; unknown -> boot_unknown [label="boot"]; boot_unknown -> boot_unknown [label="boot"]; @@ -138,16 +150,19 @@ digraph OpenNebula { # failures and misc. epilog_stop -> failure [style="dotted"]; epilog -> failure [style="dotted"]; + epilog_undeploy -> failure [style="dotted"]; prolog -> failure [style="dotted"]; prolog_migrate -> failure [style="dotted"]; prolog_resume -> stopped [style="dotted"]; + prolog_undeploy -> undeployed [style="dotted"]; boot -> failure [style="dotted"]; boot_poweroff -> poweroff [style="dotted"]; boot_unknown -> unknown [style="dotted"]; boot_suspended -> suspended [style="dotted"]; boot_stopped -> epilog_stop [style="dotted"]; + boot_undeploy -> epilog_undeploy [style="dotted"]; running -> failure [style="dotted"]; unknown -> failure [style="dotted"]; diff --git a/share/doc/states/states-simple.dot b/share/doc/states/states-simple.dot index 65a567e25e..25ba06bf1a 100644 --- a/share/doc/states/states-simple.dot +++ b/share/doc/states/states-simple.dot @@ -19,11 +19,11 @@ digraph OpenNebula { "ANY \\ {suspended,poweroff,done}" [ shape="box" ]; subgraph { rank = min; user} -# subgraph { rank = same; pending; hold; color="white"} - subgraph { rank = same; prolog; boot; color="white" } + subgraph { rank = same; pending; hold; color="white"} +# subgraph { rank = same; prolog; boot; color="white" } subgraph { rank = same; migrate; save; shutdown; unknown; hotplug; snapshot; color="white" } - subgraph { rank = max; suspended; done; failure; stopped; poweroff; color="white" } + subgraph { rank = max; suspended; done; failure; stopped; poweroff; undeployed; color="white" } # create user -> pending [label="create"]; @@ -36,7 +36,7 @@ digraph OpenNebula { # shutdown running -> shutdown [label="shutdown"]; shutdown -> epilog [label="shutdown", style="dashed"]; - epilog -> done [style="dashed"]; + epilog -> done [label="shutdown", style="dashed"]; # poweroff running -> shutdown [label="poweroff"]; @@ -62,12 +62,18 @@ digraph OpenNebula { save -> epilog [label="stop", style="dashed"]; epilog -> stopped [label="stop", style="dashed"]; +# undeploy + running -> shutdown [label="undeploy"]; + shutdown -> epilog [label="undeploy", style="dashed"]; + epilog -> undeployed [label="undeploy", style="dashed"]; + # suspend running -> save [label="suspend"]; save -> suspended [label="suspend", style="dashed"]; # resume stopped -> pending [label="resume"]; + undeployed -> pending [label="resume"]; suspended -> boot [label="resume"]; poweroff -> boot [label="resume"]; diff --git a/share/doc/xsd/acct.xsd b/share/doc/xsd/acct.xsd index f7c7d29381..31b90573e2 100644 --- a/share/doc/xsd/acct.xsd +++ b/share/doc/xsd/acct.xsd @@ -77,6 +77,7 @@ DONE = 6 FAILED = 7 POWEROFF = 8 + UNDEPLOYED = 9 --> @@ -111,7 +112,11 @@ HOTPLUG_NIC = 25, HOTPLUG_SAVEAS = 26, HOTPLUG_SAVEAS_POWEROFF = 27, - HOTPLUG_SAVEAS_SUSPENDED = 28 + HOTPLUG_SAVEAS_SUSPENDED = 28, + SHUTDOWN_UNDEPLOY = 29, + EPILOG_UNDEPLOY = 30, + PROLOG_UNDEPLOY = 31, + BOOT_UNDEPLOY = 32 --> diff --git a/share/doc/xsd/vm.xsd b/share/doc/xsd/vm.xsd index fa5babf322..a6e6d2dcdd 100644 --- a/share/doc/xsd/vm.xsd +++ b/share/doc/xsd/vm.xsd @@ -39,6 +39,7 @@ DONE = 6 FAILED = 7 POWEROFF = 8 + UNDEPLOYED = 9 --> @@ -73,7 +74,11 @@ HOTPLUG_NIC = 25, HOTPLUG_SAVEAS = 26, HOTPLUG_SAVEAS_POWEROFF = 27, - HOTPLUG_SAVEAS_SUSPENDED = 28 + HOTPLUG_SAVEAS_SUSPENDED = 28, + SHUTDOWN_UNDEPLOY = 29, + EPILOG_UNDEPLOY = 30, + PROLOG_UNDEPLOY = 31, + BOOT_UNDEPLOY = 32 --> From 735cb7722303f43ce656397d36f5ce28964f7aa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Thu, 4 Apr 2013 18:01:17 +0200 Subject: [PATCH 21/40] Feature #1839: Add missing states to java OCA --- .../java/src/org/opennebula/client/vm/VirtualMachine.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java index 5781b9a214..6e02efa24e 100644 --- a/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java +++ b/src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java @@ -140,7 +140,11 @@ public class VirtualMachine extends PoolElement{ "hotp", "hotp", "hotp", - "hotp" }; + "hotp", + "shut", + "epil", + "prol", + "boot" }; /** * Creates a new VM representation. From 0a23c534542025b062c2a56690a3847ed434e698 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Thu, 4 Apr 2013 19:06:17 +0200 Subject: [PATCH 22/40] feature #1643: add IPv6 context variables to CLI --- src/cli/one_helper.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cli/one_helper.rb b/src/cli/one_helper.rb index 1ce49a1c73..aa6aa5a4f6 100644 --- a/src/cli/one_helper.rb +++ b/src/cli/one_helper.rb @@ -745,6 +745,9 @@ EOT lines<<"ETH#{index}_MASK = \"$NETWORK[NETWORK_MASK, NETWORK=\\\"#{name}\\\"]\"" lines<<"ETH#{index}_GATEWAY = \"$NETWORK[GATEWAY, NETWORK=\\\"#{name}\\\"]\"" lines<<"ETH#{index}_DNS = \"$NETWORK[DNS, NETWORK=\\\"#{name}\\\"]\"" + lines<<"ETH#{index}_IPV6 = \"$NIC[IP6_GLOBAL, NETWORK=\\\"#{name}\\\"]\"" + lines<<"ETH#{index}_GATEWAY6 = \"$NETWORK[GATEWAY6, NETWORK=\\\"#{name}\\\"]\"" + lines<<"ETH#{index}_CONTEXT_FORCE_IPV4 = \"$NETWORK[CONTEXT_FORCE_IPV4, NETWORK=\\\"#{name}\\\"]\"" end end From 85eeb4b240881f1918b37ab2ee7c201e311cd474 Mon Sep 17 00:00:00 2001 From: Jaime Melis Date: Thu, 4 Apr 2013 21:34:43 +0200 Subject: [PATCH 23/40] Feature #1068: Fix unnecessary use of sudo in the Ceph drivers --- src/datastore_mad/remotes/ceph/cp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datastore_mad/remotes/ceph/cp b/src/datastore_mad/remotes/ceph/cp index e72268c6a7..93f6d862e3 100755 --- a/src/datastore_mad/remotes/ceph/cp +++ b/src/datastore_mad/remotes/ceph/cp @@ -110,7 +110,7 @@ http://*|https://*) ;; esac -exec_and_log "eval $DUMP | $SSH $DST_HOST $SUDO $DD of=$TMP_DST bs=64k" \ +exec_and_log "eval $DUMP | $SSH $DST_HOST $DD of=$TMP_DST bs=64k" \ "Error dumping $SRC to $DST_HOST:$TMP_DST" REGISTER_CMD=$(cat < Date: Thu, 4 Apr 2013 23:17:55 +0200 Subject: [PATCH 24/40] feautr #1631: Renamed to life-migrate. --- include/History.h | 4 ++-- include/VirtualMachine.h | 6 +++--- src/lcm/LifeCycleActions.cc | 31 +++++++++++++++---------------- src/lcm/LifeCycleStates.cc | 6 +++--- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/include/History.h b/include/History.h index ce852c3a32..b0253c4548 100644 --- a/include/History.h +++ b/include/History.h @@ -70,7 +70,7 @@ public: st = "migrate"; break; case LIVE_MIGRATE_ACTION: - st = "migrate-live"; + st = "live-migrate"; break; case SHUTDOWN_ACTION: st = "shutdown"; @@ -140,7 +140,7 @@ public: { action = MIGRATE_ACTION; } - else if (st == "migrate-live") + else if (st == "live-migrate") { action = LIVE_MIGRATE_ACTION; } diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 3caa17335e..fa452ffe52 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -509,7 +509,7 @@ public: * Returns the action that closed the history record in the previous host * @return the action that closed the history record in the previous host */ - const History::VMAction get_previous_history_action() const + const History::VMAction get_previous_action() const { return previous_history->action; }; @@ -660,7 +660,7 @@ public: * Sets the action that closed the history record * @param action that closed the history record */ - void set_history_action(History::VMAction action) + void set_action(History::VMAction action) { history->action = action; }; @@ -669,7 +669,7 @@ public: * Sets the action that closed the history record in the previous host * @param action that closed the history record in the previous host */ - void set_previous_history_action(History::VMAction action) + void set_previous_action(History::VMAction action) { previous_history->action = action; }; diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 0ef0f49511..5c95a6f866 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -48,14 +48,13 @@ void LifeCycleManager::deploy_action(int vid) if (vm->hasPreviousHistory()) { - if (vm->get_previous_history_action() == History::STOP_ACTION) + if (vm->get_previous_action() == History::STOP_ACTION) { vm_state = VirtualMachine::PROLOG_RESUME; tm_action = TransferManager::PROLOG_RESUME; } - else if ( - vm->get_previous_history_action() == History::UNDEPLOY_ACTION || - vm->get_previous_history_action() == History::UNDEPLOY_HARD_ACTION) + else if (vm->get_previous_action() == History::UNDEPLOY_ACTION || + vm->get_previous_action() == History::UNDEPLOY_HARD_ACTION) { vm_state = VirtualMachine::PROLOG_UNDEPLOY; tm_action = TransferManager::PROLOG_RESUME; @@ -122,7 +121,7 @@ void LifeCycleManager::suspend_action(int vid) vmpool->update(vm); - vm->set_history_action(History::SUSPEND_ACTION); + vm->set_action(History::SUSPEND_ACTION); vmpool->update_history(vm); @@ -172,7 +171,7 @@ void LifeCycleManager::stop_action(int vid) vmpool->update(vm); - vm->set_history_action(History::STOP_ACTION); + vm->set_action(History::STOP_ACTION); vmpool->update_history(vm); @@ -225,7 +224,7 @@ void LifeCycleManager::migrate_action(int vid) vm->set_stime(time(0)); - vm->set_previous_history_action(History::MIGRATE_ACTION); + vm->set_previous_action(History::MIGRATE_ACTION); vmpool->update_history(vm); @@ -283,7 +282,7 @@ void LifeCycleManager::live_migrate_action(int vid) vm->set_stime(time(0)); - vm->set_history_action(History::LIVE_MIGRATE_ACTION); + vm->set_action(History::LIVE_MIGRATE_ACTION); vmpool->update_history(vm); @@ -337,7 +336,7 @@ void LifeCycleManager::shutdown_action(int vid) vmpool->update(vm); - vm->set_history_action(History::SHUTDOWN_ACTION); + vm->set_action(History::SHUTDOWN_ACTION); vmpool->update_history(vm); @@ -393,13 +392,13 @@ void LifeCycleManager::undeploy_action(int vid, bool hard) if (hard) { - vm->set_history_action(History::UNDEPLOY_HARD_ACTION); + vm->set_action(History::UNDEPLOY_HARD_ACTION); vmm->trigger(VirtualMachineManager::CANCEL,vid); } else { - vm->set_history_action(History::UNDEPLOY_ACTION); + vm->set_action(History::UNDEPLOY_ACTION); vmm->trigger(VirtualMachineManager::SHUTDOWN,vid); } @@ -469,13 +468,13 @@ void LifeCycleManager::poweroff_action(int vid, bool hard) if (hard) { - vm->set_history_action(History::POWEROFF_HARD_ACTION); + vm->set_action(History::POWEROFF_HARD_ACTION); vmm->trigger(VirtualMachineManager::CANCEL,vid); } else { - vm->set_history_action(History::POWEROFF_ACTION); + vm->set_action(History::POWEROFF_ACTION); vmm->trigger(VirtualMachineManager::SHUTDOWN,vid); } @@ -578,7 +577,7 @@ void LifeCycleManager::cancel_action(int vid) vmpool->update(vm); - vm->set_history_action(History::SHUTDOWN_HARD_ACTION); + vm->set_action(History::SHUTDOWN_HARD_ACTION); vmpool->update_history(vm); @@ -843,12 +842,12 @@ void LifeCycleManager::clean_up_vm(VirtualMachine * vm, bool dispose, int& imag if (dispose) { vm->set_state(VirtualMachine::CLEANUP_DELETE); - vm->set_history_action(History::DESTROY_ACTION); + vm->set_action(History::DESTROY_ACTION); } else { vm->set_state(VirtualMachine::CLEANUP_RESUBMIT); - vm->set_history_action(History::DESTROY_RECREATE_ACTION); + vm->set_action(History::DESTROY_RECREATE_ACTION); } vm->set_resched(false); diff --git a/src/lcm/LifeCycleStates.cc b/src/lcm/LifeCycleStates.cc index 58eff2d1b4..8a6363cef8 100644 --- a/src/lcm/LifeCycleStates.cc +++ b/src/lcm/LifeCycleStates.cc @@ -222,7 +222,7 @@ void LifeCycleManager::save_failure_action(int vid) vmpool->update(vm); - vm->set_history_action(History::NONE_ACTION); + vm->set_action(History::NONE_ACTION); vmpool->update_history(vm); @@ -581,7 +581,7 @@ void LifeCycleManager::shutdown_failure_action(int vid) vmpool->update(vm); - vm->set_history_action(History::NONE_ACTION); + vm->set_action(History::NONE_ACTION); vmpool->update_history(vm); @@ -1055,7 +1055,7 @@ void LifeCycleManager::cancel_failure_action(int vid) vmpool->update(vm); - vm->set_history_action(History::NONE_ACTION); + vm->set_action(History::NONE_ACTION); vmpool->update_history(vm); From f1bd884fd6527565aaf9a86ad08c1451f790662e Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 5 Apr 2013 00:05:47 +0200 Subject: [PATCH 25/40] Fix TEMPLATE_NAME in USER_TEMPLATE --- src/vm/VirtualMachine.cc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 5109fd3e3c..c7e43283a2 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -274,16 +274,20 @@ int VirtualMachine::insert(SqlDB * db, string& error_str) user_obj_template->get("NAME",name); user_obj_template->erase("NAME"); + user_obj_template->get("TEMPLATE_NAME", prefix); + user_obj_template->erase("TEMPLATE_NAME"); + + if (prefix.empty()) + { + prefix = "one"; + } + else + { + obj_template->add("TEMPLATE_NAME", prefix); + } + if (name.empty() == true) { - user_obj_template->get("TEMPLATE_NAME", prefix); - user_obj_template->erase("TEMPLATE_NAME"); - - if (prefix.empty()) - { - prefix = "one"; - } - oss.str(""); oss << prefix << "-" << oid; name = oss.str(); From afaa90ec735ecae35cc4b65e2eba38ec5338d335 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 5 Apr 2013 12:50:49 +0200 Subject: [PATCH 26/40] feature #1643: add IPv6 support to RPM context packages --- .../base_rpm/etc/one-context.d/00-network | 33 ++++++++++++++++--- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/share/scripts/context-packages/base_rpm/etc/one-context.d/00-network b/share/scripts/context-packages/base_rpm/etc/one-context.d/00-network index 92e630b645..6886d538f7 100755 --- a/share/scripts/context-packages/base_rpm/etc/one-context.d/00-network +++ b/share/scripts/context-packages/base_rpm/etc/one-context.d/00-network @@ -103,10 +103,6 @@ upcase() { gen_iface_conf() { cat < /etc/sysconfig/network-scripts/ifcfg-${DEV} + IPV6=$(get_iface_var "IPV6") + GATEWAY6=$(get_iface_var "GATEWAY6") + CONTEXT_FORCE_IPV4=$(get_iface_var "CONTEXT_FORCE_IPV4") + + ( + cat < /etc/sysconfig/network-scripts/ifcfg-${DEV} done } From 7fdb30508e236a31b6f6f3065388dadf53b266dd Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 5 Apr 2013 13:09:32 +0200 Subject: [PATCH 27/40] feature #1643: packages version bump --- share/scripts/context-packages/generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/scripts/context-packages/generate.sh b/share/scripts/context-packages/generate.sh index 3033859003..4111894bf4 100755 --- a/share/scripts/context-packages/generate.sh +++ b/share/scripts/context-packages/generate.sh @@ -16,7 +16,7 @@ # limitations under the License. # #--------------------------------------------------------------------------- # -VERSION=${VERSION:-3.8.1} +VERSION=${VERSION:-3.9.80} MAINTAINER=${MAINTAINER:-C12G Labs } LICENSE=${LICENSE:-Apache 2.0} PACKAGE_NAME=${PACKAGE_NAME:-one-context} From 588b3c5e34ef37b8a86749aabbd8eda7b2db8070 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Fri, 5 Apr 2013 13:11:45 +0200 Subject: [PATCH 28/40] feature #1643: enable /root/.ssh in selinux (for SSH_PUBLIC_KEY) --- .../context-packages/base_rpm/etc/one-context.d/03-selinux-ssh | 1 + 1 file changed, 1 insertion(+) create mode 100755 share/scripts/context-packages/base_rpm/etc/one-context.d/03-selinux-ssh diff --git a/share/scripts/context-packages/base_rpm/etc/one-context.d/03-selinux-ssh b/share/scripts/context-packages/base_rpm/etc/one-context.d/03-selinux-ssh new file mode 100755 index 0000000000..164d1c10e0 --- /dev/null +++ b/share/scripts/context-packages/base_rpm/etc/one-context.d/03-selinux-ssh @@ -0,0 +1 @@ +restorecon -R -v /root/.ssh From 561f4b37e87e5991679655f3eca2c0dc1bc067ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 5 Apr 2013 15:01:06 +0200 Subject: [PATCH 29/40] Update xsd files, add tests for accounting xsd --- share/doc/xsd/acct.xsd | 2 + share/doc/xsd/oned.conf | 516 ++++++++++++++++++++++++++++++++++ share/doc/xsd/test.sh | 31 +- share/doc/xsd/test/template.1 | 5 +- share/doc/xsd/vm.xsd | 1 + 5 files changed, 551 insertions(+), 4 deletions(-) create mode 100644 share/doc/xsd/oned.conf diff --git a/share/doc/xsd/acct.xsd b/share/doc/xsd/acct.xsd index bf09e3e64e..a34fbebf51 100644 --- a/share/doc/xsd/acct.xsd +++ b/share/doc/xsd/acct.xsd @@ -22,6 +22,7 @@ + @@ -159,6 +160,7 @@ + diff --git a/share/doc/xsd/oned.conf b/share/doc/xsd/oned.conf new file mode 100644 index 0000000000..2e22dca0bf --- /dev/null +++ b/share/doc/xsd/oned.conf @@ -0,0 +1,516 @@ +#******************************************************************************* +# OpenNebula Configuration file +#******************************************************************************* + +#******************************************************************************* +# Daemon configuration attributes +#------------------------------------------------------------------------------- +# MANAGER_TIMER: Time in seconds the core uses to evaluate periodical functions. +# MONITORING_INTERVAL cannot have a smaller value than MANAGER_TIMER. +# +# MONITORING_INTERVAL: Time in seconds between host and VM monitorization. +# +# HOST_PER_INTERVAL: Number of hosts monitored in each interval. +# HOST_MONITORING_EXPIRATION_TIME: Time, in seconds, to expire monitoring +# information. Use 0 to disable HOST monitoring recording. +# +# VM_PER_INTERVAL: Number of VMs monitored in each interval. +# VM_MONITORING_EXPIRATION_TIME: Time, in seconds, to expire monitoring +# information. Use 0 to disable VM monitoring recording. +# +# SCRIPTS_REMOTE_DIR: Remote path to store the monitoring and VM management +# scripts. +# +# PORT: Port where oned will listen for xmlrpc calls. +# +# DB: Configuration attributes for the database backend +# backend : can be sqlite or mysql (default is sqlite) +# server : (mysql) host name or an IP address for the MySQL server +# port : (mysql) port for the connection to the server. +# If set to 0, the default port is used. +# user : (mysql) user's MySQL login ID +# passwd : (mysql) the password for user +# db_name : (mysql) the database name +# +# VNC_BASE_PORT: VNC ports for VMs can be automatically set to VNC_BASE_PORT + +# VMID +# +# LOG: Configuration for the logging system +# system: defines the logging system: +# file to log in the oned.log file +# syslog to use the syslog facilities +# debug_level: 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG +# +# VM_SUBMIT_ON_HOLD: Forces VMs to be created on hold state instead of pending. +# Values: YES or NO. +#******************************************************************************* + +LOG = [ + system = "file", + debug_level = 3 +] + +MANAGER_TIMER = 2 + +MONITORING_INTERVAL = 2 + +#HOST_PER_INTERVAL = 15 +#HOST_MONITORING_EXPIRATION_TIME = 86400 + +#VM_PER_INTERVAL = 5 +#VM_MONITORING_EXPIRATION_TIME = 86400 + +SCRIPTS_REMOTE_DIR=/var/tmp/one + +PORT = 2633 + +DB = [ backend = "sqlite" ] + +# Sample configuration for MySQL +# DB = [ backend = "mysql", +# server = "localhost", +# port = 0, +# user = "oneadmin", +# passwd = "oneadmin", +# db_name = "opennebula" ] + +VNC_BASE_PORT = 5900 + +#VM_SUBMIT_ON_HOLD = "NO" + +#******************************************************************************* +# Physical Networks configuration +#******************************************************************************* +# NETWORK_SIZE: Here you can define the default size for the virtual networks +# +# MAC_PREFIX: Default MAC prefix to be used to create the auto-generated MAC +# addresses is defined here (this can be overrided by the Virtual Network +# template) +#******************************************************************************* + +NETWORK_SIZE = 254 + +MAC_PREFIX = "02:00" + +#******************************************************************************* +# DataStore Configuration +#******************************************************************************* +# DATASTORE_LOCATION: *Default* Path for Datastores in the hosts. It IS the +# same for all the hosts in the cluster. DATASTORE_LOCATION IS ONLY FOR THE +# HOSTS AND *NOT* THE FRONT-END. It defaults to /var/lib/one/datastores (or +# $ONE_LOCATION/var/datastores in self-contained mode) +# +# You can define a different DATASTORE_LOCATION in each cluster by updating +# its properties with onecluster update. +# +# DEFAULT_IMAGE_TYPE: This can take values +# OS Image file holding an operating system +# CDROM Image file holding a CDROM +# DATABLOCK Image file holding a datablock, +# always created as an empty block +# DEFAULT_DEVICE_PREFIX: This can be set to +# hd IDE prefix +# sd SCSI +# xvd XEN Virtual Disk +# vd KVM virtual disk +#******************************************************************************* + +#DATASTORE_LOCATION = /var/lib/one/datastores + +DEFAULT_IMAGE_TYPE = "OS" +DEFAULT_DEVICE_PREFIX = "hd" + +#******************************************************************************* +# Information Driver Configuration +#******************************************************************************* +# You can add more information managers with different configurations but make +# sure it has different names. +# +# name : name for this information manager +# +# executable: path of the information driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, usually a probe configuration file, +# can be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +#******************************************************************************* + +#------------------------------------------------------------------------------- +# KVM Information Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +IM_MAD = [ + name = "kvm", + executable = "one_im_ssh", + arguments = "-r 0 -t 15 kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Information Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "xen", +# executable = "one_im_ssh", +# arguments = "xen" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# VMware Information Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "vmware", +# executable = "one_im_sh", +# arguments = "-c -t 15 -r 0 vmware" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# EC2 Information Driver Manager Configuration +#------------------------------------------------------------------------------- +#IM_MAD = [ +# name = "ec2", +# executable = "one_im_ec2", +# arguments = "im_ec2/im_ec2.conf" ] +#------------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Ganglia Information Driver Manager Configuration +#----------------------------------------------------------------------------- +#IM_MAD = [ +# name = "ganglia", +# executable = "one_im_sh", +# arguments = "ganglia" ] +#----------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Information Driver Manager Configuration +#------------------------------------------------------------------------------- +IM_MAD = [ name="dummy", executable="one_im_dummy"] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Virtualization Driver Configuration +#******************************************************************************* +# You can add more virtualization managers with different configurations but +# make sure it has different names. +# +# name : name of the virtual machine manager driver +# +# executable: path of the virtualization driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable +# +# default : default values and configuration parameters for the driver, can +# be an absolute path or relative to $ONE_LOCATION/etc (or +# /etc/one/ if OpenNebula was installed in /) +# +# type : driver type, supported drivers: xen, kvm, xml +#******************************************************************************* + +#------------------------------------------------------------------------------- +# KVM Virtualization Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +# -l actions executed locally, command can be +# overridden for each action. +# Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll +# An example: "-l migrate,poll=poll_ganglia,save" +#------------------------------------------------------------------------------- +VM_MAD = [ + name = "kvm", + executable = "one_vmm_exec", + arguments = "-t 15 -r 0 kvm", + default = "vmm_exec/vmm_exec_kvm.conf", + type = "kvm" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# XEN Virtualization Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +# -l actions executed locally, command can be +# overridden for each action. +# Valid actions: deploy, shutdown, cancel, save, restore, migrate, poll +# An example: "-l migrate,poll=poll_ganglia,save" +#------------------------------------------------------------------------------- + +# Driver for Xen 3.x +#VM_MAD = [ +# name = "xen", +# executable = "one_vmm_exec", +# arguments = "-t 15 -r 0 xen3", +# default = "vmm_exec/vmm_exec_xen3.conf", +# type = "xen" ] + +# Driver for Xen 4.x +#VM_MAD = [ +# name = "xen", +# executable = "one_vmm_exec", +# arguments = "-t 15 -r 0 xen4", +# default = "vmm_exec/vmm_exec_xen4.conf", +# type = "xen" ] + +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# VMware Virtualization Driver Manager Configuration +# -r number of retries when monitoring a host +# -t number of threads, i.e. number of hosts monitored at the same time +#------------------------------------------------------------------------------- +#VM_MAD = [ +# name = "vmware", +# executable = "one_vmm_sh", +# arguments = "-t 15 -r 0 vmware -s sh", +# default = "vmm_exec/vmm_exec_vmware.conf", +# type = "vmware" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# EC2 Virtualization Driver Manager Configuration +# arguments: default values for the EC2 driver, can be an absolute path or +# relative to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was +# installed in /). +#------------------------------------------------------------------------------- +#VM_MAD = [ +# name = "ec2", +# executable = "one_vmm_ec2", +# arguments = "vmm_ec2/vmm_ec2.conf", +# type = "xml" ] +#------------------------------------------------------------------------------- + +#------------------------------------------------------------------------------- +# Dummy Virtualization Driver Configuration +#------------------------------------------------------------------------------- +VM_MAD = [ name="dummy", executable="one_vmm_dummy", type="xml" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Transfer Manager Driver Configuration +#******************************************************************************* +# You can add more transfer managers with different configurations but make +# sure it has different names. +# name : name for this transfer driver +# +# executable: path of the transfer driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# arguments : +# -t: number of threads, i.e. number of transfers made at the same time +# -d: list of transfer drivers separated by commas, if not defined all the +# drivers available will be enabled +#******************************************************************************* + +TM_MAD = [ + executable = "one_tm", + arguments = "-t 15 -d dummy,lvm,shared,qcow2,ssh,vmfs,iscsi,ceph" ] + +#******************************************************************************* +# Datastore Driver Configuration +#******************************************************************************* +# Drivers to manage the datastores, specialized for the storage backend +# executable: path of the transfer driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable +# -t number of threads, i.e. number of repo operations at the same time +# -d datastore mads separated by commas +#******************************************************************************* + +DATASTORE_MAD = [ + executable = "one_datastore", + arguments = "-t 15 -d fs,vmware,vmfs,iscsi,lvm,ceph" +] + +#******************************************************************************* +# Hook Manager Configuration +#******************************************************************************* +# The Driver (HM_MAD) +# ----------------------------------------------- +# +# Used to execute the Hooks: +# executable: path of the hook driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# arguments : for the driver executable, can be an absolute path or relative +# to $ONE_LOCATION/etc (or /etc/one/ if OpenNebula was installed +# in /) +# +# Virtual Machine Hooks (VM_HOOK) +# ------------------------------- +# +# Defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the VM is created (onevm create) +# - PROLOG, when the VM is in the prolog state +# - RUNNING, after the VM is successfully booted +# - UNKNOWN, when the VM is in the unknown state +# - SHUTDOWN, after the VM is shutdown +# - STOP, after the VM is stopped (including VM image transfers) +# - DONE, after the VM is deleted or shutdown +# - FAILED, when the VM enters the failed state +# command : path is relative to $ONE_LOCATION/var/remotes/hook +# (self-contained) or to /var/lib/one/remotes/hook (system-wide). +# That directory will be copied on the hosts under +# SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist +# on the target host +# arguments : for the hook. You can access to VM information with $ +# - $ID, the ID of the virtual machine +# - $TEMPLATE, the VM template in xml and base64 encoded +# remote : values, +# - YES, The hook is executed in the host where the VM was +# allocated +# - NO, The hook is executed in the OpenNebula server (default) +# +# Host Hooks (HOST_HOOK) +# ------------------------------- +# +# Defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the Host is created (onehost create) +# - ERROR, when the Host enters the error state +# - DISABLE, when the Host is disabled +# command : path is relative to $ONE_LOCATION/var/remotes/hook +# (self-contained) or to /var/lib/one/remotes/hook (system-wide). +# That directory will be copied on the hosts under +# SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist +# on the target host. +# arguments : for the hook. You can use the following Host information: +# - $ID, the ID of the host +# - $TEMPLATE, the Host template in xml and base64 encoded +# remote : values, +# - YES, The hook is executed in the host +# - NO, The hook is executed in the OpenNebula server (default) +# +# Virtual Network (VNET_HOOK) +# User (USER_HOOK) +# Group (GROUP_HOOK) +# Image (IMAGE_HOOK) +# ------------------------------- +# +# These hooks are executed when one of the referring entities are created or +# removed. Each hook is defined by: +# name : for the hook, useful to track the hook (OPTIONAL) +# on : when the hook should be executed, +# - CREATE, when the vnet is created +# - REMOVE, when the vnet is removed +# command : path is relative to $ONE_LOCATION/var/remotes/hook +# (self-contained) or to /var/lib/one/remotes/hook (system-wide). +# That directory will be copied on the hosts under +# SCRIPTS_REMOTE_DIR. It can be an absolute path that must exist +# on the target host. +# arguments : for the hook. You can use the following Host information: +# - $ID, the ID of the host +# - $TEMPLATE, the vnet template in xml and base64 encoded +#------------------------------------------------------------------------------- +HM_MAD = [ + executable = "one_hm" ] + +#******************************************************************************* +# Fault Tolerance Hooks +#******************************************************************************* +# This hook is used to perform recovery actions when a host fails. +# Script to implement host failure tolerance +# It can be set to +# -r recreate VMs running in the host +# -d delete VMs running in the host +# Additional flags +# -f force resubmission of suspended VMs +# -p avoid resubmission if host comes +# back after n monitoring cycles +#******************************************************************************* +# +#HOST_HOOK = [ +# name = "error", +# on = "ERROR", +# command = "ft/host_error.rb", +# arguments = "$ID -r", +# remote = "no" ] +#------------------------------------------------------------------------------- +# These two hooks can be used to automatically delete or resubmit VMs that reach +# the "failed" state. This way, the administrator doesn't have to interact +# manually to release its resources or retry the deployment. +# +# +# Only one of them should be uncommented. +#------------------------------------------------------------------------------- +# +#VM_HOOK = [ +# name = "on_failure_delete", +# on = "FAILED", +# command = "/usr/bin/env onevm destroy", +# arguments = "$ID" ] +# +#VM_HOOK = [ +# name = "on_failure_recreate", +# on = "FAILED", +# command = "/usr/bin/env onevm destroy --recreate", +# arguments = "$ID" ] +#------------------------------------------------------------------------------- + +#******************************************************************************* +# Auth Manager Configuration +#******************************************************************************* +# AUTH_MAD: The Driver that will be used to authenticate (authn) and +# authorize (authz) OpenNebula requests. If defined OpenNebula will use the +# built-in auth policies. +# +# executable: path of the auth driver executable, can be an +# absolute path or relative to $ONE_LOCATION/lib/mads (or +# /usr/lib/one/mads/ if OpenNebula was installed in /) +# +# authn : list of authentication modules separated by commas, if not +# defined all the modules available will be enabled +# authz : list of authentication modules separated by commas +# +# SESSION_EXPIRATION_TIME: Time in seconds to keep an authenticated token as +# valid. During this time, the driver is not used. Use 0 to disable session +# caching +# +# ENABLE_OTHER_PERMISSIONS: Whether or not users can set the permissions for +# 'other', so publishing or sharing resources with others. Users in the oneadmin +# group will still be able to change these permissions. Values: YES or NO. +# +# DEFAULT_UMASK: Similar to Unix umask, sets the default resources permissions. +# Its format must be 3 octal digits. For example a umask of 137 will set +# the new object's permissions to 640 "um- u-- ---" +#******************************************************************************* + +AUTH_MAD = [ + executable = "one_auth_mad", + authn = "ssh,x509,ldap,server_cipher,server_x509" +] + +SESSION_EXPIRATION_TIME = 900 + +#ENABLE_OTHER_PERMISSIONS = "YES" + +DEFAULT_UMASK = 177 + +#******************************************************************************* +# Restricted Attributes Configuration +#******************************************************************************* +# The following attributes are restricted to users outside the oneadmin group +#******************************************************************************* + +VM_RESTRICTED_ATTR = "CONTEXT/FILES" +VM_RESTRICTED_ATTR = "NIC/MAC" +VM_RESTRICTED_ATTR = "NIC/VLAN_ID" + +#VM_RESTRICTED_ATTR = "RANK" +#VM_RESTRICTED_ATTR = "SCHED_RANK" +#VM_RESTRICTED_ATTR = "REQUIREMENTS" +#VM_RESTRICTED_ATTR = "SCHED_REQUIREMENTS" + +IMAGE_RESTRICTED_ATTR = "SOURCE" diff --git a/share/doc/xsd/test.sh b/share/doc/xsd/test.sh index ad1622f166..e9bedbd477 100755 --- a/share/doc/xsd/test.sh +++ b/share/doc/xsd/test.sh @@ -25,6 +25,7 @@ mkdir -p samples/vmtemplate samples/vmtemplate_pool mkdir -p samples/user samples/user_pool mkdir -p samples/vm samples/vm_pool mkdir -p samples/vnet samples/vnet_pool +mkdir -p samples/vnet samples/acct @@ -79,7 +80,25 @@ onetemplate list -x > samples/vmtemplate_pool/2.xml # VM -onetemplate instantiate 0 +onetemplate instantiate 0 -m 2 +onetemplate instantiate 1 -m 2 + +for i in `onevm list | tail -n +2 | tr -s ' ' | cut -f2 -d ' '`; do + onevm deploy $i host01 +done + +sleep 5 + +onevm migrate --live 0 0 +onevm destroy 1 +onevm poweroff 2 + +sleep 5 + +onevm suspend 0 +onevm resume 2 + +sleep 5 for i in `onevm list | tail -n +2 | tr -s ' ' | cut -f2 -d ' '`; do onevm show $i -x > samples/vm/$i.xml @@ -144,8 +163,6 @@ done onegroup list -x > samples/group_pool/0.xml - - for i in cluster datastore group host image vmtemplate user vm vnet do POOL_NAME="$i""_pool" @@ -158,4 +175,12 @@ do xmllint --noout --schema $POOL_NAME.xsd samples/$POOL_NAME/* done + +# Accounting +oneacct -x > samples/acct/0.xml + +sed -i "s%%%" samples/acct/*.xml + +xmllint --noout --schema acct.xsd samples/acct/* + exit 0 diff --git a/share/doc/xsd/test/template.1 b/share/doc/xsd/test/template.1 index 464d29f63f..e3f07e3246 100644 --- a/share/doc/xsd/test/template.1 +++ b/share/doc/xsd/test/template.1 @@ -1 +1,4 @@ -NAME = template1 \ No newline at end of file +NAME = template1 +CPU = 0.45 +VCPU = 1 +MEMORY = 512 \ No newline at end of file diff --git a/share/doc/xsd/vm.xsd b/share/doc/xsd/vm.xsd index 65ad2d5f4c..072f194288 100644 --- a/share/doc/xsd/vm.xsd +++ b/share/doc/xsd/vm.xsd @@ -114,6 +114,7 @@ + From 6db5aa6c20c2e62f40aef604cc6e988df34b6f83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 5 Apr 2013 16:01:32 +0200 Subject: [PATCH 30/40] Feature #1631: Rename life-migrate in cli; fix live-migration action --- src/lcm/LifeCycleActions.cc | 2 +- src/oca/ruby/opennebula/virtual_machine.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lcm/LifeCycleActions.cc b/src/lcm/LifeCycleActions.cc index 96f30db2dc..cba4ff7dab 100644 --- a/src/lcm/LifeCycleActions.cc +++ b/src/lcm/LifeCycleActions.cc @@ -282,7 +282,7 @@ void LifeCycleManager::live_migrate_action(int vid) vm->set_stime(time(0)); - vm->set_action(History::LIVE_MIGRATE_ACTION); + vm->set_previous_action(History::LIVE_MIGRATE_ACTION); vmpool->update_history(vm); diff --git a/src/oca/ruby/opennebula/virtual_machine.rb b/src/oca/ruby/opennebula/virtual_machine.rb index dabb1cf10f..3084a7819a 100644 --- a/src/oca/ruby/opennebula/virtual_machine.rb +++ b/src/oca/ruby/opennebula/virtual_machine.rb @@ -113,7 +113,7 @@ module OpenNebula "USER" => "user" } - HISTORY_ACTION=%w{none migrate migrate-live shutdown shutdown-hard + HISTORY_ACTION=%w{none migrate live-migrate shutdown shutdown-hard undeploy undeploy-hard hold release stop suspend resume boot destroy destroy-recreate reboot reboot-hard resched unresched poweroff poweroff-hard} From 7c02cbe692ece1552393c8160096481639d02a06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 5 Apr 2013 16:44:53 +0200 Subject: [PATCH 31/40] Feature #1631: Add history action to sunstone --- src/sunstone/public/js/opennebula.js | 24 +++++++++++++++++++++++ src/sunstone/public/js/plugins/vms-tab.js | 6 ++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index b39e679910..42e5d9bc82 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -140,6 +140,30 @@ var OpenNebula = { "ERROR", "USER"][value]); break; + case "VM_MIGRATE_ACTION": + case "vm_migrate_action": + state = tr(["none", + "migrate", + "live-migrate", + "shutdown", + "shutdown-hard", + "undeploy", + "undeploy-hard", + "hold", + "release", + "stop", + "suspend", + "resume", + "boot", + "destroy", + "destroy-recreate", + "reboot", + "reboot-hard", + "resched", + "unresched", + "poweroff", + "poweroff-hard"][value]); + break; default: return value; } diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index dfa400ef92..f893725272 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -1183,6 +1183,7 @@ function generatePlacementTable(vm){ \ '+tr("#")+'\ '+tr("Host")+'\ + '+tr("Action")+'\ '+tr("Reason")+'\ '+tr("Chg time")+'\ '+tr("Total time")+'\ @@ -1225,9 +1226,10 @@ function generatePlacementTable(vm){ html += ' \ - '+history[i].SEQ+'\ + '+history[i].SEQ+'\ '+history[i].HOSTNAME+'\ - '+OpenNebula.Helper.resource_state("VM_MIGRATE_REASON",parseInt(history[i].REASON, 10))+'\ + '+OpenNebula.Helper.resource_state("VM_MIGRATE_ACTION",parseInt(history[i].ACTION, 10))+'\ + '+OpenNebula.Helper.resource_state("VM_MIGRATE_REASON",parseInt(history[i].REASON, 10))+'\ '+pretty_time(history[i].STIME)+'\ '+pretty_time_runtime(dtime)+'\ '+pretty_time_runtime(dtime2)+'\ From edd5ab1756cb47590bc8e54a38bccf0003cd1458 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 5 Apr 2013 11:38:20 +0200 Subject: [PATCH 32/40] Fix dialogs height --- src/sunstone/public/css/app.css | 314 ++++++++++-------- src/sunstone/public/js/layout.js | 4 +- src/sunstone/public/js/plugins/acls-tab.js | 9 +- .../public/js/plugins/clusters-tab.js | 13 +- src/sunstone/public/js/plugins/config-tab.js | 7 +- .../public/js/plugins/datastores-tab.js | 12 +- src/sunstone/public/js/plugins/groups-tab.js | 6 +- src/sunstone/public/js/plugins/hosts-tab.js | 11 +- src/sunstone/public/js/plugins/images-tab.js | 14 +- .../public/js/plugins/templates-tab.js | 14 +- src/sunstone/public/js/plugins/users-tab.js | 6 +- src/sunstone/public/js/plugins/vms-tab.js | 36 +- src/sunstone/public/js/plugins/vnets-tab.js | 18 +- src/sunstone/public/js/sunstone-util.js | 2 +- src/sunstone/public/sass/app.scss | 55 ++- .../jquery_layout/layout-default-latest.css | 2 +- src/sunstone/views/index.erb | 5 +- 17 files changed, 314 insertions(+), 214 deletions(-) diff --git a/src/sunstone/public/css/app.css b/src/sunstone/public/css/app.css index 88ba623478..271bd2bd06 100644 --- a/src/sunstone/public/css/app.css +++ b/src/sunstone/public/css/app.css @@ -3734,6 +3734,7 @@ ul.tabs-content.contained.vertical > li { div.alert-box { display: block; padding: 6px 7px 7px; + font-weight: bold; font-size: 14px; color: white; background-color: #2ba6cb; @@ -3746,7 +3747,6 @@ div.alert-box { border-radius: 3px; text-shadow: 0 -1px rgba(0, 0, 0, 0.3); position: relative; - font-family: Arial, Helvetica, sans-serif; } /* line 29, ../../../../../../../.rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/zurb-foundation-3.2.5/scss/foundation/components/modules/_ui.scss */ div.alert-box.success { @@ -6147,12 +6147,11 @@ div.button-bar { /* line 158, ../sass/app.scss */ #logo { font-weight: bold; - margin: 10%; margin-top: 15%; margin-bottom: 10%; } -/* line 165, ../sass/app.scss */ +/* line 164, ../sass/app.scss */ #login-info { text-align: center; overflow: visible; @@ -6169,42 +6168,42 @@ div.button-bar { visibility: visible; } -/* line 186, ../sass/app.scss */ +/* line 185, ../sass/app.scss */ #links { padding-top: 4px; margin-right: 40px; float: right; } -/* line 192, ../sass/app.scss */ +/* line 191, ../sass/app.scss */ #login-info, #login-info a, #links, #links a { color: #555; } -/* line 196, ../sass/app.scss */ +/* line 195, ../sass/app.scss */ #login-info, #login-info a { font-weight: bold; } -/* line 199, ../sass/app.scss */ +/* line 198, ../sass/app.scss */ .sunstone-color { color: #2ba6cb; } -/* line 203, ../sass/app.scss */ +/* line 202, ../sass/app.scss */ #logo-wrapper { float: right; margin-top: 0px; margin-right: 20px; } -/* line 209, ../sass/app.scss */ +/* line 208, ../sass/app.scss */ .menu-nav { height: 70%; overflow: overlay; } -/* line 214, ../sass/app.scss */ +/* line 213, ../sass/app.scss */ #menu { padding-right: 0; padding-left: 0; @@ -6212,29 +6211,29 @@ div.button-bar { overflow: hidden; } -/* line 221, ../sass/app.scss */ +/* line 220, ../sass/app.scss */ #tabs_content { box-shadow: -8px -8px 11px -11px black; z-index: 2 !important; } -/* line 226, ../sass/app.scss */ +/* line 225, ../sass/app.scss */ #navigation { - margin: 8%; + margin: 0 8%; box-shadow: 0 0 1px 0px black; } -/* line 231, ../sass/app.scss */ +/* line 230, ../sass/app.scss */ .tabs.vertical li { border-left: none; } -/* line 235, ../sass/app.scss */ +/* line 234, ../sass/app.scss */ .tabs.vertical li.active { border-top: none; } -/* line 240, ../sass/app.scss */ +/* line 239, ../sass/app.scss */ #navigation > li:not(.subTab).navigation-active-li > a, #navigation > li:not(.subTab).active > a { background: #f2f2f2; @@ -6242,12 +6241,12 @@ div.button-bar { color: #555; } -/* line 250, ../sass/app.scss */ +/* line 249, ../sass/app.scss */ #navigation i { margin-right: 3px; } -/* line 255, ../sass/app.scss */ +/* line 254, ../sass/app.scss */ #navigation li.subTab > a { background: #fdfdfd; color: #555; @@ -6255,33 +6254,43 @@ div.button-bar { padding: 7px 11px 7px 25px; } -/* line 262, ../sass/app.scss */ +/* line 261, ../sass/app.scss */ #navigation li.subsubTab { padding-left: 15px; } -/* line 266, ../sass/app.scss */ +/* line 265, ../sass/app.scss */ #navigation li:not(subTab) { - border-left: 5px solid #f2f2f2 !important; + border-left: 5px solid #f2f2f2; } -/* line 270, ../sass/app.scss */ +/* line 269, ../sass/app.scss */ +#navigation li:not(subTab):hover { + border-left: 5px solid #e2e2e2; +} + +/* line 273, ../sass/app.scss */ #navigation li.subTab:not(.navigation-active-li) { - border-left: 5px solid #fdfdfd !important; + border-left: 5px solid #fdfdfd; } -/* line 274, ../sass/app.scss */ -#navigation li:hover { - font-weight: bold; +/* line 277, ../sass/app.scss */ +#navigation li.subTab:not(.navigation-active-li):hover { + border-left: 5px solid #e2e2e2; } -/* line 278, ../sass/app.scss */ +/* line 281, ../sass/app.scss */ +#navigation a:hover { + background: #e2e2e2 !important; +} + +/* line 285, ../sass/app.scss */ #navigation .navigation-active-li { border-left: 5px solid #555 !important; } /* top menu css */ -/* line 285, ../sass/app.scss */ +/* line 293, ../sass/app.scss */ #menutop_container { margin: 0px 171px; color: #FFFFFF; @@ -6289,14 +6298,14 @@ div.button-bar { font-weight: bold; } -/* line 291, ../sass/app.scss */ +/* line 299, ../sass/app.scss */ #menutop_navbar { float: left; height: 25px; font-size: 13px; } -/* line 296, ../sass/app.scss */ +/* line 304, ../sass/app.scss */ #menutop_navbar ul { float: left; height: 25px; @@ -6305,12 +6314,12 @@ div.button-bar { padding-left: 1px; } -/* line 303, ../sass/app.scss */ +/* line 311, ../sass/app.scss */ #menutop_navbar ul { background-color: #4d4d4d; } -/* line 306, ../sass/app.scss */ +/* line 314, ../sass/app.scss */ #menutop_navbar ul li { float: left; min-width: 72px; @@ -6327,255 +6336,255 @@ div.button-bar { color: white; } -/* line 322, ../sass/app.scss */ +/* line 330, ../sass/app.scss */ #menutop_navbar ul li:hover { background-color: #ffffff; } /* end top menu css */ -/* line 333, ../sass/app.scss */ +/* line 341, ../sass/app.scss */ .ui-layout-pane { border: none; } -/* line 338, ../sass/app.scss */ +/* line 346, ../sass/app.scss */ .button.small { font-size: 12px; box-shadow: none; height: 28px; } -/* line 344, ../sass/app.scss */ +/* line 352, ../sass/app.scss */ .button { box-shadow: none; } -/* line 348, ../sass/app.scss */ +/* line 356, ../sass/app.scss */ .button.tiny { box-shadow: none; } -/* line 352, ../sass/app.scss */ +/* line 360, ../sass/app.scss */ .panel { padding: 0px; background: #f2f2f2; } -/* line 357, ../sass/app.scss */ +/* line 365, ../sass/app.scss */ .tabs.vertical li a { padding: 15px 11px; } -/* line 361, ../sass/app.scss */ +/* line 369, ../sass/app.scss */ input[type="text"] { height: 28px !important; } -/* line 365, ../sass/app.scss */ +/* line 373, ../sass/app.scss */ .right { float: right !important; } -/* line 369, ../sass/app.scss */ +/* line 377, ../sass/app.scss */ .ui-layout-pane { background: #fdfdfd; } -/* line 376, ../sass/app.scss */ +/* line 384, ../sass/app.scss */ tr.odd:hover td { background-color: #2ba6cb !important; cursor: pointer; color: #FFF !important; } -/* line 382, ../sass/app.scss */ +/* line 390, ../sass/app.scss */ tr.even:hover td { background-color: #2ba6cb !important; cursor: pointer; color: #FFF !important; } -/* line 388, ../sass/app.scss */ +/* line 396, ../sass/app.scss */ tr { border-bottom: 1px solid #e6e6e6; } -/* line 394, ../sass/app.scss */ +/* line 402, ../sass/app.scss */ table thead tr th, table tfoot tr td { padding: 5px 10px 5px; line-height: 16px; } -/* line 399, ../sass/app.scss */ +/* line 407, ../sass/app.scss */ table { border-collapse: collapse; border-spacing: 0; } /* Growl */ -/* line 405, ../sass/app.scss */ +/* line 413, ../sass/app.scss */ .jGrowl-notification h1 { font-size: 1.2em; } -/* line 409, ../sass/app.scss */ +/* line 417, ../sass/app.scss */ .jGrowl-notification, .jGrowl-notify-submit { border: 2px #444444 solid; background-color: #f3f3f3 !important; color: #666666; } -/* line 415, ../sass/app.scss */ +/* line 423, ../sass/app.scss */ .jGrowl-notify-error { border: 2px #660000 solid; background-color: #f39999 !important; color: #660000; } -/* line 421, ../sass/app.scss */ +/* line 429, ../sass/app.scss */ .jGrowl-notify-error table td.key_error { text-transform: capitalize; width: 100%; font-weight: bold; } -/* line 427, ../sass/app.scss */ +/* line 435, ../sass/app.scss */ .jGrowl-notify-error table td.key_error:after { content: ":"; } -/* line 434, ../sass/app.scss */ +/* line 442, ../sass/app.scss */ .markrow { background-color: #cdebf5 !important; } -/* line 435, ../sass/app.scss */ +/* line 443, ../sass/app.scss */ .markrowselected { background-color: #2ba6cb !important; color: #FFF; } -/* line 436, ../sass/app.scss */ +/* line 444, ../sass/app.scss */ .markrowchecked { background-color: #cdebf5; } -/* line 439, ../sass/app.scss */ +/* line 447, ../sass/app.scss */ .hidden { display: none; } -/* line 448, ../sass/app.scss */ +/* line 456, ../sass/app.scss */ #navigation li.topTab span.plusIcon, #navigation li.subTab span.plusIcon { display: none; float: right; } -/* line 453, ../sass/app.scss */ +/* line 461, ../sass/app.scss */ span.plusIcon { color: #d0d0d0; } -/* line 457, ../sass/app.scss */ +/* line 465, ../sass/app.scss */ span.plusIcon:hover { color: #555; } -/* line 464, ../sass/app.scss */ +/* line 472, ../sass/app.scss */ table.extended_table tbody tr td { padding: 3px 10px; } -/* line 471, ../sass/app.scss */ +/* line 479, ../sass/app.scss */ .reveal-modal { top: 50px; } -/* line 476, ../sass/app.scss */ +/* line 484, ../sass/app.scss */ .ui-layout-resizer-open-hover, .ui-layout-resizer-dragging { background: #EEE; } -/* line 481, ../sass/app.scss */ +/* line 489, ../sass/app.scss */ .reveal-modal .panel { margin-left: -30px; margin-right: -30px; margin-bottom: 15px; } -/* line 487, ../sass/app.scss */ +/* line 495, ../sass/app.scss */ .reveal-modal.xlarge { padding-top: 0px; width: 80%; margin-left: -40%; } -/* line 493, ../sass/app.scss */ +/* line 501, ../sass/app.scss */ .reveal-modal { padding-top: 0px; } -/* line 497, ../sass/app.scss */ +/* line 505, ../sass/app.scss */ .reveal-modal h3 { margin-left: 30px; margin-bottom: 7px !important; } -/* line 502, ../sass/app.scss */ +/* line 510, ../sass/app.scss */ .reveal-modal .close-reveal-modal:not(.button) { top: 13px; } -/* line 506, ../sass/app.scss */ +/* line 514, ../sass/app.scss */ .reveal-modal .close-reveal-modal:not(.button):hover { color: #222; } -/* line 510, ../sass/app.scss */ +/* line 518, ../sass/app.scss */ fieldset { margin: 0px 10px; } -/* line 516, ../sass/app.scss */ +/* line 524, ../sass/app.scss */ .graph_table table { border: 0px; margin: 0px; } -/* line 521, ../sass/app.scss */ +/* line 529, ../sass/app.scss */ .graph_table table tr { border: 0px; } -/* line 526, ../sass/app.scss */ +/* line 534, ../sass/app.scss */ .ui-layout-pane { padding: 0px; overflow: overlay; } -/* line 531, ../sass/app.scss */ +/* line 539, ../sass/app.scss */ .reveal-modal .columns { padding: 0 8px; } -/* line 535, ../sass/app.scss */ +/* line 543, ../sass/app.scss */ select { width: auto; } -/* line 540, ../sass/app.scss */ +/* line 548, ../sass/app.scss */ form.creation { padding: 5px; } -/* line 544, ../sass/app.scss */ +/* line 552, ../sass/app.scss */ #dialog input { margin: 0px; } -/* line 549, ../sass/app.scss */ +/* line 557, ../sass/app.scss */ .progress-container { position: relative; width: 100%; @@ -6583,7 +6592,7 @@ form.creation { background: #FFF; } -/* line 556, ../sass/app.scss */ +/* line 564, ../sass/app.scss */ .progress { position: absolute; width: 100%; @@ -6591,7 +6600,7 @@ form.creation { background: #FFF; } -/* line 563, ../sass/app.scss */ +/* line 571, ../sass/app.scss */ .progress-text { position: absolute; width: 100%; @@ -6599,53 +6608,53 @@ form.creation { color: #000 !important; } -/* line 570, ../sass/app.scss */ +/* line 578, ../sass/app.scss */ .meter { background: #cdebf5 !important; } -/* line 574, ../sass/app.scss */ +/* line 582, ../sass/app.scss */ .dashboard .subheader { text-align: center; } -/* line 578, ../sass/app.scss */ +/* line 586, ../sass/app.scss */ .dashboard h2.subheader { margin-bottom: 0; margin-top: 0; } -/* line 583, ../sass/app.scss */ +/* line 591, ../sass/app.scss */ .dashboard h6.subheader { margin-top: 0; } -/* line 587, ../sass/app.scss */ +/* line 595, ../sass/app.scss */ .dashboard h3.subheader { margin-top: 0; } -/* line 591, ../sass/app.scss */ +/* line 599, ../sass/app.scss */ ul.button-group { margin-bottom: 0; } -/* line 595, ../sass/app.scss */ +/* line 603, ../sass/app.scss */ .value_td { text-overflow: ellipsis; } -/* line 599, ../sass/app.scss */ +/* line 607, ../sass/app.scss */ small { color: #b6b6b6 !important; } -/* line 603, ../sass/app.scss */ +/* line 611, ../sass/app.scss */ .header-dashboard { margin-top: -5px; } -/* line 607, ../sass/app.scss */ +/* line 615, ../sass/app.scss */ .span-dashboard { background: #fcfcfc; color: #6f6f6f; @@ -6653,43 +6662,43 @@ small { box-shadow: 0 0 2px 0px #6f6f6f; } -/* line 616, ../sass/app.scss */ +/* line 624, ../sass/app.scss */ .button.dropdown.small::after { border-color: #9f9f9f transparent transparent transparent; border-width: 4px; } -/* line 621, ../sass/app.scss */ +/* line 629, ../sass/app.scss */ .footer-opennebula { font-size: 10px; color: #b6b6b6 !important; } -/* line 626, ../sass/app.scss */ +/* line 634, ../sass/app.scss */ a.footer.button { margin: 5px; } -/* line 631, ../sass/app.scss */ +/* line 639, ../sass/app.scss */ .user-login { float: right; } -/* line 635, ../sass/app.scss */ +/* line 643, ../sass/app.scss */ .user-login i.header-icon { color: #6f6f6f; font-weight: 300; font-size: 23px; } -/* line 641, ../sass/app.scss */ +/* line 649, ../sass/app.scss */ .user-login .button { color: #6f6f6f; font-size: 60%; line-height: 0; } -/* line 647, ../sass/app.scss */ +/* line 655, ../sass/app.scss */ .user-login .button.secondary { background: #f2f2f2; border: 0px; @@ -6697,88 +6706,88 @@ a.footer.button { font-weight: 300; } -/* line 655, ../sass/app.scss */ +/* line 663, ../sass/app.scss */ .user-login .button.secondary:hover, .user-login .button.secondary:focus { background-color: #d0d0d0; color: #6f6f6f; } -/* line 660, ../sass/app.scss */ +/* line 668, ../sass/app.scss */ .user-login .button.dropdown.tiny::after { border: solid 5px; border-color: #b6b6b6 transparent transparent transparent; right: 7px; } -/* line 666, ../sass/app.scss */ -.header-resource { - text-align: center; -} - -/* line 670, ../sass/app.scss */ -.header-resource { - float: left; -} - /* line 674, ../sass/app.scss */ -.header { +.header-resource { text-align: center; } /* line 678, ../sass/app.scss */ -.button.dropdown.tiny ul.no-hover.show-dropdown { - top: 34px !important; +.header-resource { + float: left; } /* line 682, ../sass/app.scss */ -.graph_legend { +.header { text-align: center; } /* line 686, ../sass/app.scss */ +.button.dropdown.tiny ul.no-hover.show-dropdown { + top: 34px !important; +} + +/* line 690, ../sass/app.scss */ +.graph_legend { + text-align: center; +} + +/* line 694, ../sass/app.scss */ .graph_legend table { background: inherit; border: 0px; width: 100%; } -/* line 692, ../sass/app.scss */ +/* line 700, ../sass/app.scss */ .graph_legend h3 { margin-top: 0px; } -/* line 696, ../sass/app.scss */ +/* line 704, ../sass/app.scss */ .graph_legend .subheader { margin-bottom: 5px; } -/* line 700, ../sass/app.scss */ +/* line 708, ../sass/app.scss */ .dashboard hr { margin: 0; margin-bottom: 8px; } -/* line 705, ../sass/app.scss */ +/* line 713, ../sass/app.scss */ .graph { margin-bottom: 15px !important; } -/* line 709, ../sass/app.scss */ +/* line 717, ../sass/app.scss */ .dashboard-panel { height: 450px; } -/* line 713, ../sass/app.scss */ +/* line 721, ../sass/app.scss */ .vm_log_error { color: #ff8d81; } -/* line 717, ../sass/app.scss */ +/* line 725, ../sass/app.scss */ .noUiSlider { margin: 10px; } -/* line 721, ../sass/app.scss */ +/* line 729, ../sass/app.scss */ .log-tab { background: #6f6f6f; color: #f2f2f2; @@ -6786,20 +6795,40 @@ a.footer.button { padding: 20px; } -/* line 728, ../sass/app.scss */ +/* line 736, ../sass/app.scss */ .reveal-modal ul.tabs-content { margin: 0 0 0px; } -/* line 732, ../sass/app.scss */ +/* line 740, ../sass/app.scss */ .reveal-body { - max-height: 360px; - overflow-y: auto; + height: 80%; + overflow-y: overlay; overflow-x: hidden; - padding: 5px; + padding: 5px 20px; } -/* line 742, ../sass/app.scss */ +/* line 747, ../sass/app.scss */ +.reveal-footer { + position: absolute; + bottom: 20px; + width: 90%; +} + +/* line 753, ../sass/app.scss */ +.max-height { + max-height: 85%; + position: absolute; + height: 100%; +} + +/* line 759, ../sass/app.scss */ +.ui-layout-content { + overflow-y: overlay; + overflow-x: hidden; +} + +/* line 766, ../sass/app.scss */ div.time-picker { position: absolute; height: 191px; @@ -6812,20 +6841,20 @@ div.time-picker { margin: 0; } -/* line 752, ../sass/app.scss */ +/* line 776, ../sass/app.scss */ div.time-picker-12hours { width: 6em; /* needed for IE */ } -/* line 756, ../sass/app.scss */ +/* line 780, ../sass/app.scss */ div.time-picker ul { list-style-type: none; margin: 0; padding: 0; } -/* line 761, ../sass/app.scss */ +/* line 785, ../sass/app.scss */ div.time-picker li { cursor: pointer; height: 20px; @@ -6833,36 +6862,51 @@ div.time-picker li { padding: 4px 3px; } -/* line 767, ../sass/app.scss */ +/* line 791, ../sass/app.scss */ div.time-picker li.selected { background: #0063CE; color: #fff; } -/* line 773, ../sass/app.scss */ +/* line 797, ../sass/app.scss */ .timepicker { float: left; width: 50px !important; } -/* line 778, ../sass/app.scss */ +/* line 802, ../sass/app.scss */ .jdpicker { float: left; width: 90px !important; } -/* line 783, ../sass/app.scss */ +/* line 807, ../sass/app.scss */ .columns { line-height: 2; } -/* line 787, ../sass/app.scss */ +/* line 811, ../sass/app.scss */ .transparent_table, .transparent_table tr { background: none !important; border: 0px !important; } -/* line 792, ../sass/app.scss */ +/* line 816, ../sass/app.scss */ form { margin: 0 !important; } + +/* line 820, ../sass/app.scss */ +#template_create_tabs { + width: 180px; +} + +/* line 825, ../sass/app.scss */ +.dataTables_scrollHead { + height: 30px; +} + +/* line 829, ../sass/app.scss */ +.dataTables_scrollBody { + margin-top: -3px; +} diff --git a/src/sunstone/public/js/layout.js b/src/sunstone/public/js/layout.js index 3fc6a89edf..d88012b94d 100644 --- a/src/sunstone/public/js/layout.js +++ b/src/sunstone/public/js/layout.js @@ -142,7 +142,7 @@ $(document).ready(function () { applyDefaultStyles: false , center__paneSelector: ".outer-center" , west__paneSelector: ".outer-west" - , west__size: 245 + , west__size: 260 , north__size: 26 , south__size: 26 , spacing_open: 0 // ALL panes @@ -159,7 +159,7 @@ $(document).ready(function () { , west__resizable: false }); - var factor = 0.6; + var factor = 0.5; var dialog_height = Math.floor($(".outer-center").height()*factor); innerLayout = $('div.outer-center').layout({ diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js index d28a4af0c5..96894721d1 100644 --- a/src/sunstone/public/js/plugins/acls-tab.js +++ b/src/sunstone/public/js/plugins/acls-tab.js @@ -72,8 +72,8 @@ var create_acl_tmpl = '+tr("Create ACL")+'\ \ \ -
    \
    \ +\
    \
    \ \ @@ -150,14 +150,17 @@ var create_acl_tmpl =
    \
    \
    \ + \ ×\ -
    '; +\ + '; var acl_actions = { "Acl.create" : { @@ -430,7 +433,7 @@ function setupCreateAclDialog(){ // width: 650, // height: height //}); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); //Default selected options $('#res_subgroup_all',dialog).attr('checked','checked'); diff --git a/src/sunstone/public/js/plugins/clusters-tab.js b/src/sunstone/public/js/plugins/clusters-tab.js index a79ad93996..4116dad15c 100644 --- a/src/sunstone/public/js/plugins/clusters-tab.js +++ b/src/sunstone/public/js/plugins/clusters-tab.js @@ -72,15 +72,14 @@ var datastore_datatable_table_tmpl='\ ' -var create_cluster_tmpl ='
    \ -
    \ +var create_cluster_tmpl ='
    \

    \ '+tr("Create Cluster")+'\ '+tr("Update Cluster")+'\

    \
    \
    \ -
    \ + \
    \
    \
    \ @@ -153,17 +152,17 @@ var create_cluster_tmpl ='
    \
    \ \ \ -
    \ \
    \ + '; +
    \ + ×'; // Common utils for datatatables // Holds the selected items @@ -184,7 +183,7 @@ function setupCreateClusterDialog(){ dialog.html(create_cluster_tmpl); var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); // ------- Create the dialog datatables ------------ dataTable_cluster_hosts = $("#datatable_cluster_hosts", dialog).dataTable({ diff --git a/src/sunstone/public/js/plugins/config-tab.js b/src/sunstone/public/js/plugins/config-tab.js index e5b9c9377d..59455884ab 100644 --- a/src/sunstone/public/js/plugins/config-tab.js +++ b/src/sunstone/public/js/plugins/config-tab.js @@ -21,7 +21,7 @@ var config_tab_content = '+tr("Configuration")+'\ \
    \ -
    \ +
    \
    \
    \
    \ @@ -57,10 +57,13 @@ var config_tab_content =
    \
    \
    \ +
    \ + \ ×'; var config_actions = { @@ -80,7 +83,7 @@ function setupConfigDialog() { var dialog = $config_dialog; dialog.html(config_tab_content); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index fc49ff969d..4361325d04 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -69,14 +69,13 @@ var datastores_tab_content = '\ '; var create_datastore_tmpl = -'
    \ -
    \ +'
    \

    \ '+tr("Create Datastore")+'\

    \
    \ -
    \
    \ + \
    \
    \ \ @@ -265,15 +264,16 @@ var create_datastore_tmpl =
    \
    \
    \ + \ ×\ -
    \ -
    '; + '; var datastore_image_table_tmpl='\ \ @@ -763,7 +763,7 @@ function setupCreateDatastoreDialog(){ var dialog = $create_datastore_dialog; dialog.html(create_datastore_tmpl); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index 9eebdf9109..7c384b15c6 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -265,14 +265,16 @@ var group_quotas_tmpl = '
    \
    \
    \
    \ -
    \ + \ ×\ -'; +\ +
    '; var group_actions = { diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 565d79f128..2de13c46b2 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -76,14 +76,13 @@ var hosts_tab_content = '\ '; var create_host_tmpl = -'
    \ -
    \ +'
    \

    \ '+tr("Create Host")+'\

    \
    \ -
    \
    \ + \
    \
    \ \ @@ -180,14 +179,16 @@ var create_host_tmpl =
    \
    \
    \ + \ ×\ -
    '; +'; var hosts_select=""; var dataTable_hosts; @@ -935,7 +936,7 @@ function setupCreateHostDialog(){ // modal: true, // width: 500 //}); - dialog.addClass("reveal-modal"); + dialog.addClass("reveal-modal max-height"); //$('button',dialog).button(); diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index a1feabf057..cc43bc9252 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -70,10 +70,10 @@ var images_tab_content = '\ '; var create_image_tmpl = -'
    \ -
    \ + '
    \

    '+tr("Create Image")+'

    \
    \ +
    \
    \
    \
    '+tr("Wizard")+'
    \ @@ -81,7 +81,6 @@ var create_image_tmpl =
    \
      \
    • \ -
      \
      \
      \
      \ @@ -254,13 +253,14 @@ var create_image_tmpl =
      \
      \
      \ -
      \ -
      \ + \
    • \
    • \
      \ @@ -270,12 +270,14 @@ var create_image_tmpl = \ \
      \ + \
    • \
    \ ×\ @@ -826,7 +828,7 @@ function setupCreateImageDialog(){ // width: 520, // height: height //}); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); $('.advanced',dialog).hide(); diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 906283fc94..f8d3e6e06c 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -69,9 +69,9 @@ var templates_tab_content = '\ var create_template_tmpl = '
    '+ '

    '+tr("Create VM Template")+'

    '+ '
    '+ + '
    '+ ''+ - '
    '+ - '
    '+ + '
    '+ '
    '+ '
    '+ '
    '+ @@ -81,8 +81,7 @@ var create_template_tmpl = '
    '+ ''+ '
    '+ '
    '+ - '
    '+ - '
    '+ + ''; var update_template_tmpl = @@ -2997,7 +2997,7 @@ function setupCreateTemplateDialog(){ // width: 'auto', // height: height //}); - dialog.addClass("reveal-modal xlarge") + dialog.addClass("reveal-modal xlarge max-height") var tabs = $( "#template_create_tabs", dialog)//.tabs().addClass("ui-tabs-vertical"); @@ -4157,8 +4157,6 @@ $(document).ready(function(){ "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "35px", "aTargets": [0,1] }, - { "sWidth": "150px", "aTargets": [5] }, - { "sWidth": "100px", "aTargets": [2,3] } ] }); diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js index f60d01c634..06a60ec234 100644 --- a/src/sunstone/public/js/plugins/users-tab.js +++ b/src/sunstone/public/js/plugins/users-tab.js @@ -339,14 +339,16 @@ var user_quotas_tmpl = '
    \
    \
    \
    \ -
    \ + \ ×\ -'; +\ +
    '; var user_actions = { diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index f893725272..78aeb7d70f 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -1360,8 +1360,7 @@ function updateVMInfo(request,vm){ var template_tab = { title: tr("Template"), content: - '\ - '+ + '
    '+tr("VM template")+'
    '+ prettyPrintJSON(vm_info.TEMPLATE)+ '
    ' }; @@ -2019,8 +2018,8 @@ function setupAttachDiskDialog(){ '+tr("Attach new disk")+'\ \
    \ -
    \
    \ + \
    \
    \ \ @@ -2033,16 +2032,17 @@ function setupAttachDiskDialog(){
    \
    ' + generate_disk_tab_content("attach_disk", "attach_disk") + - '
    \ + '\ ×\ -
    ') +
    ') - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); setup_disk_tab_content(dialog, "attach_disk", "attach_disk") @@ -2282,8 +2282,8 @@ function setupAttachNicDialog(){ '+tr("Attach new nic")+'\ \
    \ -
    \
    \ + \
    \
    \ \ @@ -2296,16 +2296,17 @@ function setupAttachNicDialog(){
    \
    ' + generate_nic_tab_content("attach_nic", "attach_nic") + - '
    \ + '\ ×\ -
    ') +
    ') - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); setup_nic_tab_content(dialog, "attach_nic", "attach_nic") @@ -2455,6 +2456,7 @@ function setupResizeCapacityDialog(){ '+tr("Resize VM capacity")+'\ \ \ +
    \
    \
    \
    \ @@ -2482,15 +2484,17 @@ function setupResizeCapacityDialog(){
    \
    ' + generate_capacity_tab_content() + - '
    \ + '\ ×\ -
    ') +
    ') - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); setupTips(dialog); $("#template_name_form", dialog).hide(); @@ -2894,9 +2898,11 @@ function setupVNC(){ \ \ \ +
    \ \ '+tr("Canvas not supported.")+'\ \ +
    \ ×\ \ '); @@ -2909,7 +2915,7 @@ function setupVNC(){ // resizable:true, // closeOnEscape: false //}); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); $('#sendCtrlAltDelButton',dialog).click(function(){ rfb.sendCtrlAltDel(); @@ -2991,7 +2997,7 @@ $(document).ready(function(){ }); $('#vms_search').keyup(function(){ - dataTable_templates.fnFilter( $(this).val() ); + dataTable_vMachines.fnFilter( $(this).val() ); }) //addElement([ diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index b53a3d2d1a..625632e40f 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -66,12 +66,12 @@ var vnets_tab_content = '\ '; var create_vn_tmpl = -'
    \ -
    \ +'
    \

    \ '+tr("Create Virtual Network")+'\

    \
    \ +
    \
    \
    '+tr("Wizard")+'
    \
    '+tr("Advanced mode")+'
    \ @@ -79,7 +79,6 @@ var create_vn_tmpl =
      \
    • \
      \ -
      \
      \
      \ \ @@ -317,7 +316,7 @@ var create_vn_tmpl =
      \ \
      \ -
      \ + \
      \
    • \
    • \
      \ -
      \

      '+tr("Write the Virtual Network template here")+'

      \ \ -
      \ + \
      \
    • \
    \ - ×\ -
    '; +
    \ + ×'; var update_vnet_tmpl = '
    \ @@ -972,7 +972,7 @@ function setupCreateVNetDialog() { // width: 475, // height: height //}); - dialog.addClass("reveal-modal large"); + dialog.addClass("reveal-modal large max-height"); //Make the tabs look nice for the creation mode //$('#vn_tabs',dialog).tabs(); diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js index 364daf2c12..79ab8b4d27 100644 --- a/src/sunstone/public/js/sunstone-util.js +++ b/src/sunstone/public/js/sunstone-util.js @@ -1112,7 +1112,7 @@ function setupQuotasDialog(dialog){ // width: 740, // height: height //}); - dialog.addClass("reveal-modal xlarge") + dialog.addClass("reveal-modal xlarge max-height") //$('button',dialog).button(); $('#vm_quota,#datastore_quota,#image_quota,#network_quota',dialog).hide(); diff --git a/src/sunstone/public/sass/app.scss b/src/sunstone/public/sass/app.scss index d9a893949e..4d2d101361 100644 --- a/src/sunstone/public/sass/app.scss +++ b/src/sunstone/public/sass/app.scss @@ -157,7 +157,6 @@ div.button-bar { #logo { font-weight: bold; - margin:10%; margin-top: 15%; margin-bottom: 10%; } @@ -224,7 +223,7 @@ div.button-bar { } #navigation { - margin: 8%;; + margin: 0 8%; box-shadow: 0 0 1px 0px black; } @@ -264,15 +263,23 @@ div.button-bar { } #navigation li:not(subTab) { - border-left: 5px solid #f2f2f2 !important; + border-left: 5px solid #f2f2f2; +} + +#navigation li:not(subTab):hover { + border-left: 5px solid #e2e2e2 ; } #navigation li.subTab:not(.navigation-active-li) { - border-left: 5px solid #fdfdfd !important; + border-left: 5px solid #fdfdfd; } -#navigation li:hover { - font-weight: bold; +#navigation li.subTab:not(.navigation-active-li):hover { + border-left: 5px solid #e2e2e2 ; +} + +#navigation a:hover { + background: #e2e2e2 !important; } #navigation .navigation-active-li { @@ -281,6 +288,7 @@ div.button-bar { + /* top menu css */ #menutop_container{ margin:0px 171px; @@ -730,12 +738,28 @@ a.footer.button { } .reveal-body { - max-height: 360px; - overflow-y: auto; + height:80%; + overflow-y: overlay; overflow-x: hidden; - padding: 5px; + padding: 5px 20px; } +.reveal-footer { + position: absolute; + bottom: 20px; + width: 90%; +} + +.max-height{ + max-height: 85%; + position: absolute; + height: 100%; +} + +.ui-layout-content { + overflow-y: overlay; + overflow-x: hidden; +} // time-picker @@ -791,4 +815,17 @@ div.time-picker li.selected { form { margin: 0 !important; +} + +#template_create_tabs { + //position: fixed; + width: 180px; +} + +.dataTables_scrollHead { + height: 30px; +} + +.dataTables_scrollBody { + margin-top: -3px; } \ No newline at end of file diff --git a/src/sunstone/public/vendor/4.0/jquery_layout/layout-default-latest.css b/src/sunstone/public/vendor/4.0/jquery_layout/layout-default-latest.css index 14e507b51d..ba4df7fffd 100644 --- a/src/sunstone/public/vendor/4.0/jquery_layout/layout-default-latest.css +++ b/src/sunstone/public/vendor/4.0/jquery_layout/layout-default-latest.css @@ -42,7 +42,7 @@ body { .ui-layout-content { padding: 10px; position: relative; /* contain floated or positioned elements */ - overflow: auto; /* add scrolling to content-div */ + overflow: overlay; /* add scrolling to content-div */ } /* diff --git a/src/sunstone/views/index.erb b/src/sunstone/views/index.erb index 51eb7d924c..ccd1eac86c 100644 --- a/src/sunstone/views/index.erb +++ b/src/sunstone/views/index.erb @@ -86,7 +86,9 @@
    \ \ diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 2e9ddf8e77..98059592c0 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -27,7 +27,7 @@ var images_tab_content = '\ \ \ '+tr("TOTAL")+' \ - '+tr("SIZE")+'\ + '+tr("USED")+'\ \ \ diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index c3c0f8560f..d61b859df9 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -2958,11 +2958,13 @@ function vncIcon(vm){ if (graphics && graphics.TYPE.toLowerCase() == "vnc" && $.inArray(state, VNCstates)!=-1){ gr_icon = ''; - gr_icon += '\"'+tr("Open'; + gr_icon += ''; } else { - gr_icon = '\"'+tr("VNC'; + gr_icon = ''; } + + gr_icon += '' return gr_icon; } diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index 6886eb60ee..d60ca2e962 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -27,7 +27,7 @@ var vnets_tab_content = '\ \ \ '+tr("TOTAL")+' \ - '+tr("ADDRESSES")+'\ + '+tr("USED IPs")+'\ \ \ From 7195eb6b0cea1c055a0bbd10ae4d5a36be56a9f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 5 Apr 2013 17:43:44 +0200 Subject: [PATCH 35/40] Rename VM states in sunstone to be similar to those in the CLI --- src/sunstone/public/js/opennebula.js | 46 ++++++++++++++-------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index 42e5d9bc82..9a6da37b2f 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -93,34 +93,34 @@ var OpenNebula = { "BOOT", "RUNNING", "MIGRATE", - "SAVE_STOP", - "SAVE_SUSPEND", - "SAVE_MIGRATE", - "PROLOG_MIGRATE", - "PROLOG_RESUME", - "EPILOG_STOP", + "SAVE", + "SAVE", + "SAVE", + "MIGRATE", + "PROLOG", + "EPILOG", "EPILOG", "SHUTDOWN", - "CANCEL", + "SHUTDOWN", "FAILURE", - "CLEANUP_RESUBMIT", + "CLEANUP", "UNKNOWN", "HOTPLUG", - "SHUTDOWN_POWEROFF", - "BOOT_UNKNOWN", - "BOOT_POWEROFF", - "BOOT_SUSPENDED", - "BOOT_STOPPED", - "CLEANUP_DELETE", - "HOTPLUG_SNAPSHOT", - "HOTPLUG_NIC", - "HOTPLUG_SAVEAS", - "HOTPLUG_SAVEAS_POWEROFF", - "HOTPLUG_SAVEAS_SUSPENDED", - "SHUTDOWN_UNDEPLOY", - "EPILOG_UNDEPLOY", - "PROLOG_UNDEPLOY", - "BOOT_UNDEPLOY"][value]); + "SHUTDOWN", + "BOOT", + "BOOT", + "BOOT", + "BOOT", + "CLEANUP", + "SNAPSHOT", + "HOTPLUG", + "HOTPLUG", + "HOTPLUG", + "HOTPLUG", + "SHUTDOWN", + "EPILOG", + "PROLOG", + "BOOT"][value]); break; case "IMAGE": case "image": From c5ecfd3aa84500e3df48ed375390a72a8f9de960 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 5 Apr 2013 18:12:48 +0200 Subject: [PATCH 36/40] Fix advanced css --- src/sunstone/public/css/app.css | 10 ++++++++++ src/sunstone/public/js/plugins/files-tab.js | 2 +- src/sunstone/public/js/plugins/images-tab.js | 2 +- src/sunstone/public/js/plugins/templates-tab.js | 8 ++++---- src/sunstone/public/sass/app.scss | 7 +++++++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/sunstone/public/css/app.css b/src/sunstone/public/css/app.css index 271bd2bd06..55fd3d7b85 100644 --- a/src/sunstone/public/css/app.css +++ b/src/sunstone/public/css/app.css @@ -6910,3 +6910,13 @@ form { .dataTables_scrollBody { margin-top: -3px; } + +/* line 833, ../sass/app.scss */ +.show_hide { + cursor: pointer; +} + +/* line 837, ../sass/app.scss */ +.show_hide:hover > h4 > small { + color: #6f6f6f !important; +} diff --git a/src/sunstone/public/js/plugins/files-tab.js b/src/sunstone/public/js/plugins/files-tab.js index 8389b22402..ca4758b617 100644 --- a/src/sunstone/public/js/plugins/files-tab.js +++ b/src/sunstone/public/js/plugins/files-tab.js @@ -150,7 +150,7 @@ var create_file_tmpl = \ \
    \ -

    '+tr("Advanced options")+'

    \ +

    '+tr("Advanced options")+'

    \
    \
    \
    \ diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 98059592c0..fee2154e52 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -198,7 +198,7 @@ var create_image_tmpl = \
    \
    \ -

    '+tr("Advanced options")+'

    \ +

    '+tr("Advanced options")+'

    \
    \
    \
    \ diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 9b71f6b2fd..7b7a5c8ff1 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -554,7 +554,7 @@ function generate_capacity_tab_content() { '
    '+ '
    '+ '
    '+ - '

    '+tr("Advanced options")+'

    '+ + '

    '+tr("Advanced options")+'

    '+ '
    '+ '
    '+ '
    '+ @@ -789,7 +789,7 @@ function generate_disk_tab_content(str_disk_tab_id, str_datatable_id){ '
    '+ '
    '+ '
    '+ - '

    '+tr("Advanced options")+'

    '+ + '

    '+tr("Advanced options")+'

    '+ '
    '+ '
    '+ '
    '+ @@ -873,7 +873,7 @@ function generate_disk_tab_content(str_disk_tab_id, str_datatable_id){ '
    '+ '
    '+ '
    '+ - '

    '+tr("Advanced options")+''+ + '

    '+tr("Advanced options")+''+ '

    '+ '
    '+ '
    '+ @@ -1141,7 +1141,7 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){ '
    '+ '
    '+ '
    '+ - '

    '+tr("Advanced options")+'

    '+ + '

    '+tr("Advanced options")+'

    '+ '
    '+ '
    '+ '
    '+ diff --git a/src/sunstone/public/sass/app.scss b/src/sunstone/public/sass/app.scss index a341cc9c4c..6e5081acb9 100644 --- a/src/sunstone/public/sass/app.scss +++ b/src/sunstone/public/sass/app.scss @@ -830,3 +830,10 @@ form { margin-top: -3px; } +.show_hide { + cursor: pointer; +} + +.show_hide:hover > h4 > small { + color: #6f6f6f !important; +} From 171eba7aaf71f64dbdfe7f101e323abb7111aba4 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 5 Apr 2013 18:59:46 +0200 Subject: [PATCH 37/40] Remove clone and persistence in files tab --- src/sunstone/public/js/plugins/files-tab.js | 136 -------------------- 1 file changed, 136 deletions(-) diff --git a/src/sunstone/public/js/plugins/files-tab.js b/src/sunstone/public/js/plugins/files-tab.js index ca4758b617..9807a2c693 100644 --- a/src/sunstone/public/js/plugins/files-tab.js +++ b/src/sunstone/public/js/plugins/files-tab.js @@ -319,16 +319,6 @@ var file_actions = { error: onError, notify: true }, - "File.clone_dialog" : { - type: "custom", - call: popUpFileCloneDialog - }, - "File.clone" : { - type: "single", - call: OpenNebula.Image.clone, - error: onError, - notify: true - }, "File.help" : { type: "custom", call: function() { @@ -386,11 +376,6 @@ var file_buttons = { layout: "more_select", text: tr("Disable") }, - "File.clone_dialog" : { - type: "action", - layout: "main", - text: tr("Clone") - }, "File.delete" : { type: "confirm", layout: "del", @@ -546,14 +531,6 @@ function updateFileInfo(request,img){ '+pretty_time(img_info.REGTIME)+'\ \ \ - \ - '+tr("Persistent")+'\ - '+(parseInt(img_info.PERSISTENT) ? tr("yes") : tr("no"))+'\ -
    \ - \ -
    \ - \ - \ \ '+tr("Filesystem type")+'\ '+(typeof img_info.FSTYPE === "string" ? img_info.FSTYPE : "--")+'\ @@ -633,26 +610,6 @@ function updateFileInfo(request,img){ Sunstone.runAction("File.showinfo", img_info.ID); }); - // Listener for edit link for persistency change - $("#div_edit_persistency").live("click", function() { - var value_str = $(".value_td_persistency").text(); - $(".value_td_persistency").html( - ''); - $('option[value="'+value_str+'"]').replaceWith(''); - }); - - $("#persistency_select").live("change", function() { - var new_value=$("option:selected", this).text(); - - if (new_value=="yes") - Sunstone.runAction("File.persistent",[img_info.ID]); - else - Sunstone.runAction("File.nonpersistent",[img_info.ID]); - - }); Sunstone.updateInfoPanelTab("file_info_panel","file_info_tab",info_tab); Sunstone.popUpInfoPanel("file_info_panel"); @@ -946,98 +903,6 @@ function is_persistent_file(id){ return $(data).is(':checked'); }; -function setupFileCloneDialog(){ - //Append to DOM - dialogs_context.append('
    '); - var dialog = $('#file_clone_dialog',dialogs_context); - - //Put HTML in place - - var html = '
    \ -

    \ - '+tr("Clone File")+'\ -

    \ -
    \ -
    \ -
    \ -
    \ -
    '+tr("Several file are selected, please choose prefix to name the new copies")+':
    \ -
    \ -
    \ -
    \ -
    \ - \ - \ -
    \ -
    \ - \ -
    \ -
    \ -
    \ -
    \ - \ - \ -
    \ -×\ -
    \ -'; - - dialog.html(html); - - //Convert into jQuery - //dialog.dialog({ - // autoOpen:false, - // width:375, - // modal:true, - // resizable:false - //}); - dialog.addClass("reveal-modal"); - - //$('button',dialog).button(); - - $('form',dialog).submit(function(){ - var name = $('input', this).val(); - var sel_elems = fileElements(); - if (!name || !sel_elems.length) - notifyError('A name or prefix is needed!'); - if (sel_elems.length > 1){ - for (var i=0; i< sel_elems.length; i++) - //If we are cloning several files we - //use the name as prefix - Sunstone.runAction('Image.clone', - sel_elems[i], - name+getFileName(sel_elems[i])); - } else { - Sunstone.runAction('Image.clone',sel_elems[0],name) - }; - dialog.trigger("reveal:close") - setTimeout(function(){ - Sunstone.runAction('Image.refresh'); - }, 1500); - return false; - }); -} - -function popUpFileCloneDialog(){ - var dialog = $('#file_clone_dialog'); - var sel_elems = fileElements(); - //show different text depending on how many elements are selected - if (sel_elems.length > 1){ - $('.clone_one',dialog).hide(); - $('.clone_several',dialog).show(); - $('input',dialog).val('Copy of '); - } - else { - $('.clone_one',dialog).show(); - $('.clone_several',dialog).hide(); - $('input',dialog).val('Copy of '+getFileName(sel_elems[0])); - }; - - $(dialog).reveal(); -} - //The DOM is ready at this point $(document).ready(function(){ @@ -1066,7 +931,6 @@ $(document).ready(function(){ setupCreateFileDialog(); setupTips($create_file_dialog); - setupFileCloneDialog(); setFileAutorefresh(); initCheckAllBoxes(dataTable_files); From cc1a9292c100df6457dbb45d2e9295ada525554b Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Sat, 6 Apr 2013 00:34:13 +0200 Subject: [PATCH 38/40] Fix host form creation --- src/sunstone/public/js/plugins/hosts-tab.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 7d4b922267..e2c24ef565 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -178,7 +178,6 @@ var create_host_tmpl =
    \
    \
    \ -
    \ \ ×\ -'; +\ +
    '; var hosts_select=""; var dataTable_hosts; From 5bcb9a80adff5964cd563690c5ca51440645e6fc Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Mon, 8 Apr 2013 11:34:39 +0200 Subject: [PATCH 39/40] Fix acl creation form --- src/sunstone/public/js/plugins/acls-tab.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js index 9b2851a7ee..c18e8f629c 100644 --- a/src/sunstone/public/js/plugins/acls-tab.js +++ b/src/sunstone/public/js/plugins/acls-tab.js @@ -149,7 +149,6 @@ var create_acl_tmpl =
    \
    \ \ - \