Commit Graph

38678 Commits

Author SHA1 Message Date
Ján Tomko
a5152f23e7 Move declarations before statements
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 19:03:11 +02:00
Ján Tomko
908bcaa452 util: move declarations in virStorageFileChainLookup
Use g_autofree and move the declarations to the beginning
of the block.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 19:03:11 +02:00
Ján Tomko
d8c9584aed util: virHostMem*Parameters: split out non-Linux stubs
Repeat the whole function header instead of mixing #ifdefs
in the code.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 19:03:11 +02:00
Ján Tomko
c927b2e85a util: virHostMemSetParameters: remove pointless variable
It is only used inside the condition.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 19:03:11 +02:00
Ján Tomko
ec9b47e133 util: virRandomInt: remove temporary variable
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 19:03:11 +02:00
Jim Fehlig
5af89a77b0 news: Mention support for device model commandline passthrough in Xen
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 10:14:44 -06:00
Jim Fehlig
3d76f4fceb Xen: Add support for qemu commandline passthrough to config converter
Support qemu commandline passthrough in the domXML to native config
converter. Add tests to check the conversion.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 10:13:58 -06:00
Jim Fehlig
b0cad42ef2 Xen: Add support for qemu command-line passthrough
Xen supports passing arbitrary arguments to the QEMU device model via
the 'extra' member of the public libxl_domain_build_info structure.
This patch adds a 'xen' namespace extension, similar to the QEMU and
bhyve drivers, to map arbitrary arguments to the 'extra' member. Only
passthrough of arguments is supported. Passthrough of environment
variables or capabilities adjustments is not supported.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 10:11:08 -06:00
Daniel Henrique Barboza
6738c79380 NEWS.rst: update with NVDIMM auto-alignment removal for pSeries
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-25 17:58:51 +02:00
Pavel Hrdina
81a3042a12 storage_util: fix qemu-img sparse allocation
Commit <c9ec7088c7a3f4cd26bb471f1f243931fff6f4f9> introduced a support
to fully allocate qcow2 images when <allocation> matches <capacity> but
it doesn't work as expected.

The issue is that info.size_arg is in KB but the info.allocation
introduced by the mentioned commit is in B. This results in using
"preallocation=falloc," in cases where "preallocation=metadata," should
be used.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 16:53:13 +02:00
Jin Yan
1b5bf7d540 virnetserver: fix some memory leaks in virNetTLSContextReloadForServer
These leaks were introduced in commit 15d280fa97, use g_autofree for all
cert_path pointers.

Signed-off-by: Jin Yan <jinyan12@huawei.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 14:22:03 +02:00
Peter Krempa
e2e0a4108b NEWS: Mention IQN setting for iSCSI hostdevs
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-25 11:22:20 +02:00
Han Han
8eebceef43 virsh: Add source-initiator opt to build the initiator of pool XML
For iscsi-direct pool, the initiator is necessary for pool defining:
<pool type="iscsi-direct">
 ...
    <initiator>
      <iqn name="iqn.2013-06.com.example:iscsi-initiator"/>
    </initiator>
...
</pool>

Add --source-initiator to fill the initiator iqn for
pool-create-as/pool-define-as subcommands.

https://bugzilla.redhat.com/show_bug.cgi?id=1658082

Signed-off-by: Han Han <hhan@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-25 09:32:05 +02:00
Peter Krempa
14b895ad3a qemuMigrationCapsToJSON: Refactor capability object formatting
Use virJSONValueObjectCreate rather than creating the object
piece-by-piece and use new accessors for bitmap to simplify the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-08-25 08:24:34 +02:00
Pino Toscano
433621eb48 gitdm: add missing aliases
Consider a couple of misspelt emails in B-y tags.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-08-25 07:04:41 +02:00
Pino Toscano
470c715602 gitdm: move pld-linux.org to opensource
PLD Linux is a Linux distribution, so @pld-linux.org fits in the
opensource group with similar projects.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-08-25 07:04:37 +02:00
Roman Bogorodskiy
a7292e07df docs: formatdomain: document <audio> element
Document the new <audio> element which allows to specify
host audio backend for a guest <sound> device, and update
the <sound> element description with the new <audio>
sub-element which specifies the other end of the mapping.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-08-25 08:42:17 +04:00
Roman Bogorodskiy
26a13ec469 bhyve: allow to specify host sound device
Allow to map sound playback and recording devices to host devices
using "<audio type='oss'/>" OSS audio backend.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-08-25 08:42:16 +04:00
Roman Bogorodskiy
9375bc7373 conf: allow to map sound device to host device
Introduce a new device element "<audio>" which allows
to map guest sound device specified using the "<sound>"
element to specific audio backend.

