Commit Graph

39253 Commits

Author SHA1 Message Date
Matt Coleman
a6c9d97e33 mailmap: consolidate my email addresses
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
2020-10-06 12:05:09 +02:00
Ján Tomko
20bbf85954 virsh: network-port: remove pointless comment
We do not have a legacy API for listing network ports
so there's nothing to fall back on.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-06 09:01:46 +02:00
Ján Tomko
1647e376e8 virsh: delete vsh[CM]alloc
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-06 09:01:46 +02:00
Ján Tomko
504913bf23 virsh: use g_new0 instead of vsh[CM]alloc
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-06 09:01:46 +02:00
Ján Tomko
ed2206cd70 virsh: do not add bools into size calculations
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>
2020-10-06 09:01:46 +02:00
Neal Gompa
5ebf063897 rpm: Enable Xen support on AArch64
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>
2020-10-05 20:51:32 +02:00
Cole Robinson
14f877e8d0 tests: cover disk, interface <backenddomain>
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>
2020-10-05 12:43:00 -04:00
Zhenyu Zheng
c640f382eb cpu: Modify virCPUarmCompare to perform compare actions
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>
2020-10-05 18:05:32 +02:00
Daniel P. Berrangé
95bcb97289 rpm: include aarch64 & riscv64 in systemtap 64-bit arch tapset rename
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-10-05 16:53:39 +01:00
Ján Tomko
7d77fdb90f qemu: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-05 16:44:06 +02:00
Ján Tomko
73f7b6a0ef qemu: firmware: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-05 16:44:06 +02:00
Ján Tomko
7195877348 qemu: command: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-05 16:44:06 +02:00
Ján Tomko
cc3190cc4c qemu: process: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-05 16:44:06 +02:00
Ján Tomko
aad03a0970 qemu: monitor: json: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-05 16:44:06 +02:00
Ján Tomko
c1cb299e12 qemu: driver: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-05 16:44:06 +02:00
Ján Tomko
0ac810b225 qemu: domain: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-05 16:44:06 +02:00
Ján Tomko
f655a603dd qemu: capabilities: use g_new0
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2020-10-05 16:44:06 +02:00
Ján Tomko
868c350752 qemu: separate out VIR_ALLOC calls
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>
2020-10-05 16:44:06 +02:00
Pino Toscano
15914d0707 esx: switch esxUtil_ResolveHostname to return a new string
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>
2020-10-05 16:23:41 +02:00
Pino Toscano
3aaf23ff69 esx: call freeaddrinfo earlier in esxUtil_ResolveHostname
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>
2020-10-05 16:23:35 +02:00
Cole Robinson
0fa5c23865 qemu: Taint cpu host-passthrough only after migration
From a discussion last year[1], Dan recommended libvirt drop the tain
flag for cpu host-passthrough, unless the VM has been migrated.

This repurposes the existing host-cpu taint flag to do just that.

[1]: https://www.redhat.com/archives/virt-tools-list/2019-February/msg00041.html

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

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-10-05 10:08:26 -04:00
Cole Robinson
1bd16c6cf7 docs: formatdomain: add spicevmc <redirdev> example
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>
2020-10-05 10:07:29 -04:00
Cole Robinson
4b90bb1f46 docs: formatdomain: fix net downscript 'since'
It was added in 6.4.0, not 5.1.0

Fixes: 61ba6f09b1

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-10-05 10:07:29 -04:00
Cole Robinson
10151470c8 docs: formatdomain: fix incorrect 'Vsock' heading indent
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>
2020-10-05 10:07:29 -04:00
Cole Robinson
b35947e635 docs: formatdomain: remove doubled filesystem <driver>
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>
2020-10-05 10:07:29 -04:00
Peter Krempa
c96eba3d03 qemu: migration_cookie: s/VIR_FREE/g_free/
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>
2020-10-05 15:58:53 +02:00
Peter Krempa
49530d5277 qemuMigrationCookieXMLParse: Avoid VIR_FREE when parsing lockstate
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>
2020-10-05 15:58:53 +02:00
Peter Krempa
78d330bde1 qemuMigrationCookieAddCaps: Use 'g_new0' instead of VIR_ALLOC
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-05 15:58:53 +02:00
Peter Krempa
83434e5acd qemuMigrationCookieCapsXMLParse: Refactor memory handling
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>
2020-10-05 15:58:53 +02:00
Peter Krempa
9d7ca30ece qemuMigrationCookieNBDXMLParse: Refactor memory handling
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>
2020-10-05 15:58:53 +02:00
Peter Krempa
abfb033ddb qemuMigrationCookieNetworkXMLParse: Refactor memory handling
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>
2020-10-05 15:58:53 +02:00
Peter Krempa
7dce147544 qemuMigrationCookieXMLFormat: Refactor memory handling
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>
2020-10-05 15:58:53 +02:00
Peter Krempa
dc03248181 qemuMigrationCookieNetworkAlloc: Refactor memory handling
Use modern memory handling approach to simplify the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-05 15:58:53 +02:00
Peter Krempa
f3e087ac9c qemuMigrationCookieGraphicsSpiceAlloc: Refactor memory handling
Use modern memory handling approach to simplify the code.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-05 15:58:53 +02:00
Peter Krempa
85d6d515ed qemu: migration_cookie: Register 'autoptr' functions for internal types
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>
2020-10-05 15:58:53 +02:00
Peter Krempa
a09cf33adf qemuDomainExtractTLSSubject: Refactor memory handling
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>
2020-10-05 15:58:53 +02:00
Peter Krempa
518be41aaa qemuMigrationCookieXMLFormat: Extract formatting of NBD
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>
2020-10-05 15:58:52 +02:00
Peter Krempa
84589ac004 qemuMigrationCookieNetworkXMLFormat: Refactor XML formatting
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>
2020-10-05 15:58:52 +02:00
Peter Krempa
592a9a859a qemuMigrationCookieGraphicsXMLFormat: Use 'virXMLFormatElement'
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>
2020-10-05 15:58:52 +02:00
Peter Krempa
600c1b5202 qemuMigrationCookieXMLParse: Remove 'error' label
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>
2020-10-05 15:58:52 +02:00
Peter Krempa
8c3f86e290 qemuMigrationCookieXMLParse: Remove comment mentioning that error was already set
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>
2020-10-05 15:58:52 +02:00
Peter Krempa
a9b4e523d7 qemuMigrationCookieXMLParse: Decrease scope of 'nodes' and use automatic freeing
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-05 15:58:52 +02:00
Peter Krempa
25b944e067 qemuMigrationCookieXMLParse: Check domain element count more defensively
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>
2020-10-05 15:58:52 +02:00
Peter Krempa
4a7dd2780c qemuMigrationCookieXMLParse: Switch to single-purpose temporary variables
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>
2020-10-05 15:58:52 +02:00
Peter Krempa
dd6f669d2c qemu: migration_cookie: Extract parsing/validation of mandatory features
Move the code into 'qemuMigrationCookieXMLParseMandatoryFeatures' to
simplify 'qemuMigrationCookieXMLParse'.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-10-05 15:58:52 +02:00
Peter Krempa
28027f1fb1 qemuDomainFilterHotplugVcpuEntities: Refactor memory freeing to remove 'cleanup' label
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>
2020-10-05 15:50:45 +02:00
Peter Krempa
f12f4e2658 virDomainResctrlNew: Refactor allocation to remove 'cleanup' label
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>
2020-10-05 15:50:45 +02:00
Peter Krempa
30ff783a80 util: virbitmap: Remove virBitmapCopy
The function is now unused.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:50:45 +02:00
Peter Krempa
d8a354954a Use 'virBitmapNewCopy' instead of 'virBitmapCopy'
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>
2020-10-05 15:50:45 +02:00
Peter Krempa
faa88866f5 Don't check return value of virBitmapNewCopy
The function will not fail any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-10-05 15:50:45 +02:00