mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-03 13:47:01 +03:00
parent
c53b1018b9
commit
d00b00a072
@ -1454,6 +1454,15 @@ class VirtualMachine < VCenterDriver::Template
|
||||
# get token and context
|
||||
extraconfig += extraconfig_context
|
||||
|
||||
# get file_ds
|
||||
if (files = one_item["TEMPLATE/CONTEXT/FILES_DS"])
|
||||
file_id = 0
|
||||
files.split(' ').each do |file|
|
||||
extraconfig += extraconfig_file(file, file_id)
|
||||
file_id += 1
|
||||
end
|
||||
end
|
||||
|
||||
# vnc configuration (for config_array hash)
|
||||
extraconfig += extraconfig_vnc
|
||||
|
||||
@ -1478,6 +1487,18 @@ class VirtualMachine < VCenterDriver::Template
|
||||
@item.ReconfigVM_Task(:spec => spec).wait_for_completion
|
||||
end
|
||||
|
||||
def extraconfig_file(file, id)
|
||||
path, name = file.split(':')
|
||||
name = name.gsub('\'', '')
|
||||
file_content = Base64.encode64(File.read(path))
|
||||
file_content.prepend("#{name}\n")
|
||||
|
||||
[
|
||||
{ :key => "guestinfo.opennebula.file.#{id}",
|
||||
:value => file_content }
|
||||
]
|
||||
end
|
||||
|
||||
def extraconfig_context
|
||||
context_text = "# Context variables generated by OpenNebula\n"
|
||||
one_item.each('TEMPLATE/CONTEXT/*') do |context_element|
|
||||
|
Loading…
x
Reference in New Issue
Block a user