2007-04-04 14:19:49 +00:00
|
|
|
/*
|
|
|
|
* xen_unified.c: Unified Xen driver.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* See COPYING.LIB for the License of this software
|
|
|
|
*
|
|
|
|
* Richard W.M. Jones <rjones@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_XEN_UNIFIED_H__
|
|
|
|
#define __VIR_XEN_UNIFIED_H__
|
|
|
|
|
|
|
|
#include "internal.h"
|
2008-07-25 13:17:27 +00:00
|
|
|
#include "capabilities.h"
|
2007-04-04 14:19:49 +00:00
|
|
|
|
2007-12-07 14:45:39 +00:00
|
|
|
#ifndef HAVE_WINSOCK2_H
|
Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c,
qemud/remote.c, src/internal.h, src/openvz_conf.c,
src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c,
src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c,
src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c,
tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c,
tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c,
tests/xmconfigtest.c, tests/xml2sexprtest.c:
Change #include <> to #include "" for local includes.
Removed many includes from src/internal.h and put them in
the C files which actually use them.
Removed <ansidecl.h> - unused.
Added a comment around __func__.
Removed a clashing redefinition of VERSION symbol.
All limits (PATH_MAX etc) now done in src/internal.h, so we
don't need to include those headers in other files.
2007-12-05 13:56:22 +00:00
|
|
|
#include <sys/un.h>
|
|
|
|
#include <netinet/in.h>
|
2007-12-07 14:45:39 +00:00
|
|
|
#else
|
|
|
|
#include <winsock2.h>
|
|
|
|
#endif
|
Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c,
qemud/remote.c, src/internal.h, src/openvz_conf.c,
src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c,
src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c,
src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c,
tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c,
tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c,
tests/xmconfigtest.c, tests/xml2sexprtest.c:
Change #include <> to #include "" for local includes.
Removed many includes from src/internal.h and put them in
the C files which actually use them.
Removed <ansidecl.h> - unused.
Added a comment around __func__.
Removed a clashing redefinition of VERSION symbol.
All limits (PATH_MAX etc) now done in src/internal.h, so we
don't need to include those headers in other files.
2007-12-05 13:56:22 +00:00
|
|
|
|
2007-04-04 14:19:49 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern int xenUnifiedRegister (void);
|
|
|
|
|
Fri Jul 6 16:08:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/proxy_internal.c, src/proxy_internal.h,
src.xen_internal.c, src/xen_internal.h,
src/xen_unified.c, src/xen_unified.h,
src/xend_internal.c, src/xend_internal.h,
src/xm_internal.c, src/xm_internal.h,
src/xs_internal.c, src/xs_internal.h: The interface
between xen_unified.c and its underlying driver now uses
a custom structure (struct xenUnifiedDriver) instead
of reusing virDriver.
* src/xen_unified.c: virDomainLookup* functions in Xen
now throw VIR_ERR_NO_DOMAIN if the domain does not exist.
* src/xs_internal.c: Fix indentation.
2007-07-06 15:11:22 +00:00
|
|
|
#define XEN_UNIFIED_HYPERVISOR_OFFSET 0
|
|
|
|
#define XEN_UNIFIED_PROXY_OFFSET 1
|
|
|
|
#define XEN_UNIFIED_XEND_OFFSET 2
|
|
|
|
#define XEN_UNIFIED_XS_OFFSET 3
|
|
|
|
#define XEN_UNIFIED_XM_OFFSET 4
|
2007-04-30 16:57:15 +00:00
|
|
|
#define XEN_UNIFIED_NR_DRIVERS 5
|
|
|
|
|
Fri Jul 6 16:08:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/proxy_internal.c, src/proxy_internal.h,
src.xen_internal.c, src/xen_internal.h,
src/xen_unified.c, src/xen_unified.h,
src/xend_internal.c, src/xend_internal.h,
src/xm_internal.c, src/xm_internal.h,
src/xs_internal.c, src/xs_internal.h: The interface
between xen_unified.c and its underlying driver now uses
a custom structure (struct xenUnifiedDriver) instead
of reusing virDriver.
* src/xen_unified.c: virDomainLookup* functions in Xen
now throw VIR_ERR_NO_DOMAIN if the domain does not exist.
* src/xs_internal.c: Fix indentation.
2007-07-06 15:11:22 +00:00
|
|
|
/* _xenUnifiedDriver:
|
|
|
|
*
|
|
|
|
* Entry points into the underlying Xen drivers. This structure
|
|
|
|
* will eventually go away and instead xen unified will make direct
|
|
|
|
* calls to the underlying Xen drivers.
|
|
|
|
*
|
|
|
|
* To reiterate - the goal is to remove elements from this structure
|
|
|
|
* until it is empty, replacing indirect calls through this
|
|
|
|
* structure with direct calls in xen_unified.c.
|
|
|
|
*/
|
|
|
|
struct xenUnifiedDriver {
|
2008-04-10 16:54:54 +00:00
|
|
|
virDrvOpen open;
|
|
|
|
virDrvClose close;
|
|
|
|
virDrvGetVersion version;
|
Fri Jul 6 16:08:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/proxy_internal.c, src/proxy_internal.h,
src.xen_internal.c, src/xen_internal.h,
src/xen_unified.c, src/xen_unified.h,
src/xend_internal.c, src/xend_internal.h,
src/xm_internal.c, src/xm_internal.h,
src/xs_internal.c, src/xs_internal.h: The interface
between xen_unified.c and its underlying driver now uses
a custom structure (struct xenUnifiedDriver) instead
of reusing virDriver.
* src/xen_unified.c: virDomainLookup* functions in Xen
now throw VIR_ERR_NO_DOMAIN if the domain does not exist.
* src/xs_internal.c: Fix indentation.
2007-07-06 15:11:22 +00:00
|
|
|
virDrvGetHostname getHostname;
|
|
|
|
virDrvGetURI getURI;
|
2008-04-10 16:54:54 +00:00
|
|
|
virDrvNodeGetInfo nodeGetInfo;
|
|
|
|
virDrvGetCapabilities getCapabilities;
|
|
|
|
virDrvListDomains listDomains;
|
|
|
|
virDrvNumOfDomains numOfDomains;
|
|
|
|
virDrvDomainCreateLinux domainCreateLinux;
|
|
|
|
virDrvDomainSuspend domainSuspend;
|
|
|
|
virDrvDomainResume domainResume;
|
|
|
|
virDrvDomainShutdown domainShutdown;
|
|
|
|
virDrvDomainReboot domainReboot;
|
|
|
|
virDrvDomainDestroy domainDestroy;
|
|
|
|
virDrvDomainGetOSType domainGetOSType;
|
|
|
|
virDrvDomainGetMaxMemory domainGetMaxMemory;
|
|
|
|
virDrvDomainSetMaxMemory domainSetMaxMemory;
|
|
|
|
virDrvDomainSetMemory domainSetMemory;
|
|
|
|
virDrvDomainGetInfo domainGetInfo;
|
|
|
|
virDrvDomainSave domainSave;
|
|
|
|
virDrvDomainRestore domainRestore;
|
|
|
|
virDrvDomainCoreDump domainCoreDump;
|
|
|
|
virDrvDomainSetVcpus domainSetVcpus;
|
|
|
|
virDrvDomainPinVcpu domainPinVcpu;
|
|
|
|
virDrvDomainGetVcpus domainGetVcpus;
|
|
|
|
virDrvDomainGetMaxVcpus domainGetMaxVcpus;
|
|
|
|
virDrvListDefinedDomains listDefinedDomains;
|
|
|
|
virDrvNumOfDefinedDomains numOfDefinedDomains;
|
|
|
|
virDrvDomainCreate domainCreate;
|
|
|
|
virDrvDomainDefineXML domainDefineXML;
|
|
|
|
virDrvDomainUndefine domainUndefine;
|
|
|
|
virDrvDomainAttachDevice domainAttachDevice;
|
|
|
|
virDrvDomainDetachDevice domainDetachDevice;
|
|
|
|
virDrvDomainGetAutostart domainGetAutostart;
|
|
|
|
virDrvDomainSetAutostart domainSetAutostart;
|
|
|
|
virDrvDomainGetSchedulerType domainGetSchedulerType;
|
|
|
|
virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
|
|
|
|
virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
|
Fri Jul 6 16:08:00 BST 2007 Richard W.M. Jones <rjones@redhat.com>
* src/proxy_internal.c, src/proxy_internal.h,
src.xen_internal.c, src/xen_internal.h,
src/xen_unified.c, src/xen_unified.h,
src/xend_internal.c, src/xend_internal.h,
src/xm_internal.c, src/xm_internal.h,
src/xs_internal.c, src/xs_internal.h: The interface
between xen_unified.c and its underlying driver now uses
a custom structure (struct xenUnifiedDriver) instead
of reusing virDriver.
* src/xen_unified.c: virDomainLookup* functions in Xen
now throw VIR_ERR_NO_DOMAIN if the domain does not exist.
* src/xs_internal.c: Fix indentation.
2007-07-06 15:11:22 +00:00
|
|
|
};
|
|
|
|
|
2007-04-04 14:19:49 +00:00
|
|
|
/* xenUnifiedPrivatePtr:
|
|
|
|
*
|
|
|
|
* Per-connection private data, stored in conn->privateData. All Xen
|
|
|
|
* low-level drivers access parts of this structure.
|
|
|
|
*/
|
|
|
|
struct _xenUnifiedPrivate {
|
2008-07-25 13:17:27 +00:00
|
|
|
virCapsPtr caps;
|
2007-04-04 14:19:49 +00:00
|
|
|
#ifdef WITH_XEN
|
|
|
|
int handle; /* Xen hypervisor handle */
|
|
|
|
|
|
|
|
int xendConfigVersion; /* XenD config version */
|
|
|
|
|
|
|
|
/* XXX This code is not IPv6 aware. */
|
|
|
|
/* connection to xend */
|
|
|
|
int type; /* PF_UNIX or PF_INET */
|
|
|
|
int len; /* length of addr */
|
|
|
|
struct sockaddr *addr; /* type of address used */
|
|
|
|
struct sockaddr_un addr_un; /* the unix address */
|
|
|
|
struct sockaddr_in addr_in; /* the inet address */
|
|
|
|
|
|
|
|
struct xs_handle *xshandle; /* handle to talk to the xenstore */
|
|
|
|
#endif /* WITH_XEN */
|
|
|
|
|
|
|
|
int proxy; /* fd of proxy. */
|
2007-04-30 16:57:15 +00:00
|
|
|
|
|
|
|
/* Keep track of the drivers which opened. We keep a yes/no flag
|
|
|
|
* here for each driver, corresponding to the array drivers in
|
|
|
|
* xen_unified.c.
|
|
|
|
*/
|
|
|
|
int opened[XEN_UNIFIED_NR_DRIVERS];
|
2007-04-04 14:19:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _xenUnifiedPrivate *xenUnifiedPrivatePtr;
|
|
|
|
|
2007-10-22 20:28:55 +00:00
|
|
|
|
|
|
|
int xenNbCells(virConnectPtr conn);
|
|
|
|
int xenNbCpus(virConnectPtr conn);
|
2007-10-31 09:39:13 +00:00
|
|
|
char *xenDomainUsedCpus(virDomainPtr dom);
|
2007-04-04 14:19:49 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __VIR_XEN_UNIFIED_H__ */
|