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(a)redhat.com>
--
Andrea Bolognani / Red Hat / Virtualization