mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Bug #2093: Make messages to get a resource by _uid _id similar
(cherry picked from commit ae116531f80c1f5c8f4487039e95ee12c8ef9af9)
This commit is contained in:
parent
82a023efcf
commit
fa3bf68d06
@ -64,7 +64,8 @@ Image * ImageManager::acquire_image(int vm_id, const string& name, int uid, stri
|
||||
if ( img == 0 )
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "Image " << name << " does not exist for user " << uid;
|
||||
oss << "User " << uid << " does not own an image with name: " << name
|
||||
<< " . Set IMAGE_UNAME or IMAGE_UID of owner in DISK.";
|
||||
|
||||
error = oss.str();
|
||||
return 0;
|
||||
|
@ -117,6 +117,17 @@ int get_image_path(VirtualMachine * vm,
|
||||
}
|
||||
|
||||
img = ipool->get(val1, uid, true);
|
||||
|
||||
if ( img == 0 )
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "User " << uid << " does not own an image with name: " << val1
|
||||
<< " . Set IMAGE_UNAME or IMAGE_UID of owner.";
|
||||
|
||||
error_str = oss.str();
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if ( var1 == "IMAGE_ID" )
|
||||
{
|
||||
@ -126,11 +137,20 @@ int get_image_path(VirtualMachine * vm,
|
||||
{
|
||||
img = ipool->get(iid, true);
|
||||
}
|
||||
}
|
||||
|
||||
if ( img == 0 )
|
||||
if ( img == 0 )
|
||||
{
|
||||
ostringstream oss;
|
||||
oss << "Image with ID: " << iid << " does not exist";
|
||||
|
||||
error_str = oss.str();
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error_str = "Cannot get image (check name/ID or try IMAGE_UNAME or IMAGE_UID).";
|
||||
error_str = "Cannot get image, set IMAGE_ID or IMAGE.";
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user