xend_internal.h 7.6 KB
Newer Older
1 2 3
/*
 * libxend/xend.h -- Xend library
 *
4
 * Copyright (C) 2005,2006
5 6
 *
 *      Anthony Liguori <aliguori@us.ibm.com>
7
 *	Daniel Veillard <veillard@redhat.com>
8 9 10 11 12 13 14 15 16 17 18 19 20
 *
 *  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.
 */

#ifndef _LIBXEND_XEND_H_
#define _LIBXEND_XEND_H_

#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>

21
#include "libvirt/libvirt.h"
22
#include "buf.h"
23

24 25 26 27 28 29
#ifdef __cplusplus
extern "C" {
#endif


/**
30
 * \brief Setup the connection to a xend instance via TCP
31 32
 * \param host The host name to connect to
 * \param port The port number to connect to
33
 * \return 0 in case of success, -1 in case of error
34 35 36 37 38
 * 
 * This method creates a new Xend instance via TCP.
 *
 * This function may not fail if Xend is not running.
 *
39
 * Make sure to call xenDaemonClose().
40
 */
41
int xenDaemonOpen_tcp(virConnectPtr xend, const char *host, int port);
42 43

/**
44
 * \brief Setup the connection to xend instance via a Unix domain socket
45
 * \param path The path to the domain socket
46
 * \return 0 in case of success, -1 in case of error
47 48 49 50 51
 * 
 * This method creates a new xend instance via a Unix domain socket.
 *
 * This function may not fail if Xend is not running.
 *
52
 * Make sure to call xenDaemonClose().
53
 */
54
int xenDaemonOpen_unix(virConnectPtr xend, const char *path);
55 56 57 58 59 60 61 62 63 64 65 66 67 68


/**
 * \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
 * 
 * xen_create() returns after a domain has been allocated including
 * its memory.  This does not guarentee, though, that the devices
 * 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.
 */
69
    int xend_wait_for_devices(virConnectPtr xend, const char *name);
70 71


72 73 74 75 76 77 78 79
/**
 * \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
80
 * xenDaemonResumeDomain() to begin execution.
81
 */
82
    int xenDaemonDomainCreateLinux(virConnectPtr xend, const char *sexpr);
83

84 85 86 87
/**
 * \brief Lookup the id of a domain
 * \param xend A xend instance
 * \param name The name of the domain
88
 * \param uuid pointer to store a copy of the uuid
89 90
 * \return the id number on success; -1 (with errno) on error
 *
91
 * This method looks up the ids of a domain
92
 */
93
int xenDaemonDomainLookupByName_ids(virConnectPtr xend,
94
                            const char *name, unsigned char *uuid);
95

96

97 98 99 100 101 102 103 104 105 106 107 108 109 110
/**
 * \brief Lookup the name of a domain
 * \param xend A xend instance
 * \param id The id of the domain
 * \param name pointer to store a copy of the name
 * \param uuid pointer to store a copy of the uuid
 *
 * This method looks up the name/uuid of a domain
 */
int xenDaemonDomainLookupByID(virConnectPtr xend,
			      int id,
			      char **name, unsigned char *uuid);


111
char *xenDaemonDomainDumpXMLByID(virConnectPtr xend,
112
				 int domid,
113 114
				 int flags,
				 const char *cpus);
115

116
char *xenDaemonDomainDumpXMLByName(virConnectPtr xend,
117
				   const char *name,
118 119
				   int flags,
				   const char *cpus);
120

121 122 123 124 125 126 127 128
/**
 * \brief Lookup information about the host machine
 * \param xend A xend instance
 * \return node info on success; NULL (with errno) on error
 *
 * This method returns information about the physical host
 * machine running Xen.
 */
129
    struct xend_node *xend_get_node(virConnectPtr xend);
130 131 132 133 134 135 136 137

/**
 * \brief Shutdown physical host machine
 * \param xend A xend instance
 * \return 0 on success; -1 (with errno) on error
 *
 * This method shuts down the physical machine running Xen.
 */
138
    int xend_node_shutdown(virConnectPtr xend);
139 140 141 142 143 144 145 146

/**
 * \brief Restarts physical host machine
 * \param xend A xend instance
 * \return 0 on success; -1 (with errno) on error
 *
 * This method restarts the physical machine running Xen.
 */
147
    int xend_node_restart(virConnectPtr xend);
148 149 150 151 152 153 154 155 156 157 158

/**
 * \brief Return hypervisor debugging messages
 * \param xend A xend instance
 * \param buffer A buffer to hold the messages
 * \param n_buffer Size of buffer (including null terminator)
 * \return 0 on success; -1 (with errno) on error
 *
 * This function will place the debugging messages from the
 * hypervisor into a buffer with a null terminator.
 */
159
    int xend_dmesg(virConnectPtr xend, char *buffer, size_t n_buffer);
160 161 162 163 164 165 166 167 168

/**
 * \brief Clear the hypervisor debugging messages
 * \param xend A xend instance
 * \return 0 on success; -1 (with errno) on error
 *
 * This function will clear the debugging message ring queue
 * in the hypervisor.
 */
169
    int xend_dmesg_clear(virConnectPtr xend);
170 171 172 173 174 175 176 177 178 179 180

/**
 * \brief Obtain the Xend log messages
 * \param xend A xend instance
 * \param buffer The buffer to hold the messages
 * \param n_buffer Size of buffer (including null terminator)
 * \return 0 on success; -1 (with errno) on error
 *
 * This function will place the Xend debugging messages into
 * a buffer with a null terminator.
 */
181
    int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer);
