Skip to content

Commit

Permalink
snapcraft: Move LVM and OVN setup to setup-ceph
Browse files Browse the repository at this point in the history
Signed-off-by: Max Asnaashari <[email protected]>
  • Loading branch information
masnax committed Sep 28, 2023
1 parent a38d5df commit 2f82bcd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
30 changes: 0 additions & 30 deletions snapcraft/commands/daemon.start
Original file line number Diff line number Diff line change
Expand Up @@ -247,36 +247,6 @@ if [ "${daemon_group:-"lxd"}" = "lxd" ] && ! getent group lxd >/dev/null 2>&1; t
fi
fi

# Setup for LVM
echo "==> Setting up LVM configuration"
mkdir -p /etc/lvm/
sed \
-e "s#obtain_device_list_from_udev = 1#obtain_device_list_from_udev = 0#g" \
-e "s#cache_file_prefix = \"\"#cache_file_prefix = \"lxd\"#g" \
-e "s#udev_sync = 1#udev_sync = 0#g" \
-e "s#udev_rules = 1#udev_rules = 0#g" \
-e "s#use_lvmetad = 1#use_lvmetad = 0#g" \
-e "s#monitoring = 1#monitoring = 0#g" \
-e "s%# executable = \"/sbin/dmeventd\"%executable = \"${SNAP}/bin/dmeventd\"%g" \
-e "/# .*_executable =/s/# //g" \
-e "s#/usr/sbin/#${SNAP}/bin/#g" \
"${SNAP}/etc/lvm/lvm.conf" > /etc/lvm/lvm.conf

# Setup for OVN
echo "==> Setting up OVN configuration"
if [ "${ovn_builtin:-"false"}" = "true" ]; then
mkdir -p "${SNAP_COMMON}/ovn"
ln -s "${SNAP_COMMON}/ovn" /etc/ovn
elif [ -d /var/snap/microovn/ ]; then
echo "=> Detected MicroOVN"
mkdir /etc/ovn
ln -s /var/snap/microovn/common/data/pki/client-cert.pem /etc/ovn/cert_host
ln -s /var/snap/microovn/common/data/pki/client-privkey.pem /etc/ovn/key_host
ln -s /var/snap/microovn/common/data/pki/cacert.pem /etc/ovn/ovn-central.crt
else
ln -s /var/lib/snapd/hostfs/etc/ovn /etc/ovn
fi

# Rotate logs
echo "==> Rotating logs"
logrotate -f "${SNAP}/etc/logrotate.conf" -s "/etc/logrotate.status" || true
Expand Down
30 changes: 30 additions & 0 deletions snapcraft/setup-etc
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,33 @@ else
"${SNAP}/meta/hooks/disconnect-plug-ceph-conf"
fi

# Setup for LVM
echo "==> Setting up LVM configuration"
mkdir -p /etc/lvm/
sed \
-e "s#obtain_device_list_from_udev = 1#obtain_device_list_from_udev = 0#g" \
-e "s#cache_file_prefix = \"\"#cache_file_prefix = \"lxd\"#g" \
-e "s#udev_sync = 1#udev_sync = 0#g" \
-e "s#udev_rules = 1#udev_rules = 0#g" \
-e "s#use_lvmetad = 1#use_lvmetad = 0#g" \
-e "s#monitoring = 1#monitoring = 0#g" \
-e "s%# executable = \"/sbin/dmeventd\"%executable = \"${SNAP}/bin/dmeventd\"%g" \
-e "/# .*_executable =/s/# //g" \
-e "s#/usr/sbin/#${SNAP}/bin/#g" \
"${SNAP}/etc/lvm/lvm.conf" > /etc/lvm/lvm.conf

# Setup for OVN
echo "==> Setting up OVN configuration"
if [ "${ovn_builtin:-"false"}" = "true" ]; then
mkdir -p "${SNAP_COMMON}/ovn"
ln -s "${SNAP_COMMON}/ovn" /etc/ovn
elif [ -d /var/snap/microovn/ ]; then
echo "=> Detected MicroOVN"
mkdir /etc/ovn
ln -s /var/snap/microovn/common/data/pki/client-cert.pem /etc/ovn/cert_host
ln -s /var/snap/microovn/common/data/pki/client-privkey.pem /etc/ovn/key_host
ln -s /var/snap/microovn/common/data/pki/cacert.pem /etc/ovn/ovn-central.crt
else
ln -s /var/lib/snapd/hostfs/etc/ovn /etc/ovn
fi

0 comments on commit 2f82bcd

Please sign in to comment.