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

[Xen-changelog] [xen-unstable] Added a VM.domid field.



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1172442703 0
# Node ID 532a25342a3090af9a227194951348a040ece27b
# Parent  8c8d91a006baa51977d69055287bb0b1467c8a3d
Added a VM.domid field.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex |   33 +++++++++++++++++++++++++++++++++
 tools/libxen/include/xen_vm.h     |    8 ++++++++
 tools/libxen/src/xen_vm.c         |   19 +++++++++++++++++++
 tools/python/xen/xend/XendAPI.py  |   10 +++++++++-
 4 files changed, 69 insertions(+), 1 deletion(-)

diff -r 8c8d91a006ba -r 532a25342a30 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 22:02:12 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 22:31:43 2007 +0000
@@ -1100,6 +1100,7 @@ Quals & Field & Type & Description \\
 $\mathit{RO}_\mathit{ins}$ &  {\tt PCI\_bus} & string & PCI bus path for 
pass-through devices \\
 $\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 domid} & int & domain ID (if available, -1 
otherwise) \\
 $\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{run}$ &  {\tt metrics} & VM\_metrics ref & metrics 
associated with this VM. \\
 \hline
@@ -3966,6 +3967,38 @@ void
 
 
 
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_domid}
+
+{\bf Overview:} 
+Get the domid field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_domid (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}
diff -r 8c8d91a006ba -r 532a25342a30 tools/libxen/include/xen_vm.h
--- a/tools/libxen/include/xen_vm.h     Sun Feb 25 22:02:12 2007 +0000
+++ b/tools/libxen/include/xen_vm.h     Sun Feb 25 22:31:43 2007 +0000
@@ -146,6 +146,7 @@ typedef struct xen_vm_record
     char *pci_bus;
     xen_string_string_map *tools_version;
     xen_string_string_map *other_config;
+    int64_t domid;
     bool is_control_domain;
     struct xen_vm_metrics_record_opt *metrics;
 } xen_vm_record;
@@ -547,6 +548,13 @@ xen_vm_get_other_config(xen_session *ses
 
 
 /**
+ * Get the domid field of the given VM.
+ */
+extern bool
+xen_vm_get_domid(xen_session *session, int64_t *result, xen_vm vm);
+
+
+/**
  * Get the is_control_domain field of the given VM.
  */
 extern bool
diff -r 8c8d91a006ba -r 532a25342a30 tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Sun Feb 25 22:02:12 2007 +0000
+++ b/tools/libxen/src/xen_vm.c Sun Feb 25 22:31:43 2007 +0000
@@ -168,6 +168,9 @@ static const struct_member xen_vm_record
         { .key = "other_config",
           .type = &abstract_type_string_string_map,
           .offset = offsetof(xen_vm_record, other_config) },
+        { .key = "domid",
+          .type = &abstract_type_int,
+          .offset = offsetof(xen_vm_record, domid) },
         { .key = "is_control_domain",
           .type = &abstract_type_bool,
           .offset = offsetof(xen_vm_record, is_control_domain) },
@@ -953,6 +956,22 @@ xen_vm_get_other_config(xen_session *ses
 
 
 bool
+xen_vm_get_domid(xen_session *session, int64_t *result, xen_vm vm)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm }
+        };
+
+    abstract_type result_type = abstract_type_int;
+
+    XEN_CALL_("VM.get_domid");
+    return session->ok;
+}
+
+
+bool
 xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm)
 {
     abstract_value param_values[] =
diff -r 8c8d91a006ba -r 532a25342a30 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Sun Feb 25 22:02:12 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Sun Feb 25 22:31:43 2007 +0000
@@ -1000,6 +1000,7 @@ class XendAPI(object):
                   'VTPMs',
                   'PCI_bus',
                   'tools_version',
+                  'domid',
                   'is_control_domain',
                   ]
                   
@@ -1240,6 +1241,10 @@ class XendAPI(object):
     def VM_get_other_config(self, session, vm_ref):
         return self.VM_get('other_config', session, vm_ref)        
 
+    def VM_get_domid(self, _, ref):
+        domid = XendDomain.instance().get_vm_by_uuid(ref).getDomid()
+        return xen_api_success(domid is None and -1 or domid)
+
     def VM_get_is_control_domain(self, session, vm_ref):
         xd = XendDomain.instance()
         return xen_api_success(
@@ -1396,7 +1401,9 @@ class XendAPI(object):
         xeninfo = xendom.get_vm_by_uuid(vm_ref)
         if not xeninfo:
             return xen_api_error(['HANDLE_INVALID', 'VM', vm_ref])
-        
+
+        domid = xeninfo.getDomid()
+
         record = {
             'uuid': xeninfo.get_uuid(),
             'power_state': xeninfo.get_power_state(),
@@ -1439,6 +1446,7 @@ class XendAPI(object):
             'PCI_bus': xeninfo.get_pci_bus(),
             'tools_version': xeninfo.get_tools_version(),
             'other_config': xeninfo.info.get('other_config', {}),
+            'domid': domid is None and -1 or domid,
             'is_control_domain': xeninfo == xendom.privilegedDomain(),
         }
         return xen_api_success(record)

_______________________________________________
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®.