RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1687869 - Prefer non-idempotent behavior in CLI in many cases, but retain idempotency in D-Bus API
Summary: Prefer non-idempotent behavior in CLI in many cases, but retain idempotency i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: stratis-cli
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: 8.2
Assignee: John Baublitz
QA Contact: guazhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-12 14:08 UTC by Jakub Krysl
Modified: 2021-09-06 15:34 UTC (History)
4 users (show)

Fixed In Version: 1.1.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-28 15:41:56 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-24209 0 None None None 2021-09-06 15:34:42 UTC
Red Hat Product Errata RHBA-2020:1634 0 None None None 2020-04-28 15:42:06 UTC

Description Jakub Krysl 2019-03-12 14:08:37 UTC
Description of problem:
This is another quality of life BZ. If I want to add another data/cache dev to pool and try to add one that is already there, I should be at least noted about that.

# stratis pool create test_pool /dev/sda
# stratis pool add-data test_pool /dev/sda
# echo $?
0

# vgcreate vg /dev/sdc
  Physical volume "/dev/sdc" successfully created.
  Volume group "vg" successfully created
# vgextend vg /dev/sdc
  Physical volume '/dev/sdc' is already in volume group 'vg'
  Unable to add physical volume '/dev/sdc' to volume group 'vg'
  /dev/sdc: physical volume not initialized.
# echo $?
5

Also when adding cache again, it takes significantly longer. Adding data dev again seems to be faster:
# time stratis pool add-data test_pool /dev/sdb
real    0m0.416s
user    0m0.111s
sys     0m0.013s
# time stratis pool add-data test_pool /dev/sdb
real    0m0.217s
user    0m0.119s
sys     0m0.009s

# time stratis pool add-cache test_pool /dev/sdc
real    0m0.788s
user    0m0.118s
sys     0m0.012s
# time stratis pool add-cache test_pool /dev/sdc
real    0m6.199s
user    0m0.116s
sys     0m0.013s

Version-Release number of selected component (if applicable):
stratisd-1.0.3-1.el8.x86_64
stratis-cli-1.0.2-1.el8.noarch

How reproducible:
100%

Steps to Reproduce:
1. stratis pool create test_pool /dev/sda
2. stratis pool add-data test_pool /dev/sda

Actual results:
pass, no message

Expected results:
fail / message about adding the same

Additional info:

Comment 1 mulhern 2019-04-29 20:54:31 UTC
This is another instance where the CLI is idempotent, but that doesn't seem user-friendly. We should make a general non-idempotency issue, and fold all similar cases into it.

Comment 2 mulhern 2019-07-23 15:50:31 UTC
Upstream issue: https://github.com/stratis-storage/project/issues/51.

Comment 4 John Baublitz 2019-08-26 15:38:17 UTC
Hi Jakub, I have been working on this issue and want to verify that the behavior I'm implementing meets expectations for the CLI. Currently, I have no output and a 0 exit code when the action is completed successfully. In the error case, I have the following output and a 1 exit code:

stratis-cli issued a command that had no effect: The command 'AddDataDevs' has already been completed for resource or resources '['/dev/sda']'

Let me know if something else would be clearer or generally more intuitive before we merge my changes.

