From ff36519d7198f49ddbb557c7e327f37f93a6e013 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Wed, 7 Feb 2024 12:33:23 +0100 Subject: [PATCH] M #-: Remove unused code function (cherry picked from commit 0725c4248d94be0242b4f821ec699facfaefd6f7) --- include/VirtualMachineTemplate.h | 12 ------- src/vm/VirtualMachineTemplate.cc | 59 -------------------------------- 2 files changed, 71 deletions(-) diff --git a/include/VirtualMachineTemplate.h b/include/VirtualMachineTemplate.h index 705e31b540..e867355e20 100644 --- a/include/VirtualMachineTemplate.h +++ b/include/VirtualMachineTemplate.h @@ -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 // ------------------------------------------------------------------------- diff --git a/src/vm/VirtualMachineTemplate.cc b/src/vm/VirtualMachineTemplate.cc index 8146bd8d83..b60139861d 100644 --- a/src/vm/VirtualMachineTemplate.cc +++ b/src/vm/VirtualMachineTemplate.cc @@ -27,65 +27,6 @@ std::map > 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 disks; - VectorAttribute * disk = 0; - - num_disks = get("DISK", disks); - - for(int i=0; ivector_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;