<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 19, 2019 at 11:57 AM Cornelia Huck <<a href="mailto:cohuck@redhat.com">cohuck@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, 19 Jun 2019 11:04:15 +0200<br>
Sylvain Bauza <<a href="mailto:sbauza@redhat.com" target="_blank">sbauza@redhat.com</a>> wrote:<br>
<br>
> On Wed, Jun 19, 2019 at 12:27 AM Alex Williamson <<a href="mailto:alex.williamson@redhat.com" target="_blank">alex.williamson@redhat.com</a>><br>
> wrote:<br>
> <br>
> > On Tue, 18 Jun 2019 14:48:11 +0200<br>
> > Sylvain Bauza <<a href="mailto:sbauza@redhat.com" target="_blank">sbauza@redhat.com</a>> wrote:<br>
> >  <br>
> > > On Tue, Jun 18, 2019 at 1:01 PM Cornelia Huck <<a href="mailto:cohuck@redhat.com" target="_blank">cohuck@redhat.com</a>> wrote:<br>
<br>
> > > > I think we need to reach consensus about the actual scope of the<br>
> > > > mdevctl tool.<br>
> > > ><br>
> > > >  <br>
> > > Thanks Cornelia, my thoughts:<br>
> > ><br>
> > > - Is it supposed to be responsible for managing *all* mdev devices in  <br>
> > > >   the system, or is it more supposed to be a convenience helper for<br>
> > > >   users/software wanting to manage mdevs?<br>
> > > >  <br>
> > ><br>
> > > The latter. If an operator (or some software) wants to create mdevs by  <br>
> > not  <br>
> > > using mdevctl (and rather directly calling the sysfs), I think it's OK.<br>
> > > That said, mdevs created by mdevctl would be supported by systemctl,  <br>
> > while  <br>
> > > the others not but I think it's okay.  <br>
> ><br>
> > I agree (sort of), and I'm hearing that we should drop any sort of<br>
> > automatic persistence of mdevs created outside of mdevctl.  The problem<br>
> > comes when we try to draw the line between unmanaged and manged<br>
> > devices.  For instance, if we have a command to list mdevs it would<br>
> > feel incomplete if it didn't list all mdevs both those managed by<br>
> > mdevctl and those created elsewhere.  For managed devices, I expect<br>
> > we'll also have commands that allow the mode of the device to be<br>
> > switched between transient, saved, and persistent.  Should a user then<br>
> > be allowed to promote an unmanaged device to one of these modes via the<br>
> > same command?  Should they be allowed to stop an unmanaged device<br>
> > through driverctl?  Through systemctl?  These all seem like reasonable<br>
> > things to do, so what then is the difference between transient and<br>
> > unmanaged mdev and is mdevctl therefore managing all mdevs, not just<br>
> > those it has created?<br>
> ><br>
> >  <br>
> Well, IMHO, mdevs created by mdevctl could all be persisted or transient<br>
> just by adding an option when calling mdevctl, like :<br>
> "mdevctl create-mdev [--transient] <uuid> <pci_id> <type>" where default<br>
> would be persisting the mdev.<br>
<br>
This sounds useful; the caller can avoid fiddling with sysfs entries<br>
directly, while not committing to a permanent configuration.<br>
<br>
> <br>
> For mdevs *not* created by mdevctl, then a usecase could be "I'd like to<br>
> ask mdevctl to manage mdevs I already created" and if so, a mdevctl command<br>
> like :<br>
> "mdevctl manage-mdev [--transient] <mdev_uuid>"<br>
<br>
What kind of 'managing' would this actually enable? If we rely on<br>
mdevctl working with sysfs directly for transient devices, I can't<br>
really think of anything...<br>
<br></blockquote><div><br></div><div>Just for getting the list of mdevs and see whether they are persistent.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <br>
> Of course, that would mean that when you list mdevs by "mdev list-all" you<br>
> wouldn't get mdevs managed by mdevctl.<br>
> Thoughts ?<br>
> <br>
> > - Do we want mdevctl to manage config files for individual mdevs, or  <br>
> > > >   are they supposed to be in a common format that can also be managed<br>
> > > >   by e.g. libvirt?<br>
> > > >  <br>
> > ><br>
> > > Unless I misunderstand, I think mdevctl just helps to create mdevs for<br>
> > > being used by guests created either by libvirt or QEMU or even others.<br>
> > > How a guest would allocate a mdev (ie. saying "I'll use this specific  <br>
> > mdev  <br>
> > > UUID") is IMHO not something for mdevctl.  <br>
> ><br>
> > Right, mdevctl isn't concerned with how a specific mdev is used, but I<br>
> > think what Connie is after is more the proposal from Daniel where<br>
> > libvirt can essentially manage mdevctl config files itself and then<br>
> > only invoke mdevctl for the dirty work of creating and deleting<br>
> > devices.  In fact, assuming systemd, libvirt could avoid direct<br>
> > interaction with mdevctl entirely, instead using systemctl device units<br>
> > to start and stop the mdevs.  Maybe where that proposal takes a turn is<br>
> > when we again consider non-systemd hosts, where maybe mdevctl needs to<br>
> > write out an init script per mdev and libvirt injecting itself into<br>
> > manipulation of the config files would either need to perform the same<br>
> > or fall back to mdevctl.  Unfortunately there seems to be an ultimatum<br>
> > to either condone external config file manipulation or expand the scope<br>
> > of the project into becoming a library.<br>
> ><br>
> >  <br>
> Well, like I said, I think it's maybe another user case : just using<br>
> libvirt when you want a guest having vGPUs and then libvirt would create<br>
> mdevs (so users wouln't need to know at that).<br>
> That said, for the moment, I think we don't really need it so maybe a new<br>
> RFE once we at least have mdevctl packaged and supported by RHEL ?<br>
<br>
If we allow config file handling directly, libvirt could start using it<br>
even without mdevctl present? (Not sure if that makes sense.)<br>
<br></blockquote><div><br></div><div>Well, sure.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <br>
> <br>
> > - Should mdevctl be a stand-alone tool, provide library functions, or  <br>
> > > >   both? Related: should it keep any internal state that is not written<br>
> > > >   to disk? (I think that also plays into the transient vs. persistent<br>
> > > >   question.)  <br>
> ><br>
> > I don't think we want an mdevctld, if that's what you mean by internal<br>
<br>
Yeah, mdevctld--.<br>
<br>
> > state not written to disk.  I think we ideally want all state in the<br>
> > mdev config files or discerned through sysfs.  How we handle<br>
> > non-systemd hosts may throw a wrench in that though since currently the<br>
> > systemd integration relies on a template to support arbitrary mdevs and<br>
> > I'm not sure how to replicate that in other init services.  If we need<br>
> > to dynamically manage per mdev init files in addition to config files,<br>
> > we're not so self contained.<br>
> >  <br>
> > > FWIW, I'd love using mdevctl for OpenStack (Nova) just at least for<br>
> > > creating persisted mdevs (ie. mdevs that would be recreated after  <br>
> > rebooting  <br>
> > > using systemctl). That's the real use case I need.<br>
> > > Whether libvirt would internally support mdevctl would be nice but that's<br>
> > > not really something Nova needs, so I leave others providing their own<br>
> > > thoughts.<br>
> > ><br>
> > ><br>
> > > My personal opinion is that mdevctl should be able to tolerate mdevs  <br>
> > > > being configured by other means, but probably should not try to impose<br>
> > > > its own configuration if it detects that (unless explicitly asked to do<br>
> > > > so). Not sure how feasible that goal is.<br>
> > > ><br>
> > > > That's what I misunderstand : in order to have a guest using a vGPU,  <br>
> > you  <br>
> > > need to do two things :<br>
> > > 1/ create the mdev<br>
> > > 2/ allocate this created dev to a specific guest config<br>
> > ><br>
> > > Of course, we could imagine a way to have both steps to be done directly  <br>
> > by  <br>
> > > libvirt, but from my opinion, mdevctl is really helping 1/ and not 2/.  <br>
> ><br>
> > Yep, we also don't want to presume libvirt is the only consumer here.<br>
> > mdevctl should also support other VM management tools, users who write<br>
> > their own management scripts, and even non-VM related use cases.<br>
> ><br>
> >  <br>
> Oh yes, please don't premuse mdevctl is only needed by libvirt.<br>
> FWIW, once mdevctl is supported by RHEL, I'd love to use it for OpenStack<br>
> Nova at least because I want to persist the mdevs.<br>
> At the moment, Nova just creates mdevs directly by sysfs and look the<br>
> existing onces up by sysfs, but upstream community in Nova thinks the<br>
> mission statement is not about managing mdevs so we don't really want to<br>
> add in Nova some kind of DB persistence just for mdevs.<br>
<br>
So, Nova would basically poke mdevctl, but not interact with the config<br>
files directly? Or am I misunderstanding?<br>
<br></blockquote><div><br></div><div>Correct, instead of doing something like <a href="https://github.com/openstack/nova/blob/master/nova/privsep/libvirt.py#L207-L216">https://github.com/openstack/nova/blob/master/nova/privsep/libvirt.py#L207-L216</a></div><div>That said, Nova could do like libvirt and create a config file, for sure.</div><div><br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <br>
> > > A well-defined config file format is probably a win, even if it only  <br>
> > > > ends up being used by mdevctl itself.  <br>
> ><br>
> > Yes, regardless of whether others touch them, conversion scripts on<br>
> > upgrade should be avoided.  Do we need something beyond a key=value<br>
> > file?  So far we're only storing the mdev type and startup mode, but<br>
> > vfio-ap clearly needs more, apparently key=value1,value2,... type<br>
> > representation.  Still, I think I'd prefer simple over jumping to xml<br>
> > or json or yaml.  Thanks,<br>
> ><br>
> >  <br>
> Heh, in OpenStack discussing about a file format is possibly one of the<br>
> longest arguments we already have, so I leave others to say their own<br>
> opinions but FWIW, as we use Python we tend to prefer YAML files. I don't<br>
> care about the format tho, just take the most convenient for libvirt I'd<br>
> say.<br>
<br>
Aww, and here I was looking forward to a nice file format discussion...<br>
<br>
More seriously, as I said in my other reply, .ini style would be good,<br>
but using JSON probably gives us more flexibility in the long run.<br>
</blockquote></div></div>