+Wed Jun 21 13:02:30 EDT 2006 Daniel Veillard <veillard@redhat.com>
+
+ * src/driver.h src/libvirt.c src/test.c src/xen_internal.c
+ src/xend_internal.c src/xs_internal.c: add driver numbers and
+ tweak a bit suspend/resume/destroy operation to avoid doing
+ them directly though the hypervisor if other succeeded first.
+
Wed Jun 21 12:23:15 EDT 2006 Daniel Veillard <veillard@redhat.com>
* src/xen_internal.c: try to autodetect the Xen hypervisor version
extern "C" {
#endif
+/*
+ * List of registered drivers numbers
+ */
+typedef enum {
+ VIR_DRV_XEN_HYPERVISOR = 1,
+ VIR_DRV_XEN_STORE = 2,
+ VIR_DRV_XEN_DAEMON = 3,
+ VIR_DRV_TEST = 4
+} virDrvNo;
+
+
typedef enum {
VIR_DRV_OPEN_QUIET = 1,
VIR_DRV_OPEN_RO = 2
* entry points for it.
*/
struct _virDriver {
- const char *name;
- unsigned long ver;
+ int no; /* the number virDrvNo */
+ const char * name; /* the name of the driver */
+ unsigned long ver; /* the version of the backend */
virDrvInit init;
virDrvOpen open;
virDrvClose close;
return (-1);
#endif
- /* Go though the driver registered entry points */
+ /*
+ * Go though the driver registered entry points but use the
+ * XEN_HYPERVISOR directly only as a last mechanism
+ */
for (i = 0;i < conn->nb_drivers;i++) {
if ((conn->drivers[i] != NULL) &&
+ (conn->drivers[i]->no != VIR_DRV_XEN_HYPERVISOR) &&
+ (conn->drivers[i]->domainDestroy != NULL)) {
+ if (conn->drivers[i]->domainDestroy(domain) == 0)
+ ret = 0;
+ }
+ }
+ for (i = 0;i < conn->nb_drivers;i++) {
+ if ((conn->drivers[i] != NULL) &&
+ (conn->drivers[i]->no == VIR_DRV_XEN_HYPERVISOR) &&
(conn->drivers[i]->domainDestroy != NULL)) {
if (conn->drivers[i]->domainDestroy(domain) == 0)
ret = 0;
return (-1);
#endif
- /* Go though the driver registered entry points */
+ /*
+ * Go though the driver registered entry points but use the
+ * XEN_HYPERVISOR directly only as a last mechanism
+ */
+ for (i = 0;i < conn->nb_drivers;i++) {
+ if ((conn->drivers[i] != NULL) &&
+ (conn->drivers[i]->no != VIR_DRV_XEN_HYPERVISOR) &&
+ (conn->drivers[i]->domainSuspend != NULL)) {
+ if (conn->drivers[i]->domainSuspend(domain) == 0)
+ ret = 0;
+ }
+ }
for (i = 0;i < conn->nb_drivers;i++) {
if ((conn->drivers[i] != NULL) &&
+ (conn->drivers[i]->no == VIR_DRV_XEN_HYPERVISOR) &&
(conn->drivers[i]->domainSuspend != NULL)) {
if (conn->drivers[i]->domainSuspend(domain) == 0)
ret = 0;
return (-1);
#endif
- /* Go though the driver registered entry points */
+ /*
+ * Go though the driver registered entry points but use the
+ * XEN_HYPERVISOR directly only as a last mechanism
+ */
+ for (i = 0;i < conn->nb_drivers;i++) {
+ if ((conn->drivers[i] != NULL) &&
+ (conn->drivers[i]->no != VIR_DRV_XEN_HYPERVISOR) &&
+ (conn->drivers[i]->domainResume != NULL)) {
+ if (conn->drivers[i]->domainResume(domain) == 0)
+ return(0);
+ }
+ }
for (i = 0;i < conn->nb_drivers;i++) {
if ((conn->drivers[i] != NULL) &&
+ (conn->drivers[i]->no == VIR_DRV_XEN_HYPERVISOR) &&
(conn->drivers[i]->domainResume != NULL)) {
if (conn->drivers[i]->domainResume(domain) == 0)
return(0);
#include "test.h"
static virDriver testDriver = {
+ VIR_DRV_TEST,
"Test",
LIBVIR_VERSION_NUMBER,
NULL, /* init */
static int xenHypervisorInit(void);
static virDriver xenHypervisorDriver = {
+ VIR_DRV_XEN_HYPERVISOR,
"Xen",
(DOM0_INTERFACE_VERSION >> 24) * 1000000 +
((DOM0_INTERFACE_VERSION >> 16) & 0xFF) * 1000 +
ret = ioctl(fd, cmd, (unsigned long) &hc);
if ((ret != -1) && (ret != 0)) {
- fprintf(stderr, "Using new hypervisor call: %X\n", ret);
+ /* fprintf(stderr, "Using new hypervisor call: %X\n", ret); */
hv_version = ret;
xen_ioctl_hypercall_cmd = cmd;
old_hypervisor = 0;
cmd = _IOC(_IOC_NONE, 'P', 0, sizeof(old_hypercall_t));
ret = ioctl(fd, cmd, (unsigned long) &old_hc);
if ((ret != -1) && (ret != 0)) {
- fprintf(stderr, "Using old hypervisor call: %X\n", ret);
+ /* fprintf(stderr, "Using old hypervisor call: %X\n", ret); */
hv_version = ret;
xen_ioctl_hypercall_cmd = cmd;
old_hypervisor = 1;
unsigned int flags);
static virDriver xenDaemonDriver = {
+ VIR_DRV_XEN_DAEMON,
"XenDaemon",
(DOM0_INTERFACE_VERSION >> 24) * 1000000 +
((DOM0_INTERFACE_VERSION >> 16) & 0xFF) * 1000 +
#define XEN_HYPERVISOR_SOCKET "/proc/xen/privcmd"
static virDriver xenStoreDriver = {
+ VIR_DRV_XEN_STORE,
"XenStore",
(DOM0_INTERFACE_VERSION >> 24) * 1000000 +
((DOM0_INTERFACE_VERSION >> 16) & 0xFF) * 1000 +