LXD snap awareness for ubuntu version < 18.10

Despite of official docs mentioning that 5.8 Edge is aware of LXD snap, opennebula always choose to use the LXD apt package for ubuntu version lower than 18.10. In fact the LXD apt package seems to be a dependency for installing opennebula-node-lxd. But as you know, LXD is no long udpated along apt path. The newer version always come as snap. I have tested 18.10, 18.04 and 16.04 in the way that I completely removed the apt package and installed the before hand. Opennebula is only aware of the snap LXD under 18.10. For the rest, it still tries to first install the LXD apt package.


Versions of the related components and OS (frontend, hypervisors, VMs):
Opennebula 5.8, opennebula-node-lxd, ubuntu 18.04, 16.04

Steps to reproduce:
Upon clean installation of ubuntu, remove the apt package and install the snap LXD.
Then install opennebula-node-lxd.

Current results:
Opennebula neglects snap LXD, and still install LXD apt package.

Expected results:
Opennebula should be aware of snap LXD

The drivers look for a Unix socket in two locations /var/lib/lxd and /var/snap/lxd/common/lxd it looks for it in the apt one (1st) , then, if not found in the snap one (2nd).

openebula-node-lxd package requires lxd as hard dependency, there are currently some hacks regarding the snap integration due to the lxc cli being broken with oneadmin user, so we really encourage you to use apt whenever possible, however the required dependency is causing issues for you.

Could you open an issue about this?

Hi dann1 thanks for the fast reply. I think the snap path is way that we should follow as the apt is no longer updated. Apart from that, I have encountered problems with the mapper as well. The lxc deployment simply fails without reason. I started with successful deployment of one lxc. But latter on when I added a new virtual network interface, I failed to deploy the lxc anymore. It always raises the error saying that the disk.1 can not be mapped even after I have deleted the second virtual network interface. It seems to me that once the deployment crushes, it can never recovered. I have deleted all the containers both from sunstone and lxc. I have manually deleted all the leftover in the /var/lib/one/datastores and also I removed /tmp/onelxc-lock file. Still I can no longer deploy LXC.

If something fails with the mappers you have to unmap everything about them, use lsblk and umount/unmap. For the attach_nic issue, you could show the log output, the nic hotplug action unmaps and maps the context iso using the raw mapper

Hi, so after umount everything. I still ran into error :frowning:

Fri Mar 15 00:32:08 2019 [Z0][VM][I]: New state is ACTIVE
Fri Mar 15 00:32:08 2019 [Z0][VM][I]: New LCM state is PROLOG
Fri Mar 15 00:32:11 2019 [Z0][VM][I]: New LCM state is BOOT
Fri Mar 15 00:32:11 2019 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/15/deployment.0
Fri Mar 15 00:32:12 2019 [Z0][VMM][I]: Successfully execute transfer manager driver operation: tm_context.
Fri Mar 15 00:32:14 2019 [Z0][VMM][I]: pre: Executed “sudo brctl addbr onebr.101”.
Fri Mar 15 00:32:14 2019 [Z0][VMM][I]: pre: Executed “sudo ip link set onebr.101 up”.
Fri Mar 15 00:32:14 2019 [Z0][VMM][I]: pre: Executed "sudo ip link add link bond-local name bond-local.101 mtu 1500 type vlan id 101 ".
Fri Mar 15 00:32:14 2019 [Z0][VMM][I]: pre: Executed “sudo ip link set bond-local.101 up”.
Fri Mar 15 00:32:14 2019 [Z0][VMM][I]: pre: Executed “sudo brctl addif onebr.101 bond-local.101”.
Fri Mar 15 00:32:14 2019 [Z0][VMM][I]: ExitCode: 0
Fri Mar 15 00:32:14 2019 [Z0][VMM][I]: Successfully execute network driver operation: pre.
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: Command execution fail: cat << EOT | /var/tmp/one/vmm/lxd/deploy ‘/var/lib/one//datastores/108/15/deployment.0’ ‘compute2’ 15 compute2
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Using qcow2 mapper for /var/lib/one/datastores/108/15/disk.0
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Mapping disk at /var/lib/lxd/storage-pools/default/containers/one-15/rootfs using device /dev/nbd0
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Resizing filesystem ext4 on /dev/nbd0
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Mounting /dev/nbd0 at /var/lib/lxd/storage-pools/default/containers/one-15/rootfs
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Mapping disk at /mnt/NFS/108/15/mapper/disk.1 using device /dev/loop3
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Mounting /dev/loop3 at /mnt/NFS/108/15/mapper/disk.1
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Using qcow2 mapper for /var/lib/one/datastores/108/15/disk.0
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Unmapping disk at /var/lib/lxd/storage-pools/default/containers/one-15/rootfs
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Umounting disk mapped at /dev/nbd0
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: deploy: Unmapping disk at /mnt/NFS/108/15/mapper/disk.1
Fri Mar 15 00:32:17 2019 [Z0][VMM][E]: deploy: Failed to detect block device from /mnt/NFS/108/15/mapper/disk.1
Fri Mar 15 00:32:17 2019 [Z0][VMM][E]: deploy: failed to dismantle container storage
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: /var/tmp/one/vmm/lxd/client.rb:145:in initialize': undefined method[]’ for #<LXDError:0x0000558e081b2cb8> (NoMethodError)
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: from /var/tmp/one/vmm/lxd/deploy:86:in exception' Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: from /var/tmp/one/vmm/lxd/deploy:86:inraise’
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: from /var/tmp/one/vmm/lxd/deploy:86:in rescue in &lt;main&gt;' Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: from /var/tmp/one/vmm/lxd/deploy:74:in<main>’
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: ExitCode: 1
Fri Mar 15 00:32:17 2019 [Z0][VMM][I]: Failed to execute virtualization driver operation: deploy.
Fri Mar 15 00:32:17 2019 [Z0][VMM][E]: Error deploying virtual machine
Fri Mar 15 00:32:17 2019 [Z0][VM][I]: New LCM state is BOOT_FAILURE

