[libvirt] [PATCH] virsh: add --start option to the define command
by Doug Goldstein
Adds the --start option to the define command to simplify the often used
case of virsh "define dom.xml; start dom" or virsh define dom.xml &&
virsh start dom.
This is just a rebased version of:
https://www.redhat.com/archives/libvir-list/2013-January/msg00490.html
There's a competing patchset available at:
https://www.redhat.com/archives/libvir-list/2013-February/msg01298.html
---
tools/virsh-domain.c | 23 +++++++++++++++++++++--
tools/virsh.pod | 5 +++--
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 96dd4fa..6d62197 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -6602,6 +6602,10 @@ static const vshCmdOptDef opts_define[] = {
.flags = VSH_OFLAG_REQ,
.help = N_("file containing an XML domain description")
},
+ {.name = "start",
+ .type = VSH_OT_BOOL,
+ .help = N("start the domain after definition")
+ },
{.name = NULL}
};
@@ -6612,6 +6616,7 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd)
const char *from = NULL;
bool ret = true;
char *buffer;
+ bool start = false;
if (vshCommandOptStringReq(ctl, cmd, "file", &from) < 0)
return false;
@@ -6619,17 +6624,31 @@ cmdDefine(vshControl *ctl, const vshCmd *cmd)
if (virFileReadAll(from, VSH_MAX_XML_FILE, &buffer) < 0)
return false;
+ start = vshCommandOptBool(cmd, "start");
+
dom = virDomainDefineXML(ctl->conn, buffer);
VIR_FREE(buffer);
if (dom != NULL) {
vshPrint(ctl, _("Domain %s defined from %s\n"),
virDomainGetName(dom), from);
- virDomainFree(dom);
} else {
vshError(ctl, _("Failed to define domain from %s"), from);
- ret = false;
+ return false;
}
+
+ /* Start the domain if the user requested it and it was defined */
+ if (start) {
+ if (virDomainCreate(dom) < 0) {
+ vshError(ctl, _("Failed to start domain %s, which was "
+ "successfully defined."), virDomainGetName(dom));
+ ret = false;
+ } else {
+ vshPrint(ctl, _("Domain %s started\n"), virDomainGetName(dom));
+ }
+ }
+
+ virDomainFree(dom);
return ret;
}
diff --git a/tools/virsh.pod b/tools/virsh.pod
index a5d8fe6..660331c 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -555,11 +555,12 @@ B<Example>
vi domain.xml (or make changes with your other text editor)
virsh create domain.xml
-=item B<define> I<FILE>
+=item B<define> I<FILE> [I<--start>]
Define a domain from an XML <file>. The domain definition is registered
but not started. If domain is already running, the changes will take
-effect on the next boot.
+effect on the next boot. If I<--start> is requested, start the domain
+after defining it.
=item B<desc> I<domain> [[I<--live>] [I<--config>] |
[I<--current>]] [I<--title>] [I<--edit>] [I<--new-desc>
--
1.7.12.4
12 years, 1 month
[libvirt] [PATCH 0/5] storage: add tests for qemu-img command line
by Ján Tomko
This series adds tests to check for changes in the generated
qemu-img command line and moves the options in front of
positional arguments.
Ján Tomko (5):
storage: move flag setting after declarations
storage: separate qemu-img command generation and execution
storage: add test for qemu-img command line generation
storage: move qemu-img options before positional arguments
storage: qemu-img: change INFO to DEBUG
src/storage/storage_backend.c | 131 ++++++++------
src/storage/storage_backend.h | 8 +
tests/Makefile.am | 9 +
tests/storagevolxml2argvdata/pool-dir.xml | 18 ++
tests/storagevolxml2argvdata/qcow2-flag.argv | 1 +
.../qcow2-nobacking-convert-flag.argv | 1 +
.../qcow2-nobacking-convert-none.argv | 1 +
.../qcow2-nobacking-convert-prealloc.argv | 1 +
.../qcow2-nobacking-flag.argv | 1 +
.../qcow2-nobacking-none.argv | 1 +
.../qcow2-nobacking-prealloc.argv | 1 +
tests/storagevolxml2argvdata/qcow2-none.argv | 1 +
tests/storagevolxml2argvdata/qcow2.argv | 1 +
tests/storagevolxml2argvdata/vol-file.xml | 20 +++
.../storagevolxml2argvdata/vol-qcow2-nobacking.xml | 21 +++
tests/storagevolxml2argvdata/vol-qcow2.xml | 31 ++++
tests/storagevolxml2argvtest.c | 189 +++++++++++++++++++++
17 files changed, 380 insertions(+), 56 deletions(-)
create mode 100644 tests/storagevolxml2argvdata/pool-dir.xml
create mode 100644 tests/storagevolxml2argvdata/qcow2-flag.argv
create mode 100644 tests/storagevolxml2argvdata/qcow2-nobacking-convert-flag.argv
create mode 100644 tests/storagevolxml2argvdata/qcow2-nobacking-convert-none.argv
create mode 100644 tests/storagevolxml2argvdata/qcow2-nobacking-convert-prealloc.argv
create mode 100644 tests/storagevolxml2argvdata/qcow2-nobacking-flag.argv
create mode 100644 tests/storagevolxml2argvdata/qcow2-nobacking-none.argv
create mode 100644 tests/storagevolxml2argvdata/qcow2-nobacking-prealloc.argv
create mode 100644 tests/storagevolxml2argvdata/qcow2-none.argv
create mode 100644 tests/storagevolxml2argvdata/qcow2.argv
create mode 100644 tests/storagevolxml2argvdata/vol-file.xml
create mode 100644 tests/storagevolxml2argvdata/vol-qcow2-nobacking.xml
create mode 100644 tests/storagevolxml2argvdata/vol-qcow2.xml
create mode 100644 tests/storagevolxml2argvtest.c
--
1.7.12.4
12 years, 1 month
[libvirt] [PATCH 0/2] Support PCI passthrough in libxl driver
by Chunyan Liu
This patch series is to add PCI passthrough support to libxenlight driver so that
it can create VM with managed/non-managed host pci device defined.
Chunyan Liu (2):
libxl: add APIs to prepare/release host pci device
libxl: support pci passthrough
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/libxl/libxl_conf.c | 44 ++++
src/libxl/libxl_conf.h | 5 +-
src/libxl/libxl_driver.c | 16 ++
src/libxl/libxl_hostdev.c | 600 +++++++++++++++++++++++++++++++++++++++++++++
src/libxl/libxl_hostdev.h | 44 ++++
7 files changed, 710 insertions(+), 1 deletions(-)
create mode 100644 src/libxl/libxl_hostdev.c
create mode 100644 src/libxl/libxl_hostdev.h
--
1.7.3.4
12 years, 1 month
[libvirt] [PATCH] run: license as LGPL
by Eric Blake
It makes no sense to prohibit reuse of the wrapper in other LGPL
projects, since most of libvirt is designed to be LGPL. Of
course, when using the wrapper to wrap a GPL program, the combined
result is still effectively GPL, but that shouldn't force us to
license the wrapper as GPL in isolation.
* run.in: Relicense to LGPLv2+.
---
Any objections to this?
run.in | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/run.in b/run.in
index 5063522..5d4a04c 100644
--- a/run.in
+++ b/run.in
@@ -2,18 +2,19 @@
# libvirt 'run' programs locally script
# Copyright (C) 2012-2013 Red Hat, Inc.
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
#
-# This program is distributed in the hope that it will be useful,
+# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; If not, see
+# <http://www.gnu.org/licenses/>.
#----------------------------------------------------------------------
#
--
1.8.1.2
12 years, 1 month
[libvirt] [PATCH v4 0/9] Rework storage migration
by Michal Privoznik
Since there are many hidden problems with auto-creating storage for the domain
in here, as previous rounds of reviewing the series has shown, I've decided to
not do anything about it for now and the auto allocation is dropped completely.
So we are back to the assumption we already have - users need to make sure files
already exists and have the right size. Hawk.
diff to v1:
-Eric's and Daniel's suggestions worked in. To point out the bigger ones:
don't do NBD style when TUNNELLED requested, added 'b:writable' to
'nbd-server-add'
-drop '/qemu-migration/nbd/disk/@src' attribute from migration cookie.
As pointed out by Jirka, disk->src can be changed during migration (e.g. by
migration hook or by passed xml). So I've tried (as suggested on the list)
passing disk alias. However, since qemu hasn't been started on destination yet,
the aliases hasn't been generated yet. So we have to rely on ordering
completely.
diff to v2:
-rebase to reflect changes made by offline migration patch
-send initial nbd cookie only if needed
diff to v2.1:
-nbd cookie reworked
-don't rely on disk ordering in the cookie, but use disk target for that
-adapt to virPortAllocator
-unlink pre-created storage on migration fail
-other of Jirka's suggestions worked in
"diff" to v3:
-just rebase & adapt to new qemu code after dropping QDL (Qemu Driver Lock)
diff to v4:
-drop storage auto-allocation
-include John's and Jirka's reviews
Note, that most of the patches has been ACKed already.
Michal Privoznik (9):
qemu: Introduce NBD_SERVER capability
Introduce NBD migration cookie
qemu: Introduce nbd-server-start command
qemu: Introduce nbd-server-add command
qemu: Introduce nbd-server-stop command
qemu_migration: Introduce qemuMigrationStartNBDServer()
qemu_migration: Introduce qemuMigrationDriveMirror
qemu_migration: Stop NBD server at Finish phase
qemu_migration: Cancel running jobs on failed migration
src/qemu/qemu_capabilities.c | 4 +-
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_migration.c | 458 +++++++++++++++++++++++++++++++++++++++++--
src/qemu/qemu_monitor.c | 63 ++++++
src/qemu/qemu_monitor.h | 7 +
src/qemu/qemu_monitor_json.c | 102 ++++++++++
src/qemu/qemu_monitor_json.h | 7 +
src/qemu/qemu_process.c | 5 +
9 files changed, 631 insertions(+), 17 deletions(-)
--
1.8.1.2
12 years, 1 month
[libvirt] [PATCH] run: use portable shell
by Eric Blake
Nothing in run required bash, except for the shebang. On systems
where /bin/bash doesn't exist (I hit it on FreeBSD), using /bin/sh
instead fixes a 'make check' failure:
gmake[3]: Entering directory `/usr/home/dummy/libvirt/python'
GEN check-local
/usr/local/bin/bash: ../run: /bin/bash: bad interpreter: No such file or directory
* run.in: Use /bin/sh, not bash.
---
Pushing under the build-breaker rule.
run.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/run.in b/run.in
index 845eef5..5063522 100644
--- a/run.in
+++ b/run.in
@@ -1,6 +1,6 @@
-#!/bin/bash -
+#!/bin/sh
# libvirt 'run' programs locally script
-# Copyright (C) 2012 Red Hat, Inc.
+# Copyright (C) 2012-2013 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
--
1.8.1.2
12 years, 1 month
[libvirt] [PATCH] storage: use f_frsize, not f_bsize, for calculating available space
by Sage Weil
The bfree and blocks fields are supposed to be in units of frsize. We were
calculating capacity correctly using those units, but the available
calculation was using bsize instead. Most file systems report these as the
same value specifically because many programs are buggy, but that is no
reason to rely on that behavior, or to behave inconsistently.
This bug has been present since e266ded (2008) and aa296e6c, when the code
was originally introduced (the latter via cut and paste).
Signed-off-by: Sage Weil <sage(a)newdream.net>
---
src/parallels/parallels_storage.c | 2 +-
src/storage/storage_backend_fs.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c
index 1186296..f696fcb 100644
--- a/src/parallels/parallels_storage.c
+++ b/src/parallels/parallels_storage.c
@@ -709,7 +709,7 @@ parallelsStoragePoolGetAlloc(virStoragePoolDefPtr def)
def->capacity = ((unsigned long long)sb.f_frsize *
(unsigned long long)sb.f_blocks);
def->available = ((unsigned long long)sb.f_bfree *
- (unsigned long long)sb.f_bsize);
+ (unsigned long long)sb.f_frsize);
def->allocation = def->capacity - def->available;
return 0;
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index a582804..c1684f7 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -910,7 +910,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
pool->def->capacity = ((unsigned long long)sb.f_frsize *
(unsigned long long)sb.f_blocks);
pool->def->available = ((unsigned long long)sb.f_bfree *
- (unsigned long long)sb.f_bsize);
+ (unsigned long long)sb.f_frsize);
pool->def->allocation = pool->def->capacity - pool->def->available;
return 0;
--
1.7.2.5
12 years, 1 month
[libvirt] [PATCH] maint: check all symfiles for sorting
by Eric Blake
On FreeBSD, I got a 'make check' failure:
GEN check-symsorting
Symbol block at ./libvirt_atomic.syms:4: viratomic.h not found
* src/Makefile.am (SYM_FILES): New define.
(check-symsorting): Check on all symfiles, even when not used.
* src/libvirt_atomic.syms: Fix offender.
---
Pushing under the build-breaker rule.
src/Makefile.am | 23 ++++++++++++++++++++++-
src/libvirt_atomic.syms | 2 +-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 3ef9a9c..c1659a4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -389,7 +389,7 @@ check-symfile:
endif
check-symsorting:
$(AM_V_GEN)$(PERL) $(srcdir)/check-symsorting.pl \
- $(srcdir) $(USED_SYM_FILES)
+ $(srcdir) $(SYM_FILES)
EXTRA_DIST += check-symfile.pl check-symsorting.pl
PROTOCOL_STRUCTS = \
@@ -809,6 +809,7 @@ libvirt_driver_la_CFLAGS = \
libvirt_driver_la_LIBADD = \
$(NUMACTL_LIBS) $(GNUTLS_LIBS) $(CURL_LIBS) $(DLOPEN_LIBS)
+SYM_FILES = $(USED_SYM_FILES)
USED_SYM_FILES = $(srcdir)/libvirt_private.syms
if WITH_TEST
@@ -1410,42 +1411,62 @@ check-augeas-lockd: test_libvirt_lockd.aug
if WITH_DRIVER_MODULES
USED_SYM_FILES += $(srcdir)/libvirt_driver_modules.syms
+else
+SYM_FILES += $(srcdir)/libvirt_driver_modules.syms
endif
if WITH_LINUX
USED_SYM_FILES += $(srcdir)/libvirt_linux.syms
+else
+SYM_FILES += $(srcdir)/libvirt_linux.syms
endif
if WITH_ESX
USED_SYM_FILES += $(srcdir)/libvirt_esx.syms
+else
+SYM_FILES += $(srcdir)/libvirt_esx.syms
endif
if WITH_LIBVIRTD
USED_SYM_FILES += $(srcdir)/libvirt_daemon.syms
+else
+SYM_FILES += $(srcdir)/libvirt_daemon.syms
endif
if WITH_OPENVZ
USED_SYM_FILES += $(srcdir)/libvirt_openvz.syms
+else
+SYM_FILES += $(srcdir)/libvirt_openvz.syms
endif
if WITH_VMX
USED_SYM_FILES += $(srcdir)/libvirt_vmx.syms
+else
+SYM_FILES += $(srcdir)/libvirt_vmx.syms
endif
if WITH_XENXS
USED_SYM_FILES += $(srcdir)/libvirt_xenxs.syms
+else
+SYM_FILES += $(srcdir)/libvirt_xenxs.syms
endif
if WITH_SASL
USED_SYM_FILES += $(srcdir)/libvirt_sasl.syms
+else
+SYM_FILES += $(srcdir)/libvirt_sasl.syms
endif
if WITH_SSH2
USED_SYM_FILES += $(srcdir)/libvirt_libssh2.syms
+else
+SYM_FILES += $(srcdir)/libvirt_libssh2.syms
endif
if WITH_ATOMIC_OPS_PTHREAD
USED_SYM_FILES += $(srcdir)/libvirt_atomic.syms
+else
+SYM_FILES += $(srcdir)/libvirt_atomic.syms
endif
EXTRA_DIST += \
diff --git a/src/libvirt_atomic.syms b/src/libvirt_atomic.syms
index db80ce8..e2c2363 100644
--- a/src/libvirt_atomic.syms
+++ b/src/libvirt_atomic.syms
@@ -2,7 +2,7 @@
# These symbols are dependent upon !VIR_ATOMIC_OPS_GCC.
#
-# viratomic.h
+# util/viratomic.h
virAtomicLock;
# Let emacs know we want case-insensitive sorting
--
1.8.1.2
12 years, 1 month
[libvirt] [RFC PATCH 1/4] libvirt: add VIR_DOMAIN_START_PERSISTENT flag
by Doug Goldstein
Added a VIR_DOMAIN_START_PERSISTENT flag for virDomainCreateXML() so
that the guest remains defined after it is destroyed. The result of
using this flag is equivilent to calling virDomainDefineXML() followed
by virDomainCreate() or virDomainCreateWithFlags().
---
Not sure if this is the correct place to add "Since 1.0.3 (likely 1.0.4)"
---
include/libvirt/libvirt.h.in | 1 +
src/libvirt.c | 4 ++++
2 files changed, 5 insertions(+)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index ad30cd0..e119215 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -336,6 +336,7 @@ typedef enum {
VIR_DOMAIN_START_AUTODESTROY = 1 << 1, /* Automatically kill guest when virConnectPtr is closed */
VIR_DOMAIN_START_BYPASS_CACHE = 1 << 2, /* Avoid file system cache pollution */
VIR_DOMAIN_START_FORCE_BOOT = 1 << 3, /* Boot, discarding any managed save */
+ VIR_DOMAIN_START_PERSISTENT = 1 << 4, /* Define guest to exist after it is destroyed */
} virDomainCreateFlags;
diff --git a/src/libvirt.c b/src/libvirt.c
index 1e78500..abe59cd 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -1951,6 +1951,10 @@ virDomainGetConnect(virDomainPtr dom)
* is destroyed, or if the host is restarted (see virDomainDefineXML() to
* define persistent domains).
*
+ * If the VIR_DOMAIN_START_PERSISTENT flag is set, the guest domain
+ * will remain defined even after the guest is destroyed. This is
+ * similar to if you had called virDomainDefineXML() and virDomainCreate().
+ *
* If the VIR_DOMAIN_START_PAUSED flag is set, the guest domain
* will be started, but its CPUs will remain paused. The CPUs
* can later be manually started using virDomainResume.
--
1.7.12.4
12 years, 1 month
[libvirt] [PATCH] Add support for qxl.revision in domain XML
by Christophe Fergeau
QXL devices have an associated 'revision' which is raised when
new features have been introduced which would break migration
to older versions. This commit makes it possible to set this
revision as QEMU sometimes support newer QXL revisions than what
it defaults to.
---
docs/formatdomain.html.in | 5 ++++-
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 17 +++++++++++++++++
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 8 ++++++++
.../qemuxml2argv-graphics-spice-compression.args | 3 ++-
.../qemuxml2argv-graphics-spice-compression.xml | 4 ++--
.../qemuxml2argv-graphics-spice-qxl-vga.args | 3 ++-
.../qemuxml2argv-graphics-spice-qxl-vga.xml | 4 ++--
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args | 3 ++-
tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml | 4 ++--
11 files changed, 47 insertions(+), 10 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 7ad8aea..4b269c8 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3569,7 +3569,10 @@ qemu-kvm -net nic,model=? /dev/null
attribute <code>ram</code> (<span class="since">since
1.0.2</span>) is allowed for "qxl" type only and specifies
the size of the primary bar, while <code>vram</code> specifies the
- secondary bar size. If "ram" is not supplied a default value is used.
+ secondary bar size. If "ram" or "vram" are not supplied a default
+ value is used. The optional attribute <code>revision</code> (<span
+ class="since">since 1.0.3</span>) specifies the revision of
+ the QXL device, newer revisions provides more functionality.
</dd>
<dt><code>model</code></dt>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 049f232..fc78e2d 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2280,6 +2280,11 @@
<ref name="unsignedInt"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="revision">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
</group>
</choice>
<optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5782abb..83be711 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7391,6 +7391,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
char *vram = NULL;
char *ram = NULL;
char *primary = NULL;
+ char *revision = NULL;
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
@@ -7406,6 +7407,7 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
ram = virXMLPropString(cur, "ram");
vram = virXMLPropString(cur, "vram");
heads = virXMLPropString(cur, "heads");
+ revision = virXMLPropString(cur, "revision");
if ((primary = virXMLPropString(cur, "primary")) != NULL)
if (STREQ(primary, "yes"))
@@ -7456,6 +7458,19 @@ virDomainVideoDefParseXML(const xmlNodePtr node,
def->vram = virDomainVideoDefaultRAM(dom, def->type);
}
+ if (revision) {
+ if (def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("revision attribute only supported for type of qxl"));
+ goto error;
+ }
+ if (virStrToLong_ui(revision, NULL, 10, &def->revision) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("cannot parse video revision '%s'"), revision);
+ goto error;
+ }
+ }
+
if (heads) {
if (virStrToLong_ui(heads, NULL, 10, &def->heads) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -13406,6 +13421,8 @@ virDomainVideoDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " heads='%u'", def->heads);
if (def->primary)
virBufferAddLit(buf, " primary='yes'");
+ if (def->revision)
+ virBufferAsprintf(buf, " revision='%u'", def->revision);
if (def->accel) {
virBufferAddLit(buf, ">\n");
virDomainVideoAccelDefFormat(buf, def->accel);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9a9e0b1..81925b1 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1160,6 +1160,7 @@ struct _virDomainVideoDef {
unsigned int ram; /* kibibytes (multiples of 1024) */
unsigned int vram; /* kibibytes (multiples of 1024) */
unsigned int heads;
+ unsigned int revision;
bool primary;
virDomainVideoAccelDefPtr accel;
virDomainDeviceInfo info;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f6273c1..e45c808 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3598,6 +3598,9 @@ qemuBuildDeviceVideoStr(virDomainVideoDefPtr video,
/* QEMU accepts bytes for vram_size. */
virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024);
+
+ if (video->revision != 0)
+ virBufferAsprintf(&buf, ",revision=%u", video->revision);
}
if (qemuBuildDeviceAddressStr(&buf, &video->info, caps) < 0)
@@ -6631,6 +6634,11 @@ qemuBuildCommandLine(virConnectPtr conn,
virCommandAddArgFormat(cmd, "%s.vram_size=%u",
dev, vram * 1024);
}
+ if (def->videos[0]->revision) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "%s.revision=%u",
+ dev, def->videos[0]->revision);
+ }
}
}
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
index 59f064b..05f5579 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args
@@ -7,5 +7,6 @@ image-compression=auto_glz,jpeg-wan-compression=auto,\
zlib-glz-wan-compression=auto,\
playback-compression=on,streaming-video=filter -vga \
qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 \
--device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \
+-global qxl.revision=4 \
+-device qxl,id=video1,ram_size=67108864,vram_size=33554432,revision=4,bus=pci.0,addr=0x4 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
index a8c4ad8..2dc5776 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.xml
@@ -31,10 +31,10 @@
<streaming mode='filter'/>
</graphics>
<video>
- <model type='qxl' ram='65536' vram='18432' heads='1'/>
+ <model type='qxl' ram='65536' vram='18432' heads='1' revision='4'/>
</video>
<video>
- <model type='qxl' ram='65536' vram='32768' heads='1'/>
+ <model type='qxl' ram='65536' vram='32768' heads='1' revision='4'/>
</video>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
index ef499e6..0b08038 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.args
@@ -4,5 +4,6 @@ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb -hda \
/dev/HostVG/QEMUGuest1 -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.ram_size=67108864 -global qxl-vga.vram_size=33554432 \
--device qxl,id=video1,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x4 \
+-global qxl-vga.revision=4 \
+-device qxl,id=video1,ram_size=67108864,vram_size=67108864,revision=4,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
index 563d371..3cd0c42 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-qxl-vga.xml
@@ -28,10 +28,10 @@
<channel name='inputs' mode='insecure'/>
</graphics>
<video>
- <model type='qxl' ram='65536' vram='32768' heads='1'/>
+ <model type='qxl' ram='65536' vram='32768' heads='1' revision='4'/>
</video>
<video>
- <model type='qxl' ram='65536' vram='65536' heads='1'/>
+ <model type='qxl' ram='65536' vram='65536' heads='1' revision='4'/>
</video>
<memballoon model='virtio'/>
</devices>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
index d7cfae0..082eaf7 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args
@@ -6,5 +6,6 @@ x509-dir=/etc/pki/libvirt-spice,tls-channel=default,tls-channel=main,plaintext-c
image-compression=auto_glz,jpeg-wan-compression=auto,zlib-glz-wan-compression=auto,\
playback-compression=on,streaming-video=filter,disable-copy-paste -vga \
qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 \
--device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \
+-global qxl.revision=4 \
+-device qxl,id=video1,ram_size=67108864,vram_size=33554432,revision=4,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 9a36660..e99dbc8 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.xml
@@ -34,10 +34,10 @@
<clipboard copypaste='no'/>
</graphics>
<video>
- <model type='qxl' ram='65536' vram='18432' heads='1'/>
+ <model type='qxl' ram='65536' vram='18432' heads='1' revision='4'/>
</video>
<video>
- <model type='qxl' ram='65536' vram='32768' heads='1'/>
+ <model type='qxl' ram='65536' vram='32768' heads='1' revision='4'/>
</video>
<memballoon model='virtio'/>
</devices>
--
1.8.1
12 years, 1 month