JUJU add-machine creates CONTAINER instead of VM for lxd based controller

juju add-machine creates CONTAINER instead of VM for lxd based controller

  • Created localhost lxd based juju-controller using : juju bootstrap localhost lxd-controller
  • Add new model and add new machine using : juju add-machine -n 1 --constraints=“cores=2 mem=2G” --disks=“10G,2”
  • Expected lxc list type will be shown as VIRTUAL-MACHINE but still shown as CONTAINER. (Plz refer lxc list output)

When & How juju-dff35d-0 & juju-dff35d-2 type will be shown as VIRTUAL-MACHINE.?

Which command to be used to create VM type for juju add-machine ? Am i missing something here

Thank you.

user1@juju:~$ juju version
2.9.43-ubuntu-amd64

user1@juju:~$ juju clouds
Only clouds with registered credentials are shown.
There are more clouds, use --all to see them.

Clouds available on the controller:
Cloud      Regions  Default    Type
localhost  1        localhost  lxd

user1@juju:~$ juju controllers
Controller       Model    User   Access     Cloud/Region         Models  Nodes    HA  Version
lxd-controller*  ceph     admin  superuser  localhost/localhost       3      4  none  2.9.43

user1@juju:~$ juju models
Controller: lxd-controller
Model       Cloud/Region         Type  Status     Machines  Cores  Access  Last connection
ceph*       localhost/localhost  lxd   available         2      4  admin   2 minutes ago
controller  localhost/localhost  lxd   available         1      -  admin   just now
default     localhost/localhost  lxd   available         0      -  admin   18 minutes ago

user1@juju:~$ juju machines
Machine  State    Address         Inst id        Series  AZ  Message
0        started  10.220.131.238  juju-dff35d-0  focal       Running
2        started  10.220.131.78   juju-dff35d-2  focal       Running

user1@juju:~$ juju machines
Machine  State    Address         Inst id        Series  AZ  Message
0        started  10.220.131.238  juju-dff35d-0  focal       Running
2        started  10.220.131.78   juju-dff35d-2  focal       Running

user1@juju:~$ lxc list
+---------------+---------+------------------------+------+-----------------+-----------+
|     NAME      |  STATE  |          IPV4          | IPV6 |      TYPE       | SNAPSHOTS |
+---------------+---------+------------------------+------+-----------------+-----------+
| juju-3e83c9-0 | RUNNING | 10.220.131.223 (eth0)  |      | CONTAINER       | 0         |
+---------------+---------+------------------------+------+-----------------+-----------+
| juju-dff35d-0 | RUNNING | 10.220.131.238 (eth0)  |      | CONTAINER       | 0         |
+---------------+---------+------------------------+------+-----------------+-----------+
| juju-dff35d-2 | RUNNING | 10.220.131.78 (eth0)   |      | CONTAINER       | 0         |
+---------------+---------+------------------------+------+-----------------+-----------+
| vm1           | RUNNING | 10.220.131.35 (enp5s0) |      | VIRTUAL-MACHINE | 0         |
+---------------+---------+------------------------+------+-----------------+-----------+

NOTE: Above vm1 is manually created using "lxc launch ubuntu:22.04 vm1 --vm -c limits.cpu=2 -c limits.memory=2GiB"

Thanks for trying out Juju with LXD. If you want to have LXD VMs, rather than Containers, you need to use Juju 3.1 or newer. Then you can add the virt-type=virtual-machine to your constraints.

juju add-machine -n 1 --constraints=“cores=2 mem=2G virt-type=virtual-machine” --disks=“10G,2”

Thank you @hpidcock. Used juju v3.20 to create vms.

I need to create vm -> sda with 20G and another raw blokc disk sdb with 20G. But lsblk shows only sda with 10G.

user1@juju:~$ juju add-machine -n 3 --constraints="cores=2 mem=2G virt-type=virtual-machine" --disks="20G,2"
user1@juju:~$ lxc list
+---------------+---------+-------------------------+------+-----------------+-----------+
|     NAME      |  STATE  |          IPV4           | IPV6 |      TYPE       | SNAPSHOTS |
+---------------+---------+-------------------------+------+-----------------+-----------+
| juju-3fe521-0 | RUNNING | 10.220.131.176 (enp5s0) |      | VIRTUAL-MACHINE | 0         |

user1@juju:~$ lxc shell juju-3fe521-0
root@juju-3fe521-0:~# lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0     7:0    0 111.9M  1 loop /snap/lxd/24322
loop1     7:1    0  53.3M  1 loop /snap/snapd/19457
loop2     7:2    0  63.4M  1 loop /snap/core20/1974
sda       8:0    0    10G  0 disk
├─sda1    8:1    0   9.9G  0 part /
├─sda14   8:14   0     4M  0 part
└─sda15   8:15   0   106M  0 part /boot/efi

seems below example is only provided as part of the documentation:

juju add-machine --constraints=“cores=4 mem=16G” --disks=“ebs,1T,2 ebs-ssd,100G,1”

Please help me to attach another disk (sdb) as per the requirement. Thank you.

I don’t think we can create block devices yet via juju for lxd. I’ve added this to our backlog to add support for creating block devices for lxd machines.

But you should be able to create the machines with a bigger root disk through the root-disk constraint, e.g.:

juju add-machine -n 3 --constraints="cores=2 mem=2G virt-type=virtual-machine root-disk=20G"

1 Like