[libvirt] [PATCH 2/2] qemu: Reject unsupported tuning in session mode
Martin Kletzander
mkletzan at redhat.com
Tue Mar 4 14:13:46 UTC 2014
On Tue, Mar 04, 2014 at 06:44:01AM -0700, Eric Blake wrote:
> On 03/03/2014 10:21 AM, Martin Kletzander wrote:
> > When domain is started with setting that cannot be done, i.e. those
> > that require cgroups, there is no error reported and it succeeds
> > without any message whatsoever.
> >
> > When setting with API, virsh, an error is reported, but only due to
> > the fact that no cgroups are mounted (priv->cgroup == NULL).
> >
> > Given the above it seems reasonable to reject such unsupported
> > settings.
> >
> > Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> > ---
> >
> > Notes:
> > Few questions came to my mind while writing the commit message:
> >
> > 1) Would helper function (macro) be preferred so the code looks
> > cleaner?
>
> What macro do you have in mind?
>
I haven't thought that through, just from top of my head:
#define SESSION_UNSUPP(what) if (!cfg->privileged) { \
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s %s", \
what, _("is not available in sesison mode")); \
goto cleanup; \
}
because the code repeats a lot, but it seems like it would not be that
readable. Separate function would do as well.
> >
> > 2) Do we want to allow reading of some of these settings through an
> > API? This would however require our cgroup handling to be
> > reworked.
> >
> > 3) Would new error type (for session-unsupported settings) be any
> > good or it doesn't make sense to create one just for these added
> > messages plus few older ones (just guessing the amount)?
>
> Looks like your use of VIR_ERR_CONFIG_UNSUPPORTED was reasonable.
>
> > + if (!cfg->privileged) {
> > + /* If we have no cgroups than we can have no tunings that
> > + * require them */
> > +
> > + if (def->mem.hard_limit || def->mem.soft_limit ||
> > + def->mem.min_guarantee || def->mem.swap_hard_limit) {
> > + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> > + _("Memory tuning is not available in session mode"));
> > + goto error;
> > + }
> > +
>
> Or maybe we should think about some day adding a daemon that accepts RPC
> commands for manipulating cgroups on behalf of a session client. But
> that would be a later and bigger patch.
>
I was just trying to output a better error message and forgot to add
the BZ that started it:
https://bugzilla.redhat.com/show_bug.cgi?id=1023366
> Seems reasonable to me, but it might be nice to also get Dan's opinion
> on this one.
>
Anyway, I'll have a second version which allows at least cpu pinning
as setaffinity works and is used when no cgroups are available.
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140304/20f3bc5a/attachment-0001.sig>
More information about the libvir-list
mailing list