Similarly to previous commit, implement sparse streams feature
for vol-upload. This is, however, slightly different approach,
because we must implement a function that will tell us whether
we are in a data section or in a hole. But there's no magic
hidden in here.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Add a new --sparse switch that does nothing more than
enables the sparse streams feature for this command. Among with
the switch new helper function is introduced: virshStreamSkip().
This is the callback that is called whenever daemon sends us a
hole. In the callback we reflect the hole in underlying file by
seeking as many bytes as told.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
In virsh we quite often get the domain XML just to initialize the XPath
parser so that we can extract information.
Add helpers which will simplify this by wrapping the getting of the XML
and parsing it along with error reporting.
Additionally a second helper also gets the domain object from the
parameters and releases it so that functions which need the XML as only
source of data can be simplified further.
virDomainFree has it's quirks (does not like NULL pointers, resets
libvirt errors). Replace it by a virsh helper which will allow us to
centrally fix issues with it.
The syntax-check rule will prohibit new uses of virDomainFree.
Move virshLookupDomainBy, virshCommandOptDomainBy and
virshCommandOptDomainBy to the helper file. Additionally turn the
virshCommandOptDomainBy macro into a function.