[libvirt] [PATCH] qemu: Fix indentation in qemuDomainDeviceDefValidateControllerPCI()
by Andrea Bolognani
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
Pushed as trivial.
src/qemu/qemu_domain.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 84207db16..16833474a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4458,10 +4458,10 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *controlle
if (pciopts->numaNode != -1 &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPAPR_PCI_HOST_BRIDGE_NUMA_NODE)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("the spapr-pci-host-bridge controller doesn't "
- "support numa_node in this QEMU binary"));
- return -1;
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("the spapr-pci-host-bridge controller doesn't "
+ "support numa_node in this QEMU binary"));
+ return -1;
}
break;
--
2.14.3
6 years, 10 months
[libvirt] [PATCH] qemu: fix migration with local and VIR_STORAGE_TYPE_NETWORK disks
by Chris Friesen
In the current implementation of qemuMigrateDisk() the value of the
"nmigrate_disks" parameter wrongly impacts the decision whether or not
to migrate a disk that is not a member of "migrate_disks":
1) If "nmigrate_disks" is zero, "disk" is migrated if it's non-shared
non-readonly with source.
2) If "nmigrate_disks" is non-zero and "disk" is not a member of
"migrate_disks" then "disk" is not migrated. This should instead proceed
with checking conditions as per 1) and allow migration of non-shared
non-readonly disks with source.
Fixing 2) breaks migration of VMs with a mix of rbd and local
disks because now libvirt tries to migrate the rbd root disk
and it fails.
This new problem is solved by updating 1) to factor in disk source type
and migrate only 'local' non-shared non-readonly disks with source.
The end result is that disks not in "migrate_disks" are treated
uniformly regardless of the value of "nmigrate_disks".
Signed-off-by: Chris Friesen <chris.friesen(a)windriver.com>
---
src/qemu/qemu_migration.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 5ee9e5c..77fafc6 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -409,12 +409,12 @@ qemuMigrateDisk(virDomainDiskDef const *disk,
if (STREQ(disk->dst, migrate_disks[i]))
return true;
}
- return false;
}
- /* Default is to migrate only non-shared non-readonly disks
+ /* Default is to migrate only non-shared non-readonly local disks
* with source */
return !disk->src->shared && !disk->src->readonly &&
+ (disk->src->type != VIR_STORAGE_TYPE_NETWORK) &&
!virStorageSourceIsEmpty(disk->src);
}
--
1.8.3.1
6 years, 10 months
[libvirt] [PATCH] qemu: command: Extract formatting of floppy related stuff into a helper
by Peter Krempa
The floppy command formatting is special-cased since it does not
directly translate to a single '-device' argument.
Move the code from qemuBuildDiskDriveCommandLine to a new helper
function so that all the related code is together.
---
src/qemu/qemu_command.c | 91 +++++++++++++++++++++++++++++--------------------
1 file changed, 54 insertions(+), 37 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 24b434a458..3857a5ef5b 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2211,6 +2211,58 @@ qemuBuildDriveDevStr(const virDomainDef *def,
}
+static int
+qemuBulildFloppyCommandLineOptions(virCommandPtr cmd,
+ const virDomainDef *def,
+ virDomainDiskDefPtr disk,
+ unsigned int bootindex)
+
+{
+ virBuffer fdc_opts = VIR_BUFFER_INITIALIZER;
+ char *fdc_opts_str = NULL;
+ char *optstr;
+
+ if (virAsprintf(&optstr, "drive%c=drive-%s",
+ disk->info.addr.drive.unit ? 'B' : 'A',
+ disk->info.alias) < 0)
+ return -1;
+
+ if (!qemuDomainNeedsFDC(def)) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
+ } else {
+ virBufferAsprintf(&fdc_opts, "%s,", optstr);
+ }
+ VIR_FREE(optstr);
+
+ if (bootindex) {
+ if (virAsprintf(&optstr, "bootindex%c=%u",
+ disk->info.addr.drive.unit
+ ? 'B' : 'A',
+ bootindex) < 0)
+ return -1;
+
+ if (!qemuDomainNeedsFDC(def)) {
+ virCommandAddArg(cmd, "-global");
+ virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
+ } else {
+ virBufferAsprintf(&fdc_opts, "%s,", optstr);
+ }
+ VIR_FREE(optstr);
+ }
+
+ /* Newer Q35 machine types require an explicit FDC controller */
+ virBufferTrim(&fdc_opts, ",", -1);
+ if ((fdc_opts_str = virBufferContentAndReset(&fdc_opts))) {
+ virCommandAddArg(cmd, "-device");
+ virCommandAddArgFormat(cmd, "isa-fdc,%s", fdc_opts_str);
+ VIR_FREE(fdc_opts_str);
+ }
+
+ return 0;
+}
+
+
static int
qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
const virDomainDef *def,
@@ -2220,8 +2272,6 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
unsigned int bootCD = 0;
unsigned int bootFloppy = 0;
unsigned int bootDisk = 0;
- virBuffer fdc_opts = VIR_BUFFER_INITIALIZER;
- char *fdc_opts_str = NULL;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) ||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
@@ -2300,34 +2350,9 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
if (qemuDiskBusNeedsDeviceArg(disk->bus)) {
if (disk->bus == VIR_DOMAIN_DISK_BUS_FDC) {
- if (virAsprintf(&optstr, "drive%c=drive-%s",
- disk->info.addr.drive.unit ? 'B' : 'A',
- disk->info.alias) < 0)
+ if (qemuBulildFloppyCommandLineOptions(cmd, def, disk,
+ bootindex) < 0)
return -1;
-
- if (!qemuDomainNeedsFDC(def)) {
- virCommandAddArg(cmd, "-global");
- virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
- } else {
- virBufferAsprintf(&fdc_opts, "%s,", optstr);
- }
- VIR_FREE(optstr);
-
- if (bootindex) {
- if (virAsprintf(&optstr, "bootindex%c=%u",
- disk->info.addr.drive.unit
- ? 'B' : 'A',
- bootindex) < 0)
- return -1;
-
- if (!qemuDomainNeedsFDC(def)) {
- virCommandAddArg(cmd, "-global");
- virCommandAddArgFormat(cmd, "isa-fdc.%s", optstr);
- } else {
- virBufferAsprintf(&fdc_opts, "%s,", optstr);
- }
- VIR_FREE(optstr);
- }
} else {
virCommandAddArg(cmd, "-device");
@@ -2339,14 +2364,6 @@ qemuBuildDiskDriveCommandLine(virCommandPtr cmd,
}
}
}
- /* Newer Q35 machine types require an explicit FDC controller */
- virBufferTrim(&fdc_opts, ",", -1);
- if ((fdc_opts_str = virBufferContentAndReset(&fdc_opts))) {
- virCommandAddArg(cmd, "-device");
- virCommandAddArgFormat(cmd, "isa-fdc,%s", fdc_opts_str);
- VIR_FREE(fdc_opts_str);
- }
-
return 0;
}
--
2.15.0
6 years, 10 months
[libvirt] [tck PATCH v2 0/5] Fix libvirt-tck nwfilter tests
by Laine Stump
I've pushed the patches that passed review. These patches split a
single patch from V1 into 2 patches, repost one patch that had no
response, calls out a single line that had sneaked into one of the
ACKed patches, and remove all tabs from perl and sh scripts.
Laine Stump (5):
parameterize filterref in generic_domain
default to no nwfilter in test domains
filter for proper IP address in tcpdump looking for broadcast packet
kill dhclient before attempting to change guest IP in no-ip-spoofing
test
untabify all perl and sh files
lib/Sys/Virt/TCK.pm | 549 ++++++++++++-----------
lib/Sys/Virt/TCK/Capabilities.pm | 84 ++--
lib/Sys/Virt/TCK/DomainBuilder.pm | 312 ++++++-------
lib/Sys/Virt/TCK/NetworkBuilder.pm | 44 +-
lib/Sys/Virt/TCK/NetworkHelpers.pm | 6 +-
lib/Sys/Virt/TCK/SELinux.pm | 6 +-
lib/Sys/Virt/TCK/StoragePoolBuilder.pm | 40 +-
lib/Sys/Virt/TCK/StorageVolBuilder.pm | 48 +-
lib/Sys/Virt/TCK/TAP/XMLFormatter.pm | 18 +-
lib/Sys/Virt/TCK/TAP/XMLFormatterSession.pm | 66 +--
scripts/nwfilter/100-ping-still-working.t | 3 +-
scripts/nwfilter/210-no-mac-spoofing.t | 3 +-
scripts/nwfilter/220-no-ip-spoofing.t | 4 +-
scripts/nwfilter/230-no-mac-broadcast.t | 5 +-
scripts/nwfilter/240-no-arp-spoofing.t | 3 +-
scripts/nwfilter/300-vsitype.t | 2 +-
scripts/nwfilter/concurrency/chg-vm-filter.sh | 18 +-
scripts/nwfilter/concurrency/start-destroy-vm.sh | 20 +-
scripts/nwfilter/nwfilter2vmtest.sh | 42 +-
19 files changed, 641 insertions(+), 632 deletions(-)
--
2.14.3
6 years, 10 months
[libvirt] [PATCH] rpc: export xdr_virNetMessageError for virnetmessagetest on Win32
by Daniel P. Berrangé
The Win32 symbol export file format can't do wildcards, so none of
the 'xdr_*' symbols are exported from the libvirt DLL. This doesn't
matter generally since the RPC client is built into the DLL and we
don't build libvirtd on Win32. The virnetmessagetest, however, does
require xdr_virNetMessageError to be exported, so just do a hack for
that.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Pushed as win32 CI build fix
src/libvirt_remote.syms | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
index 736848273a..97e22275b9 100644
--- a/src/libvirt_remote.syms
+++ b/src/libvirt_remote.syms
@@ -7,6 +7,12 @@
# Generated files
xdr_*;
+# Hack only required for Win32 to make tests link properly,
+# as the wildcard above doesn't work there. Fortunately
+# Win32 builds don't require the other xdr_* syms exported.
+# since there's no libvirtd built.
+xdr_virNetMessageError;
+
# rpc/virnetclient.h
virNetClientAddProgram;
--
2.14.3
6 years, 10 months
[libvirt] [PATCH 0/2] Support network stats for hostdev(SR-IOV) in Switchdev mode
by Jai Singh Rana
With availability of switchdev model in linux, it is possible to capture
stats for hostdev SR-IOV VFs using its VF representor interface name on
host for nics supporting switchdev model.
These stats are supported by adding helper APIs for getting VF
Representor name based on BDF info in 'hostdev' and querying required
net sysfs entries on host. These helper APIs are then used in
qemu_driver to get the hostdev interface stats for pci SR-IOV device.
[1] https://www.kernel.org/doc/Documentation/networking/switchdev.txt
Jai Singh Rana (2):
util: Add helper APIs to get/verify VF Representor name
qemu: conf: Network stats support for hostdev VF Representor
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/conf/domain_conf.c | 7 ++
src/libvirt_private.syms | 5 +
src/qemu/qemu_driver.c | 34 +++++-
src/util/virhostdev.c | 10 ++
src/util/virhostdev.h | 6 +
src/util/virnetdevhostdev.c | 284 ++++++++++++++++++++++++++++++++++++++++++++
src/util/virnetdevhostdev.h | 33 +++++
9 files changed, 377 insertions(+), 4 deletions(-)
create mode 100644 src/util/virnetdevhostdev.c
create mode 100644 src/util/virnetdevhostdev.h
--
2.13.6
6 years, 10 months
[libvirt] [PATCH python] tests: add special case for virStoragePoolLookupByTargetPath
by Daniel P. Berrangé
This new API trips up the sanity test for checking mapping of
all C APIs into Python.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Pushed as build fix.
sanitytest.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sanitytest.py b/sanitytest.py
index 1d65e8d..190d32b 100644
--- a/sanitytest.py
+++ b/sanitytest.py
@@ -258,7 +258,8 @@ for name in sorted(basicklassmap):
"LookupByUUIDString", "LookupByVolume" "LookupByName",
"LookupByID", "LookupByName", "LookupByKey", "LookupByPath",
"LookupByMACString", "LookupByUsage", "LookupByVolume",
- "LookupSCSIHostByWWN", "Restore", "RestoreFlags",
+ "LookupByTargetPath","LookupSCSIHostByWWN",
+ "Restore", "RestoreFlags",
"SaveImageDefineXML", "SaveImageGetXMLDesc", "DefineXMLFlags"]:
if klass != "virDomain":
func = klass[3:] + func
--
2.14.3
6 years, 10 months
[libvirt] [PATCH 0/3] lock manager plugin dlm-corosync implementation
by river
This is the implementation of the RFC from
https://www.redhat.com/archives/libvir-list/2017-December/msg00689.html
The following is the design of this iplementation.
Environmental requirements:
DLM is a symmetric general-purpose distributed lock manager,
consisting of a kernel modules named 'dlm.ko', userspace
application named 'libdlm', and cluster infrastructure
environment which could be 'corosync' responsible for communication.
For more usage about libdlm and corosync, `man corosync.conf`
and `man dlm_controld`
Implementation details:
In order to use dlm in cluster, daemons, 'dlm_controld' and
'corosync', must have been runned before. Because dlm is
asynchronous, there is something receiving notification from
kernel. 'libdlm' provides `dlm_pthread_init` and
`dlm_ls_pthread_init` for this purpose.
Here is lockspace concept in dlm. Lockspace is different
from sanlock, it's just to provide a private namespaceit's
one namespace for locks that are part of a single application.
One lock must belong to one lockspace, and is associated with
one lock resource, owned by one process in one node.
Lock/unlock need specific flag. Lock flags `LKF_PERSISTENT`
specifies a lock that wouldn't be unlocked if the process was
dead or lockspace was closed (`dlm_close_lockspace`). lockspace
is cluster-wide, lock with `LKF_PERSISTENT` flag won't be
automatically released except that the owner node reboot, but
it will become an orphan lock once process disappears. New
process in the same node want to adopt orphan lock, just
specific `LKF_ORPHAN` when re-lock using the right lock-name
and lock-mode, new lock id would be assigned for adopted lock.
lkid(lock id) is a mark uniquely identifing a lock in a process,
which is returned after locking sucessfully or adopting sucessfully.
Lock could be only released by self-process applied using lkid.
The following means: locks won't be automatically released when
the process(libvirt) that acquired them dies, daemon likes
virtlockd isn't necessary. In order to adopt orphan locks, there
must be some lock information left after the process died. A
file would store the lock information in this design.
However, I find that the existence of "leaked" fd in vm instance
process inherited from libvirt would tell lock daemon to release
their locks instead of libvirt. So destroy or shutdown qemu
instance won't make dlm release locks. I refer to the action of
libxl(`libxlDomainCleanup` function in 'src/libxl/libxl_domain.c'),
add some code after unlink pid and xml files in `qemuProcessStop`
('src/qemu/qemu_process.c') to proactively tell lock manager
release locks.
Adhere to the simple, enough principle, lock information using
by running libvirt process is stored in list instead of hash
table.
I have tested in some cases: start, migrate, destroy... It
works well.
*** BLURB HERE ***
river (3):
Add a plugin dlm for lock manager
Fix release of locks with dlm plugin
Add configuration files for dlm plugin
.gitignore | 2 +
configure.ac | 6 +
m4/virt-cpg.m4 | 37 ++
m4/virt-dlm.m4 | 36 ++
src/Makefile.am | 53 ++
src/libxl/libxl.conf | 8 +-
src/locking/dlm.conf | 52 ++
src/locking/libvirt_dlm.aug | 35 ++
src/locking/lock_driver_dlm.c | 1056 +++++++++++++++++++++++++++++++++++
src/locking/test_libvirt_dlm.aug.in | 9 +
src/qemu/qemu.conf | 8 +-
src/qemu/qemu_process.c | 5 +
src/util/virlist.h | 110 ++++
13 files changed, 1410 insertions(+), 7 deletions(-)
create mode 100644 m4/virt-cpg.m4
create mode 100644 m4/virt-dlm.m4
create mode 100644 src/locking/dlm.conf
create mode 100644 src/locking/libvirt_dlm.aug
create mode 100644 src/locking/lock_driver_dlm.c
create mode 100644 src/locking/test_libvirt_dlm.aug.in
create mode 100644 src/util/virlist.h
--
2.15.1
6 years, 10 months
[libvirt] [PATCH] fix regex to check CN from server certificate
by Tiago M. Vieira
Currently when the script validates the PKI files and
the certificate 'Subject:' field contains RDNs after
the Common Name (CN), these values are also included,
creating a false result that the CN is not correct.
A small change to the sed regex fixes this issue, by
extracting only the value for CN and nothing else. The
regex is replaced with the exact same regex used to
extract the CN value from the client certificate.
---
tools/virt-pki-validate.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/virt-pki-validate.in b/tools/virt-pki-validate.in
index 206637abf..b04680dde 100755
--- a/tools/virt-pki-validate.in
+++ b/tools/virt-pki-validate.in
@@ -255,7 +255,7 @@ then
echo CA organization: $ORG
echo Server organization: $S_ORG
fi
- S_HOST=`"$CERTOOL" -i --infile "$LIBVIRT/servercert.pem" | grep Subject: | sed 's+.*CN=\([a-zA-Z\. _-]*\)+\1+'`
+ S_HOST=`"$CERTOOL" -i --infile "$LIBVIRT/servercert.pem" | grep Subject: | sed 's+.*CN=\(.[a-zA-Z \._-]*\).*+\1+'`
if test "$S_HOST" != "`hostname -s`" && test "$S_HOST" != "`hostname`"
then
echo The server certificate does not seem to match the host name
--
2.14.3
6 years, 10 months
[libvirt] [tck PATCH 0/9] Fix libvirt-tck nwfilter tests
by Laine Stump
libvirt-tck happens to have the most thorough set of nwfilter tests
around. Unfortunately they haven't been run in quite awhile, and have
suffered from some bit rot. This patch series (along with Dan's patch
to force virt-builder to redo selinux labels after installing extra
packages) gets the nwfilter tests all completing successfully again
*on a Fedora 26 host* with libvirt 3.2.1 and libvirt 4.0.0+.
The concurrency tests (at least) still fail on an F27 host - in that
case they are actually revealing a bug due to something in libvirt,
libpcap, or maybe the kernel (and since the kernels in F26 and F27 are
nearly the same, and I tried both of the above libvirt versions on F27
with the same failure (two threads hung in a polling loop in libpcap)
Once I got this all running, I noticed that there are several domain
and network tests that are failing, and at least the ones I looked
into were due to bugs in the tests (e.g. the netdev hotplug test uses
multicast MAC addresses, and assumes that device detaches are
synchronous), so there's more work to do, but the nwfilter tests are
what's most important right now.
Laine Stump (9):
create vms that use virt-builder images with no graphics and
virtio-net
Use $net->get_dhcp_leases() when available
Use Net::OpenSSH instead of Net::SSH::Perl
Fix no-ip-spoofing test script generation
Fix no-arp-spoof test script generation
parameterize filterref in generic_domain
Fix ebtables check in no-mac-broadcast test
filter for proper IP address in tcpdump looking for broadcast packet
Eliminate unnecessary path specifications in binary names
lib/Sys/Virt/TCK.pm | 22 +++++-------
lib/Sys/Virt/TCK/NetworkHelpers.pm | 9 +++++
perl-Sys-Virt-TCK.spec.PL | 3 +-
scripts/nwfilter/100-ping-still-working.t | 6 ++--
scripts/nwfilter/210-no-mac-spoofing.t | 52 ++++++++++++++-------------
scripts/nwfilter/220-no-ip-spoofing.t | 59 ++++++++++++++++---------------
scripts/nwfilter/230-no-mac-broadcast.t | 39 ++++++++++----------
scripts/nwfilter/240-no-arp-spoofing.t | 36 ++++++++++---------
scripts/nwfilter/300-vsitype.t | 1 -
scripts/nwfilter/nwfilter_concurrent.sh | 4 +--
10 files changed, 121 insertions(+), 110 deletions(-)
--
2.13.6
6 years, 10 months