If max_workers is set to zero, then the worker thread pool won't be
created, so when serializing state for pre-exec we must set various
parameters to zero.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
src/rpc/virnetserver.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 7a1376bf49..3ce21a8f53 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -580,18 +580,21 @@ virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv)
goto error;
if (virJSONValueObjectAppendNumberUint(object, "min_workers",
+ srv->workers == NULL ? 0 :
virThreadPoolGetMinWorkers(srv->workers)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot set min_workers data in JSON document"));
goto error;
}
if (virJSONValueObjectAppendNumberUint(object, "max_workers",
+ srv->workers == NULL ? 0 :
virThreadPoolGetMaxWorkers(srv->workers)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot set max_workers data in JSON document"));
goto error;
}
if (virJSONValueObjectAppendNumberUint(object, "priority_workers",
+ srv->workers == NULL ? 0 :
virThreadPoolGetPriorityWorkers(srv->workers)) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Cannot set priority_workers data in JSON document"));
--
2.14.3
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On 03/06/2018 10:58 AM, Daniel P. Berrangé wrote:
> If max_workers is set to zero, then the worker thread pool won't be
> created, so when serializing state for pre-exec we must set various
> parameters to zero.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> src/rpc/virnetserver.c | 3 +++
> 1 file changed, 3 insertions(+)
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
Regards,
Jim
>
> diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
> index 7a1376bf49..3ce21a8f53 100644
> --- a/src/rpc/virnetserver.c
> +++ b/src/rpc/virnetserver.c
> @@ -580,18 +580,21 @@ virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv)
> goto error;
>
> if (virJSONValueObjectAppendNumberUint(object, "min_workers",
> + srv->workers == NULL ? 0 :
> virThreadPoolGetMinWorkers(srv->workers)) < 0) {
> virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> _("Cannot set min_workers data in JSON document"));
> goto error;
> }
> if (virJSONValueObjectAppendNumberUint(object, "max_workers",
> + srv->workers == NULL ? 0 :
> virThreadPoolGetMaxWorkers(srv->workers)) < 0) {
> virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> _("Cannot set max_workers data in JSON document"));
> goto error;
> }
> if (virJSONValueObjectAppendNumberUint(object, "priority_workers",
> + srv->workers == NULL ? 0 :
> virThreadPoolGetPriorityWorkers(srv->workers)) < 0) {
> virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> _("Cannot set priority_workers data in JSON document"));
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On 03/06/2018 12:58 PM, Daniel P. Berrangé wrote:
> If max_workers is set to zero, then the worker thread pool won't be
> created, so when serializing state for pre-exec we must set various
> parameters to zero.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
> src/rpc/virnetserver.c | 3 +++
> 1 file changed, 3 insertions(+)
>
Alternatively, the various virThreadPoolGet* API's could check :
if (!pool)
return 0;
and we don't run into the same problem for other callers for all the API's.
This works, but for this limited case of data being fetched.
It'd be a weak R-b at best.
John
> diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
> index 7a1376bf49..3ce21a8f53 100644
> --- a/src/rpc/virnetserver.c
> +++ b/src/rpc/virnetserver.c
> @@ -580,18 +580,21 @@ virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv)
> goto error;
>
> if (virJSONValueObjectAppendNumberUint(object, "min_workers",
> + srv->workers == NULL ? 0 :
> virThreadPoolGetMinWorkers(srv->workers)) < 0) {
> virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> _("Cannot set min_workers data in JSON document"));
> goto error;
> }
> if (virJSONValueObjectAppendNumberUint(object, "max_workers",
> + srv->workers == NULL ? 0 :
> virThreadPoolGetMaxWorkers(srv->workers)) < 0) {
> virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> _("Cannot set max_workers data in JSON document"));
> goto error;
> }
> if (virJSONValueObjectAppendNumberUint(object, "priority_workers",
> + srv->workers == NULL ? 0 :
> virThreadPoolGetPriorityWorkers(srv->workers)) < 0) {
> virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> _("Cannot set priority_workers data in JSON document"));
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Wed, Mar 07, 2018 at 06:50:09PM -0500, John Ferlan wrote:
>
>
> On 03/06/2018 12:58 PM, Daniel P. Berrangé wrote:
> > If max_workers is set to zero, then the worker thread pool won't be
> > created, so when serializing state for pre-exec we must set various
> > parameters to zero.
> >
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> > src/rpc/virnetserver.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
>
> Alternatively, the various virThreadPoolGet* API's could check :
>
> if (!pool)
> return 0;
>
> and we don't run into the same problem for other callers for all the API's.
My general opinion is that code should never knowingly pass NULL into
object methods, so I prefer to handle this in callers.
>
> This works, but for this limited case of data being fetched.
>
> It'd be a weak R-b at best.
>
> John
>
> > diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
> > index 7a1376bf49..3ce21a8f53 100644
> > --- a/src/rpc/virnetserver.c
> > +++ b/src/rpc/virnetserver.c
> > @@ -580,18 +580,21 @@ virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv)
> > goto error;
> >
> > if (virJSONValueObjectAppendNumberUint(object, "min_workers",
> > + srv->workers == NULL ? 0 :
> > virThreadPoolGetMinWorkers(srv->workers)) < 0) {
> > virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> > _("Cannot set min_workers data in JSON document"));
> > goto error;
> > }
> > if (virJSONValueObjectAppendNumberUint(object, "max_workers",
> > + srv->workers == NULL ? 0 :
> > virThreadPoolGetMaxWorkers(srv->workers)) < 0) {
> > virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> > _("Cannot set max_workers data in JSON document"));
> > goto error;
> > }
> > if (virJSONValueObjectAppendNumberUint(object, "priority_workers",
> > + srv->workers == NULL ? 0 :
> > virThreadPoolGetPriorityWorkers(srv->workers)) < 0) {
> > virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> > _("Cannot set priority_workers data in JSON document"));
> >
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.