mirror of
https://github.com/OpenNebula/one.git
synced 2025-02-03 13:47:01 +03:00
M #-: Remove unused code function
This commit is contained in:
parent
d94082d637
commit
0725c4248d
@ -57,18 +57,6 @@ public:
|
||||
Template::set_xml_root(_xml_root);
|
||||
};
|
||||
|
||||
/**
|
||||
* Replaces the given image from the DISK attribute with a new one
|
||||
* @param target_id IMAGE_ID the image to be replaced
|
||||
* @param target_name IMAGE the image to be replaced
|
||||
* @param target_uname IMAGE_UNAME the image to be replaced
|
||||
* @param new_name of the new image
|
||||
* @param new_uname of the owner of the new image
|
||||
*/
|
||||
int replace_disk_image(int target_id, const std::string&
|
||||
target_name, const std::string& target_uname,
|
||||
const std::string& new_name, const std::string& new_uname);
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Restricted attributes interface implementation
|
||||
// -------------------------------------------------------------------------
|
||||
|
@ -27,65 +27,6 @@ std::map<std::string, std::set<std::string> > VirtualMachineTemplate::encrypted;
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
int VirtualMachineTemplate::replace_disk_image(int target_id, const string&
|
||||
target_name, const string& target_uname, const string& new_name,
|
||||
const string& new_uname)
|
||||
{
|
||||
int num_disks;
|
||||
int tmp_id;
|
||||
|
||||
string tmp_name;
|
||||
string tmp_uname;
|
||||
|
||||
vector<VectorAttribute *> disks;
|
||||
VectorAttribute * disk = 0;
|
||||
|
||||
num_disks = get("DISK", disks);
|
||||
|
||||
for(int i=0; i<num_disks; i++)
|
||||
{
|
||||
disk = disks[i];
|
||||
|
||||
if (disk->vector_value("IMAGE_ID", tmp_id) == 0) //DISK has IMAGE_ID
|
||||
{
|
||||
if (tmp_id == target_id)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
else //IMAGE and IMAGE_UNAME
|
||||
{
|
||||
tmp_name = disk->vector_value("IMAGE");
|
||||
tmp_uname = disk->vector_value("IMAGE_UNAME");
|
||||
|
||||
bool uname = tmp_uname.empty() || tmp_uname == target_uname;
|
||||
|
||||
if ( tmp_name == target_name && uname )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
disk = 0;
|
||||
}
|
||||
|
||||
if ( disk == 0 )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
disk->remove("IMAGE_ID");
|
||||
|
||||
disk->replace("IMAGE", new_name);
|
||||
|
||||
disk->replace("IMAGE_UNAME", new_uname);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
string& VirtualMachineTemplate::to_xml_short(string& xml) const
|
||||
{
|
||||
ostringstream oss;
|
||||
|
Loading…
x
Reference in New Issue
Block a user