direct-io.hg
changeset 13724:2f3794098e22
Added VM.is_control_domain field.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | Ewan Mellor <ewan@xensource.com> |
---|---|
date | Tue Jan 30 15:27:10 2007 +0000 (2007-01-30) |
parents | 7fdfa020d4ed |
children | 0803bdfdd9c5 |
files | docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_vm.h tools/libxen/src/xen_vm.c tools/python/xen/xend/XendAPI.py |
line diff
1.1 --- a/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 14:51:05 2007 +0000 1.2 +++ b/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 15:27:10 2007 +0000 1.3 @@ -1062,6 +1062,7 @@ Quals & Field & Type & Description \\ 1.4 $\mathit{RO}_\mathit{ins}$ & {\tt PCI\_bus} & string & PCI bus path for pass-through devices \\ 1.5 $\mathit{RO}_\mathit{run}$ & {\tt tools\_version} & (string $\rightarrow$ string) Map & versions of installed paravirtualised drivers \\ 1.6 $\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\ 1.7 +$\mathit{RO}_\mathit{run}$ & {\tt is\_control\_domain} & bool & true if this is a control domain (domain 0 or a driver domain) \\ 1.8 \hline 1.9 \end{longtable} 1.10 \subsection{Additional RPCs associated with class: VM} 1.11 @@ -3651,6 +3652,38 @@ void 1.12 \vspace{0.3cm} 1.13 \vspace{0.3cm} 1.14 \vspace{0.3cm} 1.15 +\subsubsection{RPC name:~get\_is\_control\_domain} 1.16 + 1.17 +{\bf Overview:} 1.18 +Get the is\_control\_domain field of the given VM. 1.19 + 1.20 + \noindent {\bf Signature:} 1.21 +\begin{verbatim} bool get_is_control_domain (session_id s, VM ref self)\end{verbatim} 1.22 + 1.23 + 1.24 +\noindent{\bf Arguments:} 1.25 + 1.26 + 1.27 +\vspace{0.3cm} 1.28 +\begin{tabular}{|c|c|p{7cm}|} 1.29 + \hline 1.30 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.31 +{\tt VM ref } & self & reference to the object \\ \hline 1.32 + 1.33 +\end{tabular} 1.34 + 1.35 +\vspace{0.3cm} 1.36 + 1.37 + \noindent {\bf Return Type:} 1.38 +{\tt 1.39 +bool 1.40 +} 1.41 + 1.42 + 1.43 +value of the field 1.44 +\vspace{0.3cm} 1.45 +\vspace{0.3cm} 1.46 +\vspace{0.3cm} 1.47 \subsubsection{RPC name:~create} 1.48 1.49 {\bf Overview:} 1.50 @@ -10019,7 +10052,6 @@ Quals & Field & Type & Description \\ 1.51 $\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ 1.52 $\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & the virtual machine \\ 1.53 $\mathit{RO}_\mathit{ins}$ & {\tt backend} & VM ref & the domain where the backend is located \\ 1.54 -$\mathit{RO}_\mathit{ins}$ & {\tt instance} & int & the instance number the virtual TPM represents \\ 1.55 \hline 1.56 \end{longtable} 1.57 \subsection{Additional RPCs associated with class: VTPM}
2.1 --- a/tools/libxen/include/xen_vm.h Tue Jan 30 14:51:05 2007 +0000 2.2 +++ b/tools/libxen/include/xen_vm.h Tue Jan 30 15:27:10 2007 +0000 2.3 @@ -143,6 +143,7 @@ typedef struct xen_vm_record 2.4 char *pci_bus; 2.5 xen_string_string_map *tools_version; 2.6 xen_string_string_map *other_config; 2.7 + bool is_control_domain; 2.8 } xen_vm_record; 2.9 2.10 /** 2.11 @@ -542,6 +543,13 @@ xen_vm_get_other_config(xen_session *ses 2.12 2.13 2.14 /** 2.15 + * Get the is_control_domain field of the given VM. 2.16 + */ 2.17 +extern bool 2.18 +xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm); 2.19 + 2.20 + 2.21 +/** 2.22 * Set the name/label field of the given VM. 2.23 */ 2.24 extern bool
3.1 --- a/tools/libxen/src/xen_vm.c Tue Jan 30 14:51:05 2007 +0000 3.2 +++ b/tools/libxen/src/xen_vm.c Tue Jan 30 15:27:10 2007 +0000 3.3 @@ -167,7 +167,10 @@ static const struct_member xen_vm_record 3.4 .offset = offsetof(xen_vm_record, tools_version) }, 3.5 { .key = "other_config", 3.6 .type = &abstract_type_string_string_map, 3.7 - .offset = offsetof(xen_vm_record, other_config) } 3.8 + .offset = offsetof(xen_vm_record, other_config) }, 3.9 + { .key = "is_control_domain", 3.10 + .type = &abstract_type_bool, 3.11 + .offset = offsetof(xen_vm_record, is_control_domain) } 3.12 }; 3.13 3.14 const abstract_type xen_vm_record_abstract_type_ = 3.15 @@ -946,6 +949,22 @@ xen_vm_get_other_config(xen_session *ses 3.16 3.17 3.18 bool 3.19 +xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm) 3.20 +{ 3.21 + abstract_value param_values[] = 3.22 + { 3.23 + { .type = &abstract_type_string, 3.24 + .u.string_val = vm } 3.25 + }; 3.26 + 3.27 + abstract_type result_type = abstract_type_bool; 3.28 + 3.29 + XEN_CALL_("VM.get_is_control_domain"); 3.30 + return session->ok; 3.31 +} 3.32 + 3.33 + 3.34 +bool 3.35 xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label) 3.36 { 3.37 abstract_value param_values[] =
4.1 --- a/tools/python/xen/xend/XendAPI.py Tue Jan 30 14:51:05 2007 +0000 4.2 +++ b/tools/python/xen/xend/XendAPI.py Tue Jan 30 15:27:10 2007 +0000 4.3 @@ -941,6 +941,7 @@ class XendAPI(object): 4.4 'VTPMs', 4.5 'PCI_bus', 4.6 'tools_version', 4.7 + 'is_control_domain', 4.8 ] 4.9 4.10 VM_attr_rw = ['name_label', 4.11 @@ -1175,6 +1176,11 @@ class XendAPI(object): 4.12 def VM_get_other_config(self, session, vm_ref): 4.13 return self.VM_get('otherconfig', session, vm_ref) 4.14 4.15 + def VM_get_is_control_domain(self, session, vm_ref): 4.16 + xd = XendDomain.instance() 4.17 + return xen_api_success( 4.18 + xd.get_vm_by_uuid(vm_ref) == xd.privilegedDomain()) 4.19 + 4.20 def VM_set_name_label(self, session, vm_ref, label): 4.21 dom = XendDomain.instance().get_vm_by_uuid(vm_ref) 4.22 dom.setName(label) 4.23 @@ -1346,6 +1352,7 @@ class XendAPI(object): 4.24 'PCI_bus': xeninfo.get_pci_bus(), 4.25 'tools_version': xeninfo.get_tools_version(), 4.26 'other_config': xeninfo.info.get('otherconfig'), 4.27 + 'is_control_domain': xeninfo == xendom.privilegedDomain(), 4.28 } 4.29 return xen_api_success(record) 4.30