correct, and the values are best left implicit.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
\hline
\end{longtable}
-\vspace{1cm}
-\begin{longtable}{|ll|}
-\hline
-{\tt enum driver\_type} & \\
-\hline
-\hspace{0.5cm}{\tt ioemu} & use hardware emulation \\
-\hspace{0.5cm}{\tt paravirtualised} & use paravirtualised driver \\
-\hline
-\end{longtable}
-
\vspace{1cm}
\newpage
Quals & Field & Type & Description \\
\hline
$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\
-$\mathit{RW}$ & {\tt name} & string & human-readable name of the interface \\
-$\mathit{RW}$ & {\tt type} & driver\_type & interface type \\
$\mathit{RW}$ & {\tt device} & string & name of network device as exposed to guest e.g. eth0 \\
$\mathit{RW}$ & {\tt network} & network ref & virtual network to which this vif is connected \\
$\mathit{RW}$ & {\tt VM} & VM ref & virtual machine to which this vif is connected \\
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_type}
-
-{\bf Overview:}
-Get the type field of the given VIF.
-
- \noindent {\bf Signature:}
-\begin{verbatim} (driver_type) get_type (session_id s, VIF 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 VIF ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-driver\_type
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_type}
-
-{\bf Overview:}
-Set the type field of the given VIF.
-
- \noindent {\bf Signature:}
-\begin{verbatim} void set_type (session_id s, VIF ref self, driver_type value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VIF ref } & self & reference to the object \\ \hline
-
-{\tt driver\_type } & value & New value to set \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-void
-}
-
-
-
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
$\mathit{RW}$ & {\tt bootable} & bool & true if this VBD is bootable \\
$\mathit{RW}$ & {\tt mode} & vbd\_mode & the mode the VBD should be mounted with \\
$\mathit{RW}$ & {\tt type} & vbd\_type & how the VBD will appear to the guest (e.g. disk or CD) \\
-$\mathit{RW}$ & {\tt driver} & driver\_type & the style of driver \\
$\mathit{RO}_\mathit{run}$ & {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\
$\mathit{RO}_\mathit{run}$ & {\tt io/write\_kbs} & float & Write bandwidth (KiB/s) \\
\hline
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_driver}
-
-{\bf Overview:}
-Get the driver field of the given VBD.
-
- \noindent {\bf Signature:}
-\begin{verbatim} (driver_type) get_driver (session_id s, VBD 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 VBD ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-driver\_type
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_driver}
-
-{\bf Overview:}
-Set the driver field of the given VBD.
-
- \noindent {\bf Signature:}
-\begin{verbatim} void set_driver (session_id s, VBD ref self, driver_type value)\end{verbatim}
-
-
-\noindent{\bf Arguments:}
-
-
-\vspace{0.3cm}
-\begin{tabular}{|c|c|p{7cm}|}
- \hline
-{\bf type} & {\bf name} & {\bf description} \\ \hline
-{\tt VBD ref } & self & reference to the object \\ \hline
-
-{\tt driver\_type } & value & New value to set \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-void
-}
-
-
-
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
$\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 driver} & driver\_type & the style of driver \\
$\mathit{RO}_\mathit{ins}$ & {\tt instance} & int & the instance number the virtual TPM represents \\
\hline
\end{longtable}
}
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_driver}
-
-{\bf Overview:}
-Get the driver field of the given VTPM.
-
- \noindent {\bf Signature:}
-\begin{verbatim} (driver_type) get_driver (session_id s, VTPM 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 VTPM ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:}
-{\tt
-driver\_type
-}
-
-
value of the field
\vspace{0.3cm}
\vspace{0.3cm}
+++ /dev/null
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef XEN_DRIVER_TYPE_H
-#define XEN_DRIVER_TYPE_H
-
-
-#include "xen_common.h"
-
-
-enum xen_driver_type
-{
- /**
- * use hardware emulation
- */
- XEN_DRIVER_TYPE_IOEMU,
-
- /**
- * use paravirtualised driver
- */
- XEN_DRIVER_TYPE_PARAVIRTUALISED
-};
-
-
-typedef struct xen_driver_type_set
-{
- size_t size;
- enum xen_driver_type contents[];
-} xen_driver_type_set;
-
-/**
- * Allocate a xen_driver_type_set of the given size.
- */
-extern xen_driver_type_set *
-xen_driver_type_set_alloc(size_t size);
-
-/**
- * Free the given xen_driver_type_set. The given set must have been
- * allocated by this library.
- */
-extern void
-xen_driver_type_set_free(xen_driver_type_set *set);
-
-
-/**
- * Return the name corresponding to the given code. This string must
- * not be modified or freed.
- */
-extern const char *
-xen_driver_type_to_string(enum xen_driver_type val);
-
-
-/**
- * Return the correct code for the given string, or set the session
- * object to failure and return an undefined value if the given string does
- * not match a known code.
- */
-extern enum xen_driver_type
-xen_driver_type_from_string(xen_session *session, const char *str);
-
-
-#endif
+++ /dev/null
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-/*
- * Declarations of the abstract types used during demarshalling of enum
- * xen_driver_type. Internal to this library -- do not use from outside.
- */
-
-
-#ifndef XEN_DRIVER_TYPE_INTERNAL_H
-#define XEN_DRIVER_TYPE_INTERNAL_H
-
-
-#include "xen_internal.h"
-
-
-extern const abstract_type xen_driver_type_abstract_type_;
-extern const abstract_type xen_driver_type_set_abstract_type_;
-
-
-#endif
#define XEN_VBD_H
#include "xen_common.h"
-#include "xen_driver_type.h"
#include "xen_vbd_decl.h"
#include "xen_vbd_mode.h"
#include "xen_vdi_decl.h"
/*
- * The VBD class.
- *
+ * The VBD class.
+ *
* A virtual block device.
*/
char *image;
bool bootable;
enum xen_vbd_mode mode;
- enum xen_driver_type driver;
double io_read_kbs;
double io_write_kbs;
} xen_vbd_record;
xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd);
-/**
- * Get the driver field of the given VBD.
- */
-extern bool
-xen_vbd_get_driver(xen_session *session, enum xen_driver_type *result, xen_vbd vbd);
-
-
/**
* Get the io/read_kbs field of the given VBD.
*/
xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode);
-/**
- * Set the driver field of the given VBD.
- */
-extern bool
-xen_vbd_set_driver(xen_session *session, xen_vbd vbd, enum xen_driver_type driver);
-
-
/**
* Change the media in the device for CDROM-like devices only. For
* other devices, detach the VBD and attach a new one
#define XEN_VIF_H
#include "xen_common.h"
-#include "xen_driver_type.h"
#include "xen_network_decl.h"
#include "xen_vif_decl.h"
#include "xen_vm_decl.h"
/*
- * The VIF class.
- *
+ * The VIF class.
+ *
* A virtual network interface.
*/
{
xen_vif handle;
char *uuid;
- char *name;
- enum xen_driver_type type;
char *device;
struct xen_network_record_opt *network;
struct xen_vm_record_opt *vm;
xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif);
-/**
- * Get the name field of the given VIF.
- */
-extern bool
-xen_vif_get_name(xen_session *session, char **result, xen_vif vif);
-
-
-/**
- * Get the type field of the given VIF.
- */
-extern bool
-xen_vif_get_type(xen_session *session, enum xen_driver_type *result, xen_vif vif);
-
-
/**
* Get the device field of the given VIF.
*/
xen_vif_get_io_write_kbs(xen_session *session, double *result, xen_vif vif);
-/**
- * Set the name field of the given VIF.
- */
-extern bool
-xen_vif_set_name(xen_session *session, xen_vif vif, char *name);
-
-
-/**
- * Set the type field of the given VIF.
- */
-extern bool
-xen_vif_set_type(xen_session *session, xen_vif vif, enum xen_driver_type type);
-
-
/**
* Set the device field of the given VIF.
*/
#define XEN_VTPM_H
#include "xen_common.h"
-#include "xen_driver_type.h"
#include "xen_vm_decl.h"
#include "xen_vtpm_decl.h"
char *uuid;
struct xen_vm_record_opt *vm;
struct xen_vm_record_opt *backend;
- enum xen_driver_type driver;
int64_t instance;
} xen_vtpm_record;
xen_vtpm_get_backend(xen_session *session, xen_vm *result, xen_vtpm vtpm);
-/**
- * Get the driver field of the given VTPM.
- */
-extern bool
-xen_vtpm_get_driver(xen_session *session, enum xen_driver_type *result, xen_vtpm vtpm);
-
-
/**
* Get the instance field of the given VTPM.
*/
+++ /dev/null
-/*
- * Copyright (c) 2006, XenSource Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <string.h>
-
-#include "xen_internal.h"
-#include "xen_driver_type.h"
-#include "xen_driver_type_internal.h"
-
-
-/*
- * Maintain this in the same order as the enum declaration!
- */
-static const char *lookup_table[] =
-{
- "ioemu",
- "paravirtualised"
-};
-
-
-extern xen_driver_type_set *
-xen_driver_type_set_alloc(size_t size)
-{
- return calloc(1, sizeof(xen_driver_type_set) +
- size * sizeof(enum xen_driver_type));
-}
-
-
-extern void
-xen_driver_type_set_free(xen_driver_type_set *set)
-{
- free(set);
-}
-
-
-const char *
-xen_driver_type_to_string(enum xen_driver_type val)
-{
- return lookup_table[val];
-}
-
-
-extern enum xen_driver_type
-xen_driver_type_from_string(xen_session *session, const char *str)
-{
- return ENUM_LOOKUP(session, str, lookup_table);
-}
-
-
-const abstract_type xen_driver_type_abstract_type_ =
- {
- .typename = ENUM,
- .enum_marshaller =
- (const char *(*)(int))&xen_driver_type_to_string,
- .enum_demarshaller =
- (int (*)(xen_session *, const char *))&xen_driver_type_from_string
- };
-
-
-const abstract_type xen_driver_type_set_abstract_type_ =
- {
- .typename = SET,
- .child = &xen_driver_type_abstract_type_
- };
-
-
#include <stdlib.h>
#include "xen_common.h"
-#include "xen_driver_type_internal.h"
#include "xen_internal.h"
#include "xen_vbd.h"
#include "xen_vbd_mode_internal.h"
{ .key = "mode",
.type = &xen_vbd_mode_abstract_type_,
.offset = offsetof(xen_vbd_record, mode) },
- { .key = "driver",
- .type = &xen_driver_type_abstract_type_,
- .offset = offsetof(xen_vbd_record, driver) },
{ .key = "io_read_kbs",
.type = &abstract_type_float,
.offset = offsetof(xen_vbd_record, io_read_kbs) },
}
-bool
-xen_vbd_get_driver(xen_session *session, enum xen_driver_type *result, xen_vbd vbd)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd }
- };
-
- abstract_type result_type = xen_driver_type_abstract_type_;
- char *result_str = NULL;
- XEN_CALL_("VBD.get_driver");
- *result = xen_driver_type_from_string(session, result_str);
- return session->ok;
-}
-
-
bool
xen_vbd_get_io_read_kbs(xen_session *session, double *result, xen_vbd vbd)
{
}
-bool
-xen_vbd_set_driver(xen_session *session, xen_vbd vbd, enum xen_driver_type driver)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vbd },
- { .type = &xen_driver_type_abstract_type_,
- .u.string_val = xen_driver_type_to_string(driver) }
- };
-
- xen_call_(session, "VBD.set_driver", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
bool
xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi)
{
#include <stdlib.h>
#include "xen_common.h"
-#include "xen_driver_type_internal.h"
#include "xen_internal.h"
#include "xen_network.h"
#include "xen_vif.h"
{ .key = "uuid",
.type = &abstract_type_string,
.offset = offsetof(xen_vif_record, uuid) },
- { .key = "name",
- .type = &abstract_type_string,
- .offset = offsetof(xen_vif_record, name) },
- { .key = "type",
- .type = &xen_driver_type_abstract_type_,
- .offset = offsetof(xen_vif_record, type) },
{ .key = "device",
.type = &abstract_type_string,
.offset = offsetof(xen_vif_record, device) },
}
free(record->handle);
free(record->uuid);
- free(record->name);
free(record->device);
xen_network_record_opt_free(record->network);
xen_vm_record_opt_free(record->vm);
}
-bool
-xen_vif_get_name(xen_session *session, char **result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = abstract_type_string;
-
- *result = NULL;
- XEN_CALL_("VIF.get_name");
- return session->ok;
-}
-
-
-bool
-xen_vif_get_type(xen_session *session, enum xen_driver_type *result, xen_vif vif)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif }
- };
-
- abstract_type result_type = xen_driver_type_abstract_type_;
- XEN_CALL_("VIF.get_type");
- return session->ok;
-}
-
-
bool
xen_vif_get_device(xen_session *session, char **result, xen_vif vif)
{
}
-bool
-xen_vif_set_name(xen_session *session, xen_vif vif, char *name)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &abstract_type_string,
- .u.string_val = name }
- };
-
- xen_call_(session, "VIF.set_name", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
-bool
-xen_vif_set_type(xen_session *session, xen_vif vif, enum xen_driver_type type)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vif },
- { .type = &xen_driver_type_abstract_type_,
- .u.string_val = xen_driver_type_to_string(type) }
- };
-
- xen_call_(session, "VIF.set_type", param_values, 2, NULL, NULL);
- return session->ok;
-}
-
-
bool
xen_vif_set_device(xen_session *session, xen_vif vif, char *device)
{
#include <stdlib.h>
#include "xen_common.h"
-#include "xen_driver_type_internal.h"
#include "xen_internal.h"
#include "xen_vm.h"
#include "xen_vtpm.h"
{ .key = "backend",
.type = &abstract_type_ref,
.offset = offsetof(xen_vtpm_record, backend) },
- { .key = "driver",
- .type = &xen_driver_type_abstract_type_,
- .offset = offsetof(xen_vtpm_record, driver) },
{ .key = "instance",
.type = &abstract_type_int,
.offset = offsetof(xen_vtpm_record, instance) }
}
-bool
-xen_vtpm_get_driver(xen_session *session, enum xen_driver_type *result, xen_vtpm vtpm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vtpm }
- };
-
- abstract_type result_type = xen_driver_type_abstract_type_;
- XEN_CALL_("VTPM.get_driver");
- return session->ok;
-}
-
-
bool
xen_vtpm_get_instance(xen_session *session, int64_t *result, xen_vtpm vtpm)
{
.vm = &vm_record_opt,
.vdi = &vdi0_record_opt,
.device = "xvda1",
- .mode = XEN_VBD_MODE_RW,
- .driver = XEN_DRIVER_TYPE_PARAVIRTUALISED
+ .mode = XEN_VBD_MODE_RW
};
xen_vbd vbd0;
'device',
'bootable',
'mode',
- 'type',
- 'driver']
+ 'type']
VBD_attr_inst = VBD_attr_rw
def VBD_get_mode(self, session, vbd_ref):
return self._VBD_get(vbd_ref, 'mode')
- def VBD_get_driver(self, session, vbd_ref):
- return self._VBD_get(vbd_ref, 'driver')
-
def VBD_get_type(self, session, vbd_ref):
return self._VBD_get(vbd_ref, 'type')
VIF_attr_ro = ['io_read_kbs',
'io_write_kbs']
- VIF_attr_rw = ['name',
- 'type',
- 'device',
+ VIF_attr_rw = ['device',
'network',
'VM',
'MAC',
vm = xendom.get_vm_with_dev_uuid('vif', vif_ref)
return xen_api_success(vm.get_uuid())
- def VIF_get_name(self, session, vif_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
- 'name'))
def VIF_get_MTU(self, session, vif_ref):
xendom = XendDomain.instance()
return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
'MAC'))
- def VIF_get_type(self, session, vif_ref):
- xendom = XendDomain.instance()
- return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
- 'type'))
-
-
def VIF_get_device(self, session, vif_ref):
xendom = XendDomain.instance()
return xen_api_success(xendom.get_dev_property_by_uuid('vif', vif_ref,
'device'))
-
def VIF_get_io_read_kbs(self, session, vif_ref):
xendom = XendDomain.instance()
VTPM_attr_rw = [ ]
VTPM_attr_ro = ['VM',
'backend',
- 'instance',
- 'driver']
+ 'instance']
VTPM_attr_inst = VTPM_attr_rw
instance = -1
return xen_api_success(instance)
- def VTPM_get_driver(self, session, vtpm_ref):
- xendom = XendDomain.instance()
- vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)
- if not vm:
- return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
- cfg = vm.get_dev_xenapi_config('vtpm', vtpm_ref)
- if not cfg:
- return xen_api_error(['VTPM_HANDLE_INVALID', vtpm_ref])
- if cfg.has_key('type'):
- driver = cfg['type']
- else:
- driver = "Unknown"
- return xen_api_success(driver)
-
def VTPM_get_backend(self, session, vtpm_ref):
xendom = XendDomain.instance()
vm = xendom.get_vm_with_dev_uuid('vtpm', vtpm_ref)