2006-03-23 15:42:10 +00:00
|
|
|
/*
|
|
|
|
* xs_internal.h: internal API for access to XenStore
|
|
|
|
*
|
xml: use long long internally, to centralize overflow checks
On 64-bit platforms, unsigned long and unsigned long long are
identical, so we don't have to worry about overflow checks.
On 32-bit platforms, anywhere we narrow unsigned long long back
to unsigned long, we have to worry about overflow; it's easier
to do this in one place by having most of the code use the same
or wider types, and only doing the narrowing at the last minute.
Therefore, the memory set commands remain unsigned long, and
the memory get command now centralizes the overflow check into
libvirt.c, so that drivers don't have to repeat the work.
This also fixes a bug where xen returned the wrong value on
failure (most APIs return -1 on failure, but getMaxMemory
must return 0 on failure).
* src/driver.h (virDrvDomainGetMaxMemory): Use long long.
* src/libvirt.c (virDomainGetMaxMemory): Raise overflow.
* src/test/test_driver.c (testGetMaxMemory): Fix driver.
* src/rpc/gendispatch.pl (name_to_ProcName): Likewise.
* src/xen/xen_hypervisor.c (xenHypervisorGetMaxMemory): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainGetMaxMemory): Likewise.
* src/xen/xend_internal.c (xenDaemonDomainGetMaxMemory):
Likewise.
* src/xen/xend_internal.h (xenDaemonDomainGetMaxMemory):
Likewise.
* src/xen/xm_internal.c (xenXMDomainGetMaxMemory): Likewise.
* src/xen/xm_internal.h (xenXMDomainGetMaxMemory): Likewise.
* src/xen/xs_internal.c (xenStoreDomainGetMaxMemory): Likewise.
* src/xen/xs_internal.h (xenStoreDomainGetMaxMemory): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDomainGetMaxMemory):
Likewise.
* src/esx/esx_driver.c (esxDomainGetMaxMemory): Likewise.
* src/libxl/libxl_driver.c (libxlDomainGetMaxMemory): Likewise.
* src/qemu/qemu_driver.c (qemudDomainGetMaxMemory): Likewise.
* src/lxc/lxc_driver.c (lxcDomainGetMaxMemory): Likewise.
* src/uml/uml_driver.c (umlDomainGetMaxMemory): Likewise.
2012-03-03 00:47:16 +00:00
|
|
|
* Copyright (C) 2006, 2010-2012 Red Hat, Inc.
|
2006-03-23 15:42:10 +00:00
|
|
|
*
|
2012-07-27 09:39:53 +00:00
|
|
|
* 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, see
|
|
|
|
* <http://www.gnu.org/licenses/>.
|
2006-03-23 15:42:10 +00:00
|
|
|
*
|
|
|
|
* Daniel Veillard <veillard@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __VIR_XS_INTERNAL_H__
|
2010-03-09 18:22:22 +00:00
|
|
|
# define __VIR_XS_INTERNAL_H__
|
2006-03-23 15:42:10 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
|
|
|
# include "driver.h"
|
2007-08-10 18:25:15 +00:00
|
|
|
|
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
|
|
|
extern struct xenUnifiedDriver xenStoreDriver;
|
2007-04-04 14:19:49 +00:00
|
|
|
int xenStoreInit (void);
|
|
|
|
|
2008-12-17 21:26:16 +00:00
|
|
|
virDrvOpenStatus xenStoreOpen (virConnectPtr conn,
|
2008-04-10 16:54:54 +00:00
|
|
|
virConnectAuthPtr auth,
|
2011-07-06 20:40:19 +00:00
|
|
|
unsigned int flags);
|
2006-04-03 13:46:43 +00:00
|
|
|
int xenStoreClose (virConnectPtr conn);
|
|
|
|
int xenStoreGetDomainInfo (virDomainPtr domain,
|
2008-04-10 16:54:54 +00:00
|
|
|
virDomainInfoPtr info);
|
2011-05-02 09:35:29 +00:00
|
|
|
int xenStoreDomainGetState (virDomainPtr domain,
|
|
|
|
int *state,
|
|
|
|
int *reason,
|
|
|
|
unsigned int flags);
|
2006-04-03 13:46:43 +00:00
|
|
|
int xenStoreNumOfDomains (virConnectPtr conn);
|
2010-12-21 15:58:03 +00:00
|
|
|
int xenStoreListDomains (virConnectPtr conn,
|
2008-04-10 16:54:54 +00:00
|
|
|
int *ids,
|
|
|
|
int maxids);
|
2010-12-21 15:58:03 +00:00
|
|
|
virDomainPtr xenStoreLookupByName(virConnectPtr conn,
|
2008-04-10 16:54:54 +00:00
|
|
|
const char *name);
|
2010-12-21 15:58:03 +00:00
|
|
|
unsigned long xenStoreGetMaxMemory (virDomainPtr domain);
|
2006-04-13 17:18:49 +00:00
|
|
|
int xenStoreDomainSetMemory (virDomainPtr domain,
|
2008-04-10 16:54:54 +00:00
|
|
|
unsigned long memory);
|
xml: use long long internally, to centralize overflow checks
On 64-bit platforms, unsigned long and unsigned long long are
identical, so we don't have to worry about overflow checks.
On 32-bit platforms, anywhere we narrow unsigned long long back
to unsigned long, we have to worry about overflow; it's easier
to do this in one place by having most of the code use the same
or wider types, and only doing the narrowing at the last minute.
Therefore, the memory set commands remain unsigned long, and
the memory get command now centralizes the overflow check into
libvirt.c, so that drivers don't have to repeat the work.
This also fixes a bug where xen returned the wrong value on
failure (most APIs return -1 on failure, but getMaxMemory
must return 0 on failure).
* src/driver.h (virDrvDomainGetMaxMemory): Use long long.
* src/libvirt.c (virDomainGetMaxMemory): Raise overflow.
* src/test/test_driver.c (testGetMaxMemory): Fix driver.
* src/rpc/gendispatch.pl (name_to_ProcName): Likewise.
* src/xen/xen_hypervisor.c (xenHypervisorGetMaxMemory): Likewise.
* src/xen/xen_driver.c (xenUnifiedDomainGetMaxMemory): Likewise.
* src/xen/xend_internal.c (xenDaemonDomainGetMaxMemory):
Likewise.
* src/xen/xend_internal.h (xenDaemonDomainGetMaxMemory):
Likewise.
* src/xen/xm_internal.c (xenXMDomainGetMaxMemory): Likewise.
* src/xen/xm_internal.h (xenXMDomainGetMaxMemory): Likewise.
* src/xen/xs_internal.c (xenStoreDomainGetMaxMemory): Likewise.
* src/xen/xs_internal.h (xenStoreDomainGetMaxMemory): Likewise.
* src/xenapi/xenapi_driver.c (xenapiDomainGetMaxMemory):
Likewise.
* src/esx/esx_driver.c (esxDomainGetMaxMemory): Likewise.
* src/libxl/libxl_driver.c (libxlDomainGetMaxMemory): Likewise.
* src/qemu/qemu_driver.c (qemudDomainGetMaxMemory): Likewise.
* src/lxc/lxc_driver.c (lxcDomainGetMaxMemory): Likewise.
* src/uml/uml_driver.c (umlDomainGetMaxMemory): Likewise.
2012-03-03 00:47:16 +00:00
|
|
|
unsigned long long xenStoreDomainGetMaxMemory(virDomainPtr domain);
|
2010-12-21 15:58:03 +00:00
|
|
|
int xenStoreDomainShutdown (virDomainPtr domain);
|
|
|
|
int xenStoreDomainReboot (virDomainPtr domain,
|
2008-04-10 16:54:54 +00:00
|
|
|
unsigned int flags);
|
2006-08-09 15:21:16 +00:00
|
|
|
|
2006-11-07 16:28:16 +00:00
|
|
|
int xenStoreDomainGetVNCPort(virConnectPtr conn,
|
2008-04-10 16:54:54 +00:00
|
|
|
int domid);
|
2006-11-07 16:28:16 +00:00
|
|
|
char * xenStoreDomainGetConsolePath(virConnectPtr conn,
|
2008-04-10 16:54:54 +00:00
|
|
|
int domid);
|
2012-01-03 22:39:59 +00:00
|
|
|
char * xenStoreDomainGetSerialConsolePath(virConnectPtr conn,
|
|
|
|
int domid);
|
2006-11-20 16:42:16 +00:00
|
|
|
char * xenStoreDomainGetNetworkID(virConnectPtr conn,
|
2008-04-10 16:54:54 +00:00
|
|
|
int id,
|
|
|
|
const char *mac);
|
2007-11-06 11:49:01 +00:00
|
|
|
char * xenStoreDomainGetDiskID(virConnectPtr conn,
|
2008-04-10 16:54:54 +00:00
|
|
|
int id,
|
|
|
|
const char *dev);
|
2009-12-22 09:53:51 +00:00
|
|
|
char * xenStoreDomainGetPCIID(virConnectPtr conn,
|
|
|
|
int domid,
|
|
|
|
const char *bdf);
|
2007-08-10 18:25:15 +00:00
|
|
|
char * xenStoreDomainGetName(virConnectPtr conn,
|
2008-04-10 16:54:54 +00:00
|
|
|
int id);
|
2008-11-25 10:44:52 +00:00
|
|
|
int xenStoreDomainGetUUID(virConnectPtr conn,
|
|
|
|
int id,
|
|
|
|
unsigned char *uuid);
|
2006-08-08 20:14:40 +00:00
|
|
|
|
2008-11-25 10:44:52 +00:00
|
|
|
typedef int (*xenStoreWatchCallback)(virConnectPtr conn,
|
|
|
|
const char *path,
|
|
|
|
const char *token,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
struct _xenStoreWatch {
|
|
|
|
char *path;
|
|
|
|
char *token;
|
|
|
|
xenStoreWatchCallback cb;
|
|
|
|
void *opaque;
|
|
|
|
};
|
|
|
|
typedef struct _xenStoreWatch xenStoreWatch;
|
|
|
|
typedef xenStoreWatch *xenStoreWatchPtr;
|
|
|
|
|
|
|
|
struct _xenStoreWatchList {
|
|
|
|
unsigned int count;
|
|
|
|
xenStoreWatchPtr *watches;
|
|
|
|
};
|
|
|
|
typedef struct _xenStoreWatchList xenStoreWatchList;
|
|
|
|
typedef xenStoreWatchList *xenStoreWatchListPtr;
|
|
|
|
|
|
|
|
|
|
|
|
int xenStoreAddWatch(virConnectPtr conn,
|
|
|
|
const char *path,
|
|
|
|
const char *token,
|
|
|
|
xenStoreWatchCallback cb,
|
|
|
|
void *opaque);
|
|
|
|
int xenStoreRemoveWatch(virConnectPtr conn,
|
|
|
|
const char *path,
|
|
|
|
const char *token);
|
|
|
|
|
|
|
|
/* domain events */
|
|
|
|
int xenStoreDomainIntroduced(virConnectPtr conn,
|
|
|
|
const char *path,
|
|
|
|
const char *token,
|
|
|
|
void *opaque);
|
|
|
|
int xenStoreDomainReleased(virConnectPtr conn,
|
|
|
|
const char *path,
|
|
|
|
const char *token,
|
|
|
|
void *opaque);
|
|
|
|
|
|
|
|
int xenStoreDomainEventEmitted(virDomainEventType evt);
|
2006-03-23 15:42:10 +00:00
|
|
|
#endif /* __VIR_XS_INTERNAL_H__ */
|