Skip to content

system: add cloud-init lvm config#86

Merged
Vicente-Cheng merged 1 commit into
harvester:sle-microfrom
Vicente-Cheng:add-lvm-filter
Dec 18, 2023
Merged

system: add cloud-init lvm config#86
Vicente-Cheng merged 1 commit into
harvester:sle-microfrom
Vicente-Cheng:add-lvm-filter

Conversation

@Vicente-Cheng
Copy link
Copy Markdown
Collaborator

@Vicente-Cheng Vicente-Cheng commented Dec 17, 2023

related issue: harvester/harvester#4674

Test Plan:

  1. make sure the /etc/lvm/lvm.conf contain the following patch
# Configuration section devices.
# How LVM uses block devices.
devices {
        global_filter = [ "r|.*/|" ]
.
.
.
  1. Create any VM and try to attach a volume to it. (assume that is /dev/sda)
  2. Create LVM device on this VM by following command
$ pvcreate /dev/sda
$ vgcreate vg01 /dev/sda
$ lvcreate -L 500M -n lv01 vg01

now we can check the /dev/sda with lvm

root@vm001:~# lsblk /dev/sda
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda           8:0    0    1G  0 disk
└─vg01-lv01 253:0    0  500M  0 lvm
  1. Try to migrate this VM to another host.
  2. We should not see any LVM device on the migration target
    (If we miss this patch, we will see the following result on the host)
# lsblk /dev/sda /dev/sdb
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
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
sdb           8:16   0    1G  0 disk
└─vg01-lv01 254:0    0  500M  0 lvm <-- should not see this with patched lvm.conf

    - add global_filter to avoid create LVM device

Signed-off-by: Vicente Cheng <vicente.cheng@suse.com>
Copy link
Copy Markdown
Member

@tserong tserong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given Harvester doesn't configure LVM on the host, it seems safe to summarily reject everything as you've done here, and I've also done some testing to confirm we don't get the disk I/O errors during migration with this patch applied.

We'll probably need to handle this differently if we later decide to make harvester configure LVM on the host, but IMO we can cross that bridge when we come to it.

@Vicente-Cheng Vicente-Cheng merged commit 9d90d3c into harvester:sle-micro Dec 18, 2023
@Vicente-Cheng
Copy link
Copy Markdown
Collaborator Author

@Mergifyio backport harvester-v1.2.x

@mergify
Copy link
Copy Markdown

mergify Bot commented Dec 18, 2023

backport harvester-v1.2.x

✅ Backports have been created

Details

@Vicente-Cheng
Copy link
Copy Markdown
Collaborator Author

@Mergifyio backport harvester-v1.1.x

@mergify
Copy link
Copy Markdown

mergify Bot commented Dec 18, 2023

backport harvester-v1.1.x

✅ Backports have been created

Details

tserong added a commit to tserong/harvester-installer that referenced this pull request Apr 19, 2024
harvester/os2#86 adds a global_filter to
/etc/lvm/lvm.conf to avoid activing LVM on the host.  Unfortunately,
dracut-initqueue runs _very_ early in the boot process (before any of
the elemental stages are run), so this filter isn't taken into account
on boot, and LVM volumes are still potentially activated.  Later, when
we try to run `blkdeactivate` in `harv-install`, it doesn't work,
because the filter _is_ active then, so it skips deactivation and then
the subsequent disk repartitioning fails.  We can work around this by
setting up a temporary lvm config which has that global_filter stripped
out.

Related issue: harvester/harvester#5398

Signed-off-by: Tim Serong <tserong@suse.com>
Vicente-Cheng pushed a commit to harvester/harvester-installer that referenced this pull request Apr 19, 2024
harvester/os2#86 adds a global_filter to
/etc/lvm/lvm.conf to avoid activing LVM on the host.  Unfortunately,
dracut-initqueue runs _very_ early in the boot process (before any of
the elemental stages are run), so this filter isn't taken into account
on boot, and LVM volumes are still potentially activated.  Later, when
we try to run `blkdeactivate` in `harv-install`, it doesn't work,
because the filter _is_ active then, so it skips deactivation and then
the subsequent disk repartitioning fails.  We can work around this by
setting up a temporary lvm config which has that global_filter stripped
out.

Related issue: harvester/harvester#5398

Signed-off-by: Tim Serong <tserong@suse.com>
mergify Bot pushed a commit to harvester/harvester-installer that referenced this pull request Apr 19, 2024
harvester/os2#86 adds a global_filter to
/etc/lvm/lvm.conf to avoid activing LVM on the host.  Unfortunately,
dracut-initqueue runs _very_ early in the boot process (before any of
the elemental stages are run), so this filter isn't taken into account
on boot, and LVM volumes are still potentially activated.  Later, when
we try to run `blkdeactivate` in `harv-install`, it doesn't work,
because the filter _is_ active then, so it skips deactivation and then
the subsequent disk repartitioning fails.  We can work around this by
setting up a temporary lvm config which has that global_filter stripped
out.

Related issue: harvester/harvester#5398

Signed-off-by: Tim Serong <tserong@suse.com>
(cherry picked from commit 43dd846)
mergify Bot pushed a commit to harvester/harvester-installer that referenced this pull request Apr 19, 2024
harvester/os2#86 adds a global_filter to
/etc/lvm/lvm.conf to avoid activing LVM on the host.  Unfortunately,
dracut-initqueue runs _very_ early in the boot process (before any of
the elemental stages are run), so this filter isn't taken into account
on boot, and LVM volumes are still potentially activated.  Later, when
we try to run `blkdeactivate` in `harv-install`, it doesn't work,
because the filter _is_ active then, so it skips deactivation and then
the subsequent disk repartitioning fails.  We can work around this by
setting up a temporary lvm config which has that global_filter stripped
out.

Related issue: harvester/harvester#5398

Signed-off-by: Tim Serong <tserong@suse.com>
(cherry picked from commit 43dd846)
Vicente-Cheng pushed a commit to harvester/harvester-installer that referenced this pull request Apr 23, 2024
harvester/os2#86 adds a global_filter to
/etc/lvm/lvm.conf to avoid activing LVM on the host.  Unfortunately,
dracut-initqueue runs _very_ early in the boot process (before any of
the elemental stages are run), so this filter isn't taken into account
on boot, and LVM volumes are still potentially activated.  Later, when
we try to run `blkdeactivate` in `harv-install`, it doesn't work,
because the filter _is_ active then, so it skips deactivation and then
the subsequent disk repartitioning fails.  We can work around this by
setting up a temporary lvm config which has that global_filter stripped
out.

Related issue: harvester/harvester#5398

Signed-off-by: Tim Serong <tserong@suse.com>
(cherry picked from commit 43dd846)
Vicente-Cheng pushed a commit to harvester/harvester-installer that referenced this pull request Apr 23, 2024
harvester/os2#86 adds a global_filter to
/etc/lvm/lvm.conf to avoid activing LVM on the host.  Unfortunately,
dracut-initqueue runs _very_ early in the boot process (before any of
the elemental stages are run), so this filter isn't taken into account
on boot, and LVM volumes are still potentially activated.  Later, when
we try to run `blkdeactivate` in `harv-install`, it doesn't work,
because the filter _is_ active then, so it skips deactivation and then
the subsequent disk repartitioning fails.  We can work around this by
setting up a temporary lvm config which has that global_filter stripped
out.

Related issue: harvester/harvester#5398

Signed-off-by: Tim Serong <tserong@suse.com>
(cherry picked from commit 43dd846)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants