[libvirt] [PATCH] virsh: Add missing "async" option in virsh-domain.c opts_block_commit.
by Simone Gotti
After commit 8aecd351266a66efa59b7f7be77bf66693d99ce0 it'll detect
that a required option is not defined and it will assert and exit with:
virsh.c:1364: vshCommandOpt: Assertion `valid->name' failed.
---
tools/virsh-domain.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 49cd154..856e888 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1544,6 +1544,10 @@ static const vshCmdOptDef opts_block_commit[] = {
.type = VSH_OT_INT,
.help = N_("with --wait, abort if copy exceeds timeout (in seconds)")
},
+ {.name = "async",
+ .type = VSH_OT_BOOL,
+ .help = N_("with --wait, don't wait for cancel to finish")
+ },
{.name = NULL}
};
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCH] conf: Do better job when comparing features ABI compatibility
by Peter Krempa
The ABI compatibility check for domain features didn't check the
expanded HyperV and APIC EOI values, thus possibly allowing change in
guest ABI.
Add the check and use typecasted switch statement to warn developers
when adding a new HyperV feature.
---
src/conf/domain_conf.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 67 insertions(+), 5 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c4b6464..8953579 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13354,6 +13354,72 @@ virDomainRedirFilterDefCheckABIStability(virDomainRedirFilterDefPtr src,
return true;
}
+
+static bool
+virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
+ virDomainDefPtr dst)
+{
+ size_t i;
+
+ /* basic check */
+ if (src->features != dst->features) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target domain features %d does not match source %d"),
+ dst->features, src->features);
+ return false;
+ }
+
+ /* APIC EOI */
+ if (src->apic_eoi != dst->apic_eoi) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("State of APIC EOI differs: "
+ "source: '%s', destination: '%s'"),
+ virDomainFeatureStateTypeToString(src->apic_eoi),
+ virDomainFeatureStateTypeToString(dst->apic_eoi));
+ return false;
+ }
+
+ /* hyperv */
+ if (src->features & (1 << VIR_DOMAIN_FEATURE_HYPERV)) {
+ for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
+ switch ((enum virDomainHyperv) i) {
+ case VIR_DOMAIN_HYPERV_RELAXED:
+ case VIR_DOMAIN_HYPERV_VAPIC:
+ if (src->hyperv_features[i] != dst->hyperv_features[i]) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("State of HyperV enlightenment "
+ "feature '%s' differs: "
+ "source: '%s', destination: '%s'"),
+ virDomainHypervTypeToString(i),
+ virDomainFeatureStateTypeToString(src->hyperv_features[i]),
+ virDomainFeatureStateTypeToString(dst->hyperv_features[i]));
+ return false;
+ }
+
+ break;
+
+ case VIR_DOMAIN_HYPERV_SPINLOCKS:
+ /* spinlock count matters! */
+ if (src->hyperv_spinlocks != dst->hyperv_spinlocks) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("HyperV spinlock retry count differs: "
+ "source: '%u', destination: '%u'"),
+ src->hyperv_spinlocks,
+ dst->hyperv_spinlocks);
+ return false;
+ }
+ break;
+
+ case VIR_DOMAIN_HYPERV_LAST:
+ break;
+ }
+ }
+ }
+
+ return true;
+}
+
+
/* This compares two configurations and looks for any differences
* which will affect the guest ABI. This is primarily to allow
* validation of custom XML config passed in during migration
@@ -13455,12 +13521,8 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
return false;
}
- if (src->features != dst->features) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Target domain features %d does not match source %d"),
- dst->features, src->features);
+ if (!virDomainDefFeaturesCheckABIStability(src, dst))
return false;
- }
if (src->clock.ntimers != dst->clock.ntimers) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
--
1.8.3.2
11 years, 3 months
[libvirt] [v4 0/5] virsh: More intelligent auto-completion
by Tomas Meszaros
This series implements advanced auto-completion for virsh. Using custom option
completers (examples in 3/5, 4/5 and 5/5), it is possible to further complete
any option with defined completer function.
Option completer function should return list of completed names for each desired
option. Using C99 initialization, it is easy to enable specific completer for
any option. For example, when we want domain completer for "start --domain"
option, we write vshDomainCompleter() and along with desired flags, initialize
targeted opts struct.
static const vshCmdOptDef opts_start[] = {
{.name = "domain",
.type = VSH_OT_DATA,
.flags = VSH_OFLAG_REQ,
.help = N_("name of the inactive domain"),
.completer = vshDomainCompleter,
.completer_flags = VIR_CONNECT_LIST_DOMAINS_INACTIVE |
VIR_CONNECT_LIST_DOMAINS_PERSISTENT
},
Auto-completion itself then works like this:
virsh # start --domain <TAB>
domain1 domain2 domainN
virsh # vol-key <TAB>
--help --pool --vol vol1 vol2
---
v4:
* rewritten to use only option completers
v3:
https://www.redhat.com/archives/libvir-list/2013-August/msg01294.html
v2:
https://www.redhat.com/archives/libvir-list/2013-August/msg00992.html
v1:
https://www.redhat.com/archives/libvir-list/2013-August/msg00371.html
Tomas Meszaros (5):
virsh: Add vshCmdCompleter and vshOptCompleter
virsh: Improve readline generators and readline completion
virsh: Add vshDomainCompleter
virsh: Add vshSuspendTargetCompleter
virsh: Add vshRebootShutdownModeCompleter
tools/virsh-domain-monitor.c | 52 +++++--
tools/virsh-domain.c | 310 +++++++++++++++++++++++++++++---------
tools/virsh-snapshot.c | 50 +++++--
tools/virsh.c | 350 +++++++++++++++++++++++++++++++++++++++----
tools/virsh.h | 8 +
5 files changed, 648 insertions(+), 122 deletions(-)
--
1.8.3.1
11 years, 3 months
Re: [libvirt] [Users] Starting VM Error
by Dan Kenigsberg
On Sun, Sep 15, 2013 at 01:59:29PM +0200, Gianluca Cecchi wrote:
> On Sun, Sep 15, 2013 at 1:50 PM, Gianluca Cecchi wrote:
>
> and
>
> [root@tekkaman ~]# chgrp kvm /var/lib/libvirt/images/testvm.img
> [root@tekkaman ~]# ll /var/lib/libvirt/images/testvm.img
> -rw-rw----. 1 vdsm kvm 197120 Sep 15 12:24 /var/lib/libvirt/images/testvm.img
>
> [root@tekkaman ~]# virsh undefine testvm2
> Please enter your authentication name: virshuser
> Please enter your password:
> Domain testvm2 has been undefined
>
> [root@tekkaman ~]# virsh define /tmp/testvm2.xml
> Please enter your authentication name: virshuser
> Please enter your password:
> Domain testvm2 defined from /tmp/testvm2.xml
>
> [root@tekkaman ~]# virsh start testvm2
> Please enter your authentication name: virshuser
> Please enter your password:
> error: Failed to start domain testvm2
> error: internal error Process exited while reading console log output:
> char device redirected to /dev/pts/2
> qemu-kvm: -drive
> file=/var/lib/libvirt/images//testvm.img,if=none,id=drive-virtio-disk0,format=qcow2:
> could not open disk image /var/lib/libvirt/images//testvm.img:
> Permission denied
Gianluca, due to all the twists of this thread, I no longer recall which
libvirt version you are using. Would you remind us?
All signs show that it starts up qemu without setting its auxiliary
group properly (Assuming that your
# groups qemu
qemu : qemu kvm
is just as mine)
I've added libvir-list so the fine folks there could check why qemu
cannot read/write files group-owned by kvm.
Dan.
11 years, 3 months
[libvirt] ANNOUNCE: libvirt 0.10.2.8 maintenance release
by Cole Robinson
libvirt 0.10.2.8 maintenance release is now available. This is
libvirt 0.10.2 with additional bugfixes that have accumulated
upstream since the initial release.
This release can be downloaded at:
http://libvirt.org/sources/stable_updates/libvirt-0.10.2.8.tar.gz
Changes in this version:
* virsh: fix change-media bug on disk block type
* libvirt: lxc: don't mkdir when selinux is disabled
* Fix crash in remoteDispatchDomainMemoryStats (CVE-2013-4296)
* Add support for using 3-arg pkcheck syntax for process (CVE-2013-4311)
* Include process start time when doing polkit checks
* win32: Pretend that close-on-exec works
* virDomainDefParseXML: set the argument of virBitmapFree to NULL after
calling virBitmapFree
* security: provide supplemental groups even when parsing label
(CVE-2013-4291)
* virbitmap: Refactor virBitmapParse to avoid access beyond bounds of
array
* bitmap: add virBitmapCountBits
For info about past maintenance releases, see:
http://wiki.libvirt.org/page/Maintenance_Releases
Thanks,
Cole
11 years, 3 months
[libvirt] [PATCH] qemu: use "ide" as device name for implicit SATA controller on Q35
by Laine Stump
This resolves https://bugzilla.redhat.com/show_bug.cgi?id=1008903
The Q35 machinetype has an implicit SATA controller at 00:1F.2 which
isn't given the "expected" id of ahci0 by qemu when it's created. The
original suggested solution to this problem was to not specify any
controller for the disks that use the default controller and just
specify "unit=n" instead; qemu should then use the first ide or sata
controller for the disk.
Unfortunately, this "solution" is ignorant of the fact that in the
case of SATA disks, the "unit" attribute in the disk XML is actually
*not* being used for the unit, but is instead used to specify the
"bus" number; each SATA controller has 6 buses, and each bus only
allows a single unit. This makes it nonsensical to specify unit='n'
where n is anything other than 0. It also means that the only way to
connect more than a single device to the implicit SATA controller is
to explicitly give the bus names, which happen to be "ide.$n", where
$n can be replaced by the disk's "unit" number.
---
src/qemu/qemu_command.c | 15 ++++++---------
tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-q35.args | 2 +-
3 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4628dac..e6239c9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4383,18 +4383,15 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
if (qemuDomainMachineIsQ35(def) &&
disk->info.addr.drive.controller == 0) {
/* Q35 machines have an implicit ahci (sata) controller at
- * 00:1F.2 which has no "id" associated with it. For this
- * reason, we can't refer to it as "ahci0". Instead, we
- * don't give an id, which qemu interprets as "use the
- * first ahci controller". We then need to specify the
- * unit with "unit=%d" rather than adding it onto the bus
- * arg.
+ * 00:1F.2 which for some reason is hardcoded with the id
+ * "ide" instead of the seemingly more reasonable "ahci0"
+ * or "sata0".
*/
- virBufferAsprintf(&opt, ",unit=%d", disk->info.addr.drive.unit);
+ virBufferAsprintf(&opt, ",bus=ide.%d", disk->info.addr.drive.unit);
} else {
/* All other ahci controllers have been created by
- * libvirt, so they *do* have an id, and we can identify
- * them that way.
+ * libvirt, and we gave them the id "ahci${n}" where ${n}
+ * is the controller number. So we identify them that way.
*/
virBufferAsprintf(&opt, ",bus=ahci%d.%d",
disk->info.addr.drive.controller,
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args
index e10ccb1..175c0dc 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args
@@ -5,5 +5,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x2 \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \
--device ide-drive,unit=0,drive=drive-sata0-0-0,id=sata0-0-0 \
+-device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
-vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-q35.args
index 4461eba..6bd5f4c 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-q35.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.args
@@ -4,5 +4,5 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
-device i82801b11-bridge,id=pci.1,bus=pcie.0,addr=0x2 \
-device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \
-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \
--device ide-drive,unit=0,drive=drive-sata0-0-0,id=sata0-0-0 \
+-device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \
-vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368
--
1.8.3.1
11 years, 3 months
[libvirt] [PATCH] build: Generate libvirt_access*.xml in source dir
by Jiri Denemark
Technically, these files should be generated in build dir but since
docs/newapi.xsl style sheet is expecting them to be in source dir, it's
much easier to put them there than trying to convince newapi.xsl to look
elsewhere.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/Makefile.am | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 1388c5f..c456d48 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -863,9 +863,9 @@ ACCESS_DRIVER_SYM_FILES = \
libvirt_access_lxc.syms
ACCESS_DRIVER_API_FILES = \
- libvirt_access.xml \
- libvirt_access_qemu.xml \
- libvirt_access_lxc.xml
+ $(srcdir)/libvirt_access.xml \
+ $(srcdir)/libvirt_access_qemu.xml \
+ $(srcdir)/libvirt_access_lxc.xml
ACCESS_DRIVER_SOURCES = \
access/viraccessperm.h access/viraccessperm.c \
@@ -1554,15 +1554,15 @@ libvirt_access_lxc.syms: $(srcdir)/rpc/gendispatch.pl \
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclsym \
lxc LXC $(LXC_PROTOCOL) > $@
-libvirt_access.xml: $(srcdir)/rpc/gendispatch.pl \
+$(srcdir)/libvirt_access.xml: $(srcdir)/rpc/gendispatch.pl \
$(REMOTE_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclapi \
remote REMOTE $(REMOTE_PROTOCOL) > $@
-libvirt_access_qemu.xml: $(srcdir)/rpc/gendispatch.pl \
+$(srcdir)/libvirt_access_qemu.xml: $(srcdir)/rpc/gendispatch.pl \
$(QEMU_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclapi \
qemu QEMU $(QEMU_PROTOCOL) > $@
-libvirt_access_lxc.xml: $(srcdir)/rpc/gendispatch.pl \
+$(srcdir)/libvirt_access_lxc.xml: $(srcdir)/rpc/gendispatch.pl \
$(LXC_PROTOCOL) Makefile.am
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl --mode=aclapi \
lxc LXC $(LXC_PROTOCOL) > $@
--
1.8.3.2
11 years, 3 months
[libvirt] storage pool that contains thin LVs
by Dusty Mabe
Hey guys,
Just looking at https://bugzilla.redhat.com/show_bug.cgi?id=924672 and
looks like all we need to do is ignore thin pools and thin pool data
devices. With some trivial testing this seems to work fine (i.e.
failed before and works now).
diff --git a/src/storage/storage_backend_logical.c
b/src/storage/storage_backend_logical.c
index a1a37a1..0154256 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -85,6 +85,10 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool,
if (attrs[4] != 'a')
return 0;
+ /* Skip thin pools(t) and thin pool data(T) */
+ if (attrs[0] == 't' || attrs[0] == 'T')
+ return 0;
+
/* See if we're only looking for a specific volume */
if (data != NULL) {
vol = data;
I'm sure the fix isn't this trivial but i can finish it up and submit
an official patch (through git) if this is close.
Dusty
11 years, 3 months
[libvirt] [PATCH] Don't dereference NULL in qemumonitorjsontest
by Ján Tomko
In case of an error, qemuMonitorTestNewSimple returns NULL.
Error out instead of dereferencing it.
Found by Coverity, reported by John Ferlan.
---
Pushed as trivial.
tests/qemumonitorjsontest.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index b451e8e..0fb8d65 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -960,6 +960,9 @@ testQemuMonitorJSONCPU(const void *data)
bool running = false;
virDomainPausedReason reason = 0;
+ if (!test)
+ return -1;
+
if (qemuMonitorTestAddItem(test, "stop", "{\"return\": {}}") < 0 ||
qemuMonitorTestAddItem(test, "query-status",
"{\"return\": {"
@@ -1016,6 +1019,9 @@ testQemuMonitorJSONSimpleFunc(const void *opaque)
const char *reply = data->reply;
int ret = -1;
+ if (!test)
+ return -1;
+
if (!reply)
reply = "{\"return\":{}}";
--
1.8.1.5
11 years, 3 months
[libvirt] [PATCH 0/2] qemumonitorjsontest improvements
by Michal Privoznik
Just a couple of tests.
Michal Privoznik (2):
qemumonitorjsontest: Test CPU state handling code
qemumonitorjsontest: Introduce DO_TEST_SIMPLE
tests/qemumonitorjsontest.c | 103 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 103 insertions(+)
--
1.8.1.5
11 years, 3 months