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

F #1684: Run mount detection in pre-map stage. Fix api call also for wild containers

This commit is contained in:
Daniel Clavijo Coca 2019-02-22 02:49:56 -06:00 committed by Ruben S. Montero
parent 9107694a3e
commit ef0422030e
2 changed files with 9 additions and 9 deletions

View File

@ -110,6 +110,8 @@ class Mapper
#
# @return true on success
def map(one_vm, disk, directory)
return true if mount_on?(directory)
device = do_map(one_vm, disk, directory)
OpenNebula.log_info "Mapping disk at #{directory} using device #{device}"
@ -287,8 +289,6 @@ class Mapper
def mount_dev(dev, path)
OpenNebula.log_info "Mounting #{dev} at #{path}"
return false if mount_on?(path)
mkdir_safe(path)
rc, _out, err = Command.execute("#{COMMANDS[:mount]} #{dev} #{path}", true)

View File

@ -46,14 +46,14 @@ rescue => exception
OpenNebula.log_error exception
end
# This call may return an operation output instead of a container data
# in case of timeout. The call breaks the container attributes
# it needs to be read again
container = Container.get(vm_name, xml, client) # :status => "Sucess"
# Fixer call
container = Container.get(vm_name, xml, client) unless %w[Running Stopped].include? container.status
if !container.wild?
# This call may return an operation output instead of a container data
# in case of timeout. The call breaks the container attributes
# it needs to be read again
container = Container.get(vm_name, xml, client) # :status => "Sucess"
container = Container.get(vm_name, xml, client) unless %w[Running Stopped].include? container.status
container.stop(:force => true) if container.status == 'Running'
e = 'Failed to dismantle container storage'