From: Ewan Mellor Date: Tue, 30 Jan 2007 15:27:10 +0000 (+0000) Subject: Added VM.is_control_domain field. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~15368^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=899dc94915f0ce5f54f45b18462287c8111d76c7;p=xen.git Added VM.is_control_domain field. Signed-off-by: Ewan Mellor --- diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex index e9936df4b1..cde30247cd 100644 --- a/docs/xen-api/xenapi-datamodel.tex +++ b/docs/xen-api/xenapi-datamodel.tex @@ -1062,6 +1062,7 @@ $\mathit{RW}$ & {\tt platform/enable\_audio} & bool & emulate audio \\ $\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 --git a/tools/libxen/include/xen_vm.h b/tools/libxen/include/xen_vm.h index 8cbd786d69..f1d83f6f7e 100644 --- a/tools/libxen/include/xen_vm.h +++ b/tools/libxen/include/xen_vm.h @@ -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; /** @@ -541,6 +542,13 @@ extern bool xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm); +/** + * 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. */ diff --git a/tools/libxen/src/xen_vm.c b/tools/libxen/src/xen_vm.c index ad295984cc..4a7787825f 100644 --- a/tools/libxen/src/xen_vm.c +++ b/tools/libxen/src/xen_vm.c @@ -167,7 +167,10 @@ static const struct_member xen_vm_record_struct_members[] = .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_ = @@ -945,6 +948,22 @@ xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xe } +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) { diff --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py index 0cb40e7133..1854f4aa19 100644 --- a/tools/python/xen/xend/XendAPI.py +++ b/tools/python/xen/xend/XendAPI.py @@ -941,6 +941,7 @@ class XendAPI(object): 'VTPMs', 'PCI_bus', 'tools_version', + 'is_control_domain', ] VM_attr_rw = ['name_label', @@ -1175,6 +1176,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) dom.setName(label) @@ -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)