mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-01 05:47:01 +03:00
Merge branch 'feature-417'
This commit is contained in:
commit
dfe4437a79
@ -113,10 +113,11 @@ class CloudServer
|
|||||||
# metadata:: Additional metadata for the file
|
# metadata:: Additional metadata for the file
|
||||||
# [return] _Image_ Newly created image object
|
# [return] _Image_ Newly created image object
|
||||||
def add_image(image, file=nil)
|
def add_image(image, file=nil)
|
||||||
|
template = image.to_one_template
|
||||||
|
|
||||||
if file
|
if file
|
||||||
if file[:tempfile]
|
if file[:tempfile]
|
||||||
file_path = file[:tempfile].path
|
file_path = file[:tempfile].path
|
||||||
template = image.to_one_template
|
|
||||||
template << "\nPATH = #{file_path}"
|
template << "\nPATH = #{file_path}"
|
||||||
else
|
else
|
||||||
error_msg = "Image not present, aborting."
|
error_msg = "Image not present, aborting."
|
||||||
@ -127,7 +128,7 @@ class CloudServer
|
|||||||
|
|
||||||
rc = @img_repo.create(image, template)
|
rc = @img_repo.create(image, template)
|
||||||
|
|
||||||
file[:tempfile].unlink
|
file[:tempfile].unlink if file
|
||||||
|
|
||||||
if OpenNebula.is_error?(rc)
|
if OpenNebula.is_error?(rc)
|
||||||
return rc
|
return rc
|
||||||
|
@ -32,6 +32,9 @@ class ImageOCCI < Image
|
|||||||
<% if size != nil %>
|
<% if size != nil %>
|
||||||
<SIZE><%= size %></SIZE>
|
<SIZE><%= size %></SIZE>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if fstype != nil %>
|
||||||
|
<FSTYPE><%= fstype %></FSTYPE>
|
||||||
|
<% end %>
|
||||||
</STORAGE>
|
</STORAGE>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +73,10 @@ class ImageOCCI < Image
|
|||||||
begin
|
begin
|
||||||
if self['SOURCE'] != nil and File.exists?(self['SOURCE'])
|
if self['SOURCE'] != nil and File.exists?(self['SOURCE'])
|
||||||
size = File.stat(self['SOURCE']).size
|
size = File.stat(self['SOURCE']).size
|
||||||
|
size = size / 1024
|
||||||
end
|
end
|
||||||
|
|
||||||
|
fstype = self['TEMPLATE/FSTYPE'] if self['TEMPLATE/FSTYPE']
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
error = OpenNebula::Error.new(e.message)
|
error = OpenNebula::Error.new(e.message)
|
||||||
return error
|
return error
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
require 'OpenNebula/Image'
|
require 'OpenNebula/Image'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
|
require 'CommandManager'
|
||||||
|
|
||||||
module OpenNebula
|
module OpenNebula
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user