aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEwan Mellor <ewan@xensource.com>2007-02-25 22:31:43 +0000
committerEwan Mellor <ewan@xensource.com>2007-02-25 22:31:43 +0000
commit94217354536e8136e0c048809d199af2ff999d06 (patch)
treed584ef7c7cd4c609b65c78ab705ff789cf29fd87
parent6bae08b49815fb00e5ded98494650ed1b7006345 (diff)
downloadxen-94217354536e8136e0c048809d199af2ff999d06.tar.gz
xen-94217354536e8136e0c048809d199af2ff999d06.tar.bz2
xen-94217354536e8136e0c048809d199af2ff999d06.zip
Added a VM.domid field.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
-rw-r--r--docs/xen-api/xenapi-datamodel.tex33
-rw-r--r--tools/libxen/include/xen_vm.h8
-rw-r--r--tools/libxen/src/xen_vm.c19
-rw-r--r--tools/python/xen/xend/XendAPI.py10
4 files changed, 69 insertions, 1 deletions
diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex
index 53a25d5688..09d9dc6098 100644
--- a/docs/xen-api/xenapi-datamodel.tex
+++ b/docs/xen-api/xenapi-datamodel.tex
@@ -1100,6 +1100,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 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
@@ -3969,6 +3970,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}
\subsubsection{RPC name:~get\_is\_control\_domain}
{\bf Overview:}
diff --git a/tools/libxen/include/xen_vm.h b/tools/libxen/include/xen_vm.h
index 15abbb11c7..228a3dcb07 100644
--- a/tools/libxen/include/xen_vm.h
+++ b/tools/libxen/include/xen_vm.h
@@ -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 *session, xen_string_string_map **result, xe
/**
+ * 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 --git a/tools/libxen/src/xen_vm.c b/tools/libxen/src/xen_vm.c
index c712b71561..1d93e6a840 100644
--- a/tools/libxen/src/xen_vm.c
+++ b/tools/libxen/src/xen_vm.c
@@ -168,6 +168,9 @@ static const struct_member xen_vm_record_struct_members[] =
{ .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 *session, xen_string_string_map **result, xe
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 --git a/tools/python/xen/xend/XendAPI.py b/tools/python/xen/xend/XendAPI.py
index f528112738..abb1118dcd 100644
--- a/tools/python/xen/xend/XendAPI.py
+++ b/tools/python/xen/xend/XendAPI.py
@@ -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)