Example:

  <sound model='ich7'>
     <audio id='1'/>
  </sound>
  <audio id='1' type='oss'>
     <input dev='/dev/dsp0'/>
     <output dev='/dev/dsp0'/>
  </audio>

This block maps to OSS audio backend on the host using
/dev/dsp0 device for both input (recording)
and output (playback).

OSS is the only backend supported so far.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-08-25 08:42:16 +04:00
Roman Bogorodskiy
5d3137bbfb bhyve: implement sound device support
bhyve supports intel hda sound devices that could be specified
on the command like using "-1:0,hda,play=$play_dev,rec=$rec_dev",
where "1:0" is a PCI address, and "$play_dev" and "$rec_dev"
point to the playback and recording device on the host respectively.
Currently, schema of the 'sound' element doesn't allow specifying
neither playback nor recording devices, so for now hardcode
/dev/dsp0, which is the first audio device on the host.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-08-25 08:42:16 +04:00
Roman Bogorodskiy
9499521718 conf: add 'ich7' sound model
Add 'ich7' sound model. This is a preparation for sound support in
bhyve, as 'ich7' is the only model it supports.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-08-25 08:42:16 +04:00
Laine Stump
282d135ddb conf: properly clear out autogenerated macvtap names when formatting/parsing
Back when macvtap support was added in commit 315baab944 in Feb. 2010
(libvirt-0.7.7), it was setup to autogenerate a name for the device if
one wasn't supplied, in the pattern "macvtap%d" (or "macvlan%d"),
similar to the way an unspecified standard tap device name will lead
to an autogenerated "vnet%d".

