mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
parent
6a209118da
commit
374b9f6845
@ -190,6 +190,10 @@ class OpenNebulaVNC
|
||||
|
||||
def proxy(vm_resource)
|
||||
# Check configurations and VM attributes
|
||||
unless is_lockfile?
|
||||
return error(400, "VNC Proxy is not running")
|
||||
end
|
||||
|
||||
if !is_running?
|
||||
return error(400, "VNC Proxy is not running")
|
||||
end
|
||||
@ -344,6 +348,20 @@ class OpenNebulaVNC
|
||||
end
|
||||
alias_method :get_pid, :is_running?
|
||||
|
||||
def is_lockfile?
|
||||
dn = File.dirname(@lock_file)
|
||||
bn = File.basename(@lock_file)
|
||||
|
||||
# Due to restrictions which doesn't allow to stat the lock file
|
||||
# when Sunstone is running under Apache with SELinux enabled,
|
||||
# as a workaround we read content of the whole lock directory.
|
||||
begin
|
||||
Dir.entries(dn).include?(bn)
|
||||
rescue StandardError
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
if RUBY_VERSION<'1.9'
|
||||
def spawn(*args)
|
||||
fork {
|
||||
|
Loading…
x
Reference in New Issue
Block a user