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

Feature #3932, #3801: Rename VM shutdown & delete in oneflow

This commit is contained in:
Carlos Martín 2016-05-06 12:37:55 +02:00
parent 20b84754ee
commit 60b03bd2fd
17 changed files with 92 additions and 156 deletions

View File

@ -37,8 +37,8 @@
# Default cooldown period after a scale operation, in seconds
:default_cooldown: 300
# Default shutdown action. Values: 'shutdown', 'shutdown-hard'
:shutdown_action: 'shutdown'
# Default shutdown action. Values: 'terminate', 'terminate-hard'
:shutdown_action: 'terminate'
# Default number of virtual machines (action_number) that will receive the
# given call in each interval defined by action_period, when an action

View File

@ -28,8 +28,8 @@ module OpenNebula
# Actions that can be performed on the VMs of a given Role
SCHEDULE_ACTIONS = [
'shutdown',
'shutdown-hard',
'terminate',
'terminate-hard',
'undeploy',
'undeploy-hard',
'hold',
@ -37,8 +37,6 @@ module OpenNebula
'stop',
'suspend',
'resume',
'delete',
'delete-recreate',
'reboot',
'reboot-hard',
'poweroff',
@ -315,12 +313,12 @@ module OpenNebula
return [true, nil]
end
# Shutdown all the nodes in this role
# Terminate all the nodes in this role
#
# @param scale_down [true, false] true to shutdown and dispose the
# @param scale_down [true, false] true to terminate and dispose the
# number of VMs needed to get down to cardinality nodes
# @return [Array<true, nil>, Array<false, String>] true if all the VMs
# were shutdown, false and the error reason if there was a problem
# were terminated, false and the error reason if there was a problem
# shutting down the VMs
def shutdown(scale_down=false)
success = true
@ -348,10 +346,10 @@ module OpenNebula
Log.debug LOG_COMP, "Role #{name} : Deleting VM #{vm_id}", @service.id()
vm = OpenNebula::VirtualMachine.new_with_id(vm_id, @service.client)
rc = vm.shutdown(true)
rc = vm.terminate(true)
if OpenNebula.is_error?(rc)
rc = vm.finalize
rc = vm.delete
end
if OpenNebula.is_error?(rc)
@ -553,7 +551,7 @@ module OpenNebula
if diff > 0
return deploy(true)
elsif diff < 0
return shutdown(true)
return terminate(true)
end
return [true, nil]
@ -886,7 +884,7 @@ module OpenNebula
elsif ( Role.vm_failure?(vm_state, lcm_state) )
vm = OpenNebula::VirtualMachine.new_with_id(vm_id, @service.client)
rc = vm.finalize
rc = vm.shutdown(true)
if !OpenNebula.is_error?(rc)
# Store the VM id in the array of disposed nodes
@ -933,14 +931,14 @@ module OpenNebula
nodes.each { |node|
vm_id = node['deploy_id']
Log.debug LOG_COMP, "Role #{name} : Shutting down VM #{vm_id}", @service.id()
Log.debug LOG_COMP, "Role #{name} : Terminating VM #{vm_id}", @service.id()
vm = OpenNebula::VirtualMachine.new_with_id(vm_id, @service.client)
if action == 'shutdown-hard'
rc = vm.shutdown(true)
if action == 'terminate-hard'
rc = vm.terminate(true)
else
rc = vm.shutdown
rc = vm.terminate
end
if scale_down
@ -948,11 +946,17 @@ module OpenNebula
end
if OpenNebula.is_error?(rc)
msg = "Role #{name} : Shutdown failed for VM #{vm_id}, will perform a Delete; #{rc.message}"
msg = "Role #{name} : Terminate failed for VM #{vm_id}, will perform a Delete; #{rc.message}"
Log.error LOG_COMP, msg, @service.id()
@service.log_error(msg)
rc = vm.finalize
if action != 'terminate-hard'
rc = vm.terminate(true)
end
if OpenNebula.is_error?(rc)
rc = vm.delete
end
if OpenNebula.is_error?(rc)
msg = "Role #{name} : Delete failed for VM #{vm_id}; #{rc.message}"
@ -965,7 +969,7 @@ module OpenNebula
Log.debug LOG_COMP, "Role #{name} : Delete success for VM #{vm_id}", @service.id()
end
else
Log.debug LOG_COMP, "Role #{name} : Shutdown success for VM #{vm_id}", @service.id()
Log.debug LOG_COMP, "Role #{name} : Terminate success for VM #{vm_id}", @service.id()
end
}
end

View File

@ -48,7 +48,7 @@ module OpenNebula
},
'shutdown_action' => {
:type => :string,
:enum => %w{shutdown shutdown-hard},
:enum => %w{terminate terminate-hard shutdown shutdown-hard},
:required => false
},
'min_vms' => {
@ -158,7 +158,7 @@ module OpenNebula
},
'shutdown_action' => {
:type => :string,
:enum => %w{shutdown shutdown-hard},
:enum => %w{terminate terminate-hard shutdown shutdown-hard},
:required => false
},
'roles' => {

View File

@ -65,7 +65,7 @@ end
conf[:debug_level] ||= 2
conf[:lcm_interval] ||= 30
conf[:default_cooldown] ||= 300
conf[:shutdown_action] ||= 'shutdown'
conf[:shutdown_action] ||= 'terminate'
conf[:action_number] ||= 1
conf[:action_period] ||= 60

View File

@ -22,8 +22,8 @@ include CloudCLI
module Role
# Actions that can be performed on the VMs of a given Role
SCHEDULE_ACTIONS = [
'shutdown',
'shutdown-hard',
'terminate',
'terminate-hard',
'undeploy',
'undeploy-hard',
'hold',
@ -31,8 +31,6 @@ module Role
'stop',
'suspend',
'resume',
'delete',
'delete-recreate',
'reboot',
'reboot-hard',
'poweroff',
@ -114,7 +112,7 @@ module Service
end
# Build a json specifying an action
# @param [String] perform action to be performed (i.e: shutdowm)
# @param [String] perform action to be performed (e.g.: shutdown)
# @param [Hash, nil] params contains the params for the action
# @return [String] json representing the action
def self.build_json_action(perform, params=nil)

View File

@ -293,10 +293,8 @@ tabs:
Role.poweroff_hard: true
Role.undeploy: true
Role.undeploy_hard: true
Role.shutdown: true
Role.shutdown_hard: true
Role.delete: true
Role.delete_recreate: true
Role.terminate: true
Role.terminate_hard: true
RoleVM.hold: true
RoleVM.release: true
RoleVM.suspend: true
@ -308,10 +306,8 @@ tabs:
RoleVM.poweroff_hard: true
RoleVM.undeploy: true
RoleVM.undeploy_hard: true
RoleVM.shutdown: true
RoleVM.shutdown_hard: true
RoleVM.delete: true
RoleVM.delete_recreate: true
RoleVM.terminate: true
RoleVM.terminate_hard: true
RoleVM.resched: true
RoleVM.unresched: true
RoleVM.recover: true

View File

@ -293,10 +293,8 @@ tabs:
Role.poweroff_hard: true
Role.undeploy: true
Role.undeploy_hard: true
Role.shutdown: true
Role.shutdown_hard: true
Role.delete: true
Role.delete_recreate: true
Role.terminate: true
Role.terminate_hard: true
RoleVM.hold: true
RoleVM.release: true
RoleVM.suspend: true
@ -308,10 +306,8 @@ tabs:
RoleVM.poweroff_hard: true
RoleVM.undeploy: true
RoleVM.undeploy_hard: true
RoleVM.shutdown: true
RoleVM.shutdown_hard: true
RoleVM.delete: true
RoleVM.delete_recreate: true
RoleVM.terminate: true
RoleVM.terminate_hard: true
RoleVM.resched: true
RoleVM.unresched: true
RoleVM.recover: true

View File

@ -292,10 +292,8 @@ tabs:
Role.poweroff_hard: true
Role.undeploy: true
Role.undeploy_hard: true
Role.shutdown: true
Role.shutdown_hard: true
Role.delete: true
Role.delete_recreate: false
Role.terminate: true
Role.terminate_hard: true
RoleVM.hold: true
RoleVM.release: true
RoleVM.suspend: false
@ -307,10 +305,8 @@ tabs:
RoleVM.poweroff_hard: true
RoleVM.undeploy: true
RoleVM.undeploy_hard: true
RoleVM.shutdown: true
RoleVM.shutdown_hard: true
RoleVM.delete: true
RoleVM.delete_recreate: false
RoleVM.terminate: true
RoleVM.terminate_hard: true
RoleVM.resched: false
RoleVM.unresched: false
RoleVM.recover: false

View File

@ -294,10 +294,8 @@ tabs:
Role.poweroff_hard: true
Role.undeploy: true
Role.undeploy_hard: true
Role.shutdown: true
Role.shutdown_hard: true
Role.delete: true
Role.delete_recreate: false
Role.terminate: true
Role.terminate_hard: true
RoleVM.hold: true
RoleVM.release: true
RoleVM.suspend: false
@ -309,10 +307,8 @@ tabs:
RoleVM.poweroff_hard: true
RoleVM.undeploy: true
RoleVM.undeploy_hard: true
RoleVM.shutdown: true
RoleVM.shutdown_hard: true
RoleVM.delete: true
RoleVM.delete_recreate: false
RoleVM.terminate: true
RoleVM.terminate_hard: true
RoleVM.resched: false
RoleVM.unresched: false
RoleVM.recover: false

View File

@ -296,10 +296,8 @@ tabs:
Role.poweroff_hard: true
Role.undeploy: true
Role.undeploy_hard: true
Role.shutdown: true
Role.shutdown_hard: true
Role.delete: true
Role.delete_recreate: true
Role.terminate: true
Role.terminate_hard: true
RoleVM.hold: true
RoleVM.release: true
RoleVM.suspend: true
@ -311,10 +309,8 @@ tabs:
RoleVM.poweroff_hard: true
RoleVM.undeploy: true
RoleVM.undeploy_hard: true
RoleVM.shutdown: true
RoleVM.shutdown_hard: true
RoleVM.delete: true
RoleVM.delete_recreate: true
RoleVM.terminate: true
RoleVM.terminate_hard: true
RoleVM.resched: false
RoleVM.unresched: false
RoleVM.recover: false

View File

@ -97,13 +97,6 @@ define(function(require) {
generate_batch_action_params(),
PATH);
},
"delete_recreate" : function(params) {
OpenNebulaAction.simple_action(params,
RESOURCE,
"delete-recreate",
generate_batch_action_params(),
PATH);
},
"reboot" : function(params) {
OpenNebulaAction.simple_action(params,
RESOURCE,
@ -153,24 +146,17 @@ define(function(require) {
generate_batch_action_params(),
PATH);
},
"shutdown" : function(params) {
"terminate" : function(params) {
OpenNebulaAction.simple_action(params,
RESOURCE,
"shutdown",
"terminate",
generate_batch_action_params(),
PATH);
},
"shutdown_hard" : function(params) {
"terminate_hard" : function(params) {
OpenNebulaAction.simple_action(params,
RESOURCE,
"shutdown-hard",
generate_batch_action_params(),
PATH);
},
"del" : function(params) {
OpenNebulaAction.simple_action(params,
RESOURCE,
"delete",
"terminate-hard",
generate_batch_action_params(),
PATH);
},

View File

@ -157,24 +157,6 @@ define(function(require) {
notify: true
},
"Role.reboot_hard" : {
type: "multiple",
call: OpenNebulaRole.reboot_hard,
callback: roleCallback,
elements: roleElements,
error: Notifier.onError,
notify: true
},
"Role.delete_recreate" : {
type: "multiple",
call: OpenNebulaRole.delete_recreate,
callback: roleCallback,
elements: roleElements,
error: Notifier.onError,
notify: true
},
"Role.reboot" : {
type: "multiple",
call: OpenNebulaRole.reboot,
@ -184,6 +166,15 @@ define(function(require) {
notify: true
},
"Role.reboot_hard" : {
type: "multiple",
call: OpenNebulaRole.reboot_hard,
callback: roleCallback,
elements: roleElements,
error: Notifier.onError,
notify: true
},
"Role.poweroff" : {
type: "multiple",
call: OpenNebulaRole.poweroff,
@ -228,18 +219,18 @@ define(function(require) {
notify: true
},
"Role.shutdown" : {
"Role.terminate" : {
type: "multiple",
call: OpenNebulaRole.shutdown,
call: OpenNebulaRole.terminate,
callback: roleCallback,
elements: roleElements,
error: Notifier.onError,
notify: true
},
"Role.shutdown_hard" : {
"Role.terminate_hard" : {
type: "multiple",
call: OpenNebulaRole.shutdown_hard,
call: OpenNebulaRole.terminate_hard,
callback: roleCallback,
elements: roleElements,
error: Notifier.onError,
@ -401,27 +392,18 @@ define(function(require) {
notify: true
},
"RoleVM.shutdown" : {
"RoleVM.terminate" : {
type: "multiple",
call: OpenNebulaVM.shutdown,
call: OpenNebulaVM.terminate,
callback: roleCallback,
elements: roleVMElements,
error: Notifier.onError,
notify: true
},
"RoleVM.shutdown_hard" : {
"RoleVM.terminate_hard" : {
type: "multiple",
call: OpenNebulaVM.shutdown_hard,
callback: roleCallback,
elements: roleVMElements,
error: Notifier.onError,
notify: true
},
"RoleVM.delete" : {
type: "multiple",
call: OpenNebulaVM.del,
call: OpenNebulaVM.terminate_hard,
callback: roleCallback,
elements: roleVMElements,
error: Notifier.onError,

View File

@ -18,24 +18,24 @@
<div class="row">
{{#if servicePanel}}
<div id="role_actions">
<div class="columns large-4 medium-6 right">
<div class="action_blocks columns medium-8">
</div>
<div class="columns medium-4 right">
<div class="row">
<div class="small-6 columns">
<div class="small-6 medium-6 columns">
<label for="batch_action_period">{{tr "Period"}}:
<span class="tip">{{tr "Seconds between each group of actions"}}</span>
</label>
<input type="text" id="batch_action_period" name="batch_action_period"/>
<input type="number" min="0" id="batch_action_period" name="batch_action_period"/>
</div>
<div class="small-6 columns">
<div class="small-6 medium-6 columns">
<label for="batch_action_number">{{tr "Number"}}:
<span class="tip">{{tr "Number of VMs to apply the action to each period"}}</span>
</label>
<input type="text" id="batch_action_number" name="batch_action_number"/>
<input type="number" min="1" id="batch_action_number" name="batch_action_number"/>
</div>
</div>
</div>
<div class="action_blocks columns large-12">
</div>
</div>
{{/if}}
<div id="roles_info" class="columns large-12">

View File

@ -89,29 +89,17 @@ define(function(require) {
layout: "vmsstop_buttons",
tip: Locale.tr("Shuts down the given VM. The VM is saved in the system Datastore.")
},
"Role.shutdown" : {
"Role.terminate" : {
type: "action",
text: Locale.tr("Shutdown"),
text: Locale.tr("Terminate"),
layout: "vmsdelete_buttons",
tip: Locale.tr("This will initiate the shutdown process in the selected VMs")
tip: Locale.tr("This will initiate the terminate process in the selected VMs")
},
"Role.shutdown_hard" : {
"Role.terminate_hard" : {
type: "action",
text: Locale.tr("Shutdown") + ' <span class="label secondary radius">hard</span>',
text: Locale.tr("Terminate") + ' <span class="label secondary radius">hard</span>',
layout: "vmsdelete_buttons",
tip: Locale.tr("This will initiate the shutdown-hard (forced) process in the selected VMs")
},
"Role.delete" : {
type: "action",
text: Locale.tr("Delete"),
layout: "vmsdelete_buttons",
tip: Locale.tr("This will delete the selected VMs from the database")
},
"Role.delete_recreate" : {
type: "action",
text: Locale.tr("Delete") + ' <span class="label secondary radius">recreate</span>',
layout: "vmsrepeat_buttons",
tip: Locale.tr("This will delete and recreate VMs to PENDING state")
tip: Locale.tr("This will initiate the terminate-hard (forced) process in the selected VMs")
}
};

View File

@ -30,10 +30,8 @@ define(function(require) {
"RoleVM.poweroff_hard" : VMButtons["VM.poweroff_hard"],
"RoleVM.undeploy" : VMButtons["VM.undeploy"],
"RoleVM.undeploy_hard" : VMButtons["VM.undeploy_hard"],
"RoleVM.shutdown" : VMButtons["VM.shutdown"],
"RoleVM.shutdown_hard" : VMButtons["VM.shutdown_hard"],
"RoleVM.delete" : VMButtons["VM.delete"],
"RoleVM.delete_recreate" : VMButtons["VM.delete_recreate"],
"RoleVM.terminate" : VMButtons["VM.terminate"],
"RoleVM.terminate_hard" : VMButtons["VM.terminate_hard"],
"RoleVM.resched" : VMButtons["VM.resched"],
"RoleVM.unresched" : VMButtons["VM.unresched"]
};

View File

@ -78,12 +78,12 @@
<div class="service_template_param st_man medium-6 columns">
<label for="shutdown_action_service">
{{tr "Shutdown action"}}
<span class="tip">{{tr "VM shutdown action: 'shutdown' or 'shutdown-hard'."}}</span>
<span class="tip">{{tr "VM shutdown action: 'terminate' or 'terminate-hard'."}}</span>
</label>
<select name="shutdown_action_service">
<option value=""></option>
<option value="shutdown">{{tr "Shutdown"}}</option>
<option value="shutdown-hard">{{tr "Shutdown hard"}}</option>
<option value="terminate">{{tr "Terminate"}}</option>
<option value="terminate-hard">{{tr "Terminate hard"}}</option>
</select>
</div>
</div>

View File

@ -198,12 +198,12 @@
<div class="row">
<div class="service_template_param service_role medium-6 columns">
<label for="shutdown_action_role">{{tr "Shutdown action"}}
<span class="tip">{{tr "VM shutdown action: 'shutdown' or 'shutdown-hard'. If it is not set, the one set for the Service will be used"}}</span>
<span class="tip">{{tr "VM shutdown action: 'terminate' or 'terminate-hard'. If it is not set, the one set for the Service will be used"}}</span>
</label>
<select name="shutdown_action_role">
<option value=""></option>
<option value="shutdown">{{tr "Shutdown"}}</option>
<option value="shutdown-hard">{{tr "Shutdown hard"}}</option>
<option value="terminate">{{tr "Terminate"}}</option>
<option value="terminate-hard">{{tr "Terminate hard"}}</option>
</select>
</div>
<div class="medium-6 columns">