182

183
  char *xend_parse_domain_sexp(virConnectPtr conn,  char *root, int xendConfigVersion);
184

185
/* refactored ones */
186
int xenDaemonOpen(virConnectPtr conn, xmlURIPtr uri, virConnectAuthPtr auth, int flags);
187
int xenDaemonClose(virConnectPtr conn);
188
int xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer);
189
int xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info);
190
int xenDaemonNodeGetTopology(virConnectPtr conn, virBufferPtr xml);
191 192 193
int xenDaemonDomainSuspend(virDomainPtr domain);
int xenDaemonDomainResume(virDomainPtr domain);
int xenDaemonDomainShutdown(virDomainPtr domain);
194
int xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags);
195 196 197
int xenDaemonDomainDestroy(virDomainPtr domain);
int xenDaemonDomainSave(virDomainPtr domain, const char *filename);
int xenDaemonDomainRestore(virConnectPtr conn, const char *filename);
198
int xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory);
199 200
int xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
int xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info);
201
char *xenDaemonDomainDumpXML(virDomainPtr domain, int flags, const char *cpus);
202
unsigned long xenDaemonDomainGetMaxMemory(virDomainPtr domain);
203
char **xenDaemonListDomainsOld(virConnectPtr xend);
204

205 206 207 208
virDomainPtr xenDaemonDomainDefineXML(virConnectPtr xend, const char *sexpr);
int xenDaemonDomainCreate(virDomainPtr domain);
int xenDaemonDomainUndefine(virDomainPtr domain);

209
int	xenDaemonDomainSetVcpus		(virDomainPtr domain,
210
					 unsigned int vcpus);
211 212 213 214 215 216 217 218 219 220
int	xenDaemonDomainPinVcpu		(virDomainPtr domain,
					 unsigned int vcpu,
					 unsigned char *cpumap,
					 int maplen);
int	xenDaemonDomainGetVcpus		(virDomainPtr domain,
					 virVcpuInfoPtr info,
					 int maxinfo,
					 unsigned char *cpumaps,
					 int maplen);

221 222 223 224 225 226 227
/* xen_unified calls through here. */
extern struct xenUnifiedDriver xenDaemonDriver;
int xenDaemonInit (void);

virDomainPtr xenDaemonLookupByID(virConnectPtr conn, int id);
virDomainPtr xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid);
virDomainPtr xenDaemonLookupByName(virConnectPtr conn, const char *domname);
228 229
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);
230

231 232 233 234
#ifdef __cplusplus
}
#endif
#endif