[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Remove VM.VCPUs_number and VM.VCPUs_utilisation as these have moved onto the



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1171989024 0
# Node ID 8773b1a38c83667b000f496eb0906c3284087345
# Parent  8bcd71c3b49550b5bb8461d530c8c5275634c975
Remove VM.VCPUs_number and VM.VCPUs_utilisation as these have moved onto the
VM_metrics class.  Remove VM_metrics.VM -- the backreference is unnecessary
and awkward to deal with.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex     |  102 ----------------------------------
 tools/libxen/include/xen_vm_metrics.h |   11 ---
 tools/libxen/src/xen_vm_metrics.c     |   24 --------
 tools/libxen/test/test_bindings.c     |   42 +++++++++++---
 4 files changed, 38 insertions(+), 141 deletions(-)

diff -r 8bcd71c3b495 -r 8773b1a38c83 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Tue Feb 20 15:24:01 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Tue Feb 20 16:30:24 2007 +0000
@@ -61,7 +61,6 @@ VIF.network & network.VIFs & one-to-many
 VIF.network & network.VIFs & one-to-many\\
 host.metrics & host\_metrics.host & one-to-one\\
 PIF.metrics & PIF\_metrics.PIF & one-to-one\\
-VM.metrics & VM\_metrics.VM & one-to-one\\
 PIF.host & host.PIFs & one-to-many\\
 PIF.network & network.PIFs & one-to-many\\
 SR.VDIs & VDI.SR & many-to-one\\
@@ -1076,8 +1075,6 @@ Quals & Field & Type & Description \\
 $\mathit{RW}$ &  {\tt VCPUs/params} & (string $\rightarrow$ string) Map & 
configuration parameters for the selected VCPU policy \\
 $\mathit{RW}$ &  {\tt VCPUs/max} & int & Max number of VCPUs \\
 $\mathit{RW}$ &  {\tt VCPUs/at\_startup} & int & Boot number of VCPUs \\
-$\mathit{RO}_\mathit{ins}$ &  {\tt VCPUs/number} & int & Current number of 
VCPUs \\
-$\mathit{RO}_\mathit{run}$ &  {\tt VCPUs/utilisation} & (int $\rightarrow$ 
float) Map & Utilisation for all of guest's current VCPUs \\
 $\mathit{RW}$ &  {\tt actions/after\_shutdown} & on\_normal\_exit & action to 
take after the guest has shutdown itself \\
 $\mathit{RW}$ &  {\tt actions/after\_reboot} & on\_normal\_exit & action to 
take after the guest has rebooted itself \\
 $\mathit{RW}$ &  {\tt actions/after\_crash} & on\_crash\_behaviour & action to 
take if the guest crashes \\
@@ -1102,7 +1099,7 @@ Quals & Field & Type & Description \\
 $\mathit{RO}_\mathit{run}$ &  {\tt tools\_version} & (string $\rightarrow$ 
string) Map & versions of installed paravirtualised drivers \\
 $\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & 
additional configuration \\
 $\mathit{RO}_\mathit{run}$ &  {\tt is\_control\_domain} & bool & true if this 
is a control domain (domain 0 or a driver domain) \\
-$\mathit{RO}_\mathit{ins}$ &  {\tt metrics} & VM\_metrics ref & metrics 
associated with this VM. \\
+$\mathit{RO}_\mathit{run}$ &  {\tt metrics} & VM\_metrics ref & metrics 
associated with this VM. \\
 \hline
 \end{longtable}
 \subsection{Additional RPCs associated with class: VM}
@@ -2545,70 +2542,6 @@ void
 
 
 
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_number}
-
-{\bf Overview:} 
-Get the VCPUs/number field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} int get_VCPUs_number (session_id s, VM ref self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-int
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_utilisation}
-
-{\bf Overview:} 
-Get the VCPUs/utilisation field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} ((int -> float) Map) get_VCPUs_utilisation (session_id s, VM 
ref self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM ref } & self & reference to the object \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-(int $\rightarrow$ float) Map
-}
-
-
-value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
@@ -4273,7 +4206,6 @@ Quals & Field & Type & Description \\
 Quals & Field & Type & Description \\
 \hline
 $\mathit{RO}_\mathit{run}$ &  {\tt uuid} & string & unique identifier/object 
