rbd-pool-name for create-target action is ignored

Bug #2042419 reported by Nobuto Murata
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Ceph iSCSI Charm
Fix Committed
Undecided
Unassigned

Bug Description

When creating a target with the action like:

juju run --format=yaml ceph-iscsi/leader --wait=10m create-target \
   client-initiatorname=iqn.2004-10.com.ubuntu:01:de21d53afe31 \
   client-username=testclient \
   client-password=12to16characters \
   image-size=5G \
   image-name=disk_1 \
   rbd-pool-name=ceph-iscsi

rbd-pool-name=ceph-iscsi is ignored and the image will be created in "iscsi" pool instead.

However, "iscsi" is the *metadata* pool name by default in the charm not for storing the actual data for tenants.
https://github.com/openstack/charm-ceph-iscsi/blob/f127ac11f7ed4319bbd7b0b7b09b4afd3d8ec22a/config.yaml#L38-L42

Two issues here:

https://github.com/openstack/charm-ceph-iscsi/blob/f127ac11f7ed4319bbd7b0b7b09b4afd3d8ec22a/actions.yaml#L43-L50
1. The default value of ec-rbd-metadata-pool in the action is "iscsi"
2. The default value of rbd-pool-name in the action is "iscsi"

For 1. by having non-empty value for ec-rbd-metadata-pool, the code assumes EC code path even when the operator didn't ask for EC.
https://github.com/openstack/charm-ceph-iscsi/blob/f127ac11f7ed4319bbd7b0b7b09b4afd3d8ec22a/src/charm.py#L564
And it will set target_pool = ec_rbd_metadata_pool.

So we shouldn't set the default value in the action.

For 2. "iscsi" is the metadata pool by default so we should not have the default value there and rely on the operator to specify an expected name. Because the pool name will be determined by the application name not by the charm itself.

WORKAROUND: specify an empty value explicitly to ec-rbd-metadata-pool.

juju run --format=yaml ceph-iscsi/leader --wait=10m create-target \
   client-initiatorname=iqn.2004-10.com.ubuntu:01:de21d53afe31 \
   client-username=testclient \
   client-password=12to16characters \
   image-size=5G \
   image-name=disk_1 \
   rbd-pool-name=ceph-iscsi \
   ec-rbd-metadata-pool=''

Nobuto Murata (nobuto)
summary: - The default value as rbd-pool-name=iscsi uses metadata pool for data
+ rbd-pool-name for create-target action is ignored
Nobuto Murata (nobuto)
description: updated
tags: added: field-ceph-dashboard
description: updated
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-ceph-iscsi (master)
Changed in charm-ceph-iscsi:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-ceph-iscsi (master)

Reviewed: https://review.opendev.org/c/openstack/charm-ceph-iscsi/+/899858
Committed: https://opendev.org/openstack/charm-ceph-iscsi/commit/82779e5ff9a579610f2e1b4af557ee4ef2ede202
Submitter: "Zuul (22348)"
Branch: master

commit 82779e5ff9a579610f2e1b4af557ee4ef2ede202
Author: Nobuto Murata <email address hidden>
Date: Wed Nov 1 21:45:59 2023 +0900

    Don't set the default pool as "iscsi"

    "iscsi" is the name of the metadata pool by default in the charm and not
    to be used for tenant data. The charm can fill out the data pool name
    automatically with `def data_pool_name` or can accept a user specified
    value. After fixing the issue, the "iscsi" pool will be used only for
    hosting gateway.conf as a rados object so reflect the purpose into the
    application name for the pool too.

    Also, update the command syntax not to print the deprecation warning:
    "rbd: --user is deprecated, use --id"

    Closes-Bug: #2042419
    Related-Bug: #2040274
    Change-Id: Iec275190854edcc85915d93db233f444c92fbb17

Changed in charm-ceph-iscsi:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-ceph-iscsi (stable/quincy.2)

Fix proposed to branch: stable/quincy.2
Review: https://review.opendev.org/c/openstack/charm-ceph-iscsi/+/900073

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-ceph-iscsi (stable/quincy.2)

Reviewed: https://review.opendev.org/c/openstack/charm-ceph-iscsi/+/900073
Committed: https://opendev.org/openstack/charm-ceph-iscsi/commit/50bd805fb1b61c871b8c32f4ba2b90586624c636
Submitter: "Zuul (22348)"
Branch: stable/quincy.2

commit 50bd805fb1b61c871b8c32f4ba2b90586624c636
Author: Nobuto Murata <email address hidden>
Date: Wed Nov 1 21:45:59 2023 +0900

    Don't set the default pool as "iscsi"

    "iscsi" is the name of the metadata pool by default in the charm and not
    to be used for tenant data. The charm can fill out the data pool name
    automatically with `def data_pool_name` or can accept a user specified
    value. After fixing the issue, the "iscsi" pool will be used only for
    hosting gateway.conf as a rados object so reflect the purpose into the
    application name for the pool too.

    Also, update the command syntax not to print the deprecation warning:
    "rbd: --user is deprecated, use --id"

    Closes-Bug: #2042419
    Related-Bug: #2040274
    Change-Id: Iec275190854edcc85915d93db233f444c92fbb17
    (cherry picked from commit 82779e5ff9a579610f2e1b4af557ee4ef2ede202)

Revision history for this message
Nobuto Murata (nobuto) wrote :

The fix was incomplete.

$ juju run --format=yaml ceph-iscsi/0 --wait=10m create-target client-initiatorname=iqn.2004-10.com.ubuntu:01:de21d53afe31 client-username=testclient client-password=12to16characters image-size=5G image-name=disk_2
Running operation 29 with 1 task
  - task 30 on unit-ceph-iscsi-0

Waiting for task 30...
ceph-iscsi/0:
  id: "30"
  message: exit status 1
  results:
    return-code: 1
  status: failed
  timing:
    completed: 2023-11-06 13:03:32 +0000 UTC
    enqueued: 2023-11-06 13:03:32 +0000 UTC
    started: 2023-11-06 13:03:32 +0000 UTC
  unit: ceph-iscsi/0
ERROR the following task failed:
 - id "30" with return code 1

use 'juju show-task' to inspect the failure

2023-11-06 13:03:31 DEBUG unit.ceph-iscsi/0.juju-log server.go:325 Emitting Juju event create_target_action.
2023-11-06 13:03:32 ERROR unit.ceph-iscsi/0.juju-log server.go:325 Uncaught exception while in charm code:
Traceback (most recent call last):
  File "/var/lib/juju/agents/unit-ceph-iscsi-0/charm/./src/charm.py", line 620, in <module>
    main(ops_openstack.core.get_charm_class_for_release())
  File "/var/lib/juju/agents/unit-ceph-iscsi-0/charm/venv/ops/main.py", line 438, in main
    _emit_charm_event(charm, dispatcher.event_name)
  File "/var/lib/juju/agents/unit-ceph-iscsi-0/charm/venv/ops/main.py", line 150, in _emit_charm_event
    event_to_emit.emit(*args, **kwargs)
  File "/var/lib/juju/agents/unit-ceph-iscsi-0/charm/venv/ops/framework.py", line 355, in emit
    framework._emit(event) # noqa
  File "/var/lib/juju/agents/unit-ceph-iscsi-0/charm/venv/ops/framework.py", line 856, in _emit
    self._reemit(event_path)
  File "/var/lib/juju/agents/unit-ceph-iscsi-0/charm/venv/ops/framework.py", line 931, in _reemit
    custom_handler(event)
  File "/var/lib/juju/agents/unit-ceph-iscsi-0/charm/./src/charm.py", line 562, in on_create_target_action
    rbd_pool_name, ec_rbd_metadata_pool = self.calculate_target_pools(
  File "/var/lib/juju/agents/unit-ceph-iscsi-0/charm/./src/charm.py", line 513, in calculate_target_pools
    if event.params['ec-rbd-metadata-pool']:
KeyError: 'ec-rbd-metadata-pool'

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-ceph-iscsi (stable/quincy.2)

Fix proposed to branch: stable/quincy.2
Review: https://review.opendev.org/c/openstack/charm-ceph-iscsi/+/900185

Revision history for this message
Nobuto Murata (nobuto) wrote :
Changed in charm-ceph-iscsi:
status: Fix Committed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-ceph-iscsi (stable/quincy.2)

Reviewed: https://review.opendev.org/c/openstack/charm-ceph-iscsi/+/900185
Committed: https://opendev.org/openstack/charm-ceph-iscsi/commit/ede02d80364bef9131039aafdeca89a05a4188ff
Submitter: "Zuul (22348)"
Branch: stable/quincy.2

commit ede02d80364bef9131039aafdeca89a05a4188ff
Author: Nobuto Murata <email address hidden>
Date: Mon Nov 6 13:09:30 2023 +0000

    Fix key errors for rbd-pool-name and ec-rbd-metadata-pool

    The existing code assumes event.params['rbd-pool-name'] and
    event.params['ec-rbd-metadata-pool'] have a key. Set an empty string by
    default to be filled by other part of the code.

    Follow-up of Iec275190854edcc85915d93db233f444c92fbb17

    Closes-Bug: #2042419
    Change-Id: I819f0d4456530ace8162456dec1f2fcb7fa95e7f

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-ceph-iscsi (master)

Reviewed: https://review.opendev.org/c/openstack/charm-ceph-iscsi/+/900184
Committed: https://opendev.org/openstack/charm-ceph-iscsi/commit/fad259da9a6b8128936d82277bd5692b0c69bedc
Submitter: "Zuul (22348)"
Branch: master

commit fad259da9a6b8128936d82277bd5692b0c69bedc
Author: Nobuto Murata <email address hidden>
Date: Mon Nov 6 13:09:30 2023 +0000

    Fix key errors for rbd-pool-name and ec-rbd-metadata-pool

    The existing code assumes event.params['rbd-pool-name'] and
    event.params['ec-rbd-metadata-pool'] have a key. Set an empty string by
    default to be filled by other part of the code.

    Follow-up of Iec275190854edcc85915d93db233f444c92fbb17

    Closes-Bug: #2042419
    Change-Id: I819f0d4456530ace8162456dec1f2fcb7fa95e7f

Changed in charm-ceph-iscsi:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.