mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-05 22:05:47 +00:00
virDomainRNGDef: Convert 'model' field to proper enum type
Convert the field and adjust the XML parser to use virXMLPropEnum(). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
27a653b893
commit
53edfa23f1
@ -12116,21 +12116,16 @@ virDomainRNGDefParseXML(virDomainXMLOption *xmlopt,
|
|||||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||||
int nbackends;
|
int nbackends;
|
||||||
g_autofree xmlNodePtr *backends = NULL;
|
g_autofree xmlNodePtr *backends = NULL;
|
||||||
g_autofree char *model = NULL;
|
|
||||||
g_autofree char *backend = NULL;
|
g_autofree char *backend = NULL;
|
||||||
g_autofree char *type = NULL;
|
g_autofree char *type = NULL;
|
||||||
|
|
||||||
def = g_new0(virDomainRNGDef, 1);
|
def = g_new0(virDomainRNGDef, 1);
|
||||||
|
|
||||||
if (!(model = virXMLPropString(node, "model"))) {
|
if (virXMLPropEnum(node, "model",
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s", _("missing RNG device model"));
|
virDomainRNGModelTypeFromString,
|
||||||
|
VIR_XML_PROP_REQUIRED,
|
||||||
|
&def->model) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
|
|
||||||
if ((def->model = virDomainRNGModelTypeFromString(model)) < 0) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown RNG model '%1$s'"), model);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
ctxt->node = node;
|
ctxt->node = node;
|
||||||
|
|
||||||
|
@ -2609,7 +2609,7 @@ typedef enum {
|
|||||||
} virDomainRNGBackend;
|
} virDomainRNGBackend;
|
||||||
|
|
||||||
struct _virDomainRNGDef {
|
struct _virDomainRNGDef {
|
||||||
int model;
|
virDomainRNGModel model;
|
||||||
int backend;
|
int backend;
|
||||||
unsigned int rate; /* bytes per period */
|
unsigned int rate; /* bytes per period */
|
||||||
unsigned int period; /* milliseconds */
|
unsigned int period; /* milliseconds */
|
||||||
|
@ -912,7 +912,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDef *dev,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_DEVICE_RNG:
|
case VIR_DOMAIN_DEVICE_RNG:
|
||||||
switch ((virDomainRNGModel) dev->data.rng->model) {
|
switch (dev->data.rng->model) {
|
||||||
case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
|
case VIR_DOMAIN_RNG_MODEL_VIRTIO_TRANSITIONAL:
|
||||||
/* Transitional devices only work in conventional PCI slots */
|
/* Transitional devices only work in conventional PCI slots */
|
||||||
return pciFlags;
|
return pciFlags;
|
||||||
|
Loading…
Reference in New Issue
Block a user