reference \\
-$\mathit{RO}_\mathit{ins}$ &  {\tt VM} & VM ref & VM to which these metrics 
apply \\
 $\mathit{RO}_\mathit{run}$ &  {\tt memory/actual} & int & Guest's actual 
memory (bytes) \\
 $\mathit{RO}_\mathit{run}$ &  {\tt VCPUs/number} & int & Current number of 
VCPUs \\
 $\mathit{RO}_\mathit{run}$ &  {\tt VCPUs/utilisation} & (int $\rightarrow$ 
float) Map & Utilisation for all of guest's current VCPUs \\
@@ -4305,38 +4237,6 @@ Get the uuid field of the given VM\_metr
  \noindent {\bf Return Type:} 
 {\tt 
 string
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VM}
-
-{\bf Overview:} 
-Get the VM field of the given VM\_metrics.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} (VM ref) get_VM (session_id s, VM_metrics ref 
self)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
- 
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VM\_metrics ref } & self & reference to the object \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-VM ref
 }
 
 
diff -r 8bcd71c3b495 -r 8773b1a38c83 tools/libxen/include/xen_vm_metrics.h
--- a/tools/libxen/include/xen_vm_metrics.h     Tue Feb 20 15:24:01 2007 +0000
+++ b/tools/libxen/include/xen_vm_metrics.h     Tue Feb 20 16:30:24 2007 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, XenSource Inc.
+ * Copyright (c) 2006-2007, XenSource Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,7 +21,6 @@
 
 #include "xen_common.h"
 #include "xen_int_float_map.h"
-#include "xen_vm_decl.h"
 #include "xen_vm_metrics_decl.h"
 
 
@@ -64,7 +63,6 @@ typedef struct xen_vm_metrics_record
 {
     xen_vm_metrics handle;
     char *uuid;
-    struct xen_vm_record_opt *vm;
     int64_t memory_actual;
     int64_t vcpus_number;
     xen_int_float_map *vcpus_utilisation;
@@ -171,13 +169,6 @@ xen_vm_metrics_get_uuid(xen_session *ses
 
 
 /**
- * Get the VM field of the given VM_metrics.
- */
-extern bool
-xen_vm_metrics_get_vm(xen_session *session, xen_vm *result, xen_vm_metrics 
vm_metrics);
-
-
-/**
  * Get the memory/actual field of the given VM_metrics.
  */
 extern bool
diff -r 8bcd71c3b495 -r 8773b1a38c83 tools/libxen/src/xen_vm_metrics.c
--- a/tools/libxen/src/xen_vm_metrics.c Tue Feb 20 15:24:01 2007 +0000
+++ b/tools/libxen/src/xen_vm_metrics.c Tue Feb 20 16:30:24 2007 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, XenSource Inc.
+ * Copyright (c) 2006-2007, XenSource Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,7 +23,6 @@
 #include "xen_common.h"
 #include "xen_int_float_map.h"
 #include "xen_internal.h"
-#include "xen_vm.h"
 #include "xen_vm_metrics.h"
 
 
@@ -41,9 +40,6 @@ static const struct_member xen_vm_metric
         { .key = "uuid",
           .type = &abstract_type_string,
           .offset = offsetof(xen_vm_metrics_record, uuid) },
-        { .key = "VM",
-          .type = &abstract_type_ref,
-          .offset = offsetof(xen_vm_metrics_record, vm) },
         { .key = "memory_actual",
           .type = &abstract_type_int,
           .offset = offsetof(xen_vm_metrics_record, memory_actual) },
@@ -74,7 +70,6 @@ xen_vm_metrics_record_free(xen_vm_metric
     }
     free(record->handle);
     free(record->uuid);
-    xen_vm_record_opt_free(record->vm);
     xen_int_float_map_free(record->vcpus_utilisation);
     free(record);
 }
@@ -121,23 +116,6 @@ xen_vm_metrics_get_by_uuid(xen_session *
 
 
 bool
-xen_vm_metrics_get_vm(xen_session *session, xen_vm *result, xen_vm_metrics 
vm_metrics)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm_metrics }
-        };
-
-    abstract_type result_type = abstract_type_string;
-
-    *result = NULL;
-    XEN_CALL_("VM_metrics.get_VM");
-    return session->ok;
-}
-
-
-bool
 xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, 
