mirror of https://gitee.com/openkylin/libvirt.git
* python/tests/create.py: add one more image path
* src/libvirt.c src/xend_internal.c src/xend_internal.h: more work on the xend refactoring Daniel
This commit is contained in:
parent
44c2c10ea5
commit
faf61d94c1
|
@ -1,3 +1,9 @@
|
|||
Wed Mar 22 14:43:16 CET 2006 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* python/tests/create.py: add one more image path
|
||||
* src/libvirt.c src/xend_internal.c src/xend_internal.h: more work
|
||||
on the xend refactoring
|
||||
|
||||
Wed Mar 22 13:34:32 EST 2006 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* python/tests/create.py: adapt to new naming scheme in FC5
|
||||
|
|
|
@ -13,6 +13,7 @@ if not os.access("/proc/xen", os.R_OK):
|
|||
#
|
||||
osroots = [
|
||||
"/u/fc4.img",
|
||||
"/xen/fc4.img",
|
||||
]
|
||||
|
||||
okay = 1
|
||||
|
|
138
src/libvirt.c
138
src/libvirt.c
|
@ -166,7 +166,7 @@ virConnectOpen(const char *name)
|
|||
}
|
||||
|
||||
ret->xshandle = xshandle;
|
||||
if (xend_setup(ret) < 0)
|
||||
if (xenDaemonOpen(ret, name, 0) < 0)
|
||||
goto failed;
|
||||
ret->domains = virHashCreate(20);
|
||||
ret->flags = 0;
|
||||
|
@ -224,7 +224,7 @@ virConnectOpenReadOnly(const char *name)
|
|||
method++;
|
||||
|
||||
ret->xshandle = xshandle;
|
||||
if (xend_setup(ret) == 0)
|
||||
if (xenDaemonOpen(ret, name, VIR_DRV_OPEN_QUIET | VIR_DRV_OPEN_RO) == 0)
|
||||
method++;
|
||||
ret->domains = virHashCreate(20);
|
||||
if (ret->domains == NULL)
|
||||
|
@ -305,7 +305,7 @@ virDomainFreeName(virDomainPtr domain, const char *name ATTRIBUTE_UNUSED)
|
|||
int
|
||||
virConnectClose(virConnectPtr conn)
|
||||
{
|
||||
xend_cleanup(conn);
|
||||
xenDaemonClose(conn);
|
||||
if (!VIR_IS_CONNECT(conn))
|
||||
return (-1);
|
||||
virHashFree(conn->domains, (virHashDeallocator) virDomainFreeName);
|
||||
|
@ -404,10 +404,10 @@ virConnectListDomains(virConnectPtr conn, int *ids, int maxids)
|
|||
return (-1);
|
||||
}
|
||||
|
||||
idlist = xend_get_domains(conn);
|
||||
idlist = xenDaemonListDomains(conn);
|
||||
if (idlist != NULL) {
|
||||
for (ret = 0, i = 0; (idlist[i] != NULL) && (ret < maxids); i++) {
|
||||
id = xend_get_domain_ids(conn, idlist[i], NULL);
|
||||
id = xenDaemonDomainLookupByName_ids(conn, idlist[i], NULL);
|
||||
if (id >= 0)
|
||||
ids[ret++] = (int) id;
|
||||
}
|
||||
|
@ -460,7 +460,7 @@ virConnectNumOfDomains(virConnectPtr conn)
|
|||
/*
|
||||
* try first with Xend interface
|
||||
*/
|
||||
idlist = xend_get_domains(conn);
|
||||
idlist = xenDaemonListDomains(conn);
|
||||
if (idlist != NULL) {
|
||||
char **tmp = idlist;
|
||||
|
||||
|
@ -521,7 +521,7 @@ virDomainCreateLinux(virConnectPtr conn,
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
ret = xend_create_sexpr(conn, sexpr);
|
||||
ret = xenDaemonDomainCreateLinux(conn, sexpr);
|
||||
free(sexpr);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Failed to create domain %s\n", name);
|
||||
|
@ -531,14 +531,18 @@ virDomainCreateLinux(virConnectPtr conn,
|
|||
ret = xend_wait_for_devices(conn, name);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Failed to get devices for domain %s\n", name);
|
||||
xend_destroy(conn, name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = xend_unpause(conn, name);
|
||||
dom = virDomainLookupByName(conn, name);
|
||||
if (dom == NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = xenDaemonDomainResume(dom);
|
||||
if (ret != 0) {
|
||||
fprintf(stderr, "Failed to resume new domain %s\n", name);
|
||||
xend_destroy(conn, name);
|
||||
xenDaemonDomainDestroy(dom);
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -725,13 +729,13 @@ virDomainLookupByID(virConnectPtr conn, int id)
|
|||
}
|
||||
/* fallback to xend API then */
|
||||
if (path == NULL) {
|
||||
char **names = xend_get_domains(conn);
|
||||
char **names = xenDaemonListDomains(conn);
|
||||
char **tmp = names;
|
||||
int ident;
|
||||
|
||||
if (names != NULL) {
|
||||
while (*tmp != NULL) {
|
||||
ident = xend_get_domain_ids(conn, *tmp, &uuid[0]);
|
||||
ident = xenDaemonDomainLookupByName_ids(conn, *tmp, &uuid[0]);
|
||||
if (ident == id) {
|
||||
name = strdup(*tmp);
|
||||
break;
|
||||
|
@ -799,7 +803,7 @@ virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
|
|||
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
return (NULL);
|
||||
}
|
||||
names = xend_get_domains(conn);
|
||||
names = xenDaemonListDomains(conn);
|
||||
tmp = names;
|
||||
|
||||
if (names == NULL) {
|
||||
|
@ -807,7 +811,7 @@ virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
|
|||
return (NULL);
|
||||
}
|
||||
while (*tmp != NULL) {
|
||||
id = xend_get_domain_ids(conn, *tmp, &ident[0]);
|
||||
id = xenDaemonDomainLookupByName_ids(conn, *tmp, &ident[0]);
|
||||
if (id >= 0) {
|
||||
if (!memcmp(uuid, ident, 16)) {
|
||||
name = strdup(*tmp);
|
||||
|
@ -869,7 +873,7 @@ virDomainLookupByName(virConnectPtr conn, const char *name)
|
|||
}
|
||||
|
||||
/* try first though Xend */
|
||||
xenddomain = xend_get_domain(conn, name);
|
||||
xenddomain = xenDaemonDomainLookupByName(conn, name);
|
||||
if (xenddomain != NULL) {
|
||||
id = xenddomain->live->id;
|
||||
uuid = xenddomain->uuid;
|
||||
|
@ -953,7 +957,7 @@ virDomainDestroy(virDomainPtr domain)
|
|||
/*
|
||||
* try first with the xend method
|
||||
*/
|
||||
ret = xend_destroy(domain->conn, domain->name);
|
||||
ret = xenDaemonDomainDestroy(domain);
|
||||
if (ret == 0) {
|
||||
virDomainFree(domain);
|
||||
return (0);
|
||||
|
@ -1016,7 +1020,7 @@ virDomainSuspend(virDomainPtr domain)
|
|||
}
|
||||
|
||||
/* first try though the Xen daemon */
|
||||
ret = xend_pause(domain->conn, domain->name);
|
||||
ret = xenDaemonDomainSuspend(domain);
|
||||
if (ret == 0)
|
||||
return (0);
|
||||
|
||||
|
@ -1045,7 +1049,7 @@ virDomainResume(virDomainPtr domain)
|
|||
}
|
||||
|
||||
/* first try though the Xen daemon */
|
||||
ret = xend_unpause(domain->conn, domain->name);
|
||||
ret = xenDaemonDomainResume(domain);
|
||||
if (ret == 0)
|
||||
return (0);
|
||||
|
||||
|
@ -1100,7 +1104,7 @@ virDomainSave(virDomainPtr domain, const char *to)
|
|||
|
||||
}
|
||||
|
||||
ret = xend_save(domain->conn, domain->name, to);
|
||||
ret = xenDaemonDomainSave(domain, to);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -1147,7 +1151,7 @@ virDomainRestore(virConnectPtr conn, const char *from)
|
|||
from = &filepath[0];
|
||||
}
|
||||
|
||||
ret = xend_restore(conn, from);
|
||||
ret = xenDaemonDomainRestore(conn, from);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
@ -1177,7 +1181,7 @@ virDomainShutdown(virDomainPtr domain)
|
|||
/*
|
||||
* try first with the xend daemon
|
||||
*/
|
||||
ret = xend_shutdown(domain->conn, domain->name);
|
||||
ret = xenDaemonDomainShutdown(domain);
|
||||
if (ret == 0)
|
||||
return (0);
|
||||
|
||||
|
@ -1243,7 +1247,7 @@ virDomainGetUUID(virDomainPtr domain, unsigned char *uuid)
|
|||
(domain->uuid[10] == 0) && (domain->uuid[11] == 0) &&
|
||||
(domain->uuid[12] == 0) && (domain->uuid[13] == 0) &&
|
||||
(domain->uuid[14] == 0) && (domain->uuid[15] == 0))
|
||||
xend_get_domain_ids(domain->conn, domain->name,
|
||||
xenDaemonDomainLookupByName_ids(domain->conn, domain->name,
|
||||
&domain->uuid[0]);
|
||||
memcpy(uuid, &domain->uuid[0], 16);
|
||||
}
|
||||
|
@ -1355,34 +1359,43 @@ virDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
|
|||
int ret;
|
||||
char s[256], v[30];
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
return (-1);
|
||||
}
|
||||
if (memory < 4096) {
|
||||
virLibDomainError(domain, VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
return (-1);
|
||||
}
|
||||
if (domain == NULL) {
|
||||
TODO
|
||||
return (-1);
|
||||
}
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
return (-1);
|
||||
}
|
||||
if (domain->conn->flags & VIR_CONNECT_RO)
|
||||
return (-1);
|
||||
if (domain->conn->xshandle == NULL)
|
||||
return (-1);
|
||||
|
||||
ret = xenDaemonDomainSetMaxMemory(domain, memory);
|
||||
if (ret == 0)
|
||||
return(0);
|
||||
|
||||
ret = xenHypervisorSetMaxMemory(domain, memory);
|
||||
if (ret < 0)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* try to update at the Xenstore level too
|
||||
* Failing to do so should not be considered fatal though as long
|
||||
* as the hypervisor call succeeded
|
||||
*/
|
||||
snprintf(s, 255, "/local/domain/%d/memory/target", domain->handle);
|
||||
s[255] = 0;
|
||||
snprintf(v, 29, "%lu", memory);
|
||||
v[30] = 0;
|
||||
if (domain->conn->xshandle != NULL) {
|
||||
/*
|
||||
* try to update at the Xenstore level too
|
||||
* Failing to do so should not be considered fatal though as long
|
||||
* as the hypervisor call succeeded
|
||||
*/
|
||||
snprintf(s, 255, "/local/domain/%d/memory/target", domain->handle);
|
||||
s[255] = 0;
|
||||
snprintf(v, 29, "%lu", memory);
|
||||
v[30] = 0;
|
||||
|
||||
if (!xs_write(domain->conn->xshandle, 0, &s[0], &v[0], strlen(v)))
|
||||
ret = -1;
|
||||
if (!xs_write(domain->conn->xshandle, 0, &s[0], &v[0], strlen(v)))
|
||||
ret = -1;
|
||||
}
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
@ -1423,53 +1436,14 @@ virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
|
|||
*/
|
||||
if (domain->conn->handle >= 0) {
|
||||
ret = xenHypervisorGetDomainInfo(domain, info);
|
||||
if (ret < 0)
|
||||
goto xend_info;
|
||||
return (0);
|
||||
/*
|
||||
dom0_getdomaininfo_t dominfo;
|
||||
|
||||
dominfo.domain = domain->handle;
|
||||
ret = xenHypervisorGetDomainInfo(domain, &dominfo);
|
||||
if (ret < 0)
|
||||
goto xend_info;
|
||||
|
||||
switch (dominfo.flags & 0xFF) {
|
||||
case DOMFLAGS_DYING:
|
||||
info->state = VIR_DOMAIN_SHUTDOWN;
|
||||
break;
|
||||
case DOMFLAGS_SHUTDOWN:
|
||||
info->state = VIR_DOMAIN_SHUTOFF;
|
||||
break;
|
||||
case DOMFLAGS_PAUSED:
|
||||
info->state = VIR_DOMAIN_PAUSED;
|
||||
break;
|
||||
case DOMFLAGS_BLOCKED:
|
||||
info->state = VIR_DOMAIN_BLOCKED;
|
||||
break;
|
||||
case DOMFLAGS_RUNNING:
|
||||
info->state = VIR_DOMAIN_RUNNING;
|
||||
break;
|
||||
default:
|
||||
info->state = VIR_DOMAIN_NONE;
|
||||
}
|
||||
|
||||
* the API brings back the cpu time in nanoseconds,
|
||||
* convert to microseconds, same thing convert to
|
||||
* kilobytes from page counts
|
||||
info->cpuTime = dominfo.cpu_time;
|
||||
info->memory = dominfo.tot_pages * 4;
|
||||
info->maxMem = dominfo.max_pages * 4;
|
||||
info->nrVirtCpu = dominfo.nr_online_vcpus;
|
||||
return (0);
|
||||
*/
|
||||
if (ret == 0)
|
||||
return (0);
|
||||
}
|
||||
|
||||
xend_info:
|
||||
/*
|
||||
* try to extract the informations though access to the Xen Daemon
|
||||
*/
|
||||
if (xend_get_domain_info(domain, info) == 0)
|
||||
if (xenDaemonDomainGetInfo(domain, info) == 0)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
|
@ -1536,5 +1510,5 @@ virDomainGetXMLDesc(virDomainPtr domain, int flags)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
return (xend_get_domain_xml(domain));
|
||||
return (xenDaemonDomainDumpXML(domain));
|
||||
}
|
||||
|
|
1037
src/xend_internal.c
1037
src/xend_internal.c
File diff suppressed because it is too large
Load Diff
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* libxend/xend.h -- Xend library
|
||||
*
|
||||
* Copyright (C) 2005
|
||||
* Copyright (C) 2005,2006
|
||||
*
|
||||
* Anthony Liguori <aliguori@us.ibm.com>
|
||||
* Daniel Veillard <veillard@redhat.com>
|
||||
*
|
||||
* 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
|
||||
|
@ -443,20 +444,6 @@ extern "C" {
|
|||
const char *cc_compile_date;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Setup the connection to the local Xend instance
|
||||
* \return 0 in case of success, -1 in case of error
|
||||
*
|
||||
* This method creates a new Xend instance preferrably trying
|
||||
* to connect with the domain socket but if necessary using
|
||||
* TCP (only on localhost though).
|
||||
*
|
||||
* This function may not fail if Xend is not running.
|
||||
*
|
||||
* Make sure to call xend_cleanup().
|
||||
*/
|
||||
int xend_setup(virConnectPtr conn);
|
||||
|
||||
/**
|
||||
* \brief Setup the connection to a xend instance via TCP
|
||||
* \param host The host name to connect to
|
||||
|
@ -467,9 +454,9 @@ extern "C" {
|
|||
*
|
||||
* This function may not fail if Xend is not running.
|
||||
*
|
||||
* Make sure to call xend_cleanup().
|
||||
* Make sure to call xenDaemonClose().
|
||||
*/
|
||||
int xend_setup_tcp(virConnectPtr xend, const char *host, int port);
|
||||
int xenDaemonOpen_tcp(virConnectPtr xend, const char *host, int port);
|
||||
|
||||
/**
|
||||
* \brief Setup the connection to xend instance via a Unix domain socket
|
||||
|
@ -480,19 +467,10 @@ extern "C" {
|
|||
*
|
||||
* This function may not fail if Xend is not running.
|
||||
*
|
||||
* Make sure to call xend_cleanup().
|
||||
* Make sure to call xenDaemonClose().
|
||||
*/
|
||||
int xend_setup_unix(virConnectPtr xend, const char *path);
|
||||
int xenDaemonOpen_unix(virConnectPtr xend, const char *path);
|
||||
|
||||
/**
|
||||
* \brief Delete a previously allocated Xend instance
|
||||
* \param xend The xend instance
|
||||
*
|
||||
* This method should be called when a connection to xend instance
|
||||
* initialized with xend_setup[_{tcp, unix}] is no longer needed
|
||||
* to free the associated resources.
|
||||
*/
|
||||
void xend_cleanup(virConnectPtr xend);
|
||||
|
||||
/**
|
||||
* \brief Blocks until a domain's devices are initialized
|
||||
|
@ -509,29 +487,7 @@ extern "C" {
|
|||
int xend_wait_for_devices(virConnectPtr xend, const char *name);
|
||||
|
||||
/**
|
||||
* \brief Pause a domain
|
||||
* \param xend A xend instance
|
||||
* \param name The domain's name
|
||||
* \return 0 for success; -1 (with errno) on error
|
||||
*
|
||||
* This method will make sure that Xen does not schedule the domain
|
||||
* anymore until after xend_unpause() has been called.
|
||||
*/
|
||||
int xend_pause(virConnectPtr xend, const char *name);
|
||||
|
||||
/**
|
||||
* \brief Unpause a domain
|
||||
* \param xend A xend instance
|
||||
* \param name The domain's name
|
||||
* \return 0 for success; -1 (with errno) on error
|
||||
*
|
||||
* This method will allow a paused domain (the result of xen_pause())
|
||||
* to be scheduled in the future.
|
||||
*/
|
||||
int xend_unpause(virConnectPtr xend, const char *name);
|
||||
|
||||
/**
|
||||
* \brief Unpause a domain
|
||||
* \brief Rename a domain
|
||||
* \param xend A xend instance
|
||||
* \param oldname The domain's name
|
||||
* \param name The new name
|
||||
|
@ -565,56 +521,6 @@ extern "C" {
|
|||
*/
|
||||
int xend_reboot(virConnectPtr xend, const char *name);
|
||||
|
||||
/**
|
||||
* \brief Request a domain to shutdown
|
||||
* \param xend A xend instance
|
||||
* \param name The domain's name
|
||||
* \return 0 for success; -1 (with errno) on error
|
||||
*
|
||||
* This method *requests* that a domain shutdown itself. This is only
|
||||
* a request and the domain may ignore it. It will return immediately
|
||||
* after queuing the request.
|
||||
*/
|
||||
int xend_shutdown(virConnectPtr xend, const char *name);
|
||||
|
||||
/**
|
||||
* \brief Destroy a domain
|
||||
* \param xend A xend instance
|
||||
* \param name The domain's name
|
||||
* \return 0 for success; -1 (with errno) on error
|
||||
*
|
||||
* This method will immediately destroy a domain. If you call this
|
||||
* function while a domain is running, you risk corrupting its devices.
|
||||
* After calling this function, the domain's status will change to
|
||||
* dying and will go away completely once all of the resources have been
|
||||
* unmapped (usually from the backend devices).
|
||||
*/
|
||||
int xend_destroy(virConnectPtr xend, const char *name);
|
||||
|
||||
/**
|
||||
* \brief Save a domain to the disk
|
||||
* \param xend A xend instance
|
||||
* \param name The domain's name
|
||||
* \param filename The filename to save to
|
||||
* \return 0 for success; -1 (with errno) on error
|
||||
*
|
||||
* This method will suspend a domain and save its memory contents to
|
||||
* a file on disk. Use xend_restore() to restore a domain after
|
||||
* saving.
|
||||
*/
|
||||
int xend_save(virConnectPtr xend, const char *name,
|
||||
const char *filename);
|
||||
|
||||
/**
|
||||
* \brief Restore a domain from the disk
|
||||
* \param xend A xend instance
|
||||
* \param filename The filename to restore from
|
||||
* \return 0 for success; -1 (with errno) on error
|
||||
*
|
||||
* This method will restore a domain saved to disk by xend_save().
|
||||
*/
|
||||
int xend_restore(virConnectPtr xend, const char *filename);
|
||||
|
||||
/**
|
||||
* \brief Obtain a list of currently running domains
|
||||
* \param xend A xend instance
|
||||
|
@ -623,19 +529,7 @@ extern "C" {
|
|||
* This method will return an array of names of currently running
|
||||
* domains. The memory should be released will a call to free().
|
||||
*/
|
||||
char **xend_get_domains(virConnectPtr xend);
|
||||
|
||||
/**
|
||||
* \brief Create a new domain
|
||||
* \param xend A xend instance
|
||||
* \param info A struct xen_domain instance describing 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
|
||||
* xend_unpause() to begin execution.
|
||||
*/
|
||||
int xend_create(virConnectPtr xend, const struct xend_domain *info);
|
||||
char **xenDaemonListDomains(virConnectPtr xend);
|
||||
|
||||
/**
|
||||
* \brief Create a new domain
|
||||
|
@ -645,24 +539,9 @@ extern "C" {
|
|||
*
|
||||
* This method will create a domain based the passed in description. The
|
||||
* domain will be paused after creation and must be unpaused with
|
||||
* xend_unpause() to begin execution.
|
||||
* xenDaemonResumeDomain() to begin execution.
|
||||
*/
|
||||
int xend_create_sexpr(virConnectPtr xend, const char *sexpr);
|
||||
|
||||
/**
|
||||
* \brief Set the maximum memory for a domain
|
||||
* \param xend A xend instance
|
||||
* \param name The name of the domain
|
||||
* \param value The maximum memory in bytes
|
||||
* \return 0 for success; -1 (with errno) on error
|
||||
*
|
||||
* This method will set the maximum amount of memory that can be allocated to
|
||||
* a domain. Please note that a domain is able to allocate up to this amount
|
||||
* on its own (although under normal circumstances, memory allocation for a
|
||||
* domain is only done through xend_set_memory()).
|
||||
*/
|
||||
int xend_set_max_memory(virConnectPtr xend, const char *name,
|
||||
uint64_t value);
|
||||
int xenDaemonDomainCreateLinux(virConnectPtr xend, const char *sexpr);
|
||||
|
||||
/**
|
||||
* \brief Set the memory allocation for a domain
|
||||
|
@ -683,70 +562,6 @@ extern "C" {
|
|||
int xend_set_memory(virConnectPtr xend, const char *name,
|
||||
uint64_t value);
|
||||
|
||||
/**
|
||||
* \brief Create a virtual block device
|
||||
* \param xend A xend instance
|
||||
* \param name The name of the domain
|
||||
* \param vbd A virtual block device description
|
||||
* \return 0 on success; -1 (with errno) on error
|
||||
*
|
||||
* This method creates and attachs a block device to a domain. A successful
|
||||
* return value does not indicate that the device successfully attached,
|
||||
* rather, one should use xend_wait_for_devices() to block until the device
|
||||
* has been successfully attached.
|
||||
*/
|
||||
int xend_vbd_create(virConnectPtr xend,
|
||||
const char *name,
|
||||
const struct xend_device_vbd *vbd);
|
||||
|
||||
/**
|
||||
* \brief Destroy a virtual block device
|
||||
* \param xend A xend instance
|
||||
* \param name The name of the domain
|
||||
* \param vbd A virtual block device description
|
||||
* \return 0 on success; -1 (with errno) on error
|
||||
*
|
||||
* This method detachs a block device from a given domain. A successful return
|
||||
* value does not indicate that the device successfully detached, rather, one
|
||||
* should use xend_wait_for_devices() to block until the device has been
|
||||
* successfully detached.
|
||||
*/
|
||||
int xend_vbd_destroy(virConnectPtr xend,
|
||||
const char *name,
|
||||
const struct xend_device_vbd *vbd);
|
||||
|
||||
/**
|
||||
* \brief Create a virtual network device
|
||||
* \param xend A xend instance
|
||||
* \param name The name of the domain
|
||||
* \param vif A virtual network device description
|
||||
* \return 0 on success; -1 (with errno) on error
|
||||
*
|
||||
* This method creates and attachs a network device to a domain. A successful
|
||||
* return value does not indicate that the device successfully attached,
|
||||
* rather, one should use xend_wait_for_devices() to network until the device
|
||||
* has been successfully attached.
|
||||
*/
|
||||
int xend_vif_create(virConnectPtr xend,
|
||||
const char *name,
|
||||
const struct xend_device_vif *vif);
|
||||
|
||||
/**
|
||||
* \brief Destroy a virtual network device
|
||||
* \param xend A xend instance
|
||||
* \param name The name of the domain
|
||||
* \param vif A virtual network device description
|
||||
* \return 0 on success; -1 (with errno) on error
|
||||
*
|
||||
* This method detachs a network device from a given domain. A successful
|
||||
* return value does not indicate that the device successfully detached,
|
||||
* rather, one should use xend_wait_for_devices() to network until the device
|
||||
* has been successfully detached.
|
||||
*/
|
||||
int xend_vif_destroy(virConnectPtr xend,
|
||||
const char *name,
|
||||
const struct xend_device_vif *vif);
|
||||
|
||||
/**
|
||||
* \brief Lookup information about a domain
|
||||
* \param xend A xend instance
|
||||
|
@ -757,7 +572,7 @@ extern "C" {
|
|||
* it in the form of a struct xend_domain. This should be
|
||||
* free()'d when no longer needed.
|
||||
*/
|
||||
struct xend_domain *xend_get_domain(virConnectPtr xend,
|
||||
struct xend_domain *xenDaemonDomainLookupByName(virConnectPtr xend,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
|
@ -769,19 +584,9 @@ extern "C" {
|
|||
*
|
||||
* This method looks up the ids of a domain
|
||||
*/
|
||||
int xend_get_domain_ids(virConnectPtr xend,
|
||||
int xenDaemonDomainLookupByName_ids(virConnectPtr xend,
|
||||
const char *name, unsigned char *uuid);
|
||||
|
||||
/**
|
||||
* \brief Get status informations for a domain
|
||||
* \param domain A xend domain
|
||||
* \param info An information block provided by the user
|
||||
* \return 0 in case of success, -1 in case of error
|
||||
*
|
||||
* This method looks up information about a domain and update the
|
||||
* information block provided.
|
||||
*/
|
||||
int xend_get_domain_info(virDomainPtr domain, virDomainInfoPtr info);
|
||||
|
||||
/**
|
||||
* \brief Lookup information about the host machine
|
||||
|
@ -845,15 +650,19 @@ extern "C" {
|
|||
*/
|
||||
int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer);
|
||||
|
||||
/**
|
||||
* \brief Provide an XML description of the domain.
|
||||
* \param domain a xend domain object
|
||||
* \return a 0 terminated UTF-8 encoded XML instance, or NULL in case of error.
|
||||
* the caller must free() the returned value.
|
||||
*
|
||||
* Provide an XML description of the domain.
|
||||
*/
|
||||
char *xend_get_domain_xml(virDomainPtr domain);
|
||||
/* refactored ones */
|
||||
int xenDaemonOpen(virConnectPtr conn, const char *name, int flags);
|
||||
int xenDaemonClose(virConnectPtr conn);
|
||||
int xenDaemonDomainSuspend(virDomainPtr domain);
|
||||
int xenDaemonDomainResume(virDomainPtr domain);
|
||||
int xenDaemonDomainShutdown(virDomainPtr domain);
|
||||
int xenDaemonDomainDestroy(virDomainPtr domain);
|
||||
int xenDaemonDomainSave(virDomainPtr domain, const char *filename);
|
||||
int xenDaemonDomainRestore(virConnectPtr conn, const char *filename);
|
||||
int xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long memory);
|
||||
int xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info);
|
||||
char *xenDaemonDomainDumpXML(virDomainPtr domain);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue