On Wed, Feb 03, 2016 at 03:27:27PM +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 creates the > name as <drivername>-<id>-<name> where invalid hostname characters are > stripped out of the name and if the resulting name is longer, it > truncates it to 64 characters. That way we can start domains we > couldn't start before. Well, at least on systemd. > > To make it work all together, the machineName (which is needed only for > systemd) is saved in domain's private data. That way the generation is > moved to the driver and we don't need to pass various unnecessary > arguments to cgroup functions. > > Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1282846 > > Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx> > diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c > index da0df7ae7a5e..4aed5d20b818 100644 > --- a/src/util/vircgroup.c > +++ b/src/util/vircgroup.c > @@ -43,6 +43,7 @@ > #include "vircgrouppriv.h" > > #include "virutil.h" > +#include "viruuid.h" > #include "viralloc.h" > #include "virerror.h" > #include "virlog.h" > @@ -243,12 +244,14 @@ static bool > virCgroupValidateMachineGroup(virCgroupPtr group, > const char *name, > const char *drivername, > + const unsigned char *uuid, > bool stripEmulatorSuffix) > { > size_t i; > bool valid = false; > char *partname; > char *scopename; > + char uuidstr[VIR_UUID_STRING_BUFLEN]; > > if (virAsprintf(&partname, "%s.libvirt-%s", > name, drivername) < 0) > @@ -263,6 +266,8 @@ virCgroupValidateMachineGroup(virCgroupPtr group, > if (virCgroupPartitionEscape(&scopename) < 0) > goto cleanup; > > + virUUIDFormat(uuid, uuidstr); > + > for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) { > char *tmp; > > @@ -290,6 +295,7 @@ virCgroupValidateMachineGroup(virCgroupPtr group, > tmp++; > > if (STRNEQ(tmp, name) && > + STRNEQ(tmp, uuidstr) && > STRNEQ(tmp, partname) && > STRNEQ(tmp, scopename)) { > VIR_DEBUG("Name '%s' for controller '%s' does not match " I don't think we need this anymore, which would mean removing the uuid parameter you added to several methods in this file. 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 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list