mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-26 06:50:09 +03:00
Feature #4217: Add extra_data to the register and clone operations
This commit is contained in:
parent
15e54f59ea
commit
8a4135faaf
@ -133,11 +133,15 @@ public:
|
||||
* Adds a new image to the repository copying or creating it as needed
|
||||
* @param img pointer to the image
|
||||
* @param ds_data data of the associated datastore in XML format
|
||||
* @param extra_data data to be sent to the driver
|
||||
* @param error Error reason
|
||||
*
|
||||
* @return 0 on success
|
||||
*/
|
||||
int register_image(int iid, const string& ds_data, string& error);
|
||||
int register_image(int iid,
|
||||
const string& ds_data,
|
||||
const string& extra_data,
|
||||
string& error);
|
||||
|
||||
/**
|
||||
* Checks if an image is ready to be cloned
|
||||
@ -163,12 +167,14 @@ public:
|
||||
* @param new_id of the new image
|
||||
* @param cloning_id of the image to be cloned
|
||||
* @param ds_data data of the associated datastore in XML format
|
||||
* @param extra_data data to be sent to the driver
|
||||
* @param error describing the error
|
||||
* @return 0 on success
|
||||
*/
|
||||
int clone_image(int new_id,
|
||||
int cloning_id,
|
||||
const string& ds_data,
|
||||
const string& extra_data,
|
||||
string& error);
|
||||
/**
|
||||
* Deletes an image from the repository and the DB. The Datastore image list
|
||||
|
@ -658,6 +658,7 @@ int ImageManager::set_clone_state(int new_id, int cloning_id, std::string& error
|
||||
int ImageManager::clone_image(int new_id,
|
||||
int cloning_id,
|
||||
const string& ds_data,
|
||||
const string& extra_data,
|
||||
string& error)
|
||||
{
|
||||
const ImageManagerDriver* imd = get();
|
||||
@ -692,7 +693,7 @@ int ImageManager::clone_image(int new_id,
|
||||
return -1;
|
||||
}
|
||||
|
||||
drv_msg = format_message(img->to_xml(img_tmpl), ds_data, "");
|
||||
drv_msg = format_message(img->to_xml(img_tmpl), ds_data, extra_data);
|
||||
|
||||
imd->clone(img->get_oid(), *drv_msg);
|
||||
|
||||
@ -711,7 +712,10 @@ int ImageManager::clone_image(int new_id,
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int ImageManager::register_image(int iid, const string& ds_data, string& error)
|
||||
int ImageManager::register_image(int iid,
|
||||
const string& ds_data,
|
||||
const string& extra_data,
|
||||
string& error)
|
||||
{
|
||||
const ImageManagerDriver* imd = get();
|
||||
|
||||
@ -738,7 +742,7 @@ int ImageManager::register_image(int iid, const string& ds_data, string& error)
|
||||
return -1;
|
||||
}
|
||||
|
||||
drv_msg = format_message(img->to_xml(img_tmpl), ds_data, "");
|
||||
drv_msg = format_message(img->to_xml(img_tmpl), ds_data, extra_data);
|
||||
path = img->get_path();
|
||||
|
||||
if ( path.empty() == true ) //NO PATH
|
||||
|
@ -103,6 +103,8 @@ int ImagePool::allocate (
|
||||
string type;
|
||||
ostringstream oss;
|
||||
|
||||
int rc;
|
||||
|
||||
img = new Image(uid, gid, uname, gname, umask, img_template);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
@ -169,7 +171,9 @@ int ImagePool::allocate (
|
||||
{
|
||||
if (cloning_id == -1)
|
||||
{
|
||||
if ( imagem->register_image(*oid, ds_data, error_str) == -1 )
|
||||
rc = imagem->register_image(*oid, ds_data, extra_data, error_str);
|
||||
|
||||
if ( rc == -1 )
|
||||
{
|
||||
img = get(*oid, true);
|
||||
|
||||
@ -188,7 +192,13 @@ int ImagePool::allocate (
|
||||
}
|
||||
else
|
||||
{
|
||||
if (imagem->clone_image(*oid, cloning_id, ds_data, error_str) == -1)
|
||||
rc = imagem->clone_image(*oid,
|
||||
cloning_id,
|
||||
ds_data,
|
||||
extra_data,
|
||||
error_str);
|
||||
|
||||
if (rc == -1)
|
||||
{
|
||||
img = get(*oid, true);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user