Hello Lubomir, This whole feature looks very similar to what Radostin and I worked on last year: https://github.com/virt-manager/virt-bootstrap You should really have a look at that tool: it allows you to create a libvirt-lxc container out of a docker image, a tarball, or a virt-builder template. The good thing is that virt-manager also uses it for setting up a local OS container. -- Cedric On Fri, 2018-03-23 at 10:16 +0100, Lubomir Rintel wrote: > Hello, > > I do often use the libvirt_lxc containers with userns, and for years > I've used hacky-ish shell scripts to create them, unable to figure out a > sensible way to set them up. Perhaps virt-install is the right tool to > do the job? > > Chained up to this message is a patchset that adds the functionality to > virt-install. It is known to have some rough edges (the root password is > unset, does the wrong thing if there are multiple <filesystem>s in the VM, > remote installs are untested), but essentially is able to initialize Debian > and Fedora containers: > > virt-install \ > --connect lxc:/// \ > --name fedora \ > --memory 512 \ > --idmap uid_start=0,uid_target=1000000,uid_count=65536,gid_start=0,gid_target=1000000,gid_count=65536 \ > --filesystem /var/lib/libvirt/filesystems/fedora,/ \ > --location http://download.fedoraproject.org/pub/fedora/linux/releases/27/Server/x86_64/os > > virt-install \ > --connect lxc:/// \ > --name debian \ > --memory 512 \ > --idmap uid_start=0,uid_target=1000000,uid_count=65536,gid_start=0,gid_target=1000000,gid_count=65536 \ > --filesystem /var/lib/libvirt/filesystems/debian,/ \ > --location http://ftp.us.debian.org/debian/dists/testing/ > > Does this approach look sensible? Does it make sense to address the > known issues in this and merge the functionality to virt-manager or > should this perhaps belong to a separate tool? > > The diffstat looks optimistic. > > virt-install | 9 ++- > virtinst/__init__.py | 1 + > virtinst/lxcinstaller.py | 175 +++++++++++++++++++++++++++++++++++++++++++++++ > virtinst/urlfetcher.py | 42 +++++++++++- > 4 files changed, 223 insertions(+), 4 deletions(-) > > Thanks, > Lubo > > > _______________________________________________ > virt-tools-list mailing list > virt-tools-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/virt-tools-list > _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list