[virt-tools-list] [PATCH 0/7] [RFC] Install LXC guests with virt-install

Lubomir Rintel lkundrak at v3.sk
Fri Mar 23 09:16:59 UTC 2018


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





More information about the virt-tools-list mailing list