#include "xs_internal.h"
#include "xml.h"
-
/*
* TODO:
* - use lock to protect against concurrent accesses ?
VIR_DRV_OPEN_QUIET | VIR_DRV_OPEN_RO);
if (res == 0)
ret->drivers[ret->nb_drivers++] = virDriverTab[i];
+
}
}
if (ret->nb_drivers == 0) {
virDomainPtr ret;
char *name = NULL;
unsigned char uuid[16];
+ int i;
if (!VIR_IS_CONNECT(conn)) {
virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
}
+ /* Go though the driver registered entry points */
+ for (i = 0;i < conn->nb_drivers;i++) {
+ if ((conn->drivers[i] != NULL) &&
+ (conn->drivers[i]->domainLookupByID != NULL)) {
+ ret = conn->drivers[i]->domainLookupByID(conn, id);
+ if (ret)
+ return(ret);
+ }
+ }
+
/* retrieve home path of the domain */
if (conn->xshandle != NULL) {
path = xs_get_domain_path(conn->xshandle, (unsigned int) id);
if (name == NULL)
goto error;
- ret = virGetDomain(conn, name, (const char *)&uuid[0]);
+ ret = virGetDomain(conn, name, uuid);
if (ret == NULL) {
virLibConnError(conn, VIR_ERR_NO_MEMORY, "Allocating domain");
goto error;
char **tmp;
unsigned char ident[16];
int id = -1;
+ int i;
if (!VIR_IS_CONNECT(conn)) {
virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
}
+
+ /* Go though the driver registered entry points */
+ for (i = 0;i < conn->nb_drivers;i++) {
+ if ((conn->drivers[i] != NULL) &&
+ (conn->drivers[i]->domainLookupByUUID != NULL)) {
+ ret = conn->drivers[i]->domainLookupByUUID(conn, uuid);
+ if (ret)
+ return(ret);
+ }
+ }
+
names = xenDaemonListDomains(conn);
tmp = names;
if (name == NULL)
return (NULL);
- ret = virGetDomain(conn, name, (const char *)&uuid[0]);
+ ret = virGetDomain(conn, name, uuid);
if (ret == NULL) {
if (name != NULL)
free(name);
virDomainLookupByName(virConnectPtr conn, const char *name)
{
virDomainPtr ret = NULL;
+ int i;
if (!VIR_IS_CONNECT(conn)) {
virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
}
+ /* Go though the driver registered entry points */
+ for (i = 0;i < conn->nb_drivers;i++) {
+ if ((conn->drivers[i] != NULL) &&
+ (conn->drivers[i]->domainLookupByName != NULL)) {
+ ret = conn->drivers[i]->domainLookupByName(conn, name);
+ if (ret)
+ return(ret);
+ }
+ }
+
/* try first though Xend */
ret = xenDaemonDomainLookupByName(conn, name);
if (ret != NULL) {
virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
{
int ret;
+ int i;
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
memset(info, 0, sizeof(virDomainInfo));
+ for (i = 0;i < domain->conn->nb_drivers;i++) {
+ if ((domain->conn->drivers[i] != NULL) &&
+ (domain->conn->drivers[i]->domainGetInfo != NULL)) {
+ if (domain->conn->drivers[i]->domainGetInfo(domain, info) == 0)
+ return 0;
+ }
+ }
+
/*
* if we have direct access though the hypervisor do a direct call
*/