Switch the allocation in virshSnapshotListCollect and
its cargo-culted Checkpoint counterpart to two separate
g_new0 calls and move the boolean expression to
the if condition that chooses between them.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Starting with Linux 5.9, Xen Dom0 works on commonly available
AArch64 devices, such as the Raspberry Pi 4.
Reference: https://xenproject.org/2020/09/29/xen-on-raspberry-pi-4-adventures/
Signed-off-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
There is present no XML test coverage for this.
Add genericxml parse + formatting coverage.
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Modify virCPUarmCompare in cpu_arm.c to perform compare action.
This patch only adds host to host CPU compare, the rest cases
remains the same. This is useful for source and destination host
compare during migrations to avoid migration between different
CPU models that have different CPU freatures.
Signed-off-by: Zhenyu Zheng <zheng.zhenyu@outlook.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Move them to separate conditions to reduce churn
in following patches.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
Change the interface of esxUtil_ResolveHostname() to return a newly
allocated string with the result address, instead of forcing the callers
to provide a buffer and its size. This way we can simply (auto)free the
string, and make the function stacks smaller.
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
Call freeaddrinfo() as soon as @result is not needed anymore, i.e. right
after getnameinfo(); this avoids calling freeaddrinfo() in two branches.
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
spicevmc is the most common <redirdev> usage. This adds an XML example
for it.
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Currently it is visually at the same indent as <seclabel>. This
fixes it to be grouped it with <devices>
Fixes: d4abb7b45d
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
libvirt doesn't reject this but only one <driver> element takes
effect.
Drop the instance that is already referenced in the previous example
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Previous refactors allow us to plainly replace all VIR_FREE by g_free to
finish the modernization of the file.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Restructure the control-flow a bit using an temporary variable to avoid
the need to use VIR_FREE.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Use modern allocators, automatic memory feeing, and decrease the scope
of some variables to remove the 'cleanup' label.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Use modern allocators, automatic memory feeing, and decrease the scope
of some variables to remove the 'error' and 'cleanup' labels.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Use modern allocators, automatic memory feeing, and decrease the scope
of some variables to remove the 'error' label.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Use automatic memory freeing to get rid of the 'error' label. Since the
'tmp' variable was used only in one instance, rename it appropriately.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Use modern memory handling approach to simplify the code.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Use modern memory handling approach to simplify the code.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Register the the cleanup functions for 'qemuMigrationCookieGraphics',
'qemuMigrationCookieNetwork', 'qemuMigrationCookieNBD', and
'qemuMigrationCookieCaps'.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Switch to automatic memory cleaning, use g_new0 for allocation and get
rid of the 'error' label.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Move the code into 'qemuMigrationCookieNBDXMLFormat' and use modern XML
formatting code patterns.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Use 'virXMLFormatElement' both for formating the whole <network> element
but also for formatting the <interface> subelements. This alows to
remove the crazy logic which was determining which element was already
formatted.
Additional simplification is achieved by switching to skipping the loop
using 'continue' rather than putting everything in a giant block.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Switch to the two buffer approach to simplify the logic for terminating
the element.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Now it only returns -1 so we can do that directly.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Most of our functions report errors so there's no need to mention it
here again.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Make sure that 'virXPathNodeSet' returns '1' as the only expected value
rather than relying on the fact that the previous check for the number
of elements ensures success of the subsequent call.
The error message no longer mentions the number of <domain> elements in
the cookie, but this is a very unlikely internal error anyways.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Don't reuse 'tmp' over and over, but switch to single use automaticaly
freed variables instead.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Move the code into 'qemuMigrationCookieXMLParseMandatoryFeatures' to
simplify 'qemuMigrationCookieXMLParse'.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
After recent refactors the function can be refactored to remove the
'cleanup' label by using autoptr for the 'map' variable.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
If we use g_new0 there's no need for the 'cleanup' label as there's
nothing to fail after the allocation.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
There are only 3 places using the function. Two can use virBitmapNewCopy
directly. In case of the qemu capabilities code we need to free the old
bitmap first.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
virBitmapCopy has a failure condition, which is impossible to meet when
creating a new copy. Copy the contents directly to make it obvious that
virBitmapNewCopy can't fail.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>