Skip to content

Instantly share code, notes, and snippets.

@come-maiz
Last active November 2, 2016 08:24
Show Gist options
  • Save come-maiz/14c9ee59f19287380452fd0923072520 to your computer and use it in GitHub Desktop.
Save come-maiz/14c9ee59f19287380452fd0923072520 to your computer and use it in GitHub Desktop.
LXD snap testing

Smoke tests for the LXD snap

(Based on https://lists.ubuntu.com/archives/snapcraft/2016-October/001327.html and https://linuxcontainers.org/lxd/getting-started-cli/)

Search for the snap:

$ snap find lxd
Name  Version  Developer  Notes  Summary
lxd   2.5      canonical  -      LXD - the container lighervisor

Add the lxd group:

$ sudo groupadd --system lxd
$ sudo usermod -a -G lxd elopio
$ newgrp lxd

Install the snap:

$ sudo snap install lxd
lxd (stable) 2.5 from 'canonical' installed

Init:

$ sudo lxd init
Name of the storage backend to use (dir or zfs) [default=zfs]: 
Create a new ZFS pool (yes/no) [default=yes]? 
Name of the new ZFS pool [default=lxd]: 
Would you like to use an existing block device (yes/no) [default=no]? 
Size in GB of the new loop device (1GB minimum) [default=15]: 
Would you like LXD to be available over the network (yes/no) [default=no]? 
Would you like stale cached images to be updated automatically (yes/no) [default=yes]? 
Would you like to create a new network bridge (yes/no) [default=yes]? 
What should the new bridge be called [default=lxdbr0]? 
What IPv4 subnet should be used (CIDR notation, “auto” or “none”) [default=auto]? 
What IPv6 subnet should be used (CIDR notation, “auto” or “none”) [default=auto]? 
LXD has been successfully configured.

Launch an image:

$ lxd.lxc launch ubuntu:16.04 xenial

List the images:

$ lxd.lxc image list
+-------+--------------+--------+---------------------------------------------+--------+----------+-----------------------------+
| ALIAS | FINGERPRINT  | PUBLIC |                 DESCRIPTION                 |  ARCH  |   SIZE   |         UPLOAD DATE         |
+-------+--------------+--------+---------------------------------------------+--------+----------+-----------------------------+
|       | 315bedd32580 | no     | ubuntu 16.04 LTS amd64 (release) (20161020) | x86_64 | 144.29MB | Nov 2, 2016 at 8:20am (UTC) |
+-------+--------------+--------+---------------------------------------------+--------+----------+-----------------------------+

List the containers:

$ lxd.lxc list
+--------+---------+---------------------+----------------------------------------------+------------+-----------+
|  NAME  |  STATE  |        IPV4         |                     IPV6                     |    TYPE    | SNAPSHOTS |
+--------+---------+---------------------+----------------------------------------------+------------+-----------+
| xenial | RUNNING | 10.53.212.31 (eth0) | fd42:b52:2f50:7baf:216:3eff:fe20:2bad (eth0) | PERSISTENT | 0         |
+--------+---------+---------------------+----------------------------------------------+------------+-----------+

Run bash in a container:

$ lxd.lxc exec xenial bash
root@xenial:~# uname -a
Linux xenial 4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
@come-maiz
Copy link
Author

Tested in a ubuntu xenial classic kvm. No errors found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment