mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
feature #407: Fixes Image tests. persistent method returns 0 (not true) for successful operations
This commit is contained in:
parent
d6f9c2b453
commit
589fa7a875
@ -207,25 +207,25 @@ public:
|
||||
* @param persistent true to make an image persistent
|
||||
* @return 0 on success
|
||||
*/
|
||||
bool persistent(bool persis)
|
||||
int persistent(bool persis)
|
||||
{
|
||||
bool success = false;
|
||||
int rc = -1;
|
||||
|
||||
if (persis == true)
|
||||
{
|
||||
if (!isPublic() && running_vms == 0)
|
||||
{
|
||||
persistent_img = 1;
|
||||
success = true;
|
||||
rc = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
persistent_img = 0;
|
||||
success = true;
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
return success;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -779,18 +779,18 @@ public:
|
||||
i++;
|
||||
}
|
||||
|
||||
bool success;
|
||||
int success;
|
||||
|
||||
// img 0 is not public.
|
||||
img = imp->get( 0, false );
|
||||
CPPUNIT_ASSERT( img != 0 );
|
||||
|
||||
success = img->publish(false);
|
||||
CPPUNIT_ASSERT( success == true );
|
||||
CPPUNIT_ASSERT( success == 0 );
|
||||
CPPUNIT_ASSERT( img->isPublic() == false );
|
||||
|
||||
success = img->publish(true);
|
||||
CPPUNIT_ASSERT( success == true );
|
||||
CPPUNIT_ASSERT( success == 0 );
|
||||
CPPUNIT_ASSERT( img->isPublic() == true );
|
||||
}
|
||||
|
||||
@ -800,7 +800,7 @@ public:
|
||||
void persistence()
|
||||
{
|
||||
int oid;
|
||||
bool success;
|
||||
int success;
|
||||
ImagePoolFriend * imp = static_cast<ImagePoolFriend *>(pool);
|
||||
Image * img;
|
||||
|
||||
@ -856,33 +856,33 @@ public:
|
||||
|
||||
// make it persistent
|
||||
success = img->persistent(true);
|
||||
CPPUNIT_ASSERT( success == true );
|
||||
CPPUNIT_ASSERT( success == 0 );
|
||||
CPPUNIT_ASSERT( img->isPersistent() == true );
|
||||
|
||||
// it isn't public, try to unpublish
|
||||
success = img->publish(false);
|
||||
CPPUNIT_ASSERT( success == true );
|
||||
CPPUNIT_ASSERT( success == 0 );
|
||||
CPPUNIT_ASSERT( img->isPublic() == false );
|
||||
|
||||
// try to publish, should fail because it is persistent
|
||||
success = img->publish(true);
|
||||
CPPUNIT_ASSERT( success == false );
|
||||
CPPUNIT_ASSERT( success == -1 );
|
||||
CPPUNIT_ASSERT( img->isPublic() == false );
|
||||
|
||||
|
||||
// make it non-persistent
|
||||
success = img->persistent(false);
|
||||
CPPUNIT_ASSERT( success == true );
|
||||
CPPUNIT_ASSERT( success == 0 );
|
||||
CPPUNIT_ASSERT( img->isPersistent() == false );
|
||||
|
||||
// it isn't public, try to unpublish
|
||||
success = img->publish(false);
|
||||
CPPUNIT_ASSERT( success == true );
|
||||
CPPUNIT_ASSERT( success == 0 );
|
||||
CPPUNIT_ASSERT( img->isPublic() == false );
|
||||
|
||||
// try to publish, now it should be possible
|
||||
success = img->publish(true);
|
||||
CPPUNIT_ASSERT( success == true );
|
||||
CPPUNIT_ASSERT( success == 0 );
|
||||
CPPUNIT_ASSERT( img->isPublic() == true );
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ void ImagePersistent::request_execute(xmlrpc_c::paramList const& paramList)
|
||||
{
|
||||
int id = xmlrpc_c::value_int(paramList.getInt(1));
|
||||
bool persistent_flag = xmlrpc_c::value_boolean(paramList.getBoolean(2));
|
||||
bool result;
|
||||
int rc;
|
||||
|
||||
Image * image;
|
||||
string err_msg;
|
||||
@ -82,9 +82,9 @@ void ImagePersistent::request_execute(xmlrpc_c::paramList const& paramList)
|
||||
return;
|
||||
}
|
||||
|
||||
result = image->persistent(persistent_flag);
|
||||
rc = image->persistent(persistent_flag);
|
||||
|
||||
if ( !result )
|
||||
if ( rc != 0 )
|
||||
{
|
||||
if (persistent_flag == true)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user