mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
conf: record deprecation messages against the domain
These messages will be stored in the live status XML. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
bebaafd6b4
commit
842900dc1e
@ -1788,6 +1788,15 @@ bool virDomainObjTaint(virDomainObjPtr obj,
|
||||
}
|
||||
|
||||
|
||||
void virDomainObjDeprecation(virDomainObjPtr obj,
|
||||
const char *msg)
|
||||
{
|
||||
obj->deprecations = g_renew(char *, obj->deprecations,
|
||||
obj->ndeprecations + 1);
|
||||
obj->deprecations[obj->ndeprecations++] = g_strdup(msg);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
virDomainGraphicsAuthDefClear(virDomainGraphicsAuthDefPtr def)
|
||||
{
|
||||
@ -21258,7 +21267,8 @@ virDomainObjParseXML(xmlDocPtr xml,
|
||||
int reason = 0;
|
||||
void *parseOpaque = NULL;
|
||||
g_autofree char *tmp = NULL;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
g_autofree xmlNodePtr *taintNodes = NULL;
|
||||
g_autofree xmlNodePtr *depNodes = NULL;
|
||||
|
||||
if (!(obj = virDomainObjNew(xmlopt)))
|
||||
return NULL;
|
||||
@ -21305,10 +21315,10 @@ virDomainObjParseXML(xmlDocPtr xml,
|
||||
}
|
||||
obj->pid = (pid_t)val;
|
||||
|
||||
if ((n = virXPathNodeSet("./taint", ctxt, &nodes)) < 0)
|
||||
if ((n = virXPathNodeSet("./taint", ctxt, &taintNodes)) < 0)
|
||||
goto error;
|
||||
for (i = 0; i < n; i++) {
|
||||
char *str = virXMLPropString(nodes[i], "flag");
|
||||
char *str = virXMLPropString(taintNodes[i], "flag");
|
||||
if (str) {
|
||||
int flag = virDomainTaintTypeFromString(str);
|
||||
if (flag < 0) {
|
||||
@ -21322,6 +21332,13 @@ virDomainObjParseXML(xmlDocPtr xml,
|
||||
}
|
||||
}
|
||||
|
||||
if ((n = virXPathNodeSet("./deprecation", ctxt, &depNodes)) < 0)
|
||||
goto error;
|
||||
for (i = 0; i < n; i++) {
|
||||
g_autofree char *str = virXMLNodeContentString(depNodes[i]);
|
||||
virDomainObjDeprecation(obj, str);
|
||||
}
|
||||
|
||||
if (xmlopt->privateData.parse &&
|
||||
xmlopt->privateData.parse(ctxt, obj, &xmlopt->config) < 0)
|
||||
goto error;
|
||||
@ -29166,6 +29183,11 @@ virDomainObjFormat(virDomainObjPtr obj,
|
||||
virDomainTaintTypeToString(i));
|
||||
}
|
||||
|
||||
for (i = 0; i < obj->ndeprecations; i++) {
|
||||
virBufferEscapeString(&buf, "<deprecation>%s</deprecation>\n",
|
||||
obj->deprecations[i]);
|
||||
}
|
||||
|
||||
if (xmlopt->privateData.format &&
|
||||
xmlopt->privateData.format(&buf, obj) < 0)
|
||||
return NULL;
|
||||
|
@ -2804,6 +2804,8 @@ struct _virDomainObj {
|
||||
void (*privateDataFreeFunc)(void *);
|
||||
|
||||
int taint;
|
||||
size_t ndeprecations;
|
||||
char **deprecations;
|
||||
|
||||
unsigned long long original_memlock; /* Original RLIMIT_MEMLOCK, zero if no
|
||||
* restore will be required later */
|
||||
@ -3061,6 +3063,8 @@ void virDomainObjEndAPI(virDomainObjPtr *vm);
|
||||
|
||||
bool virDomainObjTaint(virDomainObjPtr obj,
|
||||
virDomainTaintFlags taint);
|
||||
void virDomainObjDeprecation(virDomainObjPtr obj,
|
||||
const char *msg);
|
||||
|
||||
void virDomainObjBroadcast(virDomainObjPtr vm);
|
||||
int virDomainObjWait(virDomainObjPtr vm);
|
||||
|
@ -548,6 +548,7 @@ virDomainObjAssignDef;
|
||||
virDomainObjBroadcast;
|
||||
virDomainObjCheckActive;
|
||||
virDomainObjCopyPersistentDef;
|
||||
virDomainObjDeprecation;
|
||||
virDomainObjEndAPI;
|
||||
virDomainObjFormat;
|
||||
virDomainObjGetDefs;
|
||||
|
Loading…
Reference in New Issue
Block a user