Message ID | 20250310141813.969325-13-cel@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Block device provisioning for storage nodes | expand |
On Mon, Mar 10, 2025 at 10:18:12 AM -0400, cel@kernel.org wrote: > From: Chuck Lever <chuck.lever@oracle.com> > > On storage nodes (eg., nfsd, iscsi, smbd), pick up the extra block > volumes, avoiding the root and data devices, and toss them into an > volume group to use for shared storage. Looks good to me. Reviewed-by: Chandan Babu R <chandanbabu@kernel.org> > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > .../volume_group/tasks/terraform/oci.yml | 38 +++++++++++++++++++ > 1 file changed, 38 insertions(+) > create mode 100644 playbooks/roles/volume_group/tasks/terraform/oci.yml > > diff --git a/playbooks/roles/volume_group/tasks/terraform/oci.yml b/playbooks/roles/volume_group/tasks/terraform/oci.yml > new file mode 100644 > index 000000000000..219e3d7edbfd > --- /dev/null > +++ b/playbooks/roles/volume_group/tasks/terraform/oci.yml > @@ -0,0 +1,38 @@ > +--- > +# > +# To guarantee idempotency, these steps have to generate the exact > +# same physical_volumes list every time they are run. > +# > +# Skip the block device on which the root filesystem resides, and > +# skip the device that is to be used for /data. These devices all > +# show up under /dev/oracleoci/ . > +# > + > +- name: Detect the root device > + ansible.builtin.stat: > + path: "/dev/oracleoci/oraclevda" > + register: stat_output > + > +- name: Save the name of the root device > + ansible.builtin.set_fact: > + instance_root_device: "{{ stat_output.stat.lnk_source.split('/dev/').1 }}" > + > +- name: Detect the data device > + ansible.builtin.stat: > + path: "{{ data_device }}" > + register: stat_output > + > +- name: Save the name of the data device > + ansible.builtin.set_fact: > + instance_data_device: "{{ stat_output.stat.lnk_source.split('/dev/').1 }}" > + > +- name: Add unused extra volumes to the volume list > + ansible.builtin.set_fact: > + physical_volumes: "{{ physical_volumes + ['/dev/' + item.key] }}" > + when: > + - item.value.model == "BlockVolume" > + - item.key != instance_root_device > + - item.key != instance_data_device > + loop_control: > + label: "Adding block device: /dev/{{ item.key }}" > + with_dict: "{{ ansible_devices }}"
diff --git a/playbooks/roles/volume_group/tasks/terraform/oci.yml b/playbooks/roles/volume_group/tasks/terraform/oci.yml new file mode 100644 index 000000000000..219e3d7edbfd --- /dev/null +++ b/playbooks/roles/volume_group/tasks/terraform/oci.yml @@ -0,0 +1,38 @@ +--- +# +# To guarantee idempotency, these steps have to generate the exact +# same physical_volumes list every time they are run. +# +# Skip the block device on which the root filesystem resides, and +# skip the device that is to be used for /data. These devices all +# show up under /dev/oracleoci/ . +# + +- name: Detect the root device + ansible.builtin.stat: + path: "/dev/oracleoci/oraclevda" + register: stat_output + +- name: Save the name of the root device + ansible.builtin.set_fact: + instance_root_device: "{{ stat_output.stat.lnk_source.split('/dev/').1 }}" + +- name: Detect the data device + ansible.builtin.stat: + path: "{{ data_device }}" + register: stat_output + +- name: Save the name of the data device + ansible.builtin.set_fact: + instance_data_device: "{{ stat_output.stat.lnk_source.split('/dev/').1 }}" + +- name: Add unused extra volumes to the volume list + ansible.builtin.set_fact: + physical_volumes: "{{ physical_volumes + ['/dev/' + item.key] }}" + when: + - item.value.model == "BlockVolume" + - item.key != instance_root_device + - item.key != instance_data_device + loop_control: + label: "Adding block device: /dev/{{ item.key }}" + with_dict: "{{ ansible_devices }}"