From 07ca23fcdecdb8bbb6f290882abe29255480a0ff Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Fri, 6 Jun 2014 12:14:26 +0200 Subject: [PATCH] feature #2858: Do not allow to reserve on the same VNET --- src/rm/RequestManagerVirtualNetwork.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/rm/RequestManagerVirtualNetwork.cc b/src/rm/RequestManagerVirtualNetwork.cc index 351e3392a7..156a0abc36 100644 --- a/src/rm/RequestManagerVirtualNetwork.cc +++ b/src/rm/RequestManagerVirtualNetwork.cc @@ -226,11 +226,20 @@ void VirtualNetworkReserve::request_execute( int rid; bool on_exisiting = tmpl.get("NETWORK_ID", rid); - if ( on_exisiting && (rid < 0)) + if ( on_exisiting) { - failure_response(ACTION, request_error("Error in reservation request", - "NETWORK_ID must be equal or greater than 0"), att); - return; + if (rid < 0) + { + failure_response(ACTION, request_error("Error in reservation request", + "NETWORK_ID must be equal or greater than 0"), att); + return; + } + else if (rid == id) + { + failure_response(ACTION, request_error("Error in reservation request", + "Cannot add a reservation from the same network"), att); + return; + } } string name;