[libvirt] [PATCH 3/3] systemd: Modernize machine naming
Daniel P. Berrange
berrange at redhat.com
Wed Feb 3 13:16:02 UTC 2016
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.
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>
|: 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