xen/13724_xenapi.patch

158 lines
5.0 KiB
Diff
Raw Normal View History

# HG changeset patch
# User Ewan Mellor <ewan@xensource.com>
# Date 1170170830 0
# Node ID 2f3794098e22a15064fbf07d2208cf526f59010b
# Parent 7fdfa020d4ed63fe758395c4630dab018f13424a
Added VM.is_control_domain field.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Index: xen-3.0.4-testing/docs/xen-api/xenapi-datamodel.tex
===================================================================
--- xen-3.0.4-testing.orig/docs/xen-api/xenapi-datamodel.tex
+++ xen-3.0.4-testing/docs/xen-api/xenapi-datamodel.tex
@@ -3644,6 +3644,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}
\subsubsection{RPC name:~get\_boot\_method}
{\bf Overview:}
@@ -9312,7 +9344,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}
Index: xen-3.0.4-testing/tools/libxen/include/xen_vm.h
===================================================================
--- xen-3.0.4-testing.orig/tools/libxen/include/xen_vm.h
+++ xen-3.0.4-testing/tools/libxen/include/xen_vm.h
@@ -142,6 +142,7 @@ typedef struct xen_vm_record
char *pci_bus;
xen_string_string_map *tools_version;
xen_string_string_map *otherconfig;
+ bool is_control_domain;
} xen_vm_record;
/**
@@ -562,6 +563,13 @@ xen_vm_get_otherconfig(xen_session *sess
/**
+ * 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
Index: xen-3.0.4-testing/tools/libxen/src/xen_vm.c
===================================================================
--- xen-3.0.4-testing.orig/tools/libxen/src/xen_vm.c
+++ xen-3.0.4-testing/tools/libxen/src/xen_vm.c
@@ -176,7 +176,10 @@ static const struct_member xen_vm_record
.offset = offsetof(xen_vm_record, tools_version) },
{ .key = "otherConfig",
.type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_record, otherconfig) }
+ .offset = offsetof(xen_vm_record, otherconfig) },
+ { .key = "is_control_domain",
+ .type = &abstract_type_bool,
+ .offset = offsetof(xen_vm_record, is_control_domain) }
};
const abstract_type xen_vm_record_abstract_type_ =
@@ -1006,6 +1009,22 @@ xen_vm_get_otherconfig(xen_session *sess
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[] =
Index: xen-3.0.4-testing/tools/python/xen/xend/XendAPI.py
===================================================================
--- xen-3.0.4-testing.orig/tools/python/xen/xend/XendAPI.py
+++ xen-3.0.4-testing/tools/python/xen/xend/XendAPI.py
@@ -603,6 +603,7 @@ class XendAPI:
'VTPMs',
'PCI_bus',
'tools_version',
+ 'is_control_domain',
]
VM_attr_rw = ['name_label',
@@ -856,6 +857,11 @@ class XendAPI:
def VM_get_otherConfig(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)
dom.setName(label)
@@ -1025,6 +1031,7 @@ class XendAPI:
'PCI_bus': xeninfo.get_pci_bus(),
'tools_version': xeninfo.get_tools_version(),
'otherConfig': xeninfo.info.get('otherconfig'),
+ 'is_control_domain': xeninfo == xendom.privilegedDomain(),
}
return xen_api_success(record)