提交 20cc7f9e 编写于 作者: M Michal Privoznik

domain_conf: Fix str2enum translation of video driver name

In bc1e924c we've introduced video driver name and whilst
doing so we've utilized VIR_ENUM_IMPL() macro. Then, in domain
XML parsing code the generated
virDomainVideoBackendTypeFromString() is called and its return
value is assigned directly to an unsigned int variable which is
wrong. Also, the video driver enum has 'default' value which is
not formatted into domain XML but is accepted during parsing.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 fdff7294
......@@ -15504,11 +15504,13 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xmlopt,
}
if (driver_name) {
if ((def->backend = virDomainVideoBackendTypeFromString(driver_name)) < 0) {
int backend;
if ((backend = virDomainVideoBackendTypeFromString(driver_name)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown video driver '%s'"), driver_name);
goto error;
}
def->backend = backend;
} else {
def->backend = VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT;
}
......
......@@ -1378,7 +1378,7 @@ struct _virDomainWatchdogDef {
/* the backend driver used for virtio interfaces */
typedef enum {
VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT,
VIR_DOMAIN_VIDEO_BACKEND_TYPE_DEFAULT = 0,
VIR_DOMAIN_VIDEO_BACKEND_TYPE_QEMU,
VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册