templete as below

LXD_SECURITY_PRIVILEGED = “false”
SCHED_DS_REQUIREMENTS = "ID=“108"”
SCHED_REQUIREMENTS = "ID=“0"”

Template

AUTOMATIC_DS_REQUIREMENTS = “(“CLUSTERS/ID” @> 0)”
AUTOMATIC_NIC_REQUIREMENTS = “(“CLUSTERS/ID” @> 0)”
AUTOMATIC_REQUIREMENTS = “(CLUSTER_ID = 0) & !(PUBLIC_CLOUD = YES)”
CONTEXT = [
DISK_ID = “1”,
ETH0_CONTEXT_FORCE_IPV4 = “”,
ETH0_DNS = “192.168.101.1”,
ETH0_EXTERNAL = “”,
ETH0_GATEWAY = “192.168.101.1”,
ETH0_GATEWAY6 = “”,
ETH0_IP = “192.168.101.2”,
ETH0_IP6 = “”,
ETH0_IP6_PREFIX_LENGTH = “”,
ETH0_IP6_ULA = “”,
ETH0_MAC = “02:00:c0:a8:65:02”,
ETH0_MASK = “255.255.255.0”,
ETH0_MTU = “”,
ETH0_NETWORK = “”,
ETH0_SEARCH_DOMAIN = “”,
ETH0_VLAN_ID = “101”,
ETH0_VROUTER_IP = “”,
ETH0_VROUTER_IP6 = “”,
ETH0_VROUTER_MANAGEMENT = “”,
NETWORK = “YES”,
SET_HOSTNAME = “lxd”,
SSH_PUBLIC_KEY = “”,
TARGET = “hdb” ]
CPU = “1”
DISK = [
ALLOW_ORPHANS = “NO”,
CLONE = “YES”,
CLONE_TARGET = “SYSTEM”,
CLUSTER_ID = “0”,
DATASTORE = “image qcow2”,
DATASTORE_ID = “106”,
DEV_PREFIX = “hd”,
DISK_ID = “0”,
DISK_SNAPSHOT_TOTAL_SIZE = “0”,
DISK_TYPE = “FILE”,
DRIVER = “qcow2”,
IMAGE = “ubuntu_bionic - LXD”,
IMAGE_ID = “13”,
IMAGE_STATE = “2”,
LN_TARGET = “NONE”,
ORIGINAL_SIZE = “1024”,
READONLY = “NO”,
SAVE = “NO”,
SIZE = “8192”,
SOURCE = “/var/lib/one//datastores/106/c4046b0ab7260bdb074264f517f6bddb”,
TARGET = “hda”,
TM_MAD = “qcow2”,
TYPE = “FILE” ]
GRAPHICS = [
LISTEN = “0.0.0.0”,
PORT = “5915”,
TYPE = “vnc” ]
MEMORY = “4096”
NIC = [
AR_ID = “0”,
BRIDGE = “onebr.101”,
BRIDGE_TYPE = “linux”,
CLUSTER_ID = “0”,
IP = “192.168.101.2”,
MAC = “02:00:c0:a8:65:02”,
NAME = “NIC0”,
NETWORK = “eth101”,
NETWORK_ID = “3”,
NIC_ID = “0”,
PHYDEV = “bond-local”,
SECURITY_GROUPS = “0”,
TARGET = “one-15-0”,
VLAN_ID = “101”,
VN_MAD = “802.1Q” ]
SECURITY_GROUP_RULE = [
PROTOCOL = “ALL”,
RULE_TYPE = “OUTBOUND”,
SECURITY_GROUP_ID = “0”,
SECURITY_GROUP_NAME = “default” ]
SECURITY_GROUP_RULE = [
PROTOCOL = “ALL”,
RULE_TYPE = “INBOUND”,
SECURITY_GROUP_ID = “0”,
SECURITY_GROUP_NAME = “default” ]
TEMPLATE_ID = “13”
TM_MAD_SYSTEM = “qcow2”
VCPU = “5”
VMID = “15”

Can you check the container log ?

cat /var/log/lxd/one-0/lxc.log

hmmm, the log file is actually empty :frowning: