提交 971d552e 编写于 作者: P Pavel Hrdina

qemu_command: remove xenner leftover from video device code

Qemu supports *xen* video device only with XEN and this code was part
of xenner code.  We dropped support for xenner in commit de9be0ab.

Before this patch if you used 'xen' video type you ended up with
domain without any video device at all.  Now we don't allow to start
such domain.
Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
上级 3632ddc7
...@@ -96,7 +96,7 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, ...@@ -96,7 +96,7 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
"std", "std",
"cirrus", "cirrus",
"vmware", "vmware",
"", /* no arg needed for xen */ "", /* don't support xen */
"", /* don't support vbox */ "", /* don't support vbox */
"qxl", "qxl",
"", /* don't support parallels */ "", /* don't support parallels */
...@@ -108,7 +108,7 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, ...@@ -108,7 +108,7 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
"VGA", "VGA",
"cirrus-vga", "cirrus-vga",
"vmware-svga", "vmware-svga",
"", /* no device for xen */ "", /* don't support xen */
"", /* don't support vbox */ "", /* don't support vbox */
"qxl-vga", "qxl-vga",
"", /* don't support parallels */ "", /* don't support parallels */
...@@ -4419,103 +4419,99 @@ qemuBuildVideoCommandLine(virCommandPtr cmd, ...@@ -4419,103 +4419,99 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
VIR_FREE(str); VIR_FREE(str);
} }
} else { } else {
if (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_XEN) { if ((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_QXL) &&
/* nothing - vga has no effect on Xen pvfb */ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_QXL)) {
} else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
if ((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_QXL) && _("This QEMU does not support QXL graphics adapters"));
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_QXL)) { return -1;
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", }
_("This QEMU does not support QXL graphics adapters"));
const char *vgastr = qemuVideoTypeToString(primaryVideoType);
if (!vgastr || STREQ(vgastr, "")) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("video type %s is not supported with QEMU"),
virDomainVideoTypeToString(primaryVideoType));
return -1;
}
virCommandAddArgList(cmd, "-vga", vgastr, NULL);
/* If we cannot use --device option to specify the video device
* in QEMU we will fallback to the old --vga option. To get the
* correct device name for the --vga option the 'qemuVideo' is
* used, but to set some device attributes we need to use the
* --global option and for that we need to specify the device
* name the same as for --device option and for that we need to
* use 'qemuDeviceVideo'.
*
* See 'Graphics Devices' section in docs/qdev-device-use.txt in
* QEMU repository.
*/
const char *dev = qemuDeviceVideoTypeToString(primaryVideoType);
if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
(def->videos[0]->vram || def->videos[0]->ram)) {
unsigned int ram = def->videos[0]->ram;
unsigned int vram = def->videos[0]->vram;
unsigned int vram64 = def->videos[0]->vram64;
unsigned int vgamem = def->videos[0]->vgamem;
if (vram > (UINT_MAX / 1024)) {
virReportError(VIR_ERR_OVERFLOW,
_("value for 'vram' must be less than '%u'"),
UINT_MAX / 1024);
return -1; return -1;
} }
if (ram > (UINT_MAX / 1024)) {
const char *vgastr = qemuVideoTypeToString(primaryVideoType); virReportError(VIR_ERR_OVERFLOW,
if (!vgastr || STREQ(vgastr, "")) { _("value for 'ram' must be less than '%u'"),
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, UINT_MAX / 1024);
_("video type %s is not supported with QEMU"),
virDomainVideoTypeToString(primaryVideoType));
return -1; return -1;
} }
virCommandAddArgList(cmd, "-vga", vgastr, NULL); if (ram) {
virCommandAddArg(cmd, "-global");
/* If we cannot use --device option to specify the video device virCommandAddArgFormat(cmd, "%s.ram_size=%u",
* in QEMU we will fallback to the old --vga option. To get the dev, ram * 1024);
* correct device name for the --vga option the 'qemuVideo' is
* used, but to set some device attributes we need to use the
* --global option and for that we need to specify the device
* name the same as for --device option and for that we need to
* use 'qemuDeviceVideo'.
*
* See 'Graphics Devices' section in docs/qdev-device-use.txt in
* QEMU repository.
*/
const char *dev = qemuDeviceVideoTypeToString(primaryVideoType);
if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL &&
(def->videos[0]->vram || def->videos[0]->ram)) {
unsigned int ram = def->videos[0]->ram;
unsigned int vram = def->videos[0]->vram;
unsigned int vram64 = def->videos[0]->vram64;
unsigned int vgamem = def->videos[0]->vgamem;
if (vram > (UINT_MAX / 1024)) {
virReportError(VIR_ERR_OVERFLOW,
_("value for 'vram' must be less than '%u'"),
UINT_MAX / 1024);
return -1;
}
if (ram > (UINT_MAX / 1024)) {
virReportError(VIR_ERR_OVERFLOW,
_("value for 'ram' must be less than '%u'"),
UINT_MAX / 1024);
return -1;
}
if (ram) {
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.ram_size=%u",
dev, ram * 1024);
}
if (vram) {
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.vram_size=%u",
dev, vram * 1024);
}
if (vram64 &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VRAM64)) {
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.vram64_size_mb=%u",
dev, vram64 / 1024);
}
if (vgamem &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) {
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u",
dev, vgamem / 1024);
}
} }
if (vram) {
if (def->videos[0]->vram && virCommandAddArg(cmd, "-global");
((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VGA && virCommandAddArgFormat(cmd, "%s.vram_size=%u",
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) || dev, vram * 1024);
(primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VMVGA && }
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM)))) { if (vram64 &&
unsigned int vram = def->videos[0]->vram; virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VRAM64)) {
virCommandAddArg(cmd, "-global");
if (vram < 1024) { virCommandAddArgFormat(cmd, "%s.vram64_size_mb=%u",
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, dev, vram64 / 1024);
"%s", _("value for 'vgamem' must be at " }
"least 1 MiB (1024 KiB)")); if (vgamem &&
return -1; virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) {
}
virCommandAddArg(cmd, "-global"); virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u", virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u",
dev, vram / 1024); dev, vgamem / 1024);
} }
} }
if (def->videos[0]->vram &&
((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VGA &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) ||
(primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VMVGA &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM)))) {
unsigned int vram = def->videos[0]->vram;
if (vram < 1024) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("value for 'vgamem' must be at "
"least 1 MiB (1024 KiB)"));
return -1;
}
virCommandAddArg(cmd, "-global");
virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u",
dev, vram / 1024);
}
for (i = 1; i < def->nvideos; i++) { for (i = 1; i < def->nvideos; i++) {
char *str; char *str;
if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册