[libvirt] [v3] qemu: Support vram for video of qxl type
by Osier Yang
For qemu names the primary vga as "qxl-vga":
1) if vram is specified for 2nd qxl device:
-vga qxl -global qxl-vga.vram_size=$SIZE \
-device qxl,id=video1,vram_size=$SIZE,...
2) if vram is not specified for 2nd qxl device, (use the default
set by global):
-vga qxl -global qxl-vga.vram_size=$SIZE \
-device qxl,id=video1,...
For qemu names all qxl devices as "qxl":
1) if vram is specified for 2nd qxl device:
-vga qxl -global qxl.vram_size=$SIZE \
-device qxl,id=video1,vram_size=$SIZE ...
2) if vram is not specified for 2nd qxl device:
-vga qxl -global qxl-vga.vram_size=$SIZE \
-device qxl,id=video1,...
"-global" is the only way to define vram_size for the primary qxl
device, regardless of how qemu names it, (It's not good a good
way, as original idea of "-global" is to set a global default for
a driver property, but to specify vram for first qxl device, we
have to use it).
For other qxl devices, as they are represented by "-device", could
specify it directly and seperately for each, and it overrides the
default set by "-global" if specified.
v1 - v2:
* modify "virDomainVideoDefaultRAM" so that it returns 16M as the
default vram_size for qxl device.
* vram_size * 1024 (qemu accepts bytes for vram_size).
* apply default vram_size for qxl device for which vram_size is
not specified.
* modify "graphics-spice" tests (more sensiable vram_size)
* Add an argument of virDomainDefPtr type for qemuBuildVideoDevStr,
to use virDomainVideoDefaultRAM in qemuBuildVideoDevStr).
v2 - v3:
* Modify default video memory size for qxl device from 16M to 24M
* Update codes to be consistent with changes on qemu_capabilities.*
---
src/conf/domain_conf.c | 4 ++
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 18 ++++++++++
tests/qemuhelptest.c | 1 +
.../qemuxml2argv-graphics-spice-qxl-vga.args | 7 ++++
.../qemuxml2argv-graphics-spice-qxl-vga.xml | 36 ++++++++++++++++++++
.../qemuxml2argv-graphics-spice.args | 4 +-
.../qemuxml2argv-graphics-spice.xml | 4 +-
tests/qemuxml2argvtest.c | 4 ++
tests/qemuxml2xmltest.c | 1 +
11 files changed, 78 insertions(+), 4 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c8350c6..16e1291 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4167,6 +4167,10 @@ virDomainVideoDefaultRAM(virDomainDefPtr def,
/* Original Xen PVFB hardcoded to 4 MB */
return 4 * 1024;
+ case VIR_DOMAIN_VIDEO_TYPE_QXL:
+ /* QEMU use 64M as the minimal video video memory for qxl device */
+ return 64 * 1024;
+
default:
return 0;
}
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 477924d..d8aa9cd 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1122,6 +1122,8 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
}
if (strstr(str, "virtio-net-pci.tx="))
qemuCapsSet(flags, QEMU_CAPS_VIRTIO_TX_ALG);
+ if (strstr(str, "name \"qxl-vga\""))
+ qemuCapsSet(flags, QEMU_CAPS_DEVICE_QXL_VGA);
return 0;
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a61b088..68c5958 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -94,6 +94,7 @@ enum qemuCapsFlags {
QEMU_CAPS_CHARDEV_SPICEVMC = 56, /* newer -chardev spicevmc */
QEMU_CAPS_DEVICE_SPICEVMC = 57, /* older -device spicevmc*/
QEMU_CAPS_VIRTIO_TX_ALG = 58, /* -device virtio-net-pci,tx=string */
+ QEMU_CAPS_DEVICE_QXL_VGA = 59, /* Is the primary and vga campatible qxl device named qxl-vga? */
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index fa60abe..198a4e2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1931,6 +1931,12 @@ qemuBuildVideoDevStr(virDomainVideoDefPtr video,
virBufferVSprintf(&buf, "%s", model);
virBufferVSprintf(&buf, ",id=%s", video->info.alias);
+
+ if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
+ /* QEMU accepts bytes for vram_size. */
+ virBufferVSprintf(&buf, ",vram_size=%u", video->vram * 1024);
+ }
+
if (qemuBuildDeviceAddressStr(&buf, &video->info, qemuCaps) < 0)
goto error;
@@ -4033,6 +4039,18 @@ qemuBuildCommandLine(virConnectPtr conn,
}
virCommandAddArgList(cmd, "-vga", vgastr, NULL);
+
+ if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
+ if (def->videos[0]->vram &&
+ qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+ if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA))
+ virCommandAddArgFormat(cmd, "-global qxl-vga.vram_size=%u",
+ def->videos[0]->vram * 1024);
+ else
+ virCommandAddArgFormat(cmd, "-global qxl.vram_size=%u",
+ def->videos[0]->vram * 1024);
+ }
+ }
}
} else {
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 335364f..c86c578 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -489,6 +489,7 @@ mymain(int argc, char **argv)
QEMU_CAPS_DRIVE_AIO,
QEMU_CAPS_CCID_PASSTHRU,
QEMU_CAPS_CHARDEV_SPICEVMC,
+ QEMU_CAPS_DEVICE_QXL_VGA,
QEMU_CAPS_VIRTIO_TX_ALG);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
new file mode 100644
index 0000000..18013a5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
@@ -0,0 +1,7 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nodefaults -monitor \
+unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
+/dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,\
+x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs -vga \
+qxl -global qxl-vga.vram_size=33554432 -device qxl,id=video1,vram_size=67108864,bus=pci.0,addr=0x4 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
new file mode 100644
index 0000000..a38550c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
@@ -0,0 +1,36 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219136</memory>
+ <currentMemory>219136</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'/>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='spice' port='5903' tlsPort='5904' autoport='no' listen='127.0.0.1'>
+ <channel name='main' mode='secure'/>
+ <channel name='inputs' mode='insecure'/>
+ </graphics>
+ <video>
+ <model type='qxl' vram='32768' heads='1'/>
+ </video>
+ <video>
+ <model type='qxl' vram='65536' heads='1'/>
+ </video>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
index a8fb243..c788bb6 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
@@ -3,5 +3,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=spice \
unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \
/dev/HostVG/QEMUGuest1 -usb -spice port=5903,tls-port=5904,addr=127.0.0.1,\
x509-dir=/etc/pki/libvirt-spice,tls-channel=main,plaintext-channel=inputs -vga \
-qxl -device qxl,id=video1,bus=pci.0,addr=0x4 -device virtio-balloon-pci,\
-id=balloon0,bus=pci.0,addr=0x3
+qxl -global qxl.vram_size=18874368 -device qxl,id=video1,vram_size=33554432,bus=pci.0,addr=0x4 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
index fc9f3fe..5d46509 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
@@ -26,10 +26,10 @@
<channel name='inputs' mode='insecure'/>
</graphics>
<video>
- <model type='qxl' vram='65536' heads='1'/>
+ <model type='qxl' vram='18432' heads='1'/>
</video>
<video>
- <model type='qxl' vram='65536' heads='1'/>
+ <model type='qxl' vram='32768' heads='1'/>
</video>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d2864ef..c1329fa 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -357,6 +357,10 @@ mymain(int argc, char **argv)
DO_TEST("graphics-spice", false,
QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE);
+ DO_TEST("graphics-spice-qxl-vga", false,
+ QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL,
+ QEMU_CAPS_DEVICE, QEMU_CAPS_SPICE,
+ QEMU_CAPS_DEVICE_QXL_VGA);
DO_TEST("input-usbmouse", false, NONE);
DO_TEST("input-usbtablet", false, NONE);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 67e721b..c0c36ad 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -152,6 +152,7 @@ mymain(int argc, char **argv)
DO_TEST("graphics-sdl");
DO_TEST("graphics-sdl-fullscreen");
DO_TEST("graphics-spice");
+ DO_TEST("graphics-spice-qxl-vga");
DO_TEST("input-usbmouse");
DO_TEST("input-usbtablet");
DO_TEST("input-xen");
--
1.7.4
13 years, 8 months
[libvirt] [PATCH] virsh: Free stream when shutdown console
by Osier Yang
Otherwise connection of hypervisor driver will be leaked when
one shutdown the guest in console. e.g.
[root@localhost]# init 0
......
init: Re-executing /sbin/init
Halting system...
Power down.
error: Failed to disconnect from the hypervisor, 1 leaked reference(s)
---
tools/console.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/tools/console.c b/tools/console.c
index b9dd268..01d8bd1 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -91,6 +91,8 @@ static void
virConsoleShutdown(virConsolePtr con)
{
con->quit = true;
+ if (con->st)
+ virStreamFree(con->st);
virStreamEventRemoveCallback(con->st);
if (con->stdinWatch != -1)
virEventRemoveHandle(con->stdinWatch);
--
1.7.4
13 years, 8 months
[libvirt] libvirt configuration problem
by Onkar Mahajan
Hi ,
I am getting errors while configuring libvirt to compile it from source.
There is a error in libnl
checking for UDEV... no
checking whether to compile with macvtap support... yes
checking whether to compile with virtual port support... no
checking for LIBNL... no
configure: error: libnl-devel >= 1.1 is required for macvtap support
I have already installed the libnl library in /lib/
[root@localhost lib]# ls libnl*
libnl.a libnl-cli.so.2 libnl-genl.so libnl-nf.a
libnl-nf.so.2.0.0 libnl-route.so.2 libnl.so.2.0.0
libnl-cli.a libnl-cli.so.2.0.0 libnl-genl.so.2 libnl-nf.la
libnl-route.a libnl-route.so.2.0.0
libnl-cli.la libnl-genl.a libnl-genl.so.2.0.0 libnl-nf.so
libnl-route.la libnl.so
libnl-cli.so libnl-genl.la libnl.la libnl-nf.so.2
libnl-route.so libnl.so.2
Please help me !!
Regards,
Onkar
13 years, 8 months
[libvirt] [PATCH 0/3] Fix a couple of virtual network dnsmasq bugs
by Laine Stump
(sorry for the previous message sent from "root" - I mistakenly ran
git send-email from a shell that was su'ed, and realized my mistake
midstream)
The first of these bugs is a regression that I didn't notice until it
was reported on libvirt-users list a couple days ago. The second is a
long-standing problem that I'm sure I saw discussed either on one of
the libvirt lists, or in a RHEL, Fedora, or upstream libvirt bugzilla
report, but can't find it right now.
13 years, 8 months
[libvirt] login and password in connection string for vmware hypervisors...
by john alexander sanabria ordonez
Hi,
I want submit commands against a VMWare hypervisor via virsh in a
non-interactive way. I can connect to my [remote] hypervisor via virsh as
follows:
virsh -c gsx://ic-p19-01?no_verify=1
then, it asks me for login and [root] password and I'm in.
What mechanism can be used to submit commands, e.g. virsh -c
gsx://localhost?no_verify list --all, with no password at all? A modified
version of the connection string is required? what is the structure of that
connection string? Additional parameters to the 'virsh' command?
Thank you,
13 years, 8 months
[libvirt] documenting the 802.1Qbg parameters of a 'direct' interface
by Gerhard Stenzel
This patchs adds documentation about the 802.1Qbg related parameters
of the virtualport element in a 'direct' interface definition.
Signed-off-by: Gerhard Stenzel <gerhard.stenzel(a)de.ibm.com>
patch attached to avoid line wrapping
--
Best regards,
Gerhard Stenzel,
-----------------------------------------------------------------------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
13 years, 8 months
[libvirt] [PATCH 0/3] Fix a couple of virtual network dnsmasq bugs
by root
The first of these bugs is a regression that I didn't notice until it
was reported on libvirt-users list a couple days ago. The second is a
long-standing problem that I'm sure I saw discussed either on one of
the libvirt lists, or in a RHEL, Fedora, or upstream libvirt bugzilla
report, but can't find it right now.
13 years, 8 months
[libvirt] [PATCH] RFC: support "vram" and "heads" for qxl vga
by Osier Yang
qemu command line to specify "vram":
-global qxl.vram_size=uint
qemu command line to specify "heads", (no need of '-device' for
the first 'head'):
-device qxl,id=qxl-N (N is natural number)
This patch is just about the command line building, still left work
on the command line parsing (hacking on "qemuBuildCommandLine"), as
I'm even not sure if it's the right way to build the command line.
Any advise/idea is appreciated.
---
src/qemu/qemu_capabilities.c | 5 ++++-
src/qemu/qemu_capabilities.h | 3 ++-
src/qemu/qemu_command.c | 14 ++++++++++++++
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index cc5552c..78bcb4c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -942,9 +942,12 @@ qemuCapsComputeCmdFlags(const char *help,
* two features. The benefits of JSON mode now outweigh
* the downside.
*/
- if (version >= 13000)
+ if (version >= 13000)
flags |= QEMUD_CMD_FLAG_MONITOR_JSON;
+ if (strstr(help, "-global"))
+ flags |= QEMUD_CMD_FLAG_GLOBAL;
+
return flags;
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a130a4f..b1feb87 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -91,7 +91,8 @@ enum qemuCapsFlags {
QEMUD_CMD_FLAG_CCID_EMULATED = (1LL << 54), /* -device ccid-card-emulated */
QEMUD_CMD_FLAG_CCID_PASSTHRU = (1LL << 55), /* -device ccid-card-passthru */
QEMUD_CMD_FLAG_CHARDEV_SPICEVMC = (1LL << 56), /* newer -chardev spicevmc */
- QEMUD_CMD_FLAG_DEVICE_SPICEVMC = (1LL << 57), /* older -device spicevmc*/
+ QEMUD_CMD_FLAG_DEVICE_SPICEVMC = (1LL << 57), /* older -device spicevmc */
+ QEMUD_CMD_FLAG_GLOBAL = (1LL << 58), /* Is -global available */
};
virCapsPtr qemuCapsInit(virCapsPtr old_caps);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1687203..92af6cb 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3964,6 +3964,20 @@ qemuBuildCommandLine(virConnectPtr conn,
}
virCommandAddArgList(cmd, "-vga", vgastr, NULL);
+
+ if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
+ if (def->videos[0]->vram &&
+ (qemuCmdFlags & QEMUD_CMD_FLAG_GLOBAL)) {
+ virCommandAddArgFormat(cmd, "-global qxl.vram_size=%u",
+ def->videos[0]->vram);
+ }
+
+ if (def->videos[0]->heads > 0) {
+ for (i = 0; i < def->videos[0]->heads - 1; i++) {
+ virCommandAddArgFormat(cmd, "-device %s,id=qxl-%d", vgastr, i+1);
+ }
+ }
+ }
}
} else {
--
1.7.4
13 years, 8 months
[libvirt] [PATCH 2/2] Ignore backing file errors in FS storage pool (v3)
by Philipp Hahn
Currently a single storage volume with a broken backing file will disable the
whole storage pool. This can happen when the backing file is on some
unavailable network storage or if the backing volume is deleted, while the
storage volumes using it are not.
Since the storage pool then can not be re-activated, re-creating the missing
or
deleting the now useless volumes using libvirt only is impossible.
To "fix" this case, all errors detected during storage pool activation are now
(silently) ignored. Errors are still logged by the called functions, which
have
more knowledge on the detailed error condition.
To reproduce:
dir=$(mktemp -d)
virsh pool-create-as tmp dir '' '' '' '' "$dir"
virsh vol-create-as --format qcow2 tmp back 1G
virsh vol-create-as --format qcow2 --backing-vol-format qcow2 --backing-vol
back tmp cow 1G
virsh vol-delete --pool tmp back
virsh pool-refresh tmp
After the last step, the pool will be gone (because it was not persistent). As
long as the now broken image stays in the directory, you will not be able to
re-create or re-start the pool.
Signed-off-by: Philipp Hahn <hahn(a)univention.de>
---
src/storage/storage_backend_fs.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
13 years, 8 months