mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-26 18:41:17 +00:00
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>
|
Mon Jan 19 20:58:34 CET 2009 Daniel Veillard <veillard@redhat.com>
|
||||||
|
|
||||||
* src/xen_internal.c src/xend_internal.c: Relax NUMA checking
|
* 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",
|
"usb",
|
||||||
"pci")
|
"pci")
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virDomainState, VIR_DOMAIN_CRASHED+1,
|
||||||
|
"nostate",
|
||||||
|
"running",
|
||||||
|
"blocked",
|
||||||
|
"paused",
|
||||||
|
"shutdown",
|
||||||
|
"shutoff",
|
||||||
|
"crashed")
|
||||||
|
|
||||||
#define virDomainReportError(conn, code, fmt...) \
|
#define virDomainReportError(conn, code, fmt...) \
|
||||||
virReportErrorHelper(conn, VIR_FROM_DOMAIN, code, __FILE__, \
|
virReportErrorHelper(conn, VIR_FROM_DOMAIN, code, __FILE__, \
|
||||||
__FUNCTION__, __LINE__, fmt)
|
__FUNCTION__, __LINE__, fmt)
|
||||||
|
@ -625,5 +625,7 @@ VIR_ENUM_DECL(virDomainHostdevSubsys)
|
|||||||
VIR_ENUM_DECL(virDomainInput)
|
VIR_ENUM_DECL(virDomainInput)
|
||||||
VIR_ENUM_DECL(virDomainInputBus)
|
VIR_ENUM_DECL(virDomainInputBus)
|
||||||
VIR_ENUM_DECL(virDomainGraphics)
|
VIR_ENUM_DECL(virDomainGraphics)
|
||||||
|
/* from libvirt.h */
|
||||||
|
VIR_ENUM_DECL(virDomainState)
|
||||||
|
|
||||||
#endif /* __DOMAIN_CONF_H */
|
#endif /* __DOMAIN_CONF_H */
|
||||||
|
@ -94,6 +94,8 @@ virDomainVirtTypeToString;
|
|||||||
virDomainFSDefFree;
|
virDomainFSDefFree;
|
||||||
virDomainObjLock;
|
virDomainObjLock;
|
||||||
virDomainObjUnlock;
|
virDomainObjUnlock;
|
||||||
|
virDomainStateTypeToString;
|
||||||
|
virDomainStateTypeFromString;
|
||||||
|
|
||||||
|
|
||||||
# domain_event.h
|
# domain_event.h
|
||||||
|
@ -1375,12 +1375,14 @@ qemudDomainStatusParseFile(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctxt->node = root;
|
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,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("invalid domain state"));
|
"%s", _("invalid domain state"));
|
||||||
goto error;
|
goto error;
|
||||||
} else
|
} else {
|
||||||
status->state = (int)val;
|
status->state = virDomainStateTypeFromString(tmp);
|
||||||
|
VIR_FREE(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
if((virXPathLong(conn, "string(./@pid)", ctxt, &val)) < 0) {
|
if((virXPathLong(conn, "string(./@pid)", ctxt, &val)) < 0) {
|
||||||
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -1433,7 +1435,9 @@ qemudDomainStatusFormat(virConnectPtr conn,
|
|||||||
char *config_xml = NULL, *xml = NULL;
|
char *config_xml = NULL, *xml = NULL;
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
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);
|
virBufferEscapeString(&buf, " <monitor path='%s'/>\n", vm->monitorpath);
|
||||||
|
|
||||||
if (!(config_xml = virDomainDefFormat(conn,
|
if (!(config_xml = virDomainDefFormat(conn,
|
||||||
|
Loading…
Reference in New Issue
Block a user