As a matter of fact, in commit ca1b7cc8e4 added in May 2010, the code
was changed to *always* ignore a supplied device name for macvtap
interfaces by deleting *any* name immediately during the <interface>
parsing (this was intended to prevent one domain which had failed to
completely start from deleting the macvtap device of another domain
which had subsequently been provided the same device name (this will
seem mildly ironic later). This was later fixed to only clear the
device name when inactive XML was being parsed. HOWEVER - this was
only done if the xml was <interface type='direct'> - autogenerated
names were not cleared for <interface type='network'> (which could
also result in a macvtap device).

Although the names of "vnetX" tap devices had always been
automatically cleared when parsing <interface> (see commit d1304583d
from July 2008 (!)), at the time macvtap support was added, both vnetX
and macvtapX device names were always included when formatting the
XML.

Then in commit a8be259d0c (July 2011, libvirt-0.9.4), <interface>
formatting was changed to also clear out "vnetX" device names during
XML formatting as well. However the same treatment wasn't given to
"macvtapX".

Now in 2020, there has been a report that a failed migration leads to
the macvtap device of some other unrelated guest on the destination
host losing its network connectivity. It was determined that this was
due to the domain XML in the migration containing a macvtap device
name, e.g. "macvtap0", that was already in use by the other guest on
the destination. Normally this wouldn't be a problem, because libvirt
would see that the device was already in use, and then find a
different unused name. But in this case, other external problems were
causing the migration to fail prior to selecting a macvtap device and
successfully opening it, and during error recovery, qemuProcessStop()
was called, which went through all def->nets objects and (if they were
macvtap) deleted the device specified in net->ifname; since libvirt
hadn't gotten to the point of replacing the incoming "macvtap0" with
the name of a device it actually created for this guest, that meant
that "macvtap0" was deleted, *even though it was currently in use by a
different guest*!

Whew!

So, it turns out that when formatting "migratable" XML, "vnetX"
devices are omitted, just as when formatting "inactive" XML. By making
the code in both interface parsing and formatting consistent for
"vnetX", "macvtapX", and "macvlanX", we can thus make sure that the
autogenerated (and unneeded / completely *not* wanted) macvtap device
name will not be sent with the migration XML. This way when a
migration fails, net->ifname will be NULL, and libvirt won't have any
device to try and (erroneously) delete.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-08-24 23:49:16 -04:00
Laine Stump
5cad64ec03 qemu: remove unreachable code in qemuProcessStart()
Back when the original version of this chunk of code was added (commit
41b087198 in libvirt-0.8.1 in April 2010), we used virExecDaemonize()
to start the qemu process, and would continue on in the function
(which at that time was called qemudStartVMDaemon()) even if a -1 was
returned. So it was possible to get to this code with rv == -1 (it was
called "ret" in that version of the code).

In modern libvirt code, qemu is started with virCommandRun(); then we
call virPidFileReadPath(); those are the only two ways of setting "rv"
prior to this code being removed, and in either case if the new value
of rv < 0, then we immediately skip over the rest of the code to the
cleanup: label.

This means that the code being removed by this patch is
unreachable.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-08-24 23:46:51 -04:00
Michal Privoznik
db37396e41 qemu_namespace: Don't build namespace if domain doesn't have it enabled
Even if namespaces are disabled, then due to a missing check at the
beginning of qemuDomainBuildNamespace(), the domain startup code
still tries to populate (nonexistent) domain's namespace.

Fixes: 8da362fe62
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
2020-08-24 19:19:47 +02:00
Daniel Henrique Barboza
2d93cbdea9 Revert "formatdomain.html.in: mention pSeries NVDIMM 'align down' mechanic"
We do not auto-align down pSeries NVDIMMs anymore.

This reverts commit 8f474ceea0.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 18:41:38 +02:00
Daniel Henrique Barboza
0ee56369c8 qemu_domain.c: change qemuDomainMemoryDeviceAlignSize() return type
After the recent changes, this function is now always returning
zero. Turn it to 'void' to relieve callers from checking it.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 18:41:38 +02:00
Daniel Henrique Barboza
07de813924 qemu_domain.c: do not auto-align ppc64 NVDIMMs
We don't need the auto-alignment now that the user is handling
it by hand.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 18:41:38 +02:00
Daniel Henrique Barboza
0ccceaa57c qemu_validate.c: add pSeries NVDIMM size alignment validation
The existing auto-align behavior for pSeries has the idea to
alleviate user configuration of the NVDIMM size, given that the
alignment calculation is not trivial to do (256MiB alignment
of mem->size - mem->label_size value, a.k.a guest area). We
align mem->size down to avoid end of file problems.

The end result is not ideal though. We do not touch the domain
XML, meaning that the XML can report a NVDIMM size 255MiB smaller
than the actual size the guest is seeing. It also adds one more
thing to consider in case the guest is reporting less memory
than declared, since the auto-align is transparent to the
user.

Following Andrea's suggestion in [1], let's instead do an
size alignment validation. If the NVDIMM is unaligned, error out
and suggest a rounded up value. This can be bothersome to users,
but will bring consistency of NVDIMM size between the domain XML
and the guest.

This approach will force existing non-running pSeries guests to
readjust the NVDIMM value in their XMLs, if necessary. No changes
were made for x86 NVDIMM support.

[1] https://www.redhat.com/archives/libvir-list/2020-July/msg01471.html

Suggested-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 18:41:28 +02:00
Daniel Henrique Barboza
4fa2202d88 qemu_domain.c: make qemuDomainGetMemorySizeAlignment() public
Next patch will use it outside of qemu_domain.c.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 18:36:16 +02:00
Michal Privoznik
8d8088b8d9 qemuDomainGetMemorySizeAlignment: Mark domain @def const
This function is not changing the domain definition, it's only
reading from it. The function is going to be used from another
function which already takes const virDomainDef. Make the @def
const to avoid typecasting it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 18:29:44 +02:00
Kashyap Chamarthy
7a706b02ed manpages/virsh: A couple of small clarifications
Changes:

  - Update the descriptions of --current & --config flags.

    For --config, the reason to rephrase "next boot" to "next start"
    is: "Next boot may still imply somebody selecting "reboot" in the
    guest OS and fully expecting the changes to be applied."  (per Peter
    Krempa)

    For --current, existing documentation says:

      "If *--current* is specified, affect the current guest state."

    It's not entirely clear what states can "current" mean or imply.  So
    rephrase it in context of the other two related flags --live and
    --config.

  - While at it, I also took the liberty to replace the few occurrences
    of "peristent domain[s]" with "persistent guest[s]"

Fix all occurrences (i.e. as many as I could spot) of this.

(Thanks: Dan Berrangé on IRC.)

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 18:15:36 +02:00
Peter Krempa
7a268c7c3a qemu: Move virQEMUFileOpenAs to qemu_domain.c
Commit 4362068979 moved the function to
util/virqemu.c which is compiled also on win32 and geteuid()/getegid()
doesn't exist there.

Move it to qemu_domain.c which is compiled only when the qemu driver is
enabled. Originally I didn't want to put it here as qemu_domain.c is a
code dump for helper functions but this is the least invasive fix.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2020-08-24 18:12:44 +02:00
Peter Krempa
86628e0cff qemucapabilitiesdata: Add test data for x86_64 for the qemu-5.2 dev cycle
The machine types for this cycle were already added and qemu also added
a property for the machine type object called "default-ram-id".

