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

[Xen-changelog] [xen-unstable] Added VM.is_control_domain field.



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1170170830 0
# Node ID 2f3794098e22a15064fbf07d2208cf526f59010b
# Parent  7fdfa020d4ed63fe758395c4630dab018f13424a
Added VM.is_control_domain field.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex |   34 +++++++++++++++++++++++++++++++++-
 tools/libxen/include/xen_vm.h     |    8 ++++++++
 tools/libxen/src/xen_vm.c         |   21 ++++++++++++++++++++-
 tools/python/xen/xend/XendAPI.py  |    7 +++++++
 4 files changed, 68 insertions(+), 2 deletions(-)

diff -r 7fdfa020d4ed -r 2f3794098e22 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 14:51:05 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 15:27:10 2007 +0000
@@ -1062,6 +1062,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 is\_control\_domain} & bool & true if this 
is a control domain (domain 0 or a driver domain) \\
 \hline
 \end{longtable}
 \subsection{Additional RPCs associated with class: VM}
@@ -3648,6 +3649,38 @@ void
 
 
 
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_is\_control\_domain}
+
+{\bf Overview:} 
+Get the is\_control\_domain field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} bool get_is_control_domain (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 
+bool
+}
+
+
+value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
@@ -10019,7 +10052,6 @@ Quals & Field & Type & Description \\
 $\mathit{RO}_\mathit{run}$ &  {\tt uuid} & string & unique identifier/object 
reference \\
 $\mathit{RO}_\mathit{ins}$ &  {\tt VM} & VM ref & the virtual machine \\
 $\mathit{RO}_\mathit{ins}$ &  {\tt backend} & VM ref & the domain where the 
backend is located \\
-$\mathit{RO}_\mathit{ins}$ &  {\tt instance} & int & the instance number the 
virtual TPM represents \\
 \hline
 \end{longtable}
 \subsection{Additional RPCs associated with class: VTPM}
diff -r 7fdfa020d4ed -r 2f3794098e22 tools/libxen/include/xen_vm.h
--- a/tools/libxen/include/xen_vm.h     Tue Jan 30 14:51:05 2007 +0000
+++ b/tools/libxen/include/xen_vm.h     Tue Jan 30 15:27:10 2007 +0000
@@ -143,6 +143,7 @@ typedef struct xen_vm_record
     char *pci_bus;
     xen_string_string_map *tools_version;
     xen_string_string_map *other_config;
+    bool is_control_domain;
 } xen_vm_record;
 
 /**
@@ -542,6 +543,13 @@ xen_vm_get_other_config(xen_session *ses
 
 
 /**
+ * Get the is_control_domain field of the given VM.
+ */
+extern bool
+xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm);
+
+
+/**
  * Set the name/label field of the given VM.
  */
 extern bool
diff -r 7fdfa020d4ed -r 2f3794098e22 tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Tue Jan 30 14:51:05 2007 +0000
+++ b/tools/libxen/src/xen_vm.c Tue Jan 30 15:27:10 2007 +0000
@@ -167,7 +167,10 @@ static const struct_member xen_vm_record
           .offset = offsetof(xen_vm_record, tools_version) },
         { .key = "other_config",
           .type = &abstract_type_string_string_map,
-          .offset = offsetof(xen_vm_record, other_config) }
+          .offset = offsetof(xen_vm_record, other_config) },
+        { .key = "is_control_domain",
+          .type = &abstract_type_bool,
+          .offset = offsetof(xen_vm_record, is_control_domain) }
     };
 
 const abstract_type xen_vm_record_abstract_type_ =
@@ -946,6 +949,22 @@ xen_vm_get_other_config(xen_session *ses
 
 
 bool
+xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm }
+        };
+
+    abstract_type result_type = abstract_type_bool;
+
+    XEN_CALL_("VM.get_is_control_domain");
+    return session->ok;
+}
+
+
+bool
 xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label)
 {
     abstract_value param_values[] =
diff -r 7fdfa020d4ed -r 2f3794098e22 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Tue Jan 30 14:51:05 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Tue Jan 30 15:27:10 2007 +0000
@@ -941,6 +941,7 @@ class XendAPI(object):
                   'VTPMs',
                   'PCI_bus',
                   'tools_version',
+                  'is_control_domain',
                   ]
                   
     VM_attr_rw = ['name_label',
@@ -1174,6 +1175,11 @@ class XendAPI(object):
     
     def VM_get_other_config(self, session, vm_ref):
         return self.VM_get('otherconfig', session, vm_ref)        
+
+    def VM_get_is_control_domain(self, session, vm_ref):
+        xd = XendDomain.instance()
+        return xen_api_success(
+            xd.get_vm_by_uuid(vm_ref) == xd.privilegedDomain())
 
     def VM_set_name_label(self, session, vm_ref, label):
         dom = XendDomain.instance().get_vm_by_uuid(vm_ref)
@@ -1346,6 +1352,7 @@ class XendAPI(object):
             'PCI_bus': xeninfo.get_pci_bus(),
             'tools_version': xeninfo.get_tools_version(),
             'other_config': xeninfo.info.get('otherconfig'),
+            '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®.