[libvirt] [PATCH RFC 00/51] refactor block job handling and add support for new event/commands (blockdev-add saga)
by Peter Krempa
This series refactors how libvirt stores block job data and handles
block job events in general. This is done in preparation for -blockdev
support where we'll need to add support for the 'blockdev-create' job
which is not associated to any frontend 'disk' in some cases.
This series introduces a new structure and table of blockjobs currently
running and implements handlers for the new even "JOB_STATUS_CHANGE".
RFC status excuses:
- the series needs much more testing than I did
- the last few patches are true RFC
- I didn't port/refactor the rest of the blockjob finishing code that
I have for the individual job types after the big refactor so there
aren't any examples for the -blockdev case yet.
I'll post the link to a repo containing the patches some time later.
Peter Krempa (51):
qemu: blockjob: Extract emitting of libvirt events
qemu: blockjob: Emit VIR_DOMAIN_EVENT_ID_BLOCK_JOB only for local
disks
qemu: processBlockJobEvent: Use qemuBlockJobUpdate to process block
job events
qemu: blockjob: Unexport qemuBlockJobEventProcess
qemu: blockjob: Rename public APIs
qemu: blockjob: Remove header dependency on qemu_domain.h
qemu: Consolidate disk blockjob variables into a structure
qemu: process: Consolidate error paths in qemuProcessHandleBlockJob
qemu: blockjob: Rename qemuBlockJobEventProcess to
qemuBlockJobEventProcessLegacy
qemu: blockjob: Split out handling of comlpleted jobs
qemu: migration: Properly note that non-shared-storage migration uses
a blockjob
qemu: process: refresh block jobs on reconnect
qemu: driver: Remove block job status reprobing from
qemuDomainBlockPivot
qemu: migration: Simplify cancellation of migration blockjobs
qemu: blockjob: Turn struct qemuBlockJobData into a virObject
qemu: blockjob: Clarify that job 'status' field contains new state
qemu: migration: Separate startup of disk mirror from migration logic
qemu: blockjob: Add functions for block job state control
qemu: blockjob: Drop unnecessary calls to qemuBlockJobSyncEndDisk
qemu: blockjob: Add reference to disk into struct qemuBlockJobData
qemu: blockjob: Record job type when starting the job
qemu: blockjob: Pass in job to qemuBlockJobEventProcessLegacy
qemu: blockjob: Convert qemuBlockJobSyncBeginDisk to work with the job
qemu: blockjob: Track current state of blockjob
qemu: migration: Extract reporting of disk migration error
qemu: blockjob: Remove error propagation from qemuBlockJobUpdateDisk
qemu: blockjob: Consume new block job state in the processing function
qemu: blockjob: Pass job into qemuBlockJobUpdateDisk and rename it
qemu: Allocate diskPriv->blockjob only when there's a blockjob
qemu: migration: Don't call qemuBlockJobSyncEndDisk when block job has
terminated
qemu: blockjob: Convert qemuBlockJobSyncEndDisk to take job instead of
disk
qemu: blockjob: Add job name into the data
qemu: domain: Add global table of blockjobs
qemu: blockjob: Register new and running blockjobs in the global table
qemu: blockjob: Add string convertors for blockjob type and state
enums
qemu: domain: Store blockjob data in the status XML
tests: qemustatusxml2xml: Add test case for block job tracking
qemu: monitor: Add new fields for 'block-stream' command
qemu: monitor: Add new fields for 'block-commit' command
qemu: monitor: Add new fields for 'blockdev-mirror' command
qemu: monitor: Add support for 'job-dismiss' command
qemu: monitor: Add support for 'job-cancel' command
qemu: monitor: Add support for 'job-complete' command
qemu: monitor: Add infrastructure for 'query-jobs'
qemu: blockjob: Add 'concluded' state for a block job
qemu: monitor: Implement support for 'JOB_STATUS_CHANGE' event
qemu: process: Don't trigger BLOCK_JOB* events with -blockdev
qemu: blockjob: Add helper to convert monitor job status to internal
state
qemu: Add handler for job state change event
qemu: blockjob: Add modern block job event handler
qemu: process: Refresh -blockdev based blockjobs on reconnect to qemu
src/qemu/qemu_blockjob.c | 687 ++++++++++++++----
src/qemu/qemu_blockjob.h | 111 ++-
src/qemu/qemu_domain.c | 123 +++-
src/qemu/qemu_domain.h | 13 +-
src/qemu/qemu_driver.c | 114 ++-
src/qemu/qemu_migration.c | 233 +++---
src/qemu/qemu_monitor.c | 120 ++-
src/qemu/qemu_monitor.h | 82 ++-
src/qemu/qemu_monitor_json.c | 239 +++++-
src/qemu/qemu_monitor_json.h | 28 +-
src/qemu/qemu_process.c | 179 ++++-
.../query-jobs-create.json | 20 +
.../query-jobs-create.result | 11 +
.../qemumonitorjsondata/query-jobs-empty.json | 1 +
.../query-jobs-empty.result | 0
tests/qemumonitorjsontest.c | 101 ++-
.../blockjob-blockdev-in.xml | 364 ++++++++++
.../blockjob-blockdev-out.xml | 1 +
tests/qemuxml2xmltest.c | 2 +
19 files changed, 2097 insertions(+), 332 deletions(-)
create mode 100644 tests/qemumonitorjsondata/query-jobs-create.json
create mode 100644 tests/qemumonitorjsondata/query-jobs-create.result
create mode 100644 tests/qemumonitorjsondata/query-jobs-empty.json
create mode 100644 tests/qemumonitorjsondata/query-jobs-empty.result
create mode 100644 tests/qemustatusxml2xmldata/blockjob-blockdev-in.xml
create mode 120000 tests/qemustatusxml2xmldata/blockjob-blockdev-out.xml
--
2.19.2
5 years, 10 months
[libvirt] [PATCH 0/5] network: fix networking for firewalld+nftables
by Laine Stump
The detailed explanation of this is in Patch 4/5. Basically, when
firewalld enables their new nftables backend, libvirt virtual networks
lose all ability to forward packets from guests out to the physical
network, and can only communicate with the host itself as much as
firewalld's "public" zone will allow (which isn't much, and doesn't
include DHCP or DNS).
Laine Stump (5):
docs: add forgotten mentions of forward mode "open"
util: move all firewalld-specific stuff into its own file
util: new function virFirewallDInterfaceSetZone()
network: regain guest network connectivity after firewalld switch to
nftables
network: allow configuring firewalld zone for virtual network bridge
device
docs/formatnetwork.html.in | 21 ++-
docs/news.xml | 40 ++++++
docs/schemas/basictypes.rng | 6 +
docs/schemas/network.rng | 6 +
include/libvirt/virterror.h | 1 +
libvirt.spec.in | 16 +++
src/conf/network_conf.c | 14 +-
src/conf/network_conf.h | 1 +
src/libvirt_private.syms | 4 +
src/network/Makefile.inc.am | 10 +-
src/network/bridge_driver_linux.c | 25 ++++
src/network/libvirt.zone | 14 ++
src/util/Makefile.inc.am | 2 +
src/util/virerror.c | 1 +
src/util/virfirewall.c | 86 +-----------
src/util/virfirewalld.c | 151 +++++++++++++++++++++
src/util/virfirewalld.h | 36 +++++
src/util/virfirewallpriv.h | 2 -
tests/networkxml2xmlin/routed-network.xml | 2 +-
tests/networkxml2xmlout/routed-network.xml | 2 +-
tests/virfirewalltest.c | 1 +
21 files changed, 350 insertions(+), 91 deletions(-)
create mode 100644 src/network/libvirt.zone
create mode 100644 src/util/virfirewalld.c
create mode 100644 src/util/virfirewalld.h
--
2.20.1
5 years, 10 months
[libvirt] [PATCH] qemu: Update a domain's persistent definition file if it's defined
by Wang Yechao
From: Li XueLei <li.xuelei1(a)zte.com.cn>
During making disk snapshot in an active domain, sometimes we
should update the domain's persistent definition.We must check if
the domain is defined, before we update the persistent definition
file.
First,we create a vm.Then,define the vm and undefine the vm.Last create a
--memspec snapshot for the vm.Now,we will find a persistent definition
file in the config directory if we don't use this patch.
Signed-off-by: Li XueLei <li.xuelei1(a)zte.com.cn>
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e32257f..94dcb97 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15330,7 +15330,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
if (ret == 0 || !do_transaction) {
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0 ||
- (persist && virDomainSaveConfig(cfg->configDir, driver->caps,
+ (vm->persistent && persist && virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef) < 0))
ret = -1;
}
--
1.8.3.1
5 years, 10 months
[libvirt] [PATCH 0/6] RFC: qemu: virtio-{non-}transitional support
by Cole Robinson
This series adds the beginnings of support for virtio-transitional
and virtio-non-transitional qemu devices.
qemu patches, queued for qemu 4.0.0:
https://lists.gnu.org/archive/html/qemu-devel/2018-12/msg00923.html
Previous libvirt discussion around this:
https://www.redhat.com/archives/libvir-list/2018-August/msg01073.html
Long story short we need to expose these options so apps have a
usable way to support rhel6 + virtio + q35.
This series only covers exposing the associated device models
for disk and rng devices to make sure I'm on the right track.
serial, net, scsi, input-host, balloon 9p, vsock, vhost-scsi
still need to be implemented. Those should follow the rng
example, except vhost-scsi may need to be a different approach.
The main RFC bits here are:
* The disk approach. danpb and I briefly discussed on IRC adding
new bus= values vs a new model= attribute. We decided model=
is the lesser of two evils, since bus= handling in apps is
tied with target= generation, so adding new virtio-X bus=
values will cause more work for apps. These patches add
a <disk model=X/> attribute
* The XML and naming. Previous discussions seemed to favor adding
new model-style values rather than a 'transitional' attribute
or similar. So these patches add model='virtio-transitional'
and model='virtio-non-transitional'
* The PCI address handling. I just mapped virtio-non-transitional
to imply plain PCI addressing. I think that's all we need but
I'm not positive so I'd appreciate a review of that approach.
Cole Robinson (6):
tests: Add capabilities data for QEMU 4.0.0 x86_64
tests: qemuxml2xml: Add basic DO_TEST_CAPS impl
conf: Add <disk model='virtio-{non-}transitional'/>
qemu: Wire up disk model=virtio-{non-}transitional
qemu: domcaps: Report disk <enum name="model">
qemu: Support rng model=virtio-{non-}transitional
docs/formatdomain.html.in | 10 +
docs/schemas/domaincommon.rng | 14 +-
src/conf/domain_capabilities.c | 1 +
src/conf/domain_capabilities.h | 1 +
src/conf/domain_conf.c | 32 +-
src/conf/domain_conf.h | 12 +
src/libvirt_private.syms | 2 +
src/qemu/qemu_capabilities.c | 17 +
src/qemu/qemu_capabilities.h | 6 +
src/qemu/qemu_command.c | 43 +-
src/qemu/qemu_domain_address.c | 8 +-
.../bhyve_basic.x86_64.xml | 1 +
.../bhyve_fbuf.x86_64.xml | 1 +
.../bhyve_uefi.x86_64.xml | 1 +
tests/domaincapsschemadata/full.xml | 5 +
.../domaincapsschemadata/libxl-xenfv-usb.xml | 1 +
.../domaincapsschemadata/libxl-xenpv-usb.xml | 1 +
.../qemu_1.7.0.x86_64.xml | 1 +
.../qemu_2.12.0-virt.aarch64.xml | 1 +
.../qemu_2.12.0.ppc64.xml | 1 +
.../qemu_2.12.0.s390x.xml | 1 +
.../qemu_2.12.0.x86_64.xml | 1 +
.../qemu_2.6.0-virt.aarch64.xml | 1 +
.../qemu_2.6.0.aarch64.xml | 1 +
.../domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 +
.../qemu_2.6.0.x86_64.xml | 1 +
.../domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 +
.../qemu_2.8.0-tcg.x86_64.xml | 1 +
.../domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 +
.../qemu_2.8.0.x86_64.xml | 1 +
.../qemu_2.9.0-q35.x86_64.xml | 1 +
.../qemu_2.9.0-tcg.x86_64.xml | 1 +
.../qemu_2.9.0.x86_64.xml | 1 +
.../domaincapsschemadata/qemu_3.0.0.s390x.xml | 1 +
.../qemu_4.0.0.x86_64.xml | 153 +
tests/domaincapstest.c | 4 +
.../caps_4.0.0.x86_64.replies | 23180 ++++++++++++++++
.../caps_4.0.0.x86_64.xml | 1388 +
tests/qemucapabilitiestest.c | 1 +
...virtio-non-transitional.x86_64-latest.args | 37 +
.../virtio-non-transitional.xml | 29 +
.../virtio-transitional.x86_64-latest.args | 37 +
.../qemuxml2argvdata/virtio-transitional.xml | 29 +
tests/qemuxml2argvtest.c | 3 +
.../virtio-non-transitional.xml | 50 +
.../virtio-transitional.xml | 51 +
tests/qemuxml2xmltest.c | 60 +-
47 files changed, 25172 insertions(+), 23 deletions(-)
create mode 100644 tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml
create mode 100644 tests/qemucapabilitiesdata/caps_4.0.0.x86_64.replies
create mode 100644 tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/virtio-non-transitional.xml
create mode 100644 tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/virtio-transitional.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-non-transitional.xml
create mode 100644 tests/qemuxml2xmloutdata/virtio-transitional.xml
--
2.20.1
5 years, 10 months
[libvirt] [PATCH v2] util: audit: Fix logging an error when kernel lacks audit support
by Erik Skultety
Based on an upstream discussion, reporting the errno is useful for the
user to know why audit isn't supported. Even though having an error in
the logs might look concerning when 'audit_log=1', it also denotes that
audit is only going to be used if it's available, continuing normally
if it's unavailable for whatever reason.
Partially reverts commit 4199c2f221c.
https://bugzilla.redhat.com/show_bug.cgi?id=1596119
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/remote/remote_daemon.c | 2 +-
src/util/viraudit.c | 16 ++--------------
src/util/viraudit.h | 2 +-
3 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 3be3ad02fc..ededef97b4 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -1380,7 +1380,7 @@ int main(int argc, char **argv) {
if (config->audit_level) {
VIR_DEBUG("Attempting to configure auditing subsystem");
- if (virAuditOpen(config->audit_level) < 0) {
+ if (virAuditOpen() < 0) {
if (config->audit_level > 1) {
ret = VIR_DAEMON_ERR_AUDIT;
goto cleanup;
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index a02e5b36fd..135d0e626a 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -54,23 +54,11 @@ static int auditfd = -1;
#endif
static bool auditlog;
-int virAuditOpen(unsigned int audit_level ATTRIBUTE_UNUSED)
+int virAuditOpen(void)
{
#if WITH_AUDIT
if ((auditfd = audit_open()) < 0) {
- /* You get these error codes only when the kernel does not
- * have audit compiled in or it's disabled (e.g. by the kernel
- * cmdline) */
- if (errno == EINVAL || errno == EPROTONOSUPPORT ||
- errno == EAFNOSUPPORT) {
- if (audit_level < 2)
- VIR_INFO("Audit is not supported by the kernel");
- else
- virReportError(VIR_FROM_THIS, "%s", _("Audit is not supported by the kernel"));
- } else {
- virReportSystemError(errno, "%s", _("Unable to initialize audit layer"));
- }
-
+ virReportSystemError(errno, "%s", _("Unable to initialize audit layer"));
return -1;
}
diff --git a/src/util/viraudit.h b/src/util/viraudit.h
index 66605b16b5..7fbc28ba9b 100644
--- a/src/util/viraudit.h
+++ b/src/util/viraudit.h
@@ -31,7 +31,7 @@ typedef enum {
VIR_AUDIT_RECORD_RESOURCE,
} virAuditRecordType;
-int virAuditOpen(unsigned int audit_level);
+int virAuditOpen(void);
void virAuditLog(bool enabled);
--
2.20.1
5 years, 10 months
[libvirt] [PATCH] docs: remove duplicate example usegae of nvdimm
by Luyao Zhong
original:
<devices>
<memory model='nvdimm'>
...
</memory>
<memory model='nvdimm'>
...
</memory>
</devices>
merge two examples above into one:
<devices>
<memory model='nvdimm'>
...
</memory>
</devices>
Signed-off-by: Luyao Zhong <luyao.zhong(a)intel.com>
---
docs/formatdomain.html.in | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 7f07bb7..3641e3b 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -8323,19 +8323,6 @@ qemu-kvm -net nic,model=? /dev/null
<source>
<path>/tmp/nvdimm</path>
<alignsize unit='KiB'>2048</alignsize>
- </source>
- <target>
- <size unit='KiB'>524288</size>
- <node>1</node>
- <label>
- <size unit='KiB'>128</size>
- </label>
- <readonly/>
- </target>
- </memory>
- <memory model='nvdimm'>
- <source>
- <path>/dev/dax0.0</path>
<pmem/>
</source>
<target>
@@ -8344,6 +8331,7 @@ qemu-kvm -net nic,model=? /dev/null
<label>
<size unit='KiB'>128</size>
</label>
+ <readonly/>
</target>
</memory>
</devices>
--
2.7.4
5 years, 10 months
[libvirt] [PATCH] qemu: remove comments for qemuDomainSecret.*Destroy functions
by Ján Tomko
These all contain the same copy and pasted '@disk' error,
and only repeat the list of arguments.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
src/qemu/qemu_domain.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ec6b340308..6f5e3bd826 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -1475,11 +1475,6 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr priv,
}
-/* qemuDomainSecretDiskDestroy:
- * @disk: Pointer to a disk definition
- *
- * Clears unnecessary data associated with disk secret objects.
- */
void
qemuDomainSecretDiskDestroy(virDomainDiskDefPtr disk)
{
@@ -1590,11 +1585,6 @@ qemuDomainSecretStorageSourcePrepare(qemuDomainObjPrivatePtr priv,
}
-/* qemuDomainSecretHostdevDestroy:
- * @disk: Pointer to a hostdev definition
- *
- * Clear and destroy memory associated with the secret
- */
void
qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr hostdev)
{
@@ -1642,11 +1632,6 @@ qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv,
}
-/* qemuDomainSecretChardevDestroy:
- * @disk: Pointer to a chardev definition
- *
- * Clear and destroy memory associated with the secret
- */
void
qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev)
{
--
2.20.1
5 years, 10 months
[libvirt] [PULL v2 03/49] hw/misc/ivshmem: Remove deprecated "ivshmem" legacy device
by Michael S. Tsirkin
From: Thomas Huth <thuth(a)redhat.com>
It's been marked as deprecated in QEMU v2.6.0 already, so really nobody
should use the legacy "ivshmem" device anymore (but use ivshmem-plain or
ivshmem-doorbell instead). Time to remove the deprecated device now.
Belatedly also update a mention of the deprecated "ivshmem" in the file
docs/specs/ivshmem-spec.txt to "ivshmem-doorbell". Missed in commit
5400c02b90b ("ivshmem: Split ivshmem-plain, ivshmem-doorbell off ivshmem").
Signed-off-by: Thomas Huth <thuth(a)redhat.com>
Reviewed-by: Markus Armbruster <armbru(a)redhat.com>
Reviewed-by: Michael S. Tsirkin <mst(a)redhat.com>
Signed-off-by: Michael S. Tsirkin <mst(a)redhat.com>
---
docs/specs/ivshmem-spec.txt | 8 +-
hw/i386/pc_piix.c | 1 -
hw/misc/ivshmem.c | 210 +-----------------------------------
tests/ivshmem-test.c | 67 ++++--------
qemu-deprecated.texi | 5 -
scripts/device-crash-test | 1 -
6 files changed, 34 insertions(+), 258 deletions(-)
diff --git a/docs/specs/ivshmem-spec.txt b/docs/specs/ivshmem-spec.txt
index a1f5499796..042f7eae22 100644
--- a/docs/specs/ivshmem-spec.txt
+++ b/docs/specs/ivshmem-spec.txt
@@ -17,12 +17,16 @@ get interrupted by its peers.
There are two basic configurations:
-- Just shared memory: -device ivshmem-plain,memdev=HMB,...
+- Just shared memory:
+
+ -device ivshmem-plain,memdev=HMB,...
This uses host memory backend HMB. It should have option "share"
set.
-- Shared memory plus interrupts: -device ivshmem,chardev=CHR,vectors=N,...
+- Shared memory plus interrupts:
+
+ -device ivshmem-doorbell,chardev=CHR,vectors=N,...
An ivshmem server must already be running on the host. The device
connects to the server's UNIX domain socket via character device
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 5088e2f492..63c84e3827 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -715,7 +715,6 @@ static void pc_i440fx_1_2_machine_options(MachineClass *m)
PC_CPU_MODEL_IDS("1.2.0")
{ "nec-usb-xhci", "msi", "off" },
{ "nec-usb-xhci", "msix", "off" },
- { "ivshmem", "use64", "0" },
{ "qxl", "revision", "3" },
{ "qxl-vga", "revision", "3" },
{ "VGA", "mmio", "off" },
diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 8213659602..c7b6bbc974 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -112,13 +112,6 @@ typedef struct IVShmemState {
/* migration stuff */
OnOffAuto master;
Error *migration_blocker;
-
- /* legacy cruft */
- char *role;
- char *shmobj;
- char *sizearg;
- size_t legacy_size;
- uint32_t not_legacy_32bit;
} IVShmemState;
/* registers for the Inter-VM shared memory device */
@@ -529,17 +522,6 @@ static void process_msg_shmem(IVShmemState *s, int fd, Error **errp)
size = buf.st_size;
- /* Legacy cruft */
- if (s->legacy_size != SIZE_MAX) {
- if (size < s->legacy_size) {
- error_setg(errp, "server sent only %zd bytes of shared memory",
- (size_t)buf.st_size);
- close(fd);
- return;
- }
- size = s->legacy_size;
- }
-
/* mmap the region and map into the BAR2 */
memory_region_init_ram_from_fd(&s->server_bar2, OBJECT(s),
"ivshmem.bar2", size, true, fd, &local_err);
@@ -882,8 +864,6 @@ static void ivshmem_common_realize(PCIDevice *dev, Error **errp)
IVShmemState *s = IVSHMEM_COMMON(dev);
Error *err = NULL;
uint8_t *pci_conf;
- uint8_t attr = PCI_BASE_ADDRESS_SPACE_MEMORY |
- PCI_BASE_ADDRESS_MEM_PREFETCH;
Error *local_err = NULL;
/* IRQFD requires MSI */
@@ -903,10 +883,6 @@ static void ivshmem_common_realize(PCIDevice *dev, Error **errp)
pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY,
&s->ivshmem_mmio);
- if (s->not_legacy_32bit) {
- attr |= PCI_BASE_ADDRESS_MEM_TYPE_64;
- }
-
if (s->hostmem != NULL) {
IVSHMEM_DPRINTF("using hostmem\n");
@@ -964,7 +940,11 @@ static void ivshmem_common_realize(PCIDevice *dev, Error **errp)
}
vmstate_register_ram(s->ivshmem_bar2, DEVICE(s));
- pci_register_bar(PCI_DEVICE(s), 2, attr, s->ivshmem_bar2);
+ pci_register_bar(PCI_DEVICE(s), 2,
+ PCI_BASE_ADDRESS_SPACE_MEMORY |
+ PCI_BASE_ADDRESS_MEM_PREFETCH |
+ PCI_BASE_ADDRESS_MEM_TYPE_64,
+ s->ivshmem_bar2);
}
static void ivshmem_exit(PCIDevice *dev)
@@ -1084,13 +1064,6 @@ static Property ivshmem_plain_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};
-static void ivshmem_plain_init(Object *obj)
-{
- IVShmemState *s = IVSHMEM_PLAIN(obj);
-
- s->not_legacy_32bit = 1;
-}
-
static void ivshmem_plain_realize(PCIDevice *dev, Error **errp)
{
IVShmemState *s = IVSHMEM_COMMON(dev);
@@ -1122,7 +1095,6 @@ static const TypeInfo ivshmem_plain_info = {
.name = TYPE_IVSHMEM_PLAIN,
.parent = TYPE_IVSHMEM_COMMON,
.instance_size = sizeof(IVShmemState),
- .instance_init = ivshmem_plain_init,
.class_init = ivshmem_plain_class_init,
};
@@ -1155,8 +1127,6 @@ static void ivshmem_doorbell_init(Object *obj)
IVShmemState *s = IVSHMEM_DOORBELL(obj);
s->features |= (1 << IVSHMEM_MSI);
- s->legacy_size = SIZE_MAX; /* whatever the server sends */
- s->not_legacy_32bit = 1;
}
static void ivshmem_doorbell_realize(PCIDevice *dev, Error **errp)
@@ -1189,181 +1159,11 @@ static const TypeInfo ivshmem_doorbell_info = {
.class_init = ivshmem_doorbell_class_init,
};
-static int ivshmem_load_old(QEMUFile *f, void *opaque, int version_id)
-{
- IVShmemState *s = opaque;
- PCIDevice *pdev = PCI_DEVICE(s);
- int ret;
-
- IVSHMEM_DPRINTF("ivshmem_load_old\n");
-
- if (version_id != 0) {
- return -EINVAL;
- }
-
- ret = ivshmem_pre_load(s);
- if (ret) {
- return ret;
- }
-
- ret = pci_device_load(pdev, f);
- if (ret) {
- return ret;
- }
-
- if (ivshmem_has_feature(s, IVSHMEM_MSI)) {
- msix_load(pdev, f);
- ivshmem_msix_vector_use(s);
- } else {
- s->intrstatus = qemu_get_be32(f);
- s->intrmask = qemu_get_be32(f);
- }
-
- return 0;
-}
-
-static bool test_msix(void *opaque, int version_id)
-{
- IVShmemState *s = opaque;
-
- return ivshmem_has_feature(s, IVSHMEM_MSI);
-}
-
-static bool test_no_msix(void *opaque, int version_id)
-{
- return !test_msix(opaque, version_id);
-}
-
-static const VMStateDescription ivshmem_vmsd = {
- .name = "ivshmem",
- .version_id = 1,
- .minimum_version_id = 1,
- .pre_load = ivshmem_pre_load,
- .post_load = ivshmem_post_load,
- .fields = (VMStateField[]) {
- VMSTATE_PCI_DEVICE(parent_obj, IVShmemState),
-
- VMSTATE_MSIX_TEST(parent_obj, IVShmemState, test_msix),
- VMSTATE_UINT32_TEST(intrstatus, IVShmemState, test_no_msix),
- VMSTATE_UINT32_TEST(intrmask, IVShmemState, test_no_msix),
-
- VMSTATE_END_OF_LIST()
- },
- .load_state_old = ivshmem_load_old,
- .minimum_version_id_old = 0
-};
-
-static Property ivshmem_properties[] = {
- DEFINE_PROP_CHR("chardev", IVShmemState, server_chr),
- DEFINE_PROP_STRING("size", IVShmemState, sizearg),
- DEFINE_PROP_UINT32("vectors", IVShmemState, vectors, 1),
- DEFINE_PROP_BIT("ioeventfd", IVShmemState, features, IVSHMEM_IOEVENTFD,
- false),
- DEFINE_PROP_BIT("msi", IVShmemState, features, IVSHMEM_MSI, true),
- DEFINE_PROP_STRING("shm", IVShmemState, shmobj),
- DEFINE_PROP_STRING("role", IVShmemState, role),
- DEFINE_PROP_UINT32("use64", IVShmemState, not_legacy_32bit, 1),
- DEFINE_PROP_END_OF_LIST(),
-};
-
-static void desugar_shm(IVShmemState *s)
-{
- Object *obj;
- char *path;
-
- obj = object_new("memory-backend-file");
- path = g_strdup_printf("/dev/shm/%s", s->shmobj);
- object_property_set_str(obj, path, "mem-path", &error_abort);
- g_free(path);
- object_property_set_int(obj, s->legacy_size, "size", &error_abort);
- object_property_set_bool(obj, true, "share", &error_abort);
- object_property_add_child(OBJECT(s), "internal-shm-backend", obj,
- &error_abort);
- object_unref(obj);
- user_creatable_complete(USER_CREATABLE(obj), &error_abort);
- s->hostmem = MEMORY_BACKEND(obj);
-}
-
-static void ivshmem_realize(PCIDevice *dev, Error **errp)
-{
- IVShmemState *s = IVSHMEM_COMMON(dev);
-
- if (!qtest_enabled()) {
- warn_report("ivshmem is deprecated, please use ivshmem-plain"
- " or ivshmem-doorbell instead");
- }
-
- if (qemu_chr_fe_backend_connected(&s->server_chr) + !!s->shmobj != 1) {
- error_setg(errp, "You must specify either 'shm' or 'chardev'");
- return;
- }
-
- if (s->sizearg == NULL) {
- s->legacy_size = 4 * MiB; /* 4 MB default */
- } else {
- int ret;
- uint64_t size;
-
- ret = qemu_strtosz_MiB(s->sizearg, NULL, &size);
- if (ret < 0 || (size_t)size != size || !is_power_of_2(size)) {
- error_setg(errp, "Invalid size %s", s->sizearg);
- return;
- }
- s->legacy_size = size;
- }
-
- /* check that role is reasonable */
- if (s->role) {
- if (strncmp(s->role, "peer", 5) == 0) {
- s->master = ON_OFF_AUTO_OFF;
- } else if (strncmp(s->role, "master", 7) == 0) {
- s->master = ON_OFF_AUTO_ON;
- } else {
- error_setg(errp, "'role' must be 'peer' or 'master'");
- return;
- }
- } else {
- s->master = ON_OFF_AUTO_AUTO;
- }
-
- if (s->shmobj) {
- desugar_shm(s);
- }
-
- /*
- * Note: we don't use INTx with IVSHMEM_MSI at all, so this is a
- * bald-faced lie then. But it's a backwards compatible lie.
- */
- pci_config_set_interrupt_pin(dev->config, 1);
-
- ivshmem_common_realize(dev, errp);
-}
-
-static void ivshmem_class_init(ObjectClass *klass, void *data)
-{
- DeviceClass *dc = DEVICE_CLASS(klass);
- PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
-
- k->realize = ivshmem_realize;
- k->revision = 0;
- dc->desc = "Inter-VM shared memory (legacy)";
- dc->props = ivshmem_properties;
- dc->vmsd = &ivshmem_vmsd;
-}
-
-static const TypeInfo ivshmem_info = {
- .name = TYPE_IVSHMEM,
- .parent = TYPE_IVSHMEM_COMMON,
- .instance_size = sizeof(IVShmemState),
- .class_init = ivshmem_class_init,
-};
-
static void ivshmem_register_types(void)
{
type_register_static(&ivshmem_common_info);
type_register_static(&ivshmem_plain_info);
type_register_static(&ivshmem_doorbell_info);
- type_register_static(&ivshmem_info);
}
type_init(ivshmem_register_types)
diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c
index fe5eb304b1..4911b69317 100644
--- a/tests/ivshmem-test.c
+++ b/tests/ivshmem-test.c
@@ -291,20 +291,20 @@ static void *server_thread(void *data)
return NULL;
}
-static void setup_vm_with_server(IVState *s, int nvectors, bool msi)
+static void setup_vm_with_server(IVState *s, int nvectors)
{
- char *cmd = g_strdup_printf("-chardev socket,id=chr0,path=%s,nowait "
- "-device ivshmem%s,chardev=chr0,vectors=%d",
- tmpserver,
- msi ? "-doorbell" : ",size=1M,msi=off",
- nvectors);
+ char *cmd;
- setup_vm_cmd(s, cmd, msi);
+ cmd = g_strdup_printf("-chardev socket,id=chr0,path=%s,nowait "
+ "-device ivshmem-doorbell,chardev=chr0,vectors=%d",
+ tmpserver, nvectors);
+
+ setup_vm_cmd(s, cmd, true);
g_free(cmd);
}
-static void test_ivshmem_server(bool msi)
+static void test_ivshmem_server(void)
{
IVState state1, state2, *s1, *s2;
ServerThread thread;
@@ -327,9 +327,9 @@ static void test_ivshmem_server(bool msi)
thread.thread = g_thread_new("ivshmem-server", server_thread, &thread);
g_assert(thread.thread != NULL);
- setup_vm_with_server(&state1, nvectors, msi);
+ setup_vm_with_server(&state1, nvectors);
s1 = &state1;
- setup_vm_with_server(&state2, nvectors, msi);
+ setup_vm_with_server(&state2, nvectors);
s2 = &state2;
/* check got different VM ids */
@@ -340,38 +340,28 @@ static void test_ivshmem_server(bool msi)
g_assert_cmpint(vm1, !=, vm2);
/* check number of MSI-X vectors */
- if (msi) {
- ret = qpci_msix_table_size(s1->dev);
- g_assert_cmpuint(ret, ==, nvectors);
- }
+ ret = qpci_msix_table_size(s1->dev);
+ g_assert_cmpuint(ret, ==, nvectors);
/* TODO test behavior before MSI-X is enabled */
/* ping vm2 -> vm1 on vector 0 */
- if (msi) {
- ret = qpci_msix_pending(s1->dev, 0);
- g_assert_cmpuint(ret, ==, 0);
- } else {
- g_assert_cmpuint(in_reg(s1, INTRSTATUS), ==, 0);
- }
+ ret = qpci_msix_pending(s1->dev, 0);
+ g_assert_cmpuint(ret, ==, 0);
out_reg(s2, DOORBELL, vm1 << 16);
do {
g_usleep(10000);
- ret = msi ? qpci_msix_pending(s1->dev, 0) : in_reg(s1, INTRSTATUS);
+ ret = qpci_msix_pending(s1->dev, 0);
} while (ret == 0 && g_get_monotonic_time() < end_time);
g_assert_cmpuint(ret, !=, 0);
/* ping vm1 -> vm2 on vector 1 */
- if (msi) {
- ret = qpci_msix_pending(s2->dev, 1);
- g_assert_cmpuint(ret, ==, 0);
- } else {
- g_assert_cmpuint(in_reg(s2, INTRSTATUS), ==, 0);
- }
+ ret = qpci_msix_pending(s2->dev, 1);
+ g_assert_cmpuint(ret, ==, 0);
out_reg(s1, DOORBELL, vm2 << 16 | 1);
do {
g_usleep(10000);
- ret = msi ? qpci_msix_pending(s2->dev, 1) : in_reg(s2, INTRSTATUS);
+ ret = qpci_msix_pending(s2->dev, 1);
} while (ret == 0 && g_get_monotonic_time() < end_time);
g_assert_cmpuint(ret, !=, 0);
@@ -389,27 +379,17 @@ static void test_ivshmem_server(bool msi)
close(thread.pipe[0]);
}
-static void test_ivshmem_server_msi(void)
-{
- test_ivshmem_server(true);
-}
-
-static void test_ivshmem_server_irq(void)
-{
- test_ivshmem_server(false);
-}
-
#define PCI_SLOT_HP 0x06
static void test_ivshmem_hotplug(void)
{
const char *arch = qtest_get_arch();
- qtest_start("");
+ qtest_start("-object memory-backend-ram,size=1M,id=mb1");
- qtest_qmp_device_add("ivshmem",
- "iv1", "{'addr': %s, 'shm': %s, 'size': '1M'}",
- stringify(PCI_SLOT_HP), tmpshm);
+ qtest_qmp_device_add("ivshmem-plain", "iv1",
+ "{'addr': %s, 'memdev': 'mb1'}",
+ stringify(PCI_SLOT_HP));
if (strcmp(arch, "ppc64") != 0) {
qpci_unplug_acpi_device_test("iv1", PCI_SLOT_HP);
}
@@ -509,8 +489,7 @@ int main(int argc, char **argv)
if (g_test_slow()) {
qtest_add_func("/ivshmem/pair", test_ivshmem_pair);
if (strcmp(arch, "ppc64") != 0) {
- qtest_add_func("/ivshmem/server-msi", test_ivshmem_server_msi);
- qtest_add_func("/ivshmem/server-irq", test_ivshmem_server_irq);
+ qtest_add_func("/ivshmem/server", test_ivshmem_server);
}
}
diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi
index 81de5fc019..219206a836 100644
--- a/qemu-deprecated.texi
+++ b/qemu-deprecated.texi
@@ -126,11 +126,6 @@ documentation of ``query-hotpluggable-cpus'' for additional details.
@section System emulator devices
-@subsection ivshmem (since 2.6.0)
-
-The ``ivshmem'' device type is replaced by either the ``ivshmem-plain''
-or ``ivshmem-doorbell`` device types.
-
@subsection bluetooth (since 3.1)
The bluetooth subsystem is unmaintained since many years and likely bitrotten
diff --git a/scripts/device-crash-test b/scripts/device-crash-test
index e93a7c0c84..a835772ac5 100755
--- a/scripts/device-crash-test
+++ b/scripts/device-crash-test
@@ -83,7 +83,6 @@ ERROR_WHITELIST = [
{'device':'isa-ipmi-bt', 'expected':True}, # IPMI device requires a bmc attribute to be set
{'device':'isa-ipmi-kcs', 'expected':True}, # IPMI device requires a bmc attribute to be set
{'device':'isa-parallel', 'expected':True}, # Can't create serial device, empty char device
- {'device':'ivshmem', 'expected':True}, # You must specify either 'shm' or 'chardev'
{'device':'ivshmem-doorbell', 'expected':True}, # You must specify a 'chardev'
{'device':'ivshmem-plain', 'expected':True}, # You must specify a 'memdev'
{'device':'loader', 'expected':True}, # please include valid arguments
--
MST
5 years, 10 months
[libvirt] Release of libvirt-5.0.0
by Daniel Veillard
Hi all,
as planned I just tagged the new release in git, and pushed signed tarball
and rpms to the usual place:
ftp://libvirt.org/libvirt/
I also pushed the python bindings, identical to 4.10 with just the versioning
bump, you can find them at:
ftp://libvirt.org/libvirt/python/
This release includes new features, but also remove the old apparently unused
UML driver support. There is also a rather large set of improvements:
New features:
- Xen: Add support for openvswitch
The libxl driver now supports virtual interfaces that connect to an
openvswitch bridge, including interfaces with VLAN tagging and trunking
configuration.
- qemu: Report whether KVM nesting is available
Running nested KVM guests requires specific configuration steps to be
performed on the host; libvirt will now report in the host capabilities
whether KVM nesting support is available.
Removed features:
- Drop UML driver
The UML driver was unmaintained and not tested for quite some time now.
Worse, there is a bug that causes it to deadlock on some very basic
operations (e.g. dumping domain XML). These facts make us believe no
one uses it.
Improvements:
- qemu: Add support for ARMv6l guests
- Support more NVDIMM configuration options
Introduce more configuration options. For the source element, add the
'alignsize' and 'pmem' subelements. For the target element, add the
'readonly' subelement.
- cpu: Add support for "stibp" x86_64 feature
Add cpu flag stibp (Single Thread Indirect Branch Predictors) to
prevent indirect branch predictions from being controlled by the
sibling Hyperthread.
- libxl: Handle external domain destroy
Historically, if a domain was destroyed using xl rather than through
libvirt APIs, libvirt would not be aware of the fact and keep
considering it as running. This is no longer the case.
- Start selecting the first available DRI device for OpenGL operations
If OpenGL support is needed (either with SPICE gl enabled or with
egl-headless), libvirt is now able to pick the first available DRI
device for the job. At the same time, this improvement is also a bugfix
as it prevents permission-related issues with regards to our mount
namespaces and the default DRI render node's permissions which would
normally prevent QEMU from accessing such a device.
- qemu: Add support for postcopy-requests migration statistics
The virDomainJobInfo can get number page requests received from the
destination host during post-copy migration.
Bug fixes:
- lxc: Don't forbid interfaces with type=direct
Such interfaces are supported by lxc and should be allowed.
- qemu: Fully clean up RNG devices on detach
Some RNG device types, such as those using EGD, might need extra clean
up on the host in addition to removing the guest-side device.
Thanks everybody for your help toward this release, be it with patches
reviews, bug description, documentation and localizations !
As a reminder, the next release is scheduled at the end of February,
in the meantime, enjoy the new release !
Daniel
--
Daniel Veillard | Red Hat Developers Tools http://developer.redhat.com/
veillard(a)redhat.com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
5 years, 10 months
[libvirt] [PATCH] util: audit: Fix the error code when kernel lacks audit support
by Erik Skultety
When commit 4199c2f221c tweaked the error path of virAuditOpen it used
VIR_FROM_THIS as the error code to virReportError.
https://bugzilla.redhat.com/show_bug.cgi?id=1596119
Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
---
src/util/viraudit.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index a02e5b36fd..d04343a542 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -66,7 +66,8 @@ int virAuditOpen(unsigned int audit_level ATTRIBUTE_UNUSED)
if (audit_level < 2)
VIR_INFO("Audit is not supported by the kernel");
else
- virReportError(VIR_FROM_THIS, "%s", _("Audit is not supported by the kernel"));
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Audit is not supported by the kernel"));
} else {
virReportSystemError(errno, "%s", _("Unable to initialize audit layer"));
}
--
2.20.1
5 years, 10 months