Also "block-bitmap-mapping" is supported as a migration parameter.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-24 16:43:22 +02:00
Peter Krempa
9abf742986 tests: qemucapabilities: Update data for qemu-v5.1.0 release
qemu-v5.1.0 is released now. There weren't any noticable changes since
our last update to 'rc2'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 16:43:10 +02:00
Peter Krempa
8098462bfb qemumigparamstest: Validate output parameters against QMP schema
Ensure that the migration parameters are formatted properly according to
the schema.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 16:42:57 +02:00
Peter Krempa
c501663a71 qemu: Extract snapshot related code to a separate file
We've dumped all the snapshot helpers and related code into
qemu_driver.c. It accounted for ~10% of overal size of qemu_driver.c.

Separate the code to qemu_snapshot.c/h.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 16:42:29 +02:00
Peter Krempa
2087894906 qemu: Split of code related to handling of the save image file
There's a lot of helper code related to the save image handling. Extract
it to qemu_saveimage.c/h.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 16:42:00 +02:00
Peter Krempa
8cd7ee6587 qemuFileWrapperFDClose: move to qemu_domain.c
Move the code to qemu_domain.c so that it can be reused in other parts
of the qemu driver. 'qemu_domain' was chosen as we check the domain
state after closing the wrapper.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 16:41:34 +02:00
Peter Krempa
19b2d84854 qemuOpenFile: Move to qemu_domain.c
Move the code to qemu_domain.c so that it can be reused in other parts
of the qemu driver. 'qemu_domain' was chosen as the permissions are
based on the domain configuration.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 16:41:08 +02:00
Peter Krempa
4362068979 qemuOpenFileAs: Move into util/virqemu.c
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-08-24 16:40:42 +02:00
Peter Krempa
9ea633f94f qemuMigrationCapsCheck: Refactor variable cleanup
Use automatic memory allocation to simplify the code and remove the need
for a 'cleanup:' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-24 16:40:37 +02:00
Peter Krempa
d9115e7b0f qemuMigrationParamsParse: Refactor variable cleanup
Use automatic memory allocation and move variables into correct scope to
simplify the code and remove the need for a 'cleanup:' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-24 16:34:51 +02:00
Peter Krempa
99e4467bb1 qemuMigrationCapsToJSON: Refactor variable cleanup
Use automatic memory allocation and move variables into correct scope to
simplify the code and remove the need for a 'error:' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-24 16:34:51 +02:00
Peter Krempa
47a9f078f0 qemuMigrationParamsToJSON: Refactor variable cleanup
Use automatic memory allocation and move variables into correct scope to
simplify the code and remove the need for a 'error:' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-24 16:34:51 +02:00
Peter Krempa
f2108c790c qemuMigrationParamsFromJSON: Unify return value handling with other functions
This function doesn't have an overly verbose cleanup section as there
isn't any error code path. Unify it with the rest of the functions which
will simplify adding a possible error path.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-24 16:34:51 +02:00
Peter Krempa
a8d0ab02f6 qemuMigrationParamsFromFlags: Use 'g_autoptr' to remove 'error:' label
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-24 16:34:50 +02:00
Peter Krempa
da1831de96 qemuMigrationParamsNew: Use new memory allocation to simplify code
Use automatic memory cleaning and allocate via g_new0.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-08-24 16:34:50 +02:00
Michal Privoznik
9586367d7e news: Document sparse streams for block devices
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-08-24 15:16:43 +02:00
Michal Privoznik
fd6b531cb2 virfdstream: Emulate skip for block devices
This is similar to one of previous patches.

When receiving stream (on virStorageVolUpload() and subsequent
virStreamSparseSendAll()) we may receive a hole. If the volume we
are saving the incoming data into is a regular file we just
lseek() and ftruncate() to create the hole. But this won't work
if the file is a block device. If that is the case we must write
zeroes so that any subsequent reader reads nothing just zeroes
(just like they would from a hole in a regular file).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1852528

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-08-24 13:40:06 +02:00
Michal Privoznik
9e0ba037cd virshStreamInData: Handle block devices
This is very similar to previous commit.

The virshStreamInData() callback is used by virStreamSparseSendAll()
to detect whether the file the data is read from is in data or hole
section. The SendAll() will then send corresponding type of virStream
message to make server create a hole or write actual data. But the
callback uses virFileInData() even for block devices, which results in
an error. Just like in previous commit, emulate a DATA section
for block devices.

Partially resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1852528

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2020-08-24 13:39:55 +02:00