1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-10 00:58:17 +03:00

Feature #2917: Add RUNNING=TRUE to the USER_TEMPLATE if the VM contacts OneGate

This commit is contained in:
Jaime Melis 2014-07-11 00:41:27 +02:00
parent 4d3a5a84fd
commit 2211214a4e

View File

@ -115,7 +115,14 @@ put '/vm/:id' do
halt 404, rc.message
end
rc = vm.update(request.body.read, true)
body = request.body.read
# Sets the RUNNING tag
if vm['USER_TEMPLATE/RUNNING'].nil?
body << "\nRUNNING=TRUE"
end
rc = vm.update(body, true)
if OpenNebula.is_error?(rc)
logger.error {"VMID:#{params[:id]} vm.update error: #{rc.message}"}
@ -139,6 +146,16 @@ get '/vm/:id' do
halt 404, rc.message
end
# Sets the RUNNING tag
if vm['USER_TEMPLATE/RUNNING'].nil?
rc = vm.update("RUNNING=TRUE", true)
if OpenNebula.is_error?(rc)
logger.error {"VMID:#{params[:id]} vm.update error: #{rc.message}"}
halt 500, rc.message
end
end
service_id = vm['USER_TEMPLATE/SERVICE_ID']
if service_id.nil? || !service_id.match(/^\d+$/)