From a473b280520bea04e5fd1cfd99d9c5e94bc50631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Fri, 30 Dec 2011 21:00:48 +0100 Subject: [PATCH] Fix bug introduced in to_xml methods --- src/image/Image.cc | 7 ++++--- src/vm/VirtualMachine.cc | 12 +++++++----- src/vm_template/VMTemplate.cc | 7 ++++--- src/vnm/VirtualNetwork.cc | 11 +++++++---- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/image/Image.cc b/src/image/Image.cc index 20c5ea1604..af74077a48 100644 --- a/src/image/Image.cc +++ b/src/image/Image.cc @@ -324,7 +324,8 @@ error_common: string& Image::to_xml(string& xml) const { - string aux_str; + string template_xml; + string perms_xml; ostringstream oss; oss << @@ -335,7 +336,7 @@ string& Image::to_xml(string& xml) const "" << uname << "" << "" << gname << "" << "" << name << "" << - perms_to_xml(aux_str) << + perms_to_xml(perms_xml) << "" << type << "" << "" << public_obj << "" << "" << persistent_img << "" << @@ -346,7 +347,7 @@ string& Image::to_xml(string& xml) const "" << size_mb << "" << "" << state << "" << "" << running_vms << "" << - obj_template->to_xml(aux_str) << + obj_template->to_xml(template_xml) << ""; xml = oss.str(); diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 330f59350c..96b9c1f42b 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -1237,7 +1237,9 @@ string& VirtualMachine::to_xml_extended(string& xml) const string& VirtualMachine::to_xml_extended(string& xml, bool extended) const { - string aux_str; + string template_xml; + string history_xml; + string perm_xml; ostringstream oss; oss << "" @@ -1247,7 +1249,7 @@ string& VirtualMachine::to_xml_extended(string& xml, bool extended) const << "" << uname << "" << "" << gname << "" << "" << name << "" - << perms_to_xml(aux_str) + << perms_to_xml(perm_xml) << "" << last_poll << "" << "" << state << "" << "" << lcm_state << "" @@ -1258,7 +1260,7 @@ string& VirtualMachine::to_xml_extended(string& xml, bool extended) const << "" << cpu << "" << "" << net_tx << "" << "" << net_rx << "" - << obj_template->to_xml(aux_str); + << obj_template->to_xml(template_xml); if ( hasHistory() ) { @@ -1268,12 +1270,12 @@ string& VirtualMachine::to_xml_extended(string& xml, bool extended) const { for (unsigned int i=0; i < history_records.size(); i++) { - oss << history_records[i]->to_xml(aux_str); + oss << history_records[i]->to_xml(history_xml); } } else { - oss << history->to_xml(aux_str); + oss << history->to_xml(history_xml); } oss << ""; diff --git a/src/vm_template/VMTemplate.cc b/src/vm_template/VMTemplate.cc index e2e174c374..179363a784 100644 --- a/src/vm_template/VMTemplate.cc +++ b/src/vm_template/VMTemplate.cc @@ -206,7 +206,8 @@ error_common: string& VMTemplate::to_xml(string& xml) const { ostringstream oss; - string aux_str; + string template_xml; + string perm_str; oss << "" << "" << oid << "" @@ -215,10 +216,10 @@ string& VMTemplate::to_xml(string& xml) const << "" << uname << "" << "" << gname << "" << "" << name << "" - << perms_to_xml(aux_str) + << perms_to_xml(perm_str) << "" << public_obj << "" << "" << regtime << "" - << obj_template->to_xml(aux_str) + << obj_template->to_xml(template_xml) << ""; xml = oss.str(); diff --git a/src/vnm/VirtualNetwork.cc b/src/vnm/VirtualNetwork.cc index 7e2859f63e..bd545215a0 100644 --- a/src/vnm/VirtualNetwork.cc +++ b/src/vnm/VirtualNetwork.cc @@ -464,7 +464,10 @@ string& VirtualNetwork::to_xml_extended(string& xml) const string& VirtualNetwork::to_xml_extended(string& xml, bool extended) const { ostringstream os; - string aux_str; + + string template_xml; + string leases_xml; + string perm_str; // Total leases is the number of used leases. int total_leases = 0; @@ -482,7 +485,7 @@ string& VirtualNetwork::to_xml_extended(string& xml, bool extended) const "" << uname << "" << "" << gname << "" << "" << name << "" << - perms_to_xml(aux_str) << + perms_to_xml(perm_str) << "" << type << "" << "" << bridge << ""<< "" << vlan << ""; @@ -522,14 +525,14 @@ string& VirtualNetwork::to_xml_extended(string& xml, bool extended) const os << "" << public_obj << "" << ""<< total_leases << ""<< - obj_template->to_xml(aux_str); + obj_template->to_xml(template_xml); if (extended) { if (leases != 0) { os << "" << - leases->to_xml(aux_str) << + leases->to_xml(leases_xml) << ""; } else