mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-13 11:15:08 +00:00
Remove use of static data in Xen inotify driver
This commit is contained in:
parent
437ac354fc
commit
e428a69e6f
@ -1,3 +1,9 @@
|
|||||||
|
Tue Jan 20 17:15:53 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
|
* src/xen_inotify.c, src/xen_unified.h, src/xs_internal.c:
|
||||||
|
Move statically declared data into xenUnifiedPrivatePtr
|
||||||
|
struct
|
||||||
|
|
||||||
Tue Jan 20 16:59:53 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
Tue Jan 20 16:59:53 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
Make error reporting threadsafe by avoiding strerror()
|
Make error reporting threadsafe by avoiding strerror()
|
||||||
|
@ -48,9 +48,6 @@
|
|||||||
__FUNCTION__, __LINE__, fmt)
|
__FUNCTION__, __LINE__, fmt)
|
||||||
|
|
||||||
#define LIBVIRTD_DOMAINS_DIR "/var/lib/xend/domains"
|
#define LIBVIRTD_DOMAINS_DIR "/var/lib/xend/domains"
|
||||||
static const char *configDir = NULL;
|
|
||||||
static int useXenConfigCache = 0;
|
|
||||||
static xenUnifiedDomainInfoListPtr configInfoList = NULL;
|
|
||||||
|
|
||||||
struct xenUnifiedDriver xenInotifyDriver = {
|
struct xenUnifiedDriver xenInotifyDriver = {
|
||||||
xenInotifyOpen, /* open */
|
xenInotifyOpen, /* open */
|
||||||
@ -121,6 +118,7 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
|
|||||||
virDomainPtr dom;
|
virDomainPtr dom;
|
||||||
const char *uuid_str;
|
const char *uuid_str;
|
||||||
unsigned char rawuuid[VIR_UUID_BUFLEN];
|
unsigned char rawuuid[VIR_UUID_BUFLEN];
|
||||||
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
|
||||||
/* xend is managing domains. we will get
|
/* xend is managing domains. we will get
|
||||||
* a filename in the manner:
|
* a filename in the manner:
|
||||||
@ -142,15 +140,15 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
|
|||||||
/* If we are here, the domain has gone away.
|
/* If we are here, the domain has gone away.
|
||||||
search for, and create a domain from the stored
|
search for, and create a domain from the stored
|
||||||
list info */
|
list info */
|
||||||
for (i=0; i<configInfoList->count; i++) {
|
for (i = 0 ; i < priv->configInfoList->count ; i++) {
|
||||||
if (!memcmp(uuid, configInfoList->doms[i]->uuid, VIR_UUID_BUFLEN)) {
|
if (!memcmp(uuid, priv->configInfoList->doms[i]->uuid, VIR_UUID_BUFLEN)) {
|
||||||
*name = strdup(configInfoList->doms[i]->name);
|
*name = strdup(priv->configInfoList->doms[i]->name);
|
||||||
if (!*name) {
|
if (!*name) {
|
||||||
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
_("finding dom for %s"), uuid_str);
|
_("finding dom for %s"), uuid_str);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memcpy(uuid, configInfoList->doms[i]->uuid, VIR_UUID_BUFLEN);
|
memcpy(uuid, priv->configInfoList->doms[i]->uuid, VIR_UUID_BUFLEN);
|
||||||
DEBUG0("Found dom on list");
|
DEBUG0("Found dom on list");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -172,7 +170,8 @@ static int
|
|||||||
xenInotifyDomainLookup(virConnectPtr conn,
|
xenInotifyDomainLookup(virConnectPtr conn,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
char **name, unsigned char *uuid) {
|
char **name, unsigned char *uuid) {
|
||||||
if (useXenConfigCache)
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
if (priv->useXenConfigCache)
|
||||||
return xenInotifyXenCacheLookup(filename, name, uuid);
|
return xenInotifyXenCacheLookup(filename, name, uuid);
|
||||||
else
|
else
|
||||||
return xenInotifyXendDomainsDirLookup(conn, filename, name, uuid);
|
return xenInotifyXendDomainsDirLookup(conn, filename, name, uuid);
|
||||||
@ -195,8 +194,9 @@ xenInotifyDomainEventFromFile(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn ATTRIBUTE_UNUSED,
|
xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn,
|
||||||
const char *fname) {
|
const char *fname) {
|
||||||
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
const char *uuidstr = fname + strlen(LIBVIRTD_DOMAINS_DIR) + 1;
|
const char *uuidstr = fname + strlen(LIBVIRTD_DOMAINS_DIR) + 1;
|
||||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||||
int i;
|
int i;
|
||||||
@ -208,22 +208,22 @@ xenInotifyXendDomainsDirRemoveEntry(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* match and remove on uuid */
|
/* match and remove on uuid */
|
||||||
for (i=0; i<configInfoList->count; i++) {
|
for (i = 0 ; i < priv->configInfoList->count ; i++) {
|
||||||
if (!memcmp(uuid, configInfoList->doms[i]->uuid, VIR_UUID_BUFLEN)) {
|
if (!memcmp(uuid, priv->configInfoList->doms[i]->uuid, VIR_UUID_BUFLEN)) {
|
||||||
VIR_FREE(configInfoList->doms[i]->name);
|
VIR_FREE(priv->configInfoList->doms[i]->name);
|
||||||
VIR_FREE(configInfoList->doms[i]);
|
VIR_FREE(priv->configInfoList->doms[i]);
|
||||||
|
|
||||||
if (i < (configInfoList->count - 1))
|
if (i < (priv->configInfoList->count - 1))
|
||||||
memmove(configInfoList->doms + i,
|
memmove(priv->configInfoList->doms + i,
|
||||||
configInfoList->doms + i + 1,
|
priv->configInfoList->doms + i + 1,
|
||||||
sizeof(*(configInfoList->doms)) *
|
sizeof(*(priv->configInfoList->doms)) *
|
||||||
(configInfoList->count - (i + 1)));
|
(priv->configInfoList->count - (i + 1)));
|
||||||
|
|
||||||
if (VIR_REALLOC_N(configInfoList->doms,
|
if (VIR_REALLOC_N(priv->configInfoList->doms,
|
||||||
configInfoList->count - 1) < 0) {
|
priv->configInfoList->count - 1) < 0) {
|
||||||
; /* Failure to reduce memory allocation isn't fatal */
|
; /* Failure to reduce memory allocation isn't fatal */
|
||||||
}
|
}
|
||||||
configInfoList->count--;
|
priv->configInfoList->count--;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,13 +235,15 @@ xenInotifyXendDomainsDirAddEntry(virConnectPtr conn,
|
|||||||
const char *fname) {
|
const char *fname) {
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
unsigned char uuid[VIR_UUID_BUFLEN];
|
unsigned char uuid[VIR_UUID_BUFLEN];
|
||||||
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
|
||||||
if (xenInotifyDomainLookup(conn, fname, &name, uuid) < 0) {
|
if (xenInotifyDomainLookup(conn, fname, &name, uuid) < 0) {
|
||||||
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Error looking up domain"));
|
"%s", _("Error looking up domain"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( xenUnifiedAddDomainInfo(configInfoList,
|
if (xenUnifiedAddDomainInfo(priv->configInfoList,
|
||||||
-1, name, uuid) < 0) {
|
-1, name, uuid) < 0) {
|
||||||
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("Error adding file to config cache"));
|
"%s", _("Error adding file to config cache"));
|
||||||
@ -255,14 +257,18 @@ xenInotifyXendDomainsDirAddEntry(virConnectPtr conn,
|
|||||||
static int
|
static int
|
||||||
xenInotifyRemoveDomainConfigInfo(virConnectPtr conn,
|
xenInotifyRemoveDomainConfigInfo(virConnectPtr conn,
|
||||||
const char *fname) {
|
const char *fname) {
|
||||||
return useXenConfigCache ? xenXMConfigCacheRemoveFile(conn, fname) :
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
return priv->useXenConfigCache ?
|
||||||
|
xenXMConfigCacheRemoveFile(conn, fname) :
|
||||||
xenInotifyXendDomainsDirRemoveEntry(conn, fname);
|
xenInotifyXendDomainsDirRemoveEntry(conn, fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
xenInotifyAddDomainConfigInfo(virConnectPtr conn,
|
xenInotifyAddDomainConfigInfo(virConnectPtr conn,
|
||||||
const char *fname) {
|
const char *fname) {
|
||||||
return useXenConfigCache ? xenXMConfigCacheAddFile(conn, fname) :
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
return priv->useXenConfigCache ?
|
||||||
|
xenXMConfigCacheAddFile(conn, fname) :
|
||||||
xenInotifyXendDomainsDirAddEntry(conn, fname);
|
xenInotifyXendDomainsDirAddEntry(conn, fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +283,7 @@ xenInotifyEvent(int watch ATTRIBUTE_UNUSED,
|
|||||||
struct inotify_event *e;
|
struct inotify_event *e;
|
||||||
int got;
|
int got;
|
||||||
char *tmp, *name;
|
char *tmp, *name;
|
||||||
virConnectPtr conn = (virConnectPtr) data;
|
virConnectPtr conn = data;
|
||||||
xenUnifiedPrivatePtr priv = NULL;
|
xenUnifiedPrivatePtr priv = NULL;
|
||||||
|
|
||||||
DEBUG0("got inotify event");
|
DEBUG0("got inotify event");
|
||||||
@ -315,7 +321,8 @@ reread:
|
|||||||
|
|
||||||
name = (char *)&(e->name);
|
name = (char *)&(e->name);
|
||||||
|
|
||||||
snprintf(fname, 1024, "%s/%s", configDir, name);
|
snprintf(fname, 1024, "%s/%s",
|
||||||
|
priv->configDir, name);
|
||||||
|
|
||||||
if (e->mask & (IN_DELETE | IN_MOVED_FROM)) {
|
if (e->mask & (IN_DELETE | IN_MOVED_FROM)) {
|
||||||
virDomainEventPtr event =
|
virDomainEventPtr event =
|
||||||
@ -378,24 +385,24 @@ xenInotifyOpen(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
if(priv->xendConfigVersion <= 2) {
|
if(priv->xendConfigVersion <= 2) {
|
||||||
/* /etc/xen */
|
/* /etc/xen */
|
||||||
configDir = xenXMGetConfigDir();
|
priv->configDir = xenXMGetConfigDir();
|
||||||
useXenConfigCache = 1;
|
priv->useXenConfigCache = 1;
|
||||||
} else {
|
} else {
|
||||||
/* /var/lib/xend/domains/<uuid>/config.sxp */
|
/* /var/lib/xend/domains/<uuid>/config.sxp */
|
||||||
configDir = LIBVIRTD_DOMAINS_DIR;
|
priv->configDir = LIBVIRTD_DOMAINS_DIR;
|
||||||
useXenConfigCache = 0;
|
priv->useXenConfigCache = 0;
|
||||||
|
|
||||||
if ( VIR_ALLOC(configInfoList ) < 0) {
|
if (VIR_ALLOC(priv->configInfoList) < 0) {
|
||||||
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("failed to allocate configInfoList"));
|
"%s", _("failed to allocate configInfoList"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* populate initial list */
|
/* populate initial list */
|
||||||
if (!(dh = opendir(configDir))) {
|
if (!(dh = opendir(priv->configDir))) {
|
||||||
virReportSystemError(NULL, errno,
|
virReportSystemError(NULL, errno,
|
||||||
_("cannot open directory: %s"),
|
_("cannot open directory: %s"),
|
||||||
configDir);
|
priv->configDir);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
while ((ent = readdir(dh))) {
|
while ((ent = readdir(dh))) {
|
||||||
@ -403,9 +410,10 @@ xenInotifyOpen(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Build the full file path */
|
/* Build the full file path */
|
||||||
if ((strlen(configDir) + 1 + strlen(ent->d_name) + 1) > PATH_MAX)
|
if ((strlen(priv->configDir) + 1 +
|
||||||
|
strlen(ent->d_name) + 1) > PATH_MAX)
|
||||||
continue;
|
continue;
|
||||||
strcpy(path, configDir);
|
strcpy(path, priv->configDir);
|
||||||
strcat(path, "/");
|
strcat(path, "/");
|
||||||
strcat(path, ent->d_name);
|
strcat(path, ent->d_name);
|
||||||
|
|
||||||
@ -419,24 +427,25 @@ xenInotifyOpen(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((priv->inotifyFD = inotify_init()) < 0) {
|
if ((priv->inotifyFD = inotify_init()) < 0) {
|
||||||
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virReportSystemError(NULL, errno,
|
||||||
"%s", _("initializing inotify"));
|
"%s", _("initializing inotify"));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG("Adding a watch on %s", configDir);
|
DEBUG("Adding a watch on %s", priv->configDir);
|
||||||
if (inotify_add_watch(priv->inotifyFD,
|
if (inotify_add_watch(priv->inotifyFD,
|
||||||
configDir,
|
priv->configDir,
|
||||||
IN_CREATE |
|
IN_CREATE |
|
||||||
IN_CLOSE_WRITE | IN_DELETE |
|
IN_CLOSE_WRITE | IN_DELETE |
|
||||||
IN_MOVED_TO | IN_MOVED_FROM) < 0) {
|
IN_MOVED_TO | IN_MOVED_FROM) < 0) {
|
||||||
virXenInotifyError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virReportSystemError(NULL, errno,
|
||||||
_("adding watch on %s"), _(configDir));
|
_("adding watch on %s"),
|
||||||
|
priv->configDir);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG0("Building initial config cache");
|
DEBUG0("Building initial config cache");
|
||||||
if (useXenConfigCache &&
|
if (priv->useXenConfigCache &&
|
||||||
xenXMConfigCacheRefresh (conn) < 0) {
|
xenXMConfigCacheRefresh (conn) < 0) {
|
||||||
DEBUG("Failed to enable XM config cache %s", conn->err.message);
|
DEBUG("Failed to enable XM config cache %s", conn->err.message);
|
||||||
return -1;
|
return -1;
|
||||||
@ -464,10 +473,10 @@ xenInotifyOpen(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
int
|
int
|
||||||
xenInotifyClose(virConnectPtr conn)
|
xenInotifyClose(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
|
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||||
|
|
||||||
if(configInfoList)
|
if (priv->configInfoList)
|
||||||
xenUnifiedDomainInfoListFree(configInfoList);
|
xenUnifiedDomainInfoListFree(priv->configInfoList);
|
||||||
|
|
||||||
if (priv->inotifyWatch != -1)
|
if (priv->inotifyWatch != -1)
|
||||||
virEventRemoveHandle(priv->inotifyWatch);
|
virEventRemoveHandle(priv->inotifyWatch);
|
||||||
|
@ -156,6 +156,9 @@ struct _xenUnifiedPrivate {
|
|||||||
/* A list of xenstore watches */
|
/* A list of xenstore watches */
|
||||||
xenStoreWatchListPtr xsWatchList;
|
xenStoreWatchListPtr xsWatchList;
|
||||||
int xsWatch;
|
int xsWatch;
|
||||||
|
/* A list of active domain name/uuids */
|
||||||
|
xenUnifiedDomainInfoListPtr activeDomainList;
|
||||||
|
|
||||||
|
|
||||||
/* An list of callbacks */
|
/* An list of callbacks */
|
||||||
virDomainEventCallbackListPtr domainEventCallbacks;
|
virDomainEventCallbackListPtr domainEventCallbacks;
|
||||||
@ -164,6 +167,10 @@ struct _xenUnifiedPrivate {
|
|||||||
/* The inotify fd */
|
/* The inotify fd */
|
||||||
int inotifyFD;
|
int inotifyFD;
|
||||||
int inotifyWatch;
|
int inotifyWatch;
|
||||||
|
|
||||||
|
const char *configDir;
|
||||||
|
int useXenConfigCache ;
|
||||||
|
xenUnifiedDomainInfoListPtr configInfoList;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,9 +46,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PROXY
|
#ifndef PROXY
|
||||||
/* A list of active domain name/uuids */
|
|
||||||
static xenUnifiedDomainInfoListPtr activeDomainList = NULL;
|
|
||||||
|
|
||||||
static char *xenStoreDomainGetOSType(virDomainPtr domain);
|
static char *xenStoreDomainGetOSType(virDomainPtr domain);
|
||||||
|
|
||||||
struct xenUnifiedDriver xenStoreDriver = {
|
struct xenUnifiedDriver xenStoreDriver = {
|
||||||
@ -312,7 +309,7 @@ xenStoreOpen(virConnectPtr conn,
|
|||||||
|
|
||||||
#ifndef PROXY
|
#ifndef PROXY
|
||||||
/* Init activeDomainList */
|
/* Init activeDomainList */
|
||||||
if ( VIR_ALLOC(activeDomainList) < 0) {
|
if (VIR_ALLOC(priv->activeDomainList) < 0) {
|
||||||
virXenStoreError(NULL, VIR_ERR_INTERNAL_ERROR,
|
virXenStoreError(NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("failed to allocate activeDomainList"));
|
"%s", _("failed to allocate activeDomainList"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -390,8 +387,8 @@ xenStoreClose(virConnectPtr conn)
|
|||||||
xenStoreWatchListFree(priv->xsWatchList);
|
xenStoreWatchListFree(priv->xsWatchList);
|
||||||
priv->xsWatchList = NULL;
|
priv->xsWatchList = NULL;
|
||||||
#ifndef PROXY
|
#ifndef PROXY
|
||||||
xenUnifiedDomainInfoListFree(activeDomainList);
|
xenUnifiedDomainInfoListFree(priv->activeDomainList);
|
||||||
activeDomainList = NULL;
|
priv->activeDomainList = NULL;
|
||||||
#endif
|
#endif
|
||||||
if (priv->xshandle == NULL)
|
if (priv->xshandle == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -1190,7 +1187,7 @@ int xenStoreDomainIntroduced(virConnectPtr conn,
|
|||||||
int *new_domids;
|
int *new_domids;
|
||||||
int nread;
|
int nread;
|
||||||
|
|
||||||
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) opaque;
|
xenUnifiedPrivatePtr priv = opaque;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
new_domain_cnt = xenStoreNumOfDomains(conn);
|
new_domain_cnt = xenStoreNumOfDomains(conn);
|
||||||
@ -1209,8 +1206,8 @@ retry:
|
|||||||
missing = 0;
|
missing = 0;
|
||||||
for (i=0 ; i < new_domain_cnt ; i++) {
|
for (i=0 ; i < new_domain_cnt ; i++) {
|
||||||
found = 0;
|
found = 0;
|
||||||
for (j = 0 ; j < activeDomainList->count ; j++) {
|
for (j = 0 ; j < priv->activeDomainList->count ; j++) {
|
||||||
if (activeDomainList->doms[j]->id == new_domids[i]) {
|
if (priv->activeDomainList->doms[j]->id == new_domids[i]) {
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1238,7 +1235,7 @@ retry:
|
|||||||
xenUnifiedDomainEventDispatch(priv, event);
|
xenUnifiedDomainEventDispatch(priv, event);
|
||||||
|
|
||||||
/* Add to the list */
|
/* Add to the list */
|
||||||
xenUnifiedAddDomainInfo(activeDomainList,
|
xenUnifiedAddDomainInfo(priv->activeDomainList,
|
||||||
new_domids[i], name, uuid);
|
new_domids[i], name, uuid);
|
||||||
|
|
||||||
VIR_FREE(name);
|
VIR_FREE(name);
|
||||||
@ -1267,7 +1264,7 @@ int xenStoreDomainReleased(virConnectPtr conn,
|
|||||||
|
|
||||||
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) opaque;
|
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) opaque;
|
||||||
|
|
||||||
if(!activeDomainList->count) return 0;
|
if(!priv->activeDomainList->count) return 0;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
new_domain_cnt = xenStoreNumOfDomains(conn);
|
new_domain_cnt = xenStoreNumOfDomains(conn);
|
||||||
@ -1285,10 +1282,10 @@ retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
removed = 0;
|
removed = 0;
|
||||||
for (j=0 ; j < activeDomainList->count ; j++) {
|
for (j=0 ; j < priv->activeDomainList->count ; j++) {
|
||||||
found = 0;
|
found = 0;
|
||||||
for (i=0 ; i < new_domain_cnt ; i++) {
|
for (i=0 ; i < new_domain_cnt ; i++) {
|
||||||
if (activeDomainList->doms[j]->id == new_domids[i]) {
|
if (priv->activeDomainList->doms[j]->id == new_domids[i]) {
|
||||||
found = 1;
|
found = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1297,18 +1294,18 @@ retry:
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
virDomainEventPtr event =
|
virDomainEventPtr event =
|
||||||
virDomainEventNew(-1,
|
virDomainEventNew(-1,
|
||||||
activeDomainList->doms[j]->name,
|
priv->activeDomainList->doms[j]->name,
|
||||||
activeDomainList->doms[j]->uuid,
|
priv->activeDomainList->doms[j]->uuid,
|
||||||
VIR_DOMAIN_EVENT_STOPPED,
|
VIR_DOMAIN_EVENT_STOPPED,
|
||||||
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
|
VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
|
||||||
if (event)
|
if (event)
|
||||||
xenUnifiedDomainEventDispatch(priv, event);
|
xenUnifiedDomainEventDispatch(priv, event);
|
||||||
|
|
||||||
/* Remove from the list */
|
/* Remove from the list */
|
||||||
xenUnifiedRemoveDomainInfo(activeDomainList,
|
xenUnifiedRemoveDomainInfo(priv->activeDomainList,
|
||||||
activeDomainList->doms[j]->id,
|
priv->activeDomainList->doms[j]->id,
|
||||||
activeDomainList->doms[j]->name,
|
priv->activeDomainList->doms[j]->name,
|
||||||
activeDomainList->doms[j]->uuid);
|
priv->activeDomainList->doms[j]->uuid);
|
||||||
|
|
||||||
removed = 1;
|
removed = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user