Re: [libvirt] [PATCH 07/10] Check for balloon model in qemuDomainSetMemoryStatsPeriod

2015-06-05 Thread Ján Tomko
On Fri, Jun 05, 2015 at 07:55:52AM -0400, John Ferlan wrote:
> 
> 
> On 06/04/2015 09:58 AM, Ján Tomko wrote:
> > There's no point in calling the monitor if there is no balloon.
> > ---
> >  src/qemu/qemu_driver.c | 15 +++
> >  1 file changed, 15 insertions(+)
> > 
> 
> Coverity found...
> 
> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index 4690406..bfd59a9 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c
> > @@ -2459,6 +2459,14 @@ static int 
> > qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period,
> >  priv = vm->privateData;
> >  
> >  if (def) {
> 
> Checking 'def' here...
> 
> > +if (!def->memballoon ||
> > +def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
> > +virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> > +   _("Memory balloon model must be virtio to set 
> > the"
> > + " collection period"));
> > +goto endjob;
> > +}
> > +
> >  qemuDomainObjEnterMonitor(driver, vm);
> >  r = qemuMonitorSetMemoryStatsPeriod(priv->mon, period);
> >  if (qemuDomainObjExitMonitor(driver, vm) < 0)
> > @@ -2475,6 +2483,13 @@ static int 
> > qemuDomainSetMemoryStatsPeriod(virDomainPtr dom, int period,
> >  }
> >  
> >  if (persistentDef) {
> > +if (!def->memballoon ||
> 
> Assuming 'def' here.
> 
> I think you meant persistentDef->...
> 
> ACK w/ the adjustment
> 

I fixed it to use persistentDef (also the typo in 10/10) and pushed the
series.

Thanks for the review.

Jan


signature.asc
Description: Digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 07/10] Check for balloon model in qemuDomainSetMemoryStatsPeriod

2015-06-05 Thread John Ferlan


On 06/04/2015 09:58 AM, Ján Tomko wrote:
> There's no point in calling the monitor if there is no balloon.
> ---
>  src/qemu/qemu_driver.c | 15 +++
>  1 file changed, 15 insertions(+)
> 

Coverity found...

> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 4690406..bfd59a9 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -2459,6 +2459,14 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr 
> dom, int period,
>  priv = vm->privateData;
>  
>  if (def) {

Checking 'def' here...

> +if (!def->memballoon ||
> +def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
> +virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +   _("Memory balloon model must be virtio to set the"
> + " collection period"));
> +goto endjob;
> +}
> +
>  qemuDomainObjEnterMonitor(driver, vm);
>  r = qemuMonitorSetMemoryStatsPeriod(priv->mon, period);
>  if (qemuDomainObjExitMonitor(driver, vm) < 0)
> @@ -2475,6 +2483,13 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr 
> dom, int period,
>  }
>  
>  if (persistentDef) {
> +if (!def->memballoon ||

Assuming 'def' here.

I think you meant persistentDef->...

ACK w/ the adjustment

John

> +def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
> +virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +   _("Memory balloon model must be virtio to set the"
> + " collection period"));
> +goto endjob;
> +}
>  persistentDef->memballoon->period = period;
>  ret = virDomainSaveConfig(cfg->configDir, persistentDef);
>  goto endjob;
> 

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


[libvirt] [PATCH 07/10] Check for balloon model in qemuDomainSetMemoryStatsPeriod

2015-06-04 Thread Ján Tomko
There's no point in calling the monitor if there is no balloon.
---
 src/qemu/qemu_driver.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4690406..bfd59a9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2459,6 +2459,14 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr 
dom, int period,
 priv = vm->privateData;
 
 if (def) {
+if (!def->memballoon ||
+def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
+virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+   _("Memory balloon model must be virtio to set the"
+ " collection period"));
+goto endjob;
+}
+
 qemuDomainObjEnterMonitor(driver, vm);
 r = qemuMonitorSetMemoryStatsPeriod(priv->mon, period);
 if (qemuDomainObjExitMonitor(driver, vm) < 0)
@@ -2475,6 +2483,13 @@ static int qemuDomainSetMemoryStatsPeriod(virDomainPtr 
dom, int period,
 }
 
 if (persistentDef) {
+if (!def->memballoon ||
+def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO) {
+virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+   _("Memory balloon model must be virtio to set the"
+ " collection period"));
+goto endjob;
+}
 persistentDef->memballoon->period = period;
 ret = virDomainSaveConfig(cfg->configDir, persistentDef);
 goto endjob;
-- 
2.3.6

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