mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-25 06:03:36 +03:00
B #3390: Use LXD REST exec on reconfigure. Update odd hash deletion
(cherry picked from commit 03559900ca4a735cf33de84756e9c556d9e97516)
This commit is contained in:
parent
eeee99a7cd
commit
2b73f1a79e
@ -170,13 +170,24 @@ class Container
|
||||
@lxc = @client.get("#{CONTAINERS}/#{name}")['metadata']
|
||||
end
|
||||
|
||||
# Runs command inside container
|
||||
# Runs command inside container using the LXD CLI
|
||||
# @param command [String] to execute through lxc exec
|
||||
def exec(command)
|
||||
cmd = "#{@lxc_command} exec #{@one.vm_name} -- #{command}"
|
||||
Command.execute(cmd, true)
|
||||
end
|
||||
|
||||
# Runs command inside container using REST. Execution isn't managed.
|
||||
# @param full command [String] to execute
|
||||
def exec_rest(command)
|
||||
body = { 'command' => command.split(' '),
|
||||
'wait-for-websocket' => false,
|
||||
'record-output' => false,
|
||||
'interactive' => false }
|
||||
|
||||
@client.post("#{CONTAINERS}/#{name}/exec", body)
|
||||
end
|
||||
|
||||
def show_log
|
||||
cmd = "#{@lxc_command} info --show-log #{@lxc['name']}"
|
||||
rc, o, e = Command.execute(cmd, false)
|
||||
@ -325,7 +336,7 @@ class Container
|
||||
|
||||
csrc = @lxc['devices']['context']['source'].clone
|
||||
|
||||
@lxc['devices'].delete('context')['source']
|
||||
@lxc['devices'].delete('context')
|
||||
|
||||
update
|
||||
|
||||
@ -374,7 +385,7 @@ class Container
|
||||
container devices\n#{@lxc['devices']}"
|
||||
end
|
||||
|
||||
@lxc['devices'].delete(disk_name)['source']
|
||||
@lxc['devices'].delete(disk_name)
|
||||
|
||||
update
|
||||
|
||||
|
@ -40,6 +40,4 @@ container = Container.get(vm_name, xml, client)
|
||||
|
||||
raise 'Failed to attach context' unless container.attach_context
|
||||
|
||||
rc, _out, err = container.exec('service one-context-reconfigure restart')
|
||||
|
||||
OpenNebula.log_error "Failed to run recontextualization service \n#{err}" unless rc.zero?
|
||||
container.exec_rest('service one-context-reconfigure restart')
|
||||
|
Loading…
x
Reference in New Issue
Block a user