diff --git a/src/cloud/occi/bin/occi-server b/src/cloud/occi/bin/occi-server index 9527799c69..8cf99039a6 100755 --- a/src/cloud/occi/bin/occi-server +++ b/src/cloud/occi/bin/occi-server @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh # -------------------------------------------------------------------------- # # Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs # @@ -100,9 +100,12 @@ stop() exit 1 fi - # Kill the occi-server daemon + PID=`cat $OCCI_PID` + # Kill the occi-server daemon. Thin seems to require this twice - kill -INT `cat $OCCI_PID` > /dev/null 2>&1 + kill -INT $PID > /dev/null 2>&1 + sleep 1 + kill -INT $PID > /dev/null 2>&1 # Remove pid files rm -f $OCCI_PID > /dev/null 2>&1 diff --git a/src/cloud/occi/lib/OCCIServer.rb b/src/cloud/occi/lib/OCCIServer.rb index 8b5ffd30aa..1e7c3d8258 100644 --- a/src/cloud/occi/lib/OCCIServer.rb +++ b/src/cloud/occi/lib/OCCIServer.rb @@ -645,76 +645,4 @@ class OCCIServer < CloudServer return to_occi_xml(user, :code=>200) end - - ############################################################################ - # VNC Methods - ############################################################################ - - def startvnc(id,vnc) - vm = VirtualMachineOCCI.new(VirtualMachine.build_xml(id), @client) - rc = vm.info - - if OpenNebula.is_error?(rc) - error = "Error starting VNC session, " - error << "could not retrieve Virtual Machine" - return [404, error] - end - - return vnc.proxy(vm) - end - - ########################################################################## - # Accounting - ########################################################################## - - def get_user_accounting(options) - tstart = options[:start].to_i - tend = options[:end].to_i - interval = options[:interval].to_i - meters = options[:monitor_resources] - - acct_options = {:start_time => tstart, - :end_time => tend} - info_flag = Pool::INFO_ALL - - result = {} - meters_a = meters.split(',') - meters_a.each do | meter | - result[meter] = [] - end - - pool = VirtualMachinePool.new(@client) - acct_xml = pool.accounting_xml(info_flag, acct_options) - - if OpenNebula.is_error?(acct_xml) - error = Error.new(acct_xml.message) - return [500, error.to_json] - end - - xml = XMLElement.new - xml.initialize_xml(acct_xml, 'HISTORY_RECORDS') - - while tstart < tend - - tstep = tstart + interval - count = Hash.new - - xml.each("HISTORY[STIME<=#{tstep} and ETIME=0 or STIME<=#{tstep} and ETIME>=#{tstart}]") do |hr| - - meters_a.each do | meter | - count[meter] ||= 0 - count[meter] += hr["VM/#{meter}"].to_i if hr["VM/#{meter}"] - end - end - - count.each do | mname, mcount | - result[mname] << [tstart, mcount] - end - - tstart = tstep - end - - return [200, {:monitoring => result}.to_json] - end - end