qemu: Extract and store vCPU properties as qemu returned them

In addition to the data that libvirt needs and extracts internally,
copy and store the whole 'props' JSON sub-object of the data returned by
query-hotpluggable-cpus for future use.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Peter Krempa 2019-08-29 14:47:10 +02:00
parent 1b380b89ff
commit a0b61591f2
5 changed files with 18 additions and 0 deletions

View File

@ -1144,6 +1144,7 @@ qemuDomainVcpuPrivateDispose(void *obj)
VIR_FREE(priv->type);
VIR_FREE(priv->alias);
virJSONValueFree(priv->props);
return;
}
@ -11920,6 +11921,8 @@ qemuDomainRefreshVcpuInfo(virQEMUDriverPtr driver,
VIR_STEAL_PTR(vcpupriv->type, info[i].type);
VIR_FREE(vcpupriv->alias);
VIR_STEAL_PTR(vcpupriv->alias, info[i].alias);
virJSONValueFree(vcpupriv->props);
VIR_STEAL_PTR(vcpupriv->props, info[i].props);
vcpupriv->enable_id = info[i].id;
vcpupriv->qemu_id = info[i].qemu_id;

View File

@ -449,6 +449,9 @@ struct _qemuDomainVcpuPrivate {
char *alias;
virTristateBool halted;
/* copy of the data that qemu returned */
virJSONValuePtr props;
/* information for hotpluggable cpus */
char *type;
int socket_id;

View File

@ -1780,6 +1780,7 @@ qemuMonitorCPUInfoClear(qemuMonitorCPUInfoPtr cpus,
VIR_FREE(cpus[i].qom_path);
VIR_FREE(cpus[i].alias);
VIR_FREE(cpus[i].type);
virJSONValueFree(cpus[i].props);
}
}
@ -1931,6 +1932,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
VIR_STEAL_PTR(vcpus[mastervcpu].qom_path, hotplugvcpus[i].qom_path);
VIR_STEAL_PTR(vcpus[mastervcpu].alias, hotplugvcpus[i].alias);
VIR_STEAL_PTR(vcpus[mastervcpu].type, hotplugvcpus[i].type);
VIR_STEAL_PTR(vcpus[mastervcpu].props, hotplugvcpus[i].props);
vcpus[mastervcpu].id = hotplugvcpus[i].enable_id;
/* copy state information to slave vcpus */

View File

@ -570,6 +570,9 @@ struct qemuMonitorQueryHotpluggableCpusEntry {
char *qom_path; /* full device qom path only present for online cpus */
char *alias; /* device alias, may be NULL for non-hotpluggable entities */
/* verbatim copy of the JSON data representing the CPU which must be used for hotplug */
virJSONValuePtr props;
/* topology information -1 if qemu didn't report given parameter */
int node_id;
int socket_id;
@ -603,6 +606,9 @@ struct _qemuMonitorCPUInfo {
/* name of the qemu type to add in case of hotplug */
char *type;
/* verbatim copy of the returned data from qemu which should be used when plugging */
virJSONValuePtr props;
/* alias of an hotpluggable entry. Entries with alias can be hot-unplugged */
char *alias;

View File

@ -8378,6 +8378,7 @@ qemuMonitorQueryHotpluggableCpusFree(struct qemuMonitorQueryHotpluggableCpusEntr
VIR_FREE(entry->type);
VIR_FREE(entry->qom_path);
VIR_FREE(entry->alias);
virJSONValueFree(entry->props);
}
VIR_FREE(entries);
@ -8426,6 +8427,9 @@ qemuMonitorJSONProcessHotpluggableCpusReply(virJSONValuePtr vcpu,
return -1;
}
if (!(entry->props = virJSONValueCopy(props)))
return -1;
entry->node_id = -1;
entry->socket_id = -1;
entry->core_id = -1;