[libvirt] [PATCH] virsh: support up to 64 migration options for command: again
by Nikolay Shirokovskiy
Add ULL suffix to all related operands of << or shift will give
all zeros instead of correct mask.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
---
tools/vsh.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/vsh.c b/tools/vsh.c
index a80e851..605c574 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -376,17 +376,17 @@ vshCmddefOptParse(const vshCmdDef *cmd, uint64_t *opts_need_arg,
}
if (opt->flags & VSH_OFLAG_REQ_OPT) {
if (opt->flags & VSH_OFLAG_REQ)
- *opts_required |= 1 << i;
+ *opts_required |= 1ULL << i;
else
optional = true;
continue;
}
- *opts_need_arg |= 1 << i;
+ *opts_need_arg |= 1ULL << i;
if (opt->flags & VSH_OFLAG_REQ) {
if (optional && opt->type != VSH_OT_ARGV)
return -1; /* mandatory options must be listed first */
- *opts_required |= 1 << i;
+ *opts_required |= 1ULL << i;
} else {
optional = true;
}
@@ -440,11 +440,11 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name,
}
continue;
}
- if ((*opts_seen & (1 << i)) && opt->type != VSH_OT_ARGV) {
+ if ((*opts_seen & (1ULL << i)) && opt->type != VSH_OT_ARGV) {
vshError(ctl, _("option --%s already seen"), name);
goto cleanup;
}
- *opts_seen |= 1 << i;
+ *opts_seen |= 1ULL << i;
*opt_index = i;
ret = opt;
goto cleanup;
@@ -474,8 +474,8 @@ vshCmddefGetData(const vshCmdDef *cmd, uint64_t *opts_need_arg,
i = ffsl(*opts_need_arg) - 1;
opt = &cmd->opts[i];
if (opt->type != VSH_OT_ARGV)
- *opts_need_arg &= ~(1 << i);
- *opts_seen |= 1 << i;
+ *opts_need_arg &= ~(1ULL << i);
+ *opts_seen |= 1ULL << i;
return opt;
}
@@ -494,7 +494,7 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd, uint64_t opts_required,
return 0;
for (i = 0; def->opts[i].name; i++) {
- if (opts_required & (1 << i)) {
+ if (opts_required & (1ULL << i)) {
const vshCmdOptDef *opt = &def->opts[i];
vshError(ctl,
@@ -1419,7 +1419,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser)
goto syntaxError;
}
if (opt->type != VSH_OT_ARGV)
- opts_need_arg &= ~(1 << opt_index);
+ opts_need_arg &= ~(1ULL << opt_index);
} else {
tkdata = NULL;
if (optstr) {
--
1.8.3.1
8 years, 7 months
[libvirt] [PATCH 0/8] (incomplete) fix of "peer" address feature
by Laine Stump
This patch series fixes this feature enoough that it works:
1) emits "peer" attribute in formatted XML when present in the NetDef
object, so that the config will "stick"
2) swaps "address" and "peer" for qemu, so that "address" consistently
refers to the IP address used by the guest, and "peer" to the address
used by the host.
3) ... and the rest
*BUT* it doesn't address the sub-optimal naming of the new attribute,
nor does it fix the documentation which is incorrect not only in its
description, but also in the starting version number for QEMU
support. Also, I'm skeptical that this new feature is useful for the
types of lxc interfaces that are supported (macvtap i.e. "direct", and
a veth connected to a bridge) - from my understanding, it would only
be useful for a type='ethernet' interface (a tap/veth pair not
connected to any bridge), and that isn't supported by lxc yet; for
type='bridge' and type='network' (which is also connecting to a
bridge) I don't see the use case.
So I'm torn about whether these patches should be put in for this
release in order to made the already-pushed code work, or if we should
just hold off until we:
1) find/agree on a better name for the new attribute (see my earlier
mail titled 'interface "peer address" patches are broken for details
on my opinion)
2) decide if it's actually useful to support the "peer" address for
type='network|bridge" in lxc (it isn't in qemu).
3) fix the documentation (I started into that when I realized the
By not pushing the fixes, we guarantee that nobody can use the
feature, and thus will technically still be able to change the name of
the attribute even after arelease has passed (because we won't break
anyone's usable config).
Opinions on what to do?
(I would consider reverting the original patches temporarily until
it's all sorted out, but I don't know what kind of conflicts that
would cause; I know that there has been at least one bugfix patch)
Laine Stump (8):
conf: clean up virDomainNetIpParseXML()
tests: mock virNetDevSetIPAddress
conf: emit an IP address "peer" attribute in XML when present
util: allow calling virSocketAddrGetIpPrefix with NULL netmask or
address
qemu/lxc: use correct prefix when setting tap/veth IP address
qemu/lxc: log peer address when setting a domain interface's IP
qemu: swap "address" and "peer" when setting IP address for tap
interfaces
qemu: require "peer" if ip address is supplied for an interface
src/conf/domain_conf.c | 46 +++++++++++++---------
src/lxc/lxc_container.c | 36 +++++++++++++----
src/qemu/qemu_domain.c | 44 ++++++++++++++++++---
src/qemu/qemu_interface.c | 44 +++++++++++++++------
src/util/virsocketaddr.c | 8 ++--
src/util/virsocketaddr.h | 3 +-
.../qemuxml2argv-net-eth-peer.args | 20 ++++++++++
.../qemuxml2argvdata/qemuxml2argv-net-eth-peer.xml | 30 ++++++++++++++
tests/qemuxml2argvmock.c | 10 ++++-
tests/qemuxml2argvtest.c | 1 +
.../qemuxml2xmlout-net-eth-peer.xml | 33 ++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
12 files changed, 226 insertions(+), 50 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-peer.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-eth-peer.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-net-eth-peer.xml
--
2.5.5
8 years, 7 months
[libvirt] RFC backup API
by Maxim Nestratov
Hi all,
It's been already quite a long time since qemu implemented QMP
"drive-backup" command to create block devices backups. Even more, since
qemu 2.4 there is a possibility to create incremental backups. Though it
is possible to backup all attached to a domain disk drives by combining
them into a single QMP transaction command, this way of creating them,
not to mention managing, remains inconvenient for an end user of
libvirt. Moreover, creating a single drive backup via QMP interface
isn't handy either. That said, it looks reasonable to introduce a *new
backup API* based on QMP "drive-backup" facilities.
Though we can start from a single simple function, allowing to create a
disk backup by means of QMP "drive-backup" command, I'd like to discuss
here the level of management libvirt could provide for backup
operations. To begin with, here is the preliminary list of possible
functions that I think make sense for libvirt API.
virDomainCreateBackup - which creates a backup full/incremental of
all/selected disks,
virListBackups - which lists all backups created for a particular
domain/target,
virRestoreBackup - which restores all/selected disks from a backup,
virDeleteBackup - which deletes all/selected disks from a backup.
It looks like backup management functions, except create one, shouldn't
be or might not be bound to a particular domain and we could possibly
leverage storage pool API with some extension. Specifically, volume
definition could be extended with necessary meta data related to backups.
The *question* is: if the whole idea about this new API as described
above or something similar makes sense?
If yes, then let's find out requirements for it (if any) and I will try
to prepare a patch set with the first RFC implementation to discuss the
API in more details. Looking forward for your opinions on the matter.
Maxim
8 years, 7 months
[libvirt] [PATCH v3] qemu: Regenerate VNC socket paths
by Martin Kletzander
Similarly to what commit 714080791778 did with some internal paths,
clear vnc socket paths that were generated by us. Having such path in
the definition can cause trouble when restoring the domain. The path is
generated to the per-domain directory that contains the domain ID.
However, that ID will be different upon restoration, so qemu won't be
able to create that socket because the directory will not be prepared.
To be able to migrate to older libvirt, skip formatting the socket path
in migratable XML if it was autogenerated. And mark it as autogenerated
if it already exists and we're parsing live XML.
Best viewed with '-C'.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1326270
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
v3:
- Let the new boolean survive daemon restarts (or rather make it even
more inteligent than just remembering it
v2:
- Be able to migrate to older libvirt as well
- https://www.redhat.com/archives/libvir-list/2016-April/msg01803.html
v1:
- https://www.redhat.com/archives/libvir-list/2016-April/msg01735.html
src/conf/domain_conf.c | 6 +++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 11 +++---
src/qemu/qemu_domain.c | 26 ++++++++++++++-
.../qemuxml2argv-graphics-vnc-autosocket.args | 22 ++++++++++++
.../qemuxml2argv-graphics-vnc-autosocket.xml | 34 +++++++++++++++++++
.../qemuxml2xmlout-graphics-vnc-autosocket.xml | 39 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 7 ++++
8 files changed, 140 insertions(+), 6 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b46cd2a64f75..d8bed670f243 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21342,7 +21342,11 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
switch (def->type) {
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
if (def->data.vnc.socket) {
- virBufferEscapeString(buf, " socket='%s'", def->data.vnc.socket);
+ if (!def->data.vnc.socketAutogenerated ||
+ !(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)) {
+ virBufferEscapeString(buf, " socket='%s'",
+ def->data.vnc.socket);
+ }
} else {
if (def->data.vnc.port &&
(!def->data.vnc.autoport || !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)))
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ee66e6d6aa45..31e7a86d4746 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1564,6 +1564,7 @@ struct _virDomainGraphicsDef {
bool autoport;
char *keymap;
char *socket;
+ bool socketAutogenerated;
virDomainGraphicsAuthDef auth;
int sharePolicy;
} vnc;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9597b307e9de..6fbfe215bf29 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7277,10 +7277,13 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
}
if (graphics->data.vnc.socket || cfg->vncAutoUnixSocket) {
- if (!graphics->data.vnc.socket &&
- virAsprintf(&graphics->data.vnc.socket,
- "%s/vnc.sock", domainLibDir) == -1)
- goto error;
+ if (!graphics->data.vnc.socket) {
+ if (virAsprintf(&graphics->data.vnc.socket,
+ "%s/vnc.sock", domainLibDir) < 0)
+ goto error;
+
+ graphics->data.vnc.socketAutogenerated = true;
+ }
virBufferAsprintf(&opt, "unix:%s", graphics->data.vnc.socket);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a2f981043915..6262bfee47d0 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1659,10 +1659,32 @@ qemuCanonicalizeMachine(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
}
+static void
+qemuDomainRecheckInternalPaths(virDomainDefPtr def,
+ virQEMUDriverConfigPtr cfg,
+ unsigned int flags)
+{
+ size_t i = 0;
+
+ for (i = 0; i < def->ngraphics; ++i) {
+ virDomainGraphicsDefPtr graphics = def->graphics[i];
+
+ if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+ graphics->data.vnc.socket &&
+ STRPREFIX(graphics->data.vnc.socket, cfg->libDir)) {
+ if (flags & VIR_DOMAIN_DEF_PARSE_INACTIVE)
+ VIR_FREE(graphics->data.vnc.socket);
+ else
+ graphics->data.vnc.socketAutogenerated = true;
+ }
+ }
+}
+
+
static int
qemuDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps,
- unsigned int parseFlags ATTRIBUTE_UNUSED,
+ unsigned int parseFlags,
void *opaque)
{
virQEMUDriverPtr driver = opaque;
@@ -1708,6 +1730,8 @@ qemuDomainDefPostParse(virDomainDefPtr def,
qemuDomainDefEnableDefaultFeatures(def);
+ qemuDomainRecheckInternalPaths(def, cfg, parseFlags);
+
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
goto cleanup;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args
new file mode 100644
index 000000000000..7e1fb6b3717f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args
@@ -0,0 +1,22 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-vnc unix:/tmp/lib/domain--1-QEMUGuest1/vnc.socket \
+-vga cirrus
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml
new file mode 100644
index 000000000000..fa59c39873a5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>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'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' socket='/tmp/lib/domain-99-QEMUGuest1/delete.this.socket'/>
+ <video>
+ <model type='cirrus' vram='16384' heads='1'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
new file mode 100644
index 000000000000..744053368745
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
@@ -0,0 +1,39 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>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'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes'/>
+ <video>
+ <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index f766f4dc521e..62f8f96c2274 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -263,6 +263,7 @@ mymain(void)
{
int ret = 0;
struct testInfo info;
+ virQEMUDriverConfigPtr cfg = NULL;
if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
@@ -774,6 +775,12 @@ mymain(void)
DO_TEST("virtio-input");
DO_TEST("virtio-input-passthrough");
+ cfg = virQEMUDriverGetConfig(&driver);
+ cfg->vncAutoUnixSocket = true;
+ DO_TEST_FULL("graphics-vnc-autosocket", WHEN_INACTIVE, NONE);
+ cfg->vncAutoUnixSocket = false;
+
+ virObjectUnref(cfg);
qemuTestDriverFree(&driver);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
--
2.8.1
8 years, 7 months
[libvirt] [PATCH 0/8] Add support for virtio-scsi-{pci, ccw} iothread support
by John Ferlan
Add support for virtio-scsi-{pci,ccw} iothreads.
Each patch has details.
John Ferlan (8):
qemu: Add capability for virtio-scsi iothreads
docs: clarify disk iothread support
docs: Reformat the Controllers description
conf: Move virDomainControllerModelTypeToString
conf: Add disk iothread bus check in device post parse
conf: Add support for virtio-scsi iothreads
qemu: Use switch for qemuCheckIOThreads
qemu: Add 'iothread' to command line for supported controller
docs/formatdomain.html.in | 87 ++++++---
docs/schemas/domaincommon.rng | 3 +
src/conf/domain_conf.c | 61 +++++--
src/conf/domain_conf.h | 1 +
src/qemu/qemu_capabilities.c | 9 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 115 ++++++++++--
tests/qemucapabilitiesdata/caps_1.2.2-1.replies | 80 +++++----
tests/qemucapabilitiesdata/caps_1.3.1-1.replies | 80 +++++----
tests/qemucapabilitiesdata/caps_1.4.2-1.replies | 88 +++++----
tests/qemucapabilitiesdata/caps_1.5.3-1.replies | 88 +++++----
tests/qemucapabilitiesdata/caps_1.6.0-1.replies | 88 +++++----
tests/qemucapabilitiesdata/caps_1.6.50-1.replies | 88 +++++----
tests/qemucapabilitiesdata/caps_2.1.1-1.replies | 88 +++++----
tests/qemucapabilitiesdata/caps_2.4.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_2.4.0-1.replies | 177 ++++++++++++++----
tests/qemucapabilitiesdata/caps_2.5.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_2.5.0-1.replies | 197 +++++++++++++++++----
tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_2.6.0-1.replies | 192 ++++++++++++++++----
.../qemuxml2argv-iothreads-virtio-scsi-ccw.args | 28 +++
.../qemuxml2argv-iothreads-virtio-scsi-ccw.xml | 39 ++++
.../qemuxml2argv-iothreads-virtio-scsi-pci.args | 32 ++++
.../qemuxml2argv-iothreads-virtio-scsi-pci.xml | 47 +++++
tests/qemuxml2argvtest.c | 6 +
.../qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml | 39 ++++
.../qemuxml2xmlout-iothreads-virtio-scsi-pci.xml | 51 ++++++
tests/qemuxml2xmltest.c | 7 +
28 files changed, 1314 insertions(+), 381 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-ccw.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-ccw.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-pci.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-pci.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-pci.xml
--
2.5.5
8 years, 7 months
[libvirt] [PATCH v2 0/3] Add panic device support for S390
by Boris Fiuczynski
S390 architecture inherently provides a crash detection capability
which has not been reflected in the domain xml.
This series adds an s390 model to the panic device which does not
allow an address to be specified and is by default created on S390
guests unless already provided.
v3:
Grouped default panic device creation and required test code changes into
one patch.
v2:
Added an s390 model instead of using default model for toleration.
Boris Fiuczynski (3):
qemu: add panic device support for S390
qemu: add default panic device to S390 guests
tests: add tests for panic device model s390
docs/formatdomain.html.in | 7 +++++-
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 3 ++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 21 +++++++++++++++-
src/qemu/qemu_domain.c | 9 ++++++-
.../qemuargv2xml-machine-aeskeywrap-off-argv.xml | 1 +
.../qemuargv2xml-machine-aeskeywrap-on-argv.xml | 1 +
.../qemuargv2xml-machine-deakeywrap-off-argv.xml | 1 +
.../qemuargv2xml-machine-deakeywrap-on-argv.xml | 1 +
.../qemuargv2xml-machine-keywrap-none-argv.xml | 1 +
tests/qemuxml2argvdata/qemuxml2argv-panic-s390.xml | 22 ++++++++++++++++
.../qemuxml2argv-s390-panic-address.xml | 26 +++++++++++++++++++
.../qemuxml2argv-s390-panic-missing.args | 25 +++++++++++++++++++
.../qemuxml2argv-s390-panic-missing.xml | 23 +++++++++++++++++
.../qemuxml2argv-s390-panic-no-address.args | 25 +++++++++++++++++++
.../qemuxml2argv-s390-panic-no-address.xml | 24 ++++++++++++++++++
tests/qemuxml2argvtest.c | 11 +++++++-
.../qemuxml2xmlout-iothreads-disk-virtio-ccw.xml | 1 +
.../qemuxml2xmlout-panic-s390.xml | 28 +++++++++++++++++++++
.../qemuxml2xmlout-s390-defaultconsole.xml | 1 +
.../qemuxml2xmlout-s390-panic-missing.xml | 29 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 4 +++
23 files changed, 261 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-panic-s390.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-panic-address.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-panic-missing.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-panic-missing.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-panic-no-address.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-panic-no-address.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-panic-s390.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-panic-missing.xml
--
2.3.0
8 years, 7 months
[libvirt] [PATCH v2] qemu: Regenerate VNC socket paths
by Martin Kletzander
Similarly to what commit 714080791778 did with some internal paths,
clear vnc socket paths that were generated by us. Having such path in
the definition can cause trouble when restoring the domain. The path is
generated to the per-domain directory that contains the domain ID.
However, that ID will be different upon restoration, so qemu won't be
able to create that socket because the directory will not be prepared.
To be able to migrate to older libvirt, skip formatting the socket path
in migratable XML if it was autogenerated.
Best viewed with '-C'.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1326270
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
v2:
- Be able to migrate to older libvirt as well
v1:
- https://www.redhat.com/archives/libvir-list/2016-April/msg01735.html
src/conf/domain_conf.c | 6 +++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 11 +++---
src/qemu/qemu_domain.c | 21 +++++++++++-
.../qemuxml2argv-graphics-vnc-autosocket.args | 22 ++++++++++++
.../qemuxml2argv-graphics-vnc-autosocket.xml | 34 +++++++++++++++++++
.../qemuxml2xmlout-graphics-vnc-autosocket.xml | 39 ++++++++++++++++++++++
tests/qemuxml2xmltest.c | 7 ++++
8 files changed, 135 insertions(+), 6 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b46cd2a64f75..d8bed670f243 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -21342,7 +21342,11 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
switch (def->type) {
case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
if (def->data.vnc.socket) {
- virBufferEscapeString(buf, " socket='%s'", def->data.vnc.socket);
+ if (!def->data.vnc.socketAutogenerated ||
+ !(flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)) {
+ virBufferEscapeString(buf, " socket='%s'",
+ def->data.vnc.socket);
+ }
} else {
if (def->data.vnc.port &&
(!def->data.vnc.autoport || !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)))
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index ee66e6d6aa45..31e7a86d4746 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1564,6 +1564,7 @@ struct _virDomainGraphicsDef {
bool autoport;
char *keymap;
char *socket;
+ bool socketAutogenerated;
virDomainGraphicsAuthDef auth;
int sharePolicy;
} vnc;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 9597b307e9de..6fbfe215bf29 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7277,10 +7277,13 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
}
if (graphics->data.vnc.socket || cfg->vncAutoUnixSocket) {
- if (!graphics->data.vnc.socket &&
- virAsprintf(&graphics->data.vnc.socket,
- "%s/vnc.sock", domainLibDir) == -1)
- goto error;
+ if (!graphics->data.vnc.socket) {
+ if (virAsprintf(&graphics->data.vnc.socket,
+ "%s/vnc.sock", domainLibDir) < 0)
+ goto error;
+
+ graphics->data.vnc.socketAutogenerated = true;
+ }
virBufferAsprintf(&opt, "unix:%s", graphics->data.vnc.socket);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index a2f981043915..d6f704d6f91b 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1659,10 +1659,26 @@ qemuCanonicalizeMachine(virDomainDefPtr def, virQEMUCapsPtr qemuCaps)
}
+static void
+qemuDomainCleanupInternalPaths(virDomainDefPtr def, virQEMUDriverConfigPtr cfg)
+{
+ size_t i = 0;
+
+ for (i = 0; i < def->ngraphics; ++i) {
+ virDomainGraphicsDefPtr graphics = def->graphics[i];
+
+ if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
+ graphics->data.vnc.socket &&
+ STRPREFIX(graphics->data.vnc.socket, cfg->libDir))
+ VIR_FREE(graphics->data.vnc.socket);
+ }
+}
+
+
static int
qemuDomainDefPostParse(virDomainDefPtr def,
virCapsPtr caps,
- unsigned int parseFlags ATTRIBUTE_UNUSED,
+ unsigned int parseFlags,
void *opaque)
{
virQEMUDriverPtr driver = opaque;
@@ -1708,6 +1724,9 @@ qemuDomainDefPostParse(virDomainDefPtr def,
qemuDomainDefEnableDefaultFeatures(def);
+ if (parseFlags & VIR_DOMAIN_DEF_PARSE_INACTIVE)
+ qemuDomainCleanupInternalPaths(def, cfg);
+
if (virSecurityManagerVerify(driver->securityManager, def) < 0)
goto cleanup;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args
new file mode 100644
index 000000000000..7e1fb6b3717f
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.args
@@ -0,0 +1,22 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu \
+-name QEMUGuest1 \
+-S \
+-M pc \
+-m 214 \
+-smp 1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nodefaults \
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
+-no-acpi \
+-boot c \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
+-vnc unix:/tmp/lib/domain--1-QEMUGuest1/vnc.socket \
+-vga cirrus
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml
new file mode 100644
index 000000000000..fa59c39873a5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-autosocket.xml
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>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'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='ide' index='0'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' socket='/tmp/lib/domain-99-QEMUGuest1/delete.this.socket'/>
+ <video>
+ <model type='cirrus' vram='16384' heads='1'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
new file mode 100644
index 000000000000..744053368745
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-autosocket.xml
@@ -0,0 +1,39 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>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'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='vnc' port='-1' autoport='yes'/>
+ <video>
+ <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index f766f4dc521e..62f8f96c2274 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -263,6 +263,7 @@ mymain(void)
{
int ret = 0;
struct testInfo info;
+ virQEMUDriverConfigPtr cfg = NULL;
if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
@@ -774,6 +775,12 @@ mymain(void)
DO_TEST("virtio-input");
DO_TEST("virtio-input-passthrough");
+ cfg = virQEMUDriverGetConfig(&driver);
+ cfg->vncAutoUnixSocket = true;
+ DO_TEST_FULL("graphics-vnc-autosocket", WHEN_INACTIVE, NONE);
+ cfg->vncAutoUnixSocket = false;
+
+ virObjectUnref(cfg);
qemuTestDriverFree(&driver);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
--
2.8.1
8 years, 7 months
[libvirt] [PATCH] qemu: Error out if setting vcpu count would lead to invalid config
by Peter Krempa
When the domain definition describes a machine with NUMA, setting the
maximum vCPU count via the API might lead to an invalid config.
Add a check that will forbid this until we add more advanced cpu config
capabilities.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1327499
---
src/libvirt_private.syms | 1 +
src/qemu/qemu_driver.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ad5c382..769bdb7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -673,6 +673,7 @@ virNodeDeviceObjUnlock;
virDomainNumaCheckABIStability;
virDomainNumaEquals;
virDomainNumaFree;
+virDomainNumaGetCPUCountTotal;
virDomainNumaGetMaxCPUID;
virDomainNumaGetMemorySize;
virDomainNumaGetNodeCount;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 542d13c..44ec42d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4898,6 +4898,13 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
if (persistentDef) {
if (flags & VIR_DOMAIN_VCPU_MAXIMUM) {
+ if (virDomainNumaGetCPUCountTotal(persistentDef->numa) > nvcpus) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Number of CPUs in <numa> exceeds the desired "
+ "maximum vcpu count"));
+ goto endjob;
+ }
+
if (virDomainDefSetVcpusMax(persistentDef, nvcpus) < 0)
goto endjob;
} else {
--
2.8.1
8 years, 7 months
[libvirt] [PATCH v2] qemu: conf: Set default logging approach in virQEMUDriverConfigNew
by Peter Krempa
Instead of setting the default qemu stdio logging approach in
virQEMUDriverConfigLoadFile set it in virQEMUDriverConfigNew so that
it's properly set even when the config is not present.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1325075
---
src/qemu/qemu_conf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 77ef4fe..5ed5776 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -324,6 +324,7 @@ virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged)
cfg->seccompSandbox = -1;
cfg->logTimestamp = true;
+ cfg->stdioLogD = true;
#ifdef DEFAULT_LOADER_NVRAM
if (virQEMUDriverConfigLoaderNVRAMParse(cfg, DEFAULT_LOADER_NVRAM) < 0)
@@ -812,8 +813,6 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
goto cleanup;
}
VIR_FREE(stdioHandler);
- } else {
- cfg->stdioLogD = true;
}
GET_VALUE_ULONG("max_queued", cfg->maxQueuedJobs);
--
2.8.1
8 years, 7 months
[libvirt] [PATCH] trivial: zh_CN: fix the wrong translation
by Wanlong Gao
From: Allen Gao <wanlong.gao(a)easystack.cn>
s/数值/设置/
Signed-off-by: Wanlong Gao <wanlong.gao(a)easystack.cn>
---
po/zh_CN.po | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 05d860f..54b75ce 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -34600,7 +34600,7 @@ msgstr "无法解析整数参数"
#: tools/virsh-domain.c:1473
msgid "Get or set blkio parameters"
-msgstr "获取或者数值 blkio 参数"
+msgstr "获取或者设置 blkio 参数"
#: tools/virsh-domain.c:1476
msgid ""
@@ -34609,7 +34609,7 @@ msgid ""
"\n"
" virsh # blkiotune <domain>"
msgstr ""
-"为虚拟机域获取或者数值当前 blkio 参数。\n"
+"为虚拟机域获取或者设置当前 blkio 参数。\n"
" 请使用以下命令获取 blkio 参数: \n"
"\n"
" virsh # blkiotune <domain>"
--
2.5.0
8 years, 7 months