mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-15 17:23:10 +09:00
feature #1820: Prevents occi-server from no stop when using thin. Remove unused methods
This commit is contained in:
1 parent
0c0e21d89b
commit
ff641d17b5
2 files changed
+6
-75
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user