1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

Feature 1684 (#2874)

This commit is contained in:
Daniel Clavijo Coca 2019-02-01 11:10:14 -06:00 committed by Ruben S. Montero
parent 494496bc0c
commit ddc8d6923b
3 changed files with 24 additions and 9 deletions

View File

@ -231,11 +231,17 @@ class Container
return unless @one
@one.get_disks.each do |disk|
if @one.volatile?(disk)
e = "disk #{disk['DISK_ID']} type #{disk['TYPE']} not supported"
OpenNebula.log_error e
next
end
status = setup_disk(disk, operation)
return nil unless status
end
return unless @one.has_context?
return 'no context' unless @one.has_context?
csrc = @lxc['devices']['context']['source'].clone

View File

@ -196,6 +196,8 @@ class OpenNebulaVM
disks = @xml.elements('//TEMPLATE/DISK')
disks.each do |n|
next if volatile?(n)
hash.update(disk(n, nil, nil))
end
@ -305,6 +307,13 @@ class OpenNebulaVM
{ disk_name => disk }
end
# Return true if disk if volatile
def volatile?(disk)
return true if %w[fs swap].include? disk['TYPE']
false
end
#---------------------------------------------------------------------------
# Container Mapping: Extra Configuration & Profiles
#---------------------------------------------------------------------------

View File

@ -29,17 +29,17 @@ vm_name = ARGV[0]
iso_path = ARGV[2]
vm_id = ARGV[3]
xml = STDIN.read
exit 0 if iso_path == ''
# ------------------------------------------------------------------------------
# Setup Context for the container
# ------------------------------------------------------------------------------
if iso_path != ''
client = LXDClient.new
container = Container.get(vm_name, xml, client)
xml = STDIN.read
client = LXDClient.new
container = Container.get(vm_name, xml, client)
raise 'Failed to attach context' unless container.attach_context
raise 'Failed to attach context' unless container.attach_context
rc, _out, err = container.exec('one-contextd local')
OpenNebula.log_error "Failed to run contextualization\n#{err}" unless rc.zero?
end
rc, _out, err = container.exec('service one-context-reconfigure start')
OpenNebula.log_error "Failed to run recontextualization service \n#{err}" unless rc.zero?