mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-16 01:33:10 +09:00
feature #2858: Solve bugs in onevnet reserve. Minor changes in one.vn.reserve
This commit is contained in:
1 parent
be238e98ee
commit
f87d3bb3cf
3 files changed
+13
-10
No files matched your search
+1
-1
@@ -205,7 +205,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do
|
||||
exit -1
|
||||
end
|
||||
|
||||
if rname == -1
|
||||
if rname == -1 && args[1].nil?
|
||||
STDERR.puts "Specify a name (-n name) for the reservation"
|
||||
exit -1
|
||||
end
|
||||
|
||||
@@ -199,7 +199,7 @@ module OpenNebula
|
||||
return Error.new('ID not defined') if !@pe_id
|
||||
|
||||
rtmpl = "SIZE = #{rsize}\n"
|
||||
rtmpl << "NAME = #{rname}\n" if !name.nil?
|
||||
rtmpl << "NAME = #{rname}\n" if !rname.nil?
|
||||
rtmpl << "AR_ID = #{ar_id}\n" if !ar_id.nil?
|
||||
rtmpl << "NETWORK_ID = #{vnet}\n" if !vnet.nil?
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ void VirtualNetworkReserve::request_execute(
|
||||
int id = xmlrpc_c::value_int (paramList.getInt(1));
|
||||
string str_tmpl = xmlrpc_c::value_string (paramList.getString(2));
|
||||
|
||||
VirtualNetworkPool * vnpool = static_cast<VirtualNetworkPool *>(pool);
|
||||
VirtualNetworkTemplate tmpl;
|
||||
VirtualNetwork * vn;
|
||||
VirtualNetwork * rvn;
|
||||
@@ -239,7 +240,7 @@ void VirtualNetworkReserve::request_execute(
|
||||
|
||||
// --------------- Get the VNET to make the reservation -------------
|
||||
|
||||
vn = static_cast<VirtualNetwork *>(pool->get(id,true));
|
||||
vn = vnpool->get(id,true);
|
||||
|
||||
if ( vn == 0 )
|
||||
{
|
||||
@@ -259,9 +260,8 @@ void VirtualNetworkReserve::request_execute(
|
||||
|
||||
cluster_id = vn->get_cluster_id();
|
||||
|
||||
rc = (static_cast<VirtualNetworkPool *>(pool))->allocate(att.uid, att.gid,
|
||||
att.uname, att.gname, att.umask, id, vtmpl, &rid, cluster_id,
|
||||
vn->get_cluster_name(), error_str);
|
||||
rc = vnpool->allocate(att.uid, att.gid, att.uname, att.gname, att.umask,
|
||||
id, vtmpl, &rid, cluster_id, vn->get_cluster_name(), error_str);
|
||||
|
||||
if (rc < 0)
|
||||
{
|
||||
@@ -276,7 +276,7 @@ void VirtualNetworkReserve::request_execute(
|
||||
}
|
||||
}
|
||||
|
||||
rvn = static_cast<VirtualNetwork *>(pool->get(rid,true));
|
||||
rvn = vnpool->get(rid,true);
|
||||
|
||||
if (rvn == 0)
|
||||
{
|
||||
@@ -291,11 +291,14 @@ void VirtualNetworkReserve::request_execute(
|
||||
|
||||
if (on_exisiting && rvn->get_parent() != id)
|
||||
{
|
||||
ostringstream oss;
|
||||
|
||||
oss << "New reservations for virtual network " << rid << " have to be "
|
||||
<< "from network " << rvn->get_parent();
|
||||
|
||||
quota_rollback(&qtmpl, Quotas::NETWORK, att);
|
||||
|
||||
failure_response(INTERNAL,
|
||||
request_error("Cannot put reservations from different networks on "
|
||||
"the same VNET",""), att);
|
||||
failure_response(INTERNAL, request_error(oss.str(),""), att);
|
||||
|
||||
rvn->unlock();
|
||||
|
||||
|
||||
Reference in new issue
Block a user