xen_vm_metrics vm_metrics)
 {
     abstract_value param_values[] =
diff -r 8bcd71c3b495 -r 8773b1a38c83 tools/libxen/test/test_bindings.c
--- a/tools/libxen/test/test_bindings.c Tue Feb 20 15:24:01 2007 +0000
+++ b/tools/libxen/test/test_bindings.c Tue Feb 20 16:30:24 2007 +0000
@@ -31,6 +31,7 @@
 #include "xen_vdi.h"
 #include "xen_console.h"
 #include "xen_vm.h"
+#include "xen_vm_metrics.h"
 
 
 static void usage()
@@ -61,6 +62,7 @@ typedef struct
 
 static xen_vm create_new_vm(xen_session *session, bool hvm);
 static void print_vm_power_state(xen_session *session, xen_vm vm);
+static void print_vm_metrics(xen_session *session, xen_vm vm);
 
 
 static size_t
@@ -245,12 +247,7 @@ int main(int argc, char **argv)
 
     printf("%s.\n", xen_vm_power_state_to_string(vm_record->power_state));
 
-    for (size_t i = 0; i < vm_record->vcpus_utilisation->size; i++)
-    {
-        printf("%"PRId64" -> %lf.\n",
-               vm_record->vcpus_utilisation->contents[i].key,
-               vm_record->vcpus_utilisation->contents[i].val);
-    }
+    print_vm_metrics(session, vm);
 
     xen_uuid_bytes_free(vm_uuid_bytes);
     xen_uuid_free(vm_uuid);
@@ -323,7 +320,6 @@ static xen_vm create_new_vm(xen_session 
             .memory_static_min = 128,
             .vcpus_policy = "credit",
             .vcpus_params = vcpus_params,
-            .vcpus_number = 2,
             .actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY,
             .actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART,
             .actions_after_crash = XEN_ON_CRASH_BEHAVIOUR_PRESERVE,
@@ -519,3 +515,35 @@ static void print_vm_power_state(xen_ses
 
     xen_uuid_free(vm_uuid);
 }
+
+
+/**
+ * Print the metrics for the given VM.
+ */
+static void print_vm_metrics(xen_session *session, xen_vm vm)
+{
+    xen_vm_metrics vm_metrics;
+    if (!xen_vm_get_metrics(session, &vm_metrics, vm))
+    {
+        print_error(session);
+        return;
+    }
+
+    xen_vm_metrics_record *vm_metrics_record;
+    if (!xen_vm_metrics_get_record(session, &vm_metrics_record, vm_metrics))
+    {
+        xen_vm_metrics_free(vm_metrics);
+        print_error(session);
+        return;
+    }
+
+    for (size_t i = 0; i < vm_metrics_record->vcpus_utilisation->size; i++)
+    {
+        printf("%"PRId64" -> %lf.\n",
+               vm_metrics_record->vcpus_utilisation->contents[i].key,
+               vm_metrics_record->vcpus_utilisation->contents[i].val);
+    }
+
+    xen_vm_metrics_record_free(vm_metrics_record);
+    xen_vm_metrics_free(vm_metrics);
+}

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.