Re: [PATCH v2 03/25] qemu: Move <memballoon> validation out of qemu_command.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2019-01-23 at 16:32 -0500, Cole Robinson wrote:
[...]
> +static int
> +qemuDomainDeviceDefValidateMemballoon(const virDomainMemballoonDef *memballoon,

You could pass

  const virDomainDef *def

too here, as most other qemuDomainDeviceDefValidate*() functions
already do: that would allow you to...

> +                                      virQEMUCapsPtr qemuCaps)
> +{
> +    if (!memballoon ||
> +        memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE) {
> +        return 0;
> +    }

... replace this with

  if (!virDomainDefHasMemballoon(def))
      return 0;

which is arguably slightly nicer. But this version works perfectly
fine, so it's entirely up to you whether to do that or not.

[...]
> @@ -2463,11 +2462,10 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period,
>      }
>  
>      if (persistentDef) {
> -        if (!persistentDef->memballoon ||
> -            persistentDef->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
> +        if (!virDomainDefHasMemballoon(def)) {

s/def/persistentDef/

With this fixed,

  Reviewed-by: Andrea Bolognani <abologna@xxxxxxxxxx>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux