// Module included in the following assemblies:
//
// * edge_computing/policygenerator_for_ztp/ztp-advanced-policygenerator-config.adoc
// * edge_computing/policygentemplate_for_ztp/ztp-advanced-policy-config.adoc

:_mod-docs-content-type: PROCEDURE
[id="ztp-provisioning-lvm-storage_{context}"]
= Configuring {lvms} using {policy-gen-cr} CRs

[role="_abstract"]
You can configure {lvms-first} for managed clusters that you deploy with {ztp-first}.

[NOTE]
====
You use {lvms} to persist event subscriptions when you use PTP events or bare-metal hardware events with HTTP transport.

Use the Local Storage Operator for persistent storage that uses local volumes in distributed units.
====

.Prerequisites

* Install the OpenShift CLI (`oc`).

* Log in as a user with `cluster-admin` privileges.

* Create a Git repository where you manage your custom site configuration data.

.Procedure

. To configure {lvms} for new managed clusters, add the following YAML to `{rangen-yaml-path}` in the `{policy-prefix}common-ranGen.yaml` file:
+
ifeval::["{policy-gen-cr}" == "PolicyGenTemplate"]
include::snippets/pgt-ztp-provisioning-lvm-storage.adoc[]
endif::[]
ifeval::["{policy-gen-cr}" == "PolicyGenerator"]
include::snippets/pg-ztp-provisioning-lvm-storage.adoc[]
endif::[]
+
[NOTE]
====
The Storage LVMO subscription is deprecated. In future releases of {product-title}, the storage LVMO subscription will not be available. Instead, you must use the Storage LVMS subscription.

In {product-title} {product-version}, you can use the Storage LVMS subscription instead of the LVMO subscription. The LVMS subscription does not require manual overrides in the `{policy-prefix}common-ranGen.yaml` file. Add the following YAML to `{rangen-yaml-path}` in the `{policy-prefix}common-ranGen.yaml` file to use the Storage LVMS subscription:

[source,yaml]
----
ifeval::["{policy-gen-cr}" == "PolicyGenTemplate"]
include::snippets/pgt-ztp-provisioning-lvm-storage-sub.yaml[]
endif::[]
ifeval::["{policy-gen-cr}" == "PolicyGenerator"]
include::snippets/pg-ztp-provisioning-lvm-storage-sub.yaml[]
endif::[]
----
====

. Add the `LVMCluster` CR to `{rangen-yaml-path}` in your specific group or individual site configuration file. For example, in the `{policy-prefix}group-du-sno-ranGen.yaml` file, add the following:
+
--
ifeval::["{policy-gen-cr}" == "PolicyGenTemplate"]
include::snippets/pgt-ztp-provisioning-lvm-storage-cluster.adoc[]
endif::[]
ifeval::["{policy-gen-cr}" == "PolicyGenerator"]
include::snippets/pg-ztp-provisioning-lvm-storage-cluster.adoc[]
endif::[]

This example configuration creates a volume group (`vg1`) with all the available devices, except the disk where {product-title} is installed.
A thin-pool logical volume is also created.
--

. Merge any other required changes and files with your custom site repository.

. Commit the `{policy-gen-cr}` changes in Git, and then push the changes to your site configuration repository to deploy {lvms} to new sites using {ztp}.
