[libvirt] [PATCH 3/3] systemd: Modernize machine naming
Daniel P. Berrange
berrange at redhat.com
Wed Feb 3 13:44:01 UTC 2016
On Wed, Feb 03, 2016 at 02:42:52PM +0100, Martin Kletzander wrote:
> On Wed, Feb 03, 2016 at 01:16:02PM +0000, Daniel P. Berrange wrote:
> >On Tue, Feb 02, 2016 at 09:22:49PM +0100, Martin Kletzander wrote:
> >>So, systemd-machined has this philosophy that machine names are like
> >>hostnames and hence should follow the same rules. But we always allowed
> >>international characters in domain names. Thus we need to modify the
> >>machine name we are passing to systemd.
> >>
> >>In order to change some machinenames that we will be passing to systemd,
> >>we also need to call TerminateMachine at the end of a lifetime of a
> >>domain. Even for domains that were started with older libvirt. That
> >>can be achieved thanks to virSystemdGetMachineNameByPID(). And because
> >>we can change machine names, we can get rid of the inconsistent and
> >>pointless escaping of domain names when creating machine names.
> >>
> >>So this patch modifies the naming in the following way. It tries using
> >>the name we were using earlier (without escaping the name, see above)
> >>and if that is not possible, because it doesn't follow the rules given
> >>by systemd, it then fallbacks to using <drivername>-<uuid> instead.
> >>That way we can start domains we couldn't start before. Well, at least
> >>on systemd.
> >
> >Ewww, please not uuids. They are really horrible things that should not
> >be shown to users by default. IIUC we have 2 problems you're trying to
> >address - some characters are invalid, and we have a name length limit.
> >
>
> I hate UUIDs, but the only other thing that I was offered was punnycode
> encoding using libidn. And nobody seemed to have an opinion on that.
>
> >Invalid characters can be dealt with by escaping or stripping them.
> >The length limit is harder, since if we merely truncate we'll not have
> >guaranteed unique names anymore. A nicer way to get around that would
> >be to append the domain ID to the it, since that is a short unqiue
> >token. ie <drivername>-<truncated name>-<id>
> >
>
> TL;DR Woud you agree on <drivername>-<id>-<name> where non-ascii
> characters are stripped fromt the name and then the whole string is
> truncated to 64 characters if it is longer than that?
>
> More blabber follows...
>
> I like the idea of using ID. That would help a lot. However, it would
> only make sense for long enough names. Let's say there won't be any
> user who would have a two machines, one with too long of a name and
> other with a name that is a prefix of the first one with -<number>
> appended. Also we could use the ID for every machine name, I think
> <drivername>-<id>-<name> still looks nice.
>
> Anyway, that doesn't deal with international characters in the name.
> And that can be split into two different problems as well. You can have
> a name that has one non-ASCII character in it. If we strip it, we are
> not going to have the uniqueness, but you can at least know which name
> represents which machine. However, there are then names that are with
> no ASCII characters at all, e.g. different alphabet. Stripping those
> means you have an empty string. Escaping on the other hand leads to
> longer names and in the second case is not readable at all.
>
> So as a conclusion, would you agree if we did the driver-id-name where
> non-ascii characters are stripped and then the whole string is truncated
> to 64 characters if it is longer?
Yeah, using id as a prefix unconditionally sounds fine to me - it should
make the code simpler too.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list