mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
This reverts commit 9fb5c62c55
.
This commit is contained in:
parent
29e2edc49c
commit
2b89eaaa47
@ -17,11 +17,11 @@
|
||||
#include "ImageManager.h"
|
||||
#include "NebulaLog.h"
|
||||
#include "ImagePool.h"
|
||||
#include "MarketPlacePool.h"
|
||||
#include "SyncRequest.h"
|
||||
#include "Template.h"
|
||||
#include "Nebula.h"
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@ -717,18 +717,11 @@ int ImageManager::register_image(int iid, const string& ds_data, string& error)
|
||||
|
||||
ostringstream oss;
|
||||
Image * img;
|
||||
MarketPlace * market;
|
||||
|
||||
string path;
|
||||
string img_tmpl;
|
||||
string * drv_msg;
|
||||
string extra_data = "";
|
||||
|
||||
int market_id;
|
||||
bool rc;
|
||||
|
||||
Nebula& nd = Nebula::instance();
|
||||
MarketPlacePool * marketpool = nd.get_marketpool();
|
||||
|
||||
if ( imd == 0 )
|
||||
{
|
||||
@ -745,40 +738,7 @@ int ImageManager::register_image(int iid, const string& ds_data, string& error)
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check if FROM_MARKET_ID is defined. If it is, release image, get XML
|
||||
// of the MARKET_ID and get image again.
|
||||
|
||||
rc = img->get_template_attribute("FROM_MARKET_ID", market_id);
|
||||
|
||||
if ( rc )
|
||||
{
|
||||
img->unlock();
|
||||
|
||||
// Get the market
|
||||
market = marketpool->get(market_id, true);
|
||||
|
||||
if (market == 0)
|
||||
{
|
||||
oss << "Could not find market '" << market_id << "'.";
|
||||
error = oss.str();
|
||||
return -1;
|
||||
}
|
||||
|
||||
market->to_xml(extra_data);
|
||||
|
||||
market->unlock();
|
||||
|
||||
// Get the image again
|
||||
img = ipool->get(iid,true);
|
||||
|
||||
if (img == 0)
|
||||
{
|
||||
error = "Image deleted during copy operation";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
drv_msg = format_message(img->to_xml(img_tmpl), ds_data, extra_data);
|
||||
drv_msg = format_message(img->to_xml(img_tmpl), ds_data, "");
|
||||
path = img->get_path();
|
||||
|
||||
if ( path.empty() == true ) //NO PATH
|
||||
|
@ -189,9 +189,8 @@ module OpenNebula
|
||||
tmpl << "PATH=" << self['SOURCE'] << "\n"
|
||||
tmpl << "FORMAT=" << self['FORMAT'] << "\n"
|
||||
tmpl << "MD5=" << self['MD5'] << "\n"
|
||||
tmpl << "FROM_APP=\"" << self['ID'] << "\"\n"
|
||||
tmpl << "FROM_APP_NAME=\"" << self['NAME'] << "\"\n"
|
||||
tmpl << "FROM_MARKET_ID=\"" << self['MARKETPLACE_ID'] << "\"\n"
|
||||
tmpl << "FROM_APP=\"" << self['ID'] << "\"\n"
|
||||
tmpl << "FROM_APP_NAME=\"" << self['NAME'] << "\"\n"
|
||||
|
||||
image = Image.new(Image.build_xml, one)
|
||||
rc = image.allocate(tmpl, options[:dsid])
|
||||
|
Loading…
Reference in New Issue
Block a user