2006-01-12 15:38:07 +00:00
|
|
|
/*
|
2008-07-25 13:17:27 +00:00
|
|
|
* xend_internal.h
|
2006-01-12 15:38:07 +00:00
|
|
|
*
|
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-2008, 2010-2012 Red Hat, Inc.
|
2006-03-22 13:44:01 +00:00
|
|
|
* Copyright (C) 2005,2006
|
2006-01-12 15:38:07 +00:00
|
|
|
*
|
|
|
|
* Anthony Liguori <aliguori@us.ibm.com>
|
2006-03-22 13:44:01 +00:00
|
|
|
* Daniel Veillard <veillard@redhat.com>
|
2006-01-12 15:38:07 +00:00
|
|
|
*
|
2008-07-25 13:17:27 +00:00
|
|
|
*
|
2006-01-12 15:38:07 +00:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser General
|
|
|
|
* Public License. See the file COPYING in the main directory of this archive
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
2008-07-25 13:17:27 +00:00
|
|
|
#ifndef __XEND_INTERNAL_H_
|
2010-03-09 18:22:22 +00:00
|
|
|
# define __XEND_INTERNAL_H_
|
2006-01-12 15:38:07 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include <sys/types.h>
|
|
|
|
# include <stdint.h>
|
2006-01-12 15:38:07 +00:00
|
|
|
|
2010-03-09 18:22:22 +00:00
|
|
|
# include "internal.h"
|
|
|
|
# include "capabilities.h"
|
|
|
|
# include "domain_conf.h"
|
|
|
|
# include "driver.h"
|
2012-12-04 12:04:07 +00:00
|
|
|
# include "virbuffer.h"
|
2012-02-24 18:48:55 +00:00
|
|
|
# include "viruri.h"
|
2006-01-13 16:41:01 +00:00
|
|
|
|
2008-07-25 09:51:23 +00:00
|
|
|
int
|
|
|
|
xenDaemonOpen_unix(virConnectPtr conn, const char *path);
|
2006-01-12 15:38:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Blocks until a domain's devices are initialized
|
|
|
|
* \param xend A xend instance
|
|
|
|
* \param name The domain's name
|
|
|
|
* \return 0 for success; -1 (with errno) on error
|
2008-02-05 19:27:37 +00:00
|
|
|
*
|
2006-01-12 15:38:07 +00:00
|
|
|
* xen_create() returns after a domain has been allocated including
|
2011-07-20 22:53:31 +00:00
|
|
|
* its memory. This does not guarantee, though, that the devices
|
2006-01-12 15:38:07 +00:00
|
|
|
* have come up properly. For instance, if you create a VBD with an
|
|
|
|
* invalid filename, the error won't occur until after this function
|
|
|
|
* returns.
|
|
|
|
*/
|
2006-03-15 12:13:25 +00:00
|
|
|
int xend_wait_for_devices(virConnectPtr xend, const char *name);
|
2006-01-12 15:38:07 +00:00
|
|
|
|
|
|
|
|
2006-02-16 22:50:52 +00:00
|
|
|
/**
|
|
|
|
* \brief Create a new domain
|
|
|
|
* \param xend A xend instance
|
|
|
|
* \param sexpr An S-Expr defining the domain
|
|
|
|
* \return 0 for success; -1 (with errno) on error
|
|
|
|
*
|
|
|
|
* This method will create a domain based the passed in description. The
|
|
|
|
* domain will be paused after creation and must be unpaused with
|
2006-03-22 13:44:01 +00:00
|
|
|
* xenDaemonResumeDomain() to begin execution.
|
2006-02-16 22:50:52 +00:00
|
|
|
*/
|
2008-10-10 09:32:27 +00:00
|
|
|
int xenDaemonDomainCreateXML(virConnectPtr xend, const char *sexpr);
|
2006-01-12 15:38:07 +00:00
|
|
|
|
2006-01-19 10:23:15 +00:00
|
|
|
/**
|
|
|
|
* \brief Lookup the id of a domain
|
|
|
|
* \param xend A xend instance
|
|
|
|
* \param name The name of the domain
|
2006-02-23 10:13:55 +00:00
|
|
|
* \param uuid pointer to store a copy of the uuid
|
2006-01-19 10:23:15 +00:00
|
|
|
* \return the id number on success; -1 (with errno) on error
|
|
|
|
*
|
2006-02-23 10:13:55 +00:00
|
|
|
* This method looks up the ids of a domain
|
2006-01-19 10:23:15 +00:00
|
|
|
*/
|
2006-04-13 17:18:49 +00:00
|
|
|
int xenDaemonDomainLookupByName_ids(virConnectPtr xend,
|
2006-03-15 12:13:25 +00:00
|
|
|
const char *name, unsigned char *uuid);
|
2006-01-19 10:23:15 +00:00
|
|
|
|
2006-01-17 16:56:17 +00:00
|
|
|
|
2006-07-07 18:58:35 +00:00
|
|
|
|
2008-07-25 13:17:27 +00:00
|
|
|
virDomainDefPtr
|
|
|
|
xenDaemonDomainFetch(virConnectPtr xend,
|
|
|
|
int domid,
|
|
|
|
const char *name,
|
|
|
|
const char *cpus);
|
2006-12-14 01:56:14 +00:00
|
|
|
|
2008-07-25 13:50:08 +00:00
|
|
|
|
2008-05-07 14:04:40 +00:00
|
|
|
int is_sound_model_valid(const char *model);
|
|
|
|
int is_sound_model_conflict(const char *model, const char *soundstr);
|
|
|
|
|
|
|
|
|
2006-03-22 13:44:01 +00:00
|
|
|
/* refactored ones */
|
2013-04-30 13:41:48 +00:00
|
|
|
int xenDaemonOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|
|
|
unsigned int flags);
|
2006-03-22 13:44:01 +00:00
|
|
|
int xenDaemonClose(virConnectPtr conn);
|
2006-07-03 11:12:12 +00:00
|
|
|
int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
|
2008-02-27 04:35:08 +00:00
|
|
|
int xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps);
|
2006-03-22 13:44:01 +00:00
|
|
|
int xenDaemonDomainSuspend(virDomainPtr domain);
|
|
|
|
int xenDaemonDomainResume(virDomainPtr domain);
|
|
|
|
int xenDaemonDomainShutdown(virDomainPtr domain);
|
2013-04-30 14:38:32 +00:00
|
|
|
int xenDaemonDomainReboot(virDomainPtr domain);
|
2013-04-30 14:41:52 +00:00
|
|
|
int xenDaemonDomainDestroy(virDomainPtr domain);
|
2006-03-22 13:44:01 +00:00
|
|
|
int xenDaemonDomainSave(virDomainPtr domain, const char *filename);
|
2011-07-21 21:11:32 +00:00
|
|
|
int xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename,
|
|
|
|
unsigned int flags);
|
2006-03-22 13:44:01 +00:00
|
|
|
int xenDaemonDomainRestore(virConnectPtr conn, const char *filename);
|
2006-04-13 17:18:49 +00:00
|
|
|
int xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory);
|
2006-03-22 13:44:01 +00:00
|
|
|
int xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
|
|
|
|
int xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info);
|
2011-05-02 09:35:29 +00:00
|
|
|
int xenDaemonDomainGetState(virDomainPtr domain,
|
|
|
|
int *state,
|
|
|
|
int *reason,
|
|
|
|
unsigned int flags);
|
xen: reject unknown flags
Also fix a logic bug in xenXMDomain{Attach,Detach}DeviceFlags,
where (flags & VIR_DOMAIN_DEVICE_MODIFY_CURRENT) is always false.
* src/xen/xen_driver.c (xenUnifiedDomainXMLFromNative)
(xenUnifiedDomainXMLToNative, xenUnifiedDomainBlockPeek): Reject
unknown flags.
* src/xen/xen_hypervisor.c (xenHypervisorOpen)
(xenHypervisorGetDomainState): Likewise.
* src/xen/xen_inotify.c (xenInotifyOpen): Likewise.
* src/xen/xs_internal.c (xenStoreOpen, xenStoreDomainGetState)
(xenStoreDomainReboot): Likewise.
* src/xen/xend_internal.c (xenDaemonOpen, xenDaemonDomainReboot)
(xenDaemonDomainCoreDump, xenDaemonDomainGetState)
(xenDaemonDomainMigratePrepare, xenDaemonDomainSetVcpusFlags,
xenDaemonDomainGetVcpusFlags, xenDaemonAttachDeviceFlags,
xenDaemonDetachDeviceFlags): Likewise.
(xenDaemonDomainGetXMLDesc): Prefer unsigned flags.
* src/xen/xend_internal.h (xenDaemonDomainGetXMLDesc): Likewise.
* src/xen/xm_internal.h (xenXMDomainGetXMLDesc): Likewise.
* src/xen/xm_internal.c (xenXMDomainGetXMLDesc): Likewise.
(xenXMOpen, xenXMDomainGetState, xenXMDomainSetVcpusFlags)
(xenXMDomainGetVcpusFlags): Reject unknown flags.
(xenXMDomainAttachDeviceFlags, xenXMDomainDetachDeviceFlags):
Likewise, and avoid always-false conditional.
* src/xen/xen_driver.h (XEN_MIGRATION_FLAGS): New define.
2011-07-06 23:15:33 +00:00
|
|
|
char *xenDaemonDomainGetXMLDesc(virDomainPtr domain, unsigned int flags,
|
|
|
|
const char *cpus);
|
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 xenDaemonDomainGetMaxMemory(virDomainPtr domain);
|
2006-06-29 23:53:31 +00:00
|
|
|
char **xenDaemonListDomainsOld(virConnectPtr xend);
|
2006-03-22 13:44:01 +00:00
|
|
|
|
2013-04-30 15:04:36 +00:00
|
|
|
char *xenDaemonDomainGetOSType(virDomainPtr domain);
|
|
|
|
|
2006-12-14 01:56:14 +00:00
|
|
|
virDomainPtr xenDaemonDomainDefineXML(virConnectPtr xend, const char *sexpr);
|
|
|
|
int xenDaemonDomainCreate(virDomainPtr domain);
|
|
|
|
int xenDaemonDomainUndefine(virDomainPtr domain);
|
|
|
|
|
2006-08-04 10:41:05 +00:00
|
|
|
int xenDaemonDomainSetVcpus (virDomainPtr domain,
|
2008-04-10 16:54:54 +00:00
|
|
|
unsigned int vcpus);
|
2010-10-14 22:17:18 +00:00
|
|
|
int xenDaemonDomainSetVcpusFlags (virDomainPtr domain,
|
|
|
|
unsigned int vcpus,
|
|
|
|
unsigned int flags);
|
2006-08-04 10:41:05 +00:00
|
|
|
int xenDaemonDomainPinVcpu (virDomainPtr domain,
|
2008-04-10 16:54:54 +00:00
|
|
|
unsigned int vcpu,
|
|
|
|
unsigned char *cpumap,
|
|
|
|
int maplen);
|
2010-10-06 23:54:41 +00:00
|
|
|
int xenDaemonDomainGetVcpusFlags (virDomainPtr domain,
|
|
|
|
unsigned int flags);
|
2006-08-04 10:41:05 +00:00
|
|
|
int xenDaemonDomainGetVcpus (virDomainPtr domain,
|
2008-04-10 16:54:54 +00:00
|
|
|
virVcpuInfoPtr info,
|
|
|
|
int maxinfo,
|
|
|
|
unsigned char *cpumaps,
|
|
|
|
int maplen);
|
2011-07-21 21:11:32 +00:00
|
|
|
int xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
|
|
|
|
unsigned int flags);
|
2008-05-09 08:17:18 +00:00
|
|
|
int xenDaemonDomainGetAutostart (virDomainPtr dom,
|
|
|
|
int *autostart);
|
|
|
|
int xenDaemonDomainSetAutostart (virDomainPtr domain,
|
|
|
|
int autostart);
|
2006-08-04 10:41:05 +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
|
|
|
/* xen_unified calls through here. */
|
|
|
|
extern struct xenUnifiedDriver xenDaemonDriver;
|
|
|
|
int xenDaemonInit (void);
|
|
|
|
|
2013-04-30 14:01:22 +00:00
|
|
|
virDomainPtr xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc);
|
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
|
|
|
virDomainPtr xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid);
|
|
|
|
virDomainPtr xenDaemonLookupByName(virConnectPtr conn, const char *domname);
|
2007-08-21 09:31:12 +00:00
|
|
|
int xenDaemonDomainMigratePrepare (virConnectPtr dconn, char **cookie, int *cookielen, const char *uri_in, char **uri_out, unsigned long flags, const char *dname, unsigned long resource);
|
|
|
|
int xenDaemonDomainMigratePerform (virDomainPtr domain, const char *cookie, int cookielen, const char *uri, unsigned long flags, const char *dname, unsigned long resource);
|
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
|
|
|
|
virDomainBlockPeek call
* configure.in: Document AC_SYS_LARGEFILE.
* docs/hvsupport.html.in: Document HV support for virDomainBlockPeek.
* include/libvirt/libvirt.h.in, src/driver.h, src/libvirt.c,
src/libvirt_sym.version: Add virDomainBlockPeek infrastructure.
* src/qemu_driver.c, src/test.c: Null versions of this call.
* src/xen_unified.c, src/xend_internal.c, src/xend_internal.h,
src/xm_internal.c, src/xm_internal.h: Xen implementation.
* tests/sexpr2xmldata/sexpr2xml-curmem.xml,
tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml: XML output
has been reordered slightly in the Xen driver, but should be
functionally the same.
2008-06-05 13:17:45 +00:00
|
|
|
int xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path, unsigned long long offset, size_t size, void *buffer);
|
|
|
|
|
2008-07-25 13:17:27 +00:00
|
|
|
#endif /* __XEND_INTERNAL_H_ */
|