From 2c88fe83c8d06747e914ebde9fa16811ba017f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 8 May 2012 15:42:24 +0200 Subject: [PATCH] Feature #1099: Add complete VM info to all history records, even the active ones --- include/History.h | 3 ++- include/VirtualMachine.h | 23 +++++++++++++---------- src/vm/History.cc | 7 ++++--- src/vm/VirtualMachine.cc | 28 ++++++++++++++++++++-------- 4 files changed, 39 insertions(+), 22 deletions(-) diff --git a/include/History.h b/include/History.h index 8161f4649f..952320e62c 100644 --- a/include/History.h +++ b/include/History.h @@ -45,7 +45,8 @@ public: int hid, const string& hostname, const string& vmm, - const string& vnm); + const string& vnm, + const string& vm_info); ~History(){}; diff --git a/include/VirtualMachine.h b/include/VirtualMachine.h index 1319711f81..a3c48ab9f3 100644 --- a/include/VirtualMachine.h +++ b/include/VirtualMachine.h @@ -431,18 +431,18 @@ public: /** * Sets VM info (with monitoring info) in the history record */ - void set_vm_info() - { - obj_template->to_xml(history->vm_info); - }; + void set_vm_info() + { + to_xml_extended(history->vm_info, 0); + }; /** * Sets VM info (with monitoring info) in the previous history record */ - void set_previous_vm_info() - { - obj_template->to_xml(previous_history->vm_info); - }; + void set_previous_vm_info() + { + to_xml_extended(previous_history->vm_info, 0); + }; /** * Sets end time of a VM. @@ -932,10 +932,13 @@ private: * Function that renders the VM in XML format optinally including * extended information (all history records) * @param xml the resulting XML string - * @param extended include additional info if true + * @param n_history Number of history records to include: + * 0: none + * 1: the last one + * 2: all * @return a reference to the generated string */ - string& to_xml_extended(string& xml, bool extended) const; + string& to_xml_extended(string& xml, int n_history) const; protected: diff --git a/src/vm/History.cc b/src/vm/History.cc index e1199d83e6..4d7580aba9 100644 --- a/src/vm/History.cc +++ b/src/vm/History.cc @@ -53,7 +53,7 @@ History::History( epilog_stime(0), epilog_etime(0), reason(NONE), - vm_info("