diff --git a/src/um/DefaultQuotas.cc b/src/um/DefaultQuotas.cc index 139e53e9aa..82d96f016f 100644 --- a/src/um/DefaultQuotas.cc +++ b/src/um/DefaultQuotas.cc @@ -30,16 +30,10 @@ string& DefaultQuotas::to_xml(string& xml) const { ostringstream oss; - string ds_quota_xml; - string net_quota_xml; - string vm_quota_xml; - string image_quota_xml; + string aux_xml; oss << "<" << root_elem << ">" - << datastore_quota.to_xml(ds_quota_xml) - << network_quota.to_xml(net_quota_xml) - << vm_quota.to_xml(vm_quota_xml) - << image_quota.to_xml(image_quota_xml) + << Quotas::to_xml(aux_xml) << ""; xml = oss.str(); @@ -52,49 +46,9 @@ string& DefaultQuotas::to_xml(string& xml) const int DefaultQuotas::from_xml(const string& xml) { - vector content; - int rc = 0; - ObjectXML *object_xml = new ObjectXML(xml); - object_xml->get_nodes(ds_xpath, content); - - if (!content.empty()) - { - rc += datastore_quota.from_xml_node(content[0]); - } - - object_xml->free_nodes(content); - content.clear(); - - object_xml->get_nodes(net_xpath, content); - - if (!content.empty()) - { - rc += network_quota.from_xml_node(content[0]); - } - - object_xml->free_nodes(content); - content.clear(); - - object_xml->get_nodes(vm_xpath, content); - - if (!content.empty()) - { - rc += vm_quota.from_xml_node(content[0]); - } - - object_xml->free_nodes(content); - content.clear(); - - object_xml->get_nodes(img_xpath, content); - - if (!content.empty()) - { - rc += image_quota.from_xml_node(content[0]); - } - - object_xml->free_nodes(content); + int rc = Quotas::from_xml(object_xml); delete object_xml;