1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

B #6533: Fix no_check_capacity for image create (#2994)

(cherry picked from commit 3df4cbb1d3)
This commit is contained in:
Pavel Czerný 2024-03-20 10:43:34 +01:00 committed by Ruben S. Montero
parent 4a45ddcbc9
commit 2c5a11863e
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
5 changed files with 9 additions and 13 deletions

View File

@ -169,8 +169,7 @@ class OneImageHelper < OpenNebulaHelper::OneHelper
:name => 'no_check_capacity',
:large => '--no_check_capacity',
:description =>
'Check Datastore capacity. By Default YES',
:format => String
'Do not check Datastore capacity, only for admins.'
}
FILTERS = [

View File

@ -217,11 +217,7 @@ CommandParser::CmdParser.new(ARGV) do
exit(-1)
end
if options[:no_check_capacity].nil?
check_capacity = false
else
check_capacity = true
end
no_check_capacity = !options[:no_check_capacity].nil?
conflicting_opts = []
if (args[0] || !(stdin = OpenNebulaHelper.read_stdin).empty?) &&
@ -264,7 +260,7 @@ CommandParser::CmdParser.new(ARGV) do
exit 0
end
image.allocate(template, options[:datastore], check_capacity)
image.allocate(template, options[:datastore], no_check_capacity)
rescue StandardError => e
STDERR.puts e.message
exit(-1)

View File

@ -869,8 +869,8 @@ int ImageManager::register_image(int iid,
image_msg_t msg(ImageManagerMessages::MKFS, "", img->get_oid(), drv_msg);
imd->write(msg);
oss << "Creating disk at " << source << " of "<< img->get_size()
<< "Mb (format: " << img->get_format() << ")";
oss << "Creating disk at " << img->get_ds_name() << ", size " << img->get_size()
<< "MB (format: " << img->get_format() << ")";
}
}
else //PATH -> COPY TO REPOSITORY AS SOURCE

View File

@ -115,11 +115,12 @@ module OpenNebula
#
# @param description [String] A string containing the template of the Image.
# @param ds_id [Integer] the target datastore ID
# @param no_check_capacity [Boolean] true to skip capacity check. Only for admins.
#
# @return [nil, OpenNebula::Error] nil in case of success, Error
# otherwise
def allocate(description, ds_id, check_capacity=true)
super(IMAGE_METHODS[:allocate],description, ds_id, check_capacity)
def allocate(description, ds_id, no_check_capacity=false)
super(IMAGE_METHODS[:allocate],description, ds_id, no_check_capacity)
end
# Replaces the template contents

View File

@ -455,7 +455,7 @@ void ImageAllocate::request_execute(xmlrpc_c::paramList const& params,
if ( params.size() > 3 && att.is_admin() )
{
check_capacity = xmlrpc_c::value_boolean(params.getBoolean(3));
check_capacity = !params.getBoolean(3);
}
Nebula& nd = Nebula::instance();