ceph / ceph-iscsi-cli

NOTICE: moved to https://github.com/ceph/ceph-iscsi
GNU General Public License v3.0
25 stars 25 forks source link

It is not possible to create a target #79

Open VovanSSS opened 6 years ago

VovanSSS commented 6 years ago

Hello, i can not create a target, the python fouls and gwcli crashes out

[root@ceph1 ~]# gwcli 
/iscsi-target> create iqn.1998-01.com.mycompany:myserver
IOError: [Errno 22] Invalid argument
[root@ceph1 ~]# gwcli 
/iscsi-target> /iscsi-target create iqn.2003-01.com.redhat.iscsi-gw:hosting
IOError: [Errno 22] Invalid argument

Traceback:

/> /iscsi-target create iqn.2003-01.com.redhat.iscsi-gw:hosting
CMD: /iscsi create iqn.2003-01.com.redhat.iscsi-gw:hosting
Traceback (most recent call last):
  File "/usr/bin/gwcli", line 187, in <module>
    main()
  File "/usr/bin/gwcli", line 119, in main
    shell.run_interactive()
  File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 905, in run_interactive
    self._cli_loop()
  File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 734, in _cli_loop
    self.run_cmdline(cmdline)
  File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 848, in run_cmdline
    self._execute_command(path, command, pparams, kparams)
  File "/usr/lib/python2.7/site-packages/configshell_fb/shell.py", line 823, in _execute_command
    result = target.execute_command(command, pparams, kparams)
  File "/usr/lib/python2.7/site-packages/configshell_fb/node.py", line 1406, in execute_command
    return method(*pparams, **kparams)
  File "/usr/lib/python2.7/site-packages/gwcli/gateway.py", line 222, in ui_command_create
    local_lio = root.RTSRoot()
  File "/usr/lib/python2.7/site-packages/rtslib_fb/root.py", line 85, in __init__
    self._set_dbroot_if_needed()
  File "/usr/lib/python2.7/site-packages/rtslib_fb/root.py", line 167, in _set_dbroot_if_needed
    fwrite(dbroot_path, self._preferred_dbroot+"\n")
  File "/usr/lib/python2.7/site-packages/rtslib_fb/utils.py", line 79, in fwrite
    file_fd.write(str(string))
IOError: [Errno 22] Invalid argument

Packet version: targetcli-2.1.fb47-0.1.20170815.git5bf3517.el7.noarch python-rtslib-2.1.fb64-2.el7.noarch tcmu-runner-v1.3.0-0.4.23.g68fee8c.x86_64 ceph-iscsi-config-2.3-33.gae18773.el7.noarch ceph-iscsi-cli-2.5-75.g8181a92.el7.noarch

kernel: Linux ceph1 4.14.13-1.el7.elrepo.x86_64

In this case, the target is created with the kernel-3.10.0-693.11.6.el7.x86_64, but the kernel does not pass the version check and the disks can not be added

If you add a target on the old kernel and boot into the new one, then rbd-target-gw and rbd-target-cli crush

mikechristie commented 6 years ago

For the kernel issue, you should wait for that to be resolved upstream if you do not have access to the rhel beta kernels. If you try these hacks and tricks around it, you could end up with data corruption and crashes. They checks are there for a purpose. You can follow this issue to be notified when it is ready:

https://github.com/ceph/ceph-iscsi-cli/issues/36

The target maintainer came back this week and we just need 2 more patches merged from him. We are hoping this week he will be ready.

I think the bug you are hitting in the trace is just due to rtslib-fb/targetcli-fb not setting up some dirs it needs. If you installed it by doing "python setup.py install", then you also need to create a dir:

mkdir /var/target

Here is a doc for if your distro does not distribute the needed packages

http://docs.ceph.com/ceph-prs/19931/rbd/iscsi-target-cli-manual-install/