mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
* src/hash.c, src/internal.h: Switch the uuid parameter in virGetDomain
to be of type 'unsigned char' since its a raw UUID we're passing in, not a printable one. * src/libvirt.c: Remove bogus "unsigned char" -> "char" type casts. Hook up the "domainLookupByID", "domainLookupByUUID", "domainLookupByName" and "domainGetInfo" driver backend functions. Daniel
This commit is contained in:
parent
d0f2c663be
commit
88e6f39ae6
@ -1,3 +1,12 @@
|
||||
Fri May 26 11:59:20 EDT 2006 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/hash.c, src/internal.h: Switch the uuid parameter in virGetDomain
|
||||
to be of type 'unsigned char' since its a raw UUID we're passing in,
|
||||
not a printable one.
|
||||
* src/libvirt.c: Remove bogus "unsigned char" -> "char" type casts. Hook
|
||||
up the "domainLookupByID", "domainLookupByUUID", "domainLookupByName"
|
||||
and "domainGetInfo" driver backend functions.
|
||||
|
||||
Mon May 29 17:02:26 CEST 2006 Karel Zak <kzak@redhat.com>
|
||||
|
||||
* src/libvirt_sym.version: added in missing symbols referenced by python
|
||||
|
@ -602,7 +602,7 @@ virFreeConnect(virConnectPtr conn) {
|
||||
* Returns a pointer to the domain, or NULL in case of failure
|
||||
*/
|
||||
virDomainPtr
|
||||
virGetDomain(virConnectPtr conn, const char *name, const char *uuid) {
|
||||
virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
|
||||
virDomainPtr ret = NULL;
|
||||
|
||||
if ((!VIR_IS_CONNECT(conn)) || ((name == NULL) && (uuid == NULL)) ||
|
||||
|
@ -182,7 +182,7 @@ virConnectPtr virGetConnect (void);
|
||||
int virFreeConnect (virConnectPtr conn);
|
||||
virDomainPtr virGetDomain (virConnectPtr conn,
|
||||
const char *name,
|
||||
const char *uuid);
|
||||
const unsigned char *uuid);
|
||||
int virFreeDomain (virConnectPtr conn,
|
||||
virDomainPtr domain);
|
||||
virDomainPtr virGetDomainByID(virConnectPtr conn,
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "xs_internal.h"
|
||||
#include "xml.h"
|
||||
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* - use lock to protect against concurrent accesses ?
|
||||
@ -293,6 +292,7 @@ virConnectOpenReadOnly(const char *name)
|
||||
VIR_DRV_OPEN_QUIET | VIR_DRV_OPEN_RO);
|
||||
if (res == 0)
|
||||
ret->drivers[ret->nb_drivers++] = virDriverTab[i];
|
||||
|
||||
}
|
||||
}
|
||||
if (ret->nb_drivers == 0) {
|
||||
@ -600,6 +600,7 @@ virDomainLookupByID(virConnectPtr conn, int id)
|
||||
virDomainPtr ret;
|
||||
char *name = NULL;
|
||||
unsigned char uuid[16];
|
||||
int i;
|
||||
|
||||
if (!VIR_IS_CONNECT(conn)) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||
@ -610,6 +611,16 @@ virDomainLookupByID(virConnectPtr conn, int id)
|
||||
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);
|
||||
@ -633,7 +644,7 @@ virDomainLookupByID(virConnectPtr conn, 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;
|
||||
@ -670,6 +681,7 @@ virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
|
||||
char **tmp;
|
||||
unsigned char ident[16];
|
||||
int id = -1;
|
||||
int i;
|
||||
|
||||
if (!VIR_IS_CONNECT(conn)) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||
@ -679,6 +691,17 @@ virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
|
||||
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;
|
||||
|
||||
@ -701,7 +724,7 @@ virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
|
||||
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);
|
||||
@ -774,6 +797,7 @@ virDomainPtr
|
||||
virDomainLookupByName(virConnectPtr conn, const char *name)
|
||||
{
|
||||
virDomainPtr ret = NULL;
|
||||
int i;
|
||||
|
||||
if (!VIR_IS_CONNECT(conn)) {
|
||||
virLibConnError(conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
|
||||
@ -784,6 +808,16 @@ virDomainLookupByName(virConnectPtr conn, const char *name)
|
||||
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) {
|
||||
@ -1400,6 +1434,7 @@ int
|
||||
virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(domain, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
@ -1412,6 +1447,14 @@ virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
|
||||
|
||||
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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user