canonical / lxd

Powerful system container and virtual machine manager
https://canonical.com/lxd
GNU Affero General Public License v3.0
4.32k stars 926 forks source link

Flags `--property` & `-f` and option `source.wipe` don't work #12299

Closed just-doks closed 11 months ago

just-doks commented 12 months ago

Required information

Issue description/steps to reproduce

Hello. Let me describe, what I did and what I got after that:

  1. Reinstalled Debian 12.1; 0.1. during the install:
    • /boot on primary partition;
    • swap and /root on LVM logical volumes;
    • leave free space on volume group;
  2. installed lxd package: sudo apt install lxd;
  3. installed btrfs package: sudo apt install btrfs-progs;
  4. run init command: sudo lxd init;
  5. configured managed network (lxdbr0) and btrfs pool using lvm logical volume during init;
  6. run launching command: sudo lxc launch images:debian/12 deb-container;
  7. stopped instance;

First issue: flag --property doesn't work.

  1. I tried to get some basic properties: sudo lxc config get deb-container name --property;
  2. received error: Error: unknown flag: --property; I expected to get deb-container.

How to reproduce: just do everything I described above.

Second issue: flag -f & option storage.wipe=true don't work.

  1. I tried to create storage pool manually using lvm logical volume, that was used before. 1.1. When I tried to create pool without additional options, I got error: Command: sudo lxc storage create pool2 btrfs source=/dev/vg1/lv1-5gb; Response: Error: Failed to format block device: Failed to run: mkfs.btrfs -L pool2 /dev/vg1/lv1-5gb: exit status 1 (ERROR: /dev/vg1/lv1-5gb appears to contain a partition table (dos) ERROR: use the -f option to force overwrite of /dev/vg1/lv1-5gb); 1.2. Then I tried to set recommended option source.wipe=true but I got another error: Command: sudo lxc storage create pool2 btrfs source=/dev/vg1/lv1-5gb source.wipe=true Response: Error: Invalid option "source.wipe"; 1.3. When I tried to use recommended flag -f I got one more error: Command: sudo lxc storage create pool2 btrfs source=/dev/vg1/lv1-5gb -f; Response: Error: unknown shorthand flag: 'f' in -f; I expected to get a ready to use storage pool.

By running command: sudo wipefs -af /dev/vg1/lv1-5gb - this solves the problem, but the issue is still there.

How to reproduce:

  1. Create btrfs storage pool on empty lvm logical volume;
  2. Delete that storage pool using lxc commands;
  3. Create new storage pool on the same lvm logical volume.

I reported about those issues to debian maintainers, but they think I should report about it here. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1052318

Information to attach

tomponline commented 12 months ago

@gabrielmougard please can you look into this one when you can, thanks

tomponline commented 11 months ago

@gabrielmougard did you confirm if this is an issue yet or not? Thanks

MusicDin commented 11 months ago

@tomponline Could this be a backport issue to 5.0.2?


On lxd 5.0.2 there is no flag --property/-p. Even lxc config get --help does not contain it, however, it is described in docs under 5.0 stable.

On lxd 5.18:

$ lxc config get c1 ephemeral --property
false
$ lxc config set c1 ephemeral=true --property
$ lxc config get c1 ephemeral --property
true

Similar for the source.wipe.


For lxc create storage <storange_name> <driver>, I am not aware of -f flag in any of the versions.

tomponline commented 11 months ago

The use the -f option to force part of the error is coming from mkfs.btrfs and isn't coming from LXD.

tomponline commented 11 months ago

The source.wipe option has been backported to stable-5.0 but has not been released yet. It will be in LXD 5.0.3.