opentelekomcloud / ansible-collection-cloud

Ansible modules for using with OTC (addition to the native OpenStack modules)
Apache License 2.0
21 stars 14 forks source link

Howto Create shared scsi volume #230

Open hadoopch opened 1 year ago

hadoopch commented 1 year ago

Hi all,

i would like to create a shared scsi volume on OTC.

I am using ansible module

I am able to create a scsi volume by setting

But this volume should also be shareable among several hosts. How can i configure this?

Thanks in advance

Uli

hadoopch commented 1 year ago

Hi all,

i was able to create a shared scsi volume by using the huawei ansible modules:

community.general.hwc_evs_disk

Regards

Uli

hadoopch commented 1 year ago

Now i tried to attached the shareable volume to two servers using

openstack.cloud.server_volume and i get a 'in-use' error

Polina-Gubina commented 1 year ago

Hi! could you clarify if you set 'multiattach' parameter to true or not?

Polina-Gubina commented 1 year ago

and describe please problem in more detail (i would like to see whole playbook with all related tasks)

hadoopch commented 1 year ago

Hi Polina,

my goal is to create three shareable SCSI devices and attach them to two servers.
First i tried to create the shareable volumes by using the standard openstack module:

Here i set metadata to {"hw:passthrough": "true"}.

By using metadata i was able to create a scsci device but this volume was not shareable. So i tried to set further key value pairs in metadata: "shareable" : "True" or "multiattach": "True" but without success. Finally i was not able to get a shareable volume when i used:

So i had the idea to use the HWC modules which are part of the collection:

I tried the following module:

With the following playbook i was able to create shared scsi volumes:

  tasks:
        - name: "Create shared scsi volume"
          community.general.hwc_evs_disk:
            state: "present"
            availability_zone: "eu-ch2a"
            name: 'my-shared-volume-01'
            size: "10"
            volume_type: "SAS"
            enable_scsi: "true"
            enable_share: "true"

You can see this module has to distinguished parameter for creating evs volumes:

The other parameter were provided by using environment variables, e.g.

export ANSIBLE_HWC_PROJECT=eu-ch2_dvs
export ANSIBLE_HWC_USER=A12650921
...

After that i tried to attach the volumes. You can see that the volume has the appropriate attributes:


{
  "attachments": [
    {
      "id": "21b5114d-7f39-4590-99bd-0c94222f7d11",
      "attachment_id": "e583bbfb-bc6a-4fb1-a0b8-5a1c276ba8bf",
      "volume_id": "21b5114d-7f39-4590-99bd-0c94222f7d11",
      "server_id": "30257b1c-29c5-46f9-87c5-186ca673705d",
      "host_name": null,
      "device": "/dev/sdd",
      "attached_at": "2022-11-07T14:12:43.989645"
    }
  ],
  "availability_zone": "eu-ch2b",
  "bootable": "false",
  "consistencygroup_id": null,
  "created_at": "2022-11-07T13:52:37.152961",
  "description": null,
  "encrypted": false,
  "id": "21b5114d-7f39-4590-99bd-0c94222f7d11",
  "multiattach": true,
  "name": "kunde1-sbdfence-03",
  "os-vol-host-attr:host": "cinder-kvm002@SAS#0",
  "os-vol-mig-status-attr:migstat": null,
  "os-vol-mig-status-attr:name_id": null,
  "os-vol-tenant-attr:tenant_id": "6573b4be93e742f9a45b0f2d33e6b03b",
  "os-volume-replication:extended_status": null,
  "properties": {
    "hw:passthrough": "true",
    "readonly": "False"
  },
  "replication_status": "disabled",
  "shareable": true,
  "size": 10,
  "snapshot_id": null,
  "source_volid": null,
  "status": "in-use",
  "type": "SAS",
  "updated_at": "2022-11-07T14:24:47.775719",
  "user_id": "1fe0961c3a7a434ca026ff726b4656d2",
  "volume_image_metadata": {}
}

Fo attaching the volume i Used

Here is the playbook.

- name: "Volume Attachment  {{svol.size}} GByte {{svol.volume_type}} {{svol.name}} to ECS instance"
  openstack.cloud.server_volume:
   state: "{{_action}}"
   server: "{{item.0}}"
   volume: "{{item.1}}"
  tags:
   - SVOL
  when: _action == "present"
  ignore_errors: yes
  with_nested:
   - "{{ svol.serverlist}}"
   - "{{svol.devicelist}}"

The attachment to the secomnd server always failed and i got an 'in use' error.

Thanks for your support.

Regards

Uli

Polina-Gubina commented 1 year ago

thank you for detailed description! it seems to be missing parameter 'multiattach' in module and I opened a bug for ansible openstack collection. I will try to fix module and let you know when it is ready

hadoopch commented 1 year ago

Thanks a lot Polina.

Do you think it is OK to use the Huawei Module for creating the EVS?

For all other tasks i use either:

In the meantime - To complete my playbook - i will use the shell command because opentack cli seems to work with multiattached volumes.

As soon as everything is fixed i will switch back to the openstack or opentelekom modules.

Regards

Uli

gtema commented 1 year ago

Do you think it is OK to use the Huawei Module for creating the EVS?

Strongly discouraged. This code is not maintained, exists as copy-paste of other code with no maintenance (since adding in 2019). Maybe you can use it temporarily until you get a working module/param, but do not use hwc_ modules as a permanent solution

Polina-Gubina commented 1 year ago

Hi @hadoopch! now you can use is_multiattach=True. This parameter was added, but not released yet. So you can use it throughth installing openstacksdk and ansible-collections-openstack locally from master brunch until it is realised

hadoopch commented 1 year ago

Hi Polina,

after upgrading ansible collection from github (openstack.cloud 2.0.0-dev) and openstacksdk (0.103) it worked. But then i ran into problems with my other playbooks.

So one problem solved , new problems occured

What about the scsi parameter Is this done also by a new parameter or is it still required to set {"hw:passthrough": "true"}.

Polina-Gubina commented 1 year ago

Hi @hadoopch ! it is still required to set {"hw:passthrough": "true"}, there is no special parameter for this