mirror of https://gitee.com/openkylin/libvirt.git
save domstate as string in status file
This commit is contained in:
parent
e59dd65380
commit
5d99a309e6
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Mon Jan 19 21:54:25 CET 2009 Guido Günther <agx@sigxcpu.org>
|
||||
|
||||
save domstate as string in status file
|
||||
* src/domain_conf.c (virDomainState): add VIR_ENUM_IMPL
|
||||
* src/domain_conf.h (virDomainState): add VIR_ENUM_DECL
|
||||
* src/qemu_conf.c (qemudDomainStatusParseFile): parse state as string
|
||||
(qemudDomainStatusFormat): write as string
|
||||
* src/libvirt_private.syms (virDomainStateTypeToString,
|
||||
virDomainStateTypeFromString): add sympbols
|
||||
|
||||
Mon Jan 19 20:58:34 CET 2009 Daniel Veillard <veillard@redhat.com>
|
||||
|
||||
* src/xen_internal.c src/xend_internal.c: Relax NUMA checking
|
||||
|
|
|
@ -142,6 +142,15 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST,
|
|||
"usb",
|
||||
"pci")
|
||||
|
||||
VIR_ENUM_IMPL(virDomainState, VIR_DOMAIN_CRASHED+1,
|
||||
"nostate",
|
||||
"running",
|
||||
"blocked",
|
||||
"paused",
|
||||
"shutdown",
|
||||
"shutoff",
|
||||
"crashed")
|
||||
|
||||
#define virDomainReportError(conn, code, fmt...) \
|
||||
virReportErrorHelper(conn, VIR_FROM_DOMAIN, code, __FILE__, \
|
||||
__FUNCTION__, __LINE__, fmt)
|
||||
|
|
|
@ -625,5 +625,7 @@ VIR_ENUM_DECL(virDomainHostdevSubsys)
|
|||
VIR_ENUM_DECL(virDomainInput)
|
||||
VIR_ENUM_DECL(virDomainInputBus)
|
||||
VIR_ENUM_DECL(virDomainGraphics)
|
||||
/* from libvirt.h */
|
||||
VIR_ENUM_DECL(virDomainState)
|
||||
|
||||
#endif /* __DOMAIN_CONF_H */
|
||||
|
|
|
@ -94,6 +94,8 @@ virDomainVirtTypeToString;
|
|||
virDomainFSDefFree;
|
||||
virDomainObjLock;
|
||||
virDomainObjUnlock;
|
||||
virDomainStateTypeToString;
|
||||
virDomainStateTypeFromString;
|
||||
|
||||
|
||||
# domain_event.h
|
||||
|
|
|
@ -1375,12 +1375,14 @@ qemudDomainStatusParseFile(virConnectPtr conn,
|
|||
}
|
||||
|
||||
ctxt->node = root;
|
||||
if((virXPathLong(conn, "string(./@state)", ctxt, &val)) < 0) {
|
||||
if(!(tmp = virXPathString(conn, "string(./@state)", ctxt))) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("invalid domain state"));
|
||||
goto error;
|
||||
} else
|
||||
status->state = (int)val;
|
||||
} else {
|
||||
status->state = virDomainStateTypeFromString(tmp);
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
if((virXPathLong(conn, "string(./@pid)", ctxt, &val)) < 0) {
|
||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||
|
@ -1433,7 +1435,9 @@ qemudDomainStatusFormat(virConnectPtr conn,
|
|||
char *config_xml = NULL, *xml = NULL;
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
|
||||
virBufferVSprintf(&buf, "<domstatus state='%d' pid='%d'>\n", vm->state, vm->pid);
|
||||
virBufferVSprintf(&buf, "<domstatus state='%s' pid='%d'>\n",
|
||||
virDomainStateTypeToString(vm->state),
|
||||
vm->pid);
|
||||
virBufferEscapeString(&buf, " <monitor path='%s'/>\n", vm->monitorpath);
|
||||
|
||||
if (!(config_xml = virDomainDefFormat(conn,
|
||||
|
|
Loading…
Reference in New Issue