mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-26 06:50:09 +03:00
feature #4317: Use xpath templates
(cherry picked from commit 7df5b936c7049f86ab02f8149ea1e299ed0cbb09)
This commit is contained in:
parent
048c8991a3
commit
59aae97a58
@ -74,8 +74,10 @@ public:
|
||||
* Returns all the DISK/IMAGE_IDs in the Template
|
||||
* @return image IDs
|
||||
*/
|
||||
vector<int> get_img_ids();
|
||||
// TODO: make const
|
||||
void get_img_ids(vector<int>& img_ids)
|
||||
{
|
||||
xpaths<int>(img_ids,"/VMTEMPLATE/TEMPLATE/DISK/IMAGE_ID");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Virtual Router
|
||||
|
@ -224,7 +224,9 @@ void TemplateChmod::request_execute(xmlrpc_c::paramList const& paramList,
|
||||
return;
|
||||
}
|
||||
|
||||
vector<int> img_ids = tmpl->get_img_ids();
|
||||
vector<int> img_ids;
|
||||
|
||||
tmpl->get_img_ids(img_ids);
|
||||
|
||||
tmpl->unlock();
|
||||
|
||||
|
@ -182,7 +182,7 @@ void TemplateDelete::request_execute(
|
||||
|
||||
if (recursive)
|
||||
{
|
||||
img_ids = object->get_img_ids();
|
||||
object->get_img_ids(img_ids);
|
||||
}
|
||||
|
||||
object->unlock();
|
||||
|
@ -260,31 +260,3 @@ bool VMTemplate::is_vrouter()
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
vector<int> VMTemplate::get_img_ids()
|
||||
{
|
||||
vector<int> img_ids;
|
||||
|
||||
// TODO: xpaths(vector<int>..) is not working
|
||||
//xpaths(img_ids,"/VMTEMPLATE/TEMPLATE/DISK/IMAGE_ID");
|
||||
|
||||
vector<string> img_ids_st;
|
||||
vector<string>::iterator it;
|
||||
|
||||
xpaths(img_ids_st,"/VMTEMPLATE/TEMPLATE/DISK/IMAGE_ID");
|
||||
|
||||
for (it = img_ids_st.begin(); it != img_ids_st.end(); it++)
|
||||
{
|
||||
istringstream iss(*it);
|
||||
int val;
|
||||
|
||||
iss >> dec >> val;
|
||||
|
||||
if (!iss.fail())
|
||||
{
|
||||
img_ids.push_back( val );
|
||||
}
|
||||
}
|
||||
|
||||
return img_ids;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user