Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-8047

[targetcli] Creating fileio backstore without specifying file_or_dev full path can be problematic

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-9.1.0
    • targetcli
    • None
    • Moderate
    • rhel-sst-storage-io
    • ssg_filesystems_storage_and_HA
    • 3
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • If docs needed, set a value
    • None

      Description of problem:
      When creating a fileio backstore, users are allowed to specify file_or_dev without full path.
      The file location is then determined by the directory the command is being run from (or where the targetcli shell was started).

      If restoreconfig is then started from another directory, targetcli will create another file with the same name on that location.
      One example is when file is created in any other directory than root, rebooting the OS with target service enabled will create a new file under /

      1. cd /home/
      2. targetcli backstores/fileio create name=test size=100M file_or_dev=testfile
        Created fileio test with size 104857600
      1. cat /etc/target/saveconfig.json
        snip
        "dev": "testfile",
        "name": "test",
        snip

      I would suggest to update targetcli to always save full path to json or at least print warning.

      Version-Release number of selected component (if applicable):
      targetcli-2.1.53-7.el9.noarch
      python3-configshell-1.1.28-7.el9.noarch
      python3-rtslib-2.1.75-1.el9.noarch

      How reproducible:
      100%

      Steps to Reproduce:
      1. change directory to anything other than /
      2. create fileio backstore without full path
      3. run targetcli restoreconfig from other directory

      Actual results:
      new file created

      Expected results:
      users not being able to make this mistake

              mlombard@redhat.com Maurizio Lombardi
              mhoyer@redhat.com Martin Hoyer
              Maurizio Lombardi Maurizio Lombardi
              Zhaojuan Guo Zhaojuan Guo
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated: