Commit Graph

20 Commits

Author SHA1 Message Date
Peng Liang
bc16c1bcf6 qemu: Remove unused includes
Signed-off-by: Peng Liang <tcx4c70@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2022-06-16 06:43:57 +02:00
Peter Krempa
2b81fbb22e qemu: Reject 'rename-restart' action for 'on_reboot'/'on_poweroff'/'on_crash'
The qemu driver didn't ever implement any meaningful handling for the
'rename-restart' action.

At this point the following handling would take place:

'on_reboot' set to 'rename-restart' is ignored on guest-initiated
reboots, the guest simply reboots.

For on_poweroff set to 'rename-restart' the following happens:

guest initiated shutdown -> 'destroy'
libvirt initiated shutdown -> 'reboot'

In addition when 'on_reboot' is 'destroy' in addition to 'on_poweroff'
being 'rename-restart' the guest is able to execute instructions after
issuing a reset before libvirt terminates it. This will be addressed
separately later.

Forbid the flag in the qemu def validator and update the documentation
to be factual.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-08-25 15:32:44 +02:00
Peter Krempa
d28103b4c4 qemu: validate: Reformat header and purge unused includes
Use the new style header formatting.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2021-08-25 15:32:44 +02:00
Michal Privoznik
c8238579fb lib: Drop internal virXXXPtr typedefs
Historically, we declared pointer type to our types:

  typedef struct _virXXX virXXX;
  typedef virXXX *virXXXPtr;

But usefulness of such declaration is questionable, at best.
Unfortunately, we can't drop every such declaration - we have to
carry some over, because they are part of public API (e.g.
virDomainPtr). But for internal types - we can do drop them and
use what every other C project uses 'virXXX *'.

This change was generated by a very ugly shell script that
generated sed script which was then called over each file in the
repository. For the shell script refer to the cover letter:

https://listman.redhat.com/archives/libvir-list/2021-March/msg00537.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2021-04-13 17:00:38 +02:00
Peter Krempa
18de9dfd77 virDomainDefValidate: Add per-run 'opaque' data
virDomainDefPostParse infrastructure has apart from the global opaque
data also per-run data, but this was not duplicated into the validation
callbacks.

This is important when drivers want to use correct run-state for the
validation.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2020-12-09 09:33:47 +01:00
Peter Krempa
ca03369c99 qemu: validate: Validate blkdeviotune settings in the validator
Move the code from qemuCheckDiskConfigBlkdeviotune in
src/qemu/qemu_commandline.c to
qemuValidateDomainDeviceDefDiskBlkdeviotune.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
2020-05-12 06:54:59 +02:00
Daniel Henrique Barboza
bc210e7ab2 qemu: move qemuValidateDomainDeviceDef() to qemu_validate.c
Now that all its helper functions are in qemu_validate.c, we can
move the function itself. The helpers can become static again since
they're all in the same file.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
a5f488d3d4 qemu: move remaining qemuDomainDeviceDefValidate() helpers
This will allow to move qemuDomainDeviceDefValidate() itself in
the next patch in a cleaner way.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
78f605e0b3 qemu: move qemuDomainDeviceDefValidateSound() to qemu_validate.c
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
48e2aadce0 qemu: move qemuDomainDeviceDefValidateFS() to qemu_validate.c
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
3b4e054c3d qemu: move qemuDomainDeviceDefValidateGraphics() to qemu_validate.c
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
4d3d025ecb qemu: move qemuDomainDeviceDefValidateController() to qemu_validate.c
Move the function and all its static helper functions.

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-04-03 16:25:30 +02:00
Daniel Henrique Barboza
b8f1f037ed qemu: move qemuDomainDeviceDefValidateDisk() to qemu_validate.c
This function will remain public due to its usage in qemublocktest.c
even after moving qemuDomainDeviceDefValidate(). The position of its
header in qemu_validate.h is no accident.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
5d80af2cf3 qemu: move qemuDomainDeviceDefValidateVideo() to qemu_validate.c
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
94410ded3d qemu: move qemuDomainDeviceDefValidateHostdev() to qemu_validate.c
This function alone requires other 3 static functions to be
moved as well, thus let's move it in its own patch.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
f38cfe7225 qemu: move qemuDomainChrDefValidate() to qemu_validate.c
qemuDomainChrDefValidate() has a lot of static helpers functions
that needed to be moved as well.

Other functions from qemuDomainDeviceDefValidate() that were
also moved:
- qemuValidateDomainSmartcardDef
- qemuValidateDomainRNGDef
- qemuValidateDomainRedirdevDef
- qemuValidateDomainWatchdogDef

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
a03738cee4 qemu: move qemuDomainDeviceDefValidateNetwork() to qemu_validate.c
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-04-03 16:25:30 +02:00
Daniel Henrique Barboza
2a8168c99b qemu: move qemuDomainDeviceDefValidateAddress() to qemu_validate.c
The next big task is to move qemuDomainDeviceDefValidate() to
qemu_validation.c, which is a function that calls a lot of
other static helper functions. This patch starts it by moving
qemuDomainDeviceDefValidateAddress().

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2020-04-03 16:25:30 +02:00
Daniel Henrique Barboza
07cfccc53a qemu: move qemuDomainValidateDef() to qemu_validate.c
Move the static functions qemuDomainValidateDef() uses, as well as
qemuDomainValidateDef() itself to qemu_validate.

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-04-03 16:25:30 +02:00
Daniel Henrique Barboza
906fddf733 qemu: move qemuDomainDefValidateFeatures to qemu_validate.c
This patch introduces a new file to host domain validations from
the QEMU driver. And to get things started, let's move
qemuDomainDefValidateFeatures() to this new file.

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-04-03 16:25:30 +02:00