Comment 5 Jakub Krysl 2019-08-26 16:06:49 UTC
(In reply to John Baublitz from comment #4)
> Hi Jakub, I have been working on this issue and want to verify that the
> behavior I'm implementing meets expectations for the CLI. Currently, I have
> no output and a 0 exit code when the action is completed successfully. In
> the error case, I have the following output and a 1 exit code:
> 
> stratis-cli issued a command that had no effect: The command 'AddDataDevs'
> has already been completed for resource or resources '['/dev/sda']'
> 
> Let me know if something else would be clearer or generally more intuitive
> before we merge my changes.

Hi John,

Thanks for reaching out. I like how verbose it is and that it covers the possibility of adding more at once. I have a question regarding that: What happens if I try to add multiple devices where some of them are already added? Does it try to 'AddDataDevs' for each of them and list only those failed ones or does it return at the first fail and list them all (which is wrong) or just the single one (at which case it should not state 'resources')?

And a note regarding the command 'AddDataDevs': The user hits this error only by running stratis-cli command "stratis pool add-data test_pool /dev/sda", is that correct? In that case I think it should link to the command and not internal stratis-cli function 'AddDataDev' which is hidden to user. Returning something known to user instead of something unknown seems like better practise to me, prevents confusion ("What is 'AddDataDev', how did I call it?"). So my suggestion would be to either somehow reword it to link it to 'add-data' called by user OR just state something similar to:
"stratis-cli issued a command that had no effect: Resource or resources '['/dev/sda']' is already part of stratis pool X"
/
"stratis-cli issued a command that had no effect: Stratis pool X already contains resource or resources '['/dev/sda']'".

Comment 6 John Baublitz 2019-08-26 16:21:40 UTC
(In reply to Jakub Krysl from comment #5) 
> Hi John,
> 
> Thanks for reaching out. I like how verbose it is and that it covers the
> possibility of adding more at once. I have a question regarding that: What
> happens if I try to add multiple devices where some of them are already
> added? Does it try to 'AddDataDevs' for each of them and list only those
> failed ones or does it return at the first fail and list them all (which is
> wrong) or just the single one (at which case it should not state
> 'resources')?

Hi Jakub, given that we currently have enough information to provide warning messages about some devices already being added, I'm happy to put that together. As it stands at the moment, any command that adds any new data/cache devices will simply succeed with no output even if some devices have already been added. I can see how that may be confusing so I'm happy to discuss with the team about how we want to approach warning messages for the devices that have already been added if that sounds better. 

> 
> And a note regarding the command 'AddDataDevs': The user hits this error
> only by running stratis-cli command "stratis pool add-data test_pool
> /dev/sda", is that correct? In that case I think it should link to the
> command and not internal stratis-cli function 'AddDataDev' which is hidden
> to user. Returning something known to user instead of something unknown
> seems like better practise to me, prevents confusion ("What is 'AddDataDev',
> how did I call it?"). So my suggestion would be to either somehow reword it
> to link it to 'add-data' called by user OR just state something similar to:
> "stratis-cli issued a command that had no effect: Resource or resources
> '['/dev/sda']' is already part of stratis pool X"
> /
> "stratis-cli issued a command that had no effect: Stratis pool X already
> contains resource or resources '['/dev/sda']'".

I can most definitely change the command text as that's a fairly simple change to make. I'll use the CLI command as opposed to the DBus command as that does seem to be more intuitive.

Thank you for your feedback, and let me know if you have any other concerns.

Comment 7 John Baublitz 2019-08-27 15:54:56 UTC
Hi Jakub, I've settled on two separate types of behavior, one for single resource operations and one for multiple resource operations.

For commands that operate on a single resource like pool create, I emit the following error message if no changes are applied:

$ stratis pool create test_pool /dev/sda
Execution failed:
stratis-cli issued a command that had no effect: The command 'create' has already been completed for resource 'test_pool'

For commands that operate on multiple resources like pool add-cache, I emit the following error message if *any* of the provided blockdevs already exist in the pool:

$ stratis pool add-data test_pool /dev/sda /dev/sdb
Execution failed:
stratis-cli issued a command that could not be completely applied: The command 'add-data' has already been completed for resource or resources ['/dev/sda'] but not yet for resource or resources ['/dev/sdb']

This is different behavior from what was discussed before mainly because we decided this should return an error on the CLI side, but there should be no partial application of resources that would could be added if there were also some that could not be added. It seems like it would be very confusing to have some actions performed successfully while simultaneously returning an error code.

Does the outlined behavior sound like it would be intuitive to you when using the CLI?

Comment 8 Jakub Krysl 2019-08-28 10:33:42 UTC
(In reply to John Baublitz from comment #7)
> Hi Jakub, I've settled on two separate types of behavior, one for single
> resource operations and one for multiple resource operations.
> 
> For commands that operate on a single resource like pool create, I emit the
> following error message if no changes are applied:
> 
> $ stratis pool create test_pool /dev/sda
> Execution failed:
> stratis-cli issued a command that had no effect: The command 'create' has
> already been completed for resource 'test_pool'
> 
> For commands that operate on multiple resources like pool add-cache, I emit
> the following error message if *any* of the provided blockdevs already exist
> in the pool:
> 
> $ stratis pool add-data test_pool /dev/sda /dev/sdb
> Execution failed:
> stratis-cli issued a command that could not be completely applied: The
> command 'add-data' has already been completed for resource or resources
> ['/dev/sda'] but not yet for resource or resources ['/dev/sdb']
> 
> This is different behavior from what was discussed before mainly because we
> decided this should return an error on the CLI side, but there should be no
> partial application of resources that would could be added if there were
> also some that could not be added. It seems like it would be very confusing
> to have some actions performed successfully while simultaneously returning
> an error code.
> 
> Does the outlined behavior sound like it would be intuitive to you when
> using the CLI?

Hi John,

I like the proposed messages and I agree with you that it would be confusing to perform any action when the command fails.

Comment 9 Jakub Krysl 2019-10-02 11:32:58 UTC
Mass migration to Guangwu.

Comment 11 guazhang@redhat.com 2019-11-25 08:55:58 UTC
Hello


test pass with stratis-cli-2.0.0-1.el8 so move to verified 

[root@storageqe-24 ~]# systemctl restart stratisd
[root@storageqe-24 ~]# stratis pool create test_pool /dev/sdb
[root@storageqe-24 ~]# stratis pool add-data test_pool /dev/sdb
Execution failed:
You issued a command that would have a partial or no effect: The 'add to data' action has no effect for resource /dev/sdb
[root@storageqe-24 ~]# stratis pool add-data test_pool /dev/sdc
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: ERROR: Device /dev/sdc has an existing signature ID_FS_UUID=b876566e-e111-4092-b365-802feac557ed ID_FS_UUID_ENC=b876566e-e111-4092-b365-802feac557ed ID_FS_TYPE=xfs ID_FS_USAGE=filesystem.
[root@storageqe-24 ~]# 
[root@storageqe-24 ~]# 
[root@storageqe-24 ~]# stratis pool add-data test_pool /dev/sdc
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: ERROR: Device /dev/sdc has an existing signature ID_FS_UUID=b876566e-e111-4092-b365-802feac557ed ID_FS_USAGE=filesystem ID_FS_TYPE=xfs ID_FS_UUID_ENC=b876566e-e111-4092-b365-802feac557ed.
[root@storageqe-24 ~]# lsblk
NAME                                                                    MAJ:MIN RM  SIZE RO TYPE    MOUNTPOINT
sda                                                                       8:0    0  5.5T  0 disk    
├─sda1                                                                    8:1    0    1M  0 part    
├─sda2                                                                    8:2    0    1G  0 part    /boot
└─sda3                                                                    8:3    0  5.5T  0 part    
  ├─rhel_storageqe--24-root                                             253:0    0   50G  0 lvm     /
  ├─rhel_storageqe--24-swap                                             253:1    0 31.5G  0 lvm     [SWAP]
  └─rhel_storageqe--24-home                                             253:2    0  5.4T  0 lvm     /home
sdb                                                                       8:16   0  5.5T  0 disk    
└─stratis-1-private-a5d7c6ee26f242bcb3a5fbc8fa66eb7f-physical-originsub 253:3    0  5.5T  0 stratis 
  ├─stratis-1-private-a5d7c6ee26f242bcb3a5fbc8fa66eb7f-flex-thinmeta    253:4    0  5.6G  0 stratis 
  │ └─stratis-1-private-a5d7c6ee26f242bcb3a5fbc8fa66eb7f-thinpool-pool  253:7    0  5.5T  0 stratis 
  ├─stratis-1-private-a5d7c6ee26f242bcb3a5fbc8fa66eb7f-flex-thindata    253:5    0  5.5T  0 stratis 
  │ └─stratis-1-private-a5d7c6ee26f242bcb3a5fbc8fa66eb7f-thinpool-pool  253:7    0  5.5T  0 stratis 
  └─stratis-1-private-a5d7c6ee26f242bcb3a5fbc8fa66eb7f-flex-mdv         253:6    0   16M  0 stratis 
sdc                                                                       8:32   0  5.5T  0 disk    
sdd                                                                       8:48   0  5.5T  0 disk    
sde                                                                       8:64   0  5.5T  0 disk    
sdf                                                                       8:80   0  5.5T  0 disk    
sdg                                                                       8:96   0  5.5T  0 disk    
sdh                                                                       8:112  0  5.5T  0 disk    
sdi                                                                       8:128  0  5.5T  0 disk    
sdj                                                                       8:144  0  5.5T  0 disk    
sdk                                                                       8:160  0  5.5T  0 disk    
└─sdk1                                                                    8:161  0   10G  0 part    
sdl                                                                       8:176  0  9.8G  0 disk 

[root@storageqe-24 ~]# dd if=/dev/zero of=/dev/sdc bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB, 10 MiB) copied, 0.0579613 s, 181 MB/s
[root@storageqe-24 ~]# stratis pool add-data test_pool /dev/sdc
[root@storageqe-24 ~]# dd if=/dev/zero of=/dev/sdd bs=1M count=10
10+0 records in
10+0 records out
10485760 bytes (10 MB, 10 MiB) copied, 0.25584 s, 41.0 MB/s
[root@storageqe-24 ~]# 
[root@storageqe-24 ~]# stratis pool add-data test_pool /dev/sdc
Execution failed:
You issued a command that would have a partial or no effect: The 'add to data' action has no effect for resource /dev/sdc
[root@storageqe-24 ~]# stratis pool add-cache  test_pool /dev/sdd
[root@storageqe-24 ~]# stratis pool add-cache  test_pool /dev/sdd
Execution failed:
You issued a command that would have a partial or no effect: The 'add to cache' action has no effect for resource /dev/sdd
[root@storageqe-24 ~]# 

[root@storageqe-24 ~]# stratis pool add-cache  test_pool /dev/sdd /dev/sde
Execution failed:
You issued a command that would have a partial or no effect: The 'add to cache' action has no effect for resource /dev/sdd but does for resource /dev/sde
[root@storageqe-24 ~]# stratis pool add-data  test_pool /dev/sdd /dev/sde
Execution failed:
You issued a command that would have resulted in including a block device in both cache and data tiers: The block device /dev/sdd would be added to the Data tier but is already in use in the Cache tier
[root@storageqe-24 ~]#

Comment 13 errata-xmlrpc 2020-04-28 15:41:56 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1634


Note You need to log in before you can comment on or make changes to this bug.