Giter VIP home page Giter VIP logo

gluster-block's Introduction

gluster-block

gluster-block is a CLI utility, which aims at making Gluster backed block storage creation and maintenance as simple as possible.

Maintenance Status


⚠️ IMPORTANT - Please read this section carefully if you are currently using or plan to use gluster-block or want to contribute to the project. ⚠️

As of gluster-block release v5.1 the project is considered to be in maintenance only status. This means that only major bugs, performance regressions, or security defects are being considered for inclusion by the project team. Please also expect slow replies to issues.

Thank you for your understanding.

Demo


asciicast

Install


# git clone https://github.com/gluster/gluster-block.git
# cd gluster-block/

# dnf install gcc autoconf automake make file libtool libuuid-devel json-c-devel glusterfs-api-devel glusterfs-server tcmu-runner targetcli

On Fedora27 and Centos7 [Which use legacy glibc RPC], pass '--enable-tirpc=no' flag at configure time
# ./autogen.sh && ./configure --enable-tirpc=no && make -j install

On Fedora28 and higher [Which use TIRPC], in addition to above, we should also install
# dnf install rpcgen libtirpc-devel

And pass '--enable-tirpc=yes'(default) flag or nothing at configure time
# ./autogen.sh && ./configure && make -j install

Usage


Prerequisites: this guide assumes that the following are already present

  • A block hosting gluster volume with name 'hosting-volume'
  • Open 24007(for glusterd) 24010(gluster-blockd) 3260(iscsi targets) 111(rpcbind) ports and glusterfs service in your firewall

Daemon: gluster-blockd runs on all the nodes

# gluster-blockd --help
gluster-blockd (0.4)
usage:
  gluster-blockd [--glfs-lru-count <COUNT>]
                 [--log-level <LOGLEVEL>]
                 [--no-remote-rpc]

commands:
  --glfs-lru-count <COUNT>
        Glfs objects cache capacity [max: 512] [default: 5]
  --log-level <LOGLEVEL>
        Logging severity. Valid options are,
        TRACE, DEBUG, INFO, WARNING, ERROR, CRIT and NONE [default: INFO]
  --no-remote-rpc
        Ignore remote rpc communication, capabilities check and
        other node sanity checks
  --help
        Show this message and exit.
  --version
        Show version info and exit.

You can run gluster-blockd as systemd service, note '/etc/sysconfig/gluster-blockd' is the configuration file which gets dynamicaly reloaded on changing any options.

# cat /etc/sysconfig/gluster-blockd
# systemctl daemon-reload
# systemctl start gluster-blockd

CLI: you can choose to run gluster-block(cli) from any node which has gluster-blockd running

# gluster-block --help
gluster-block (0.4)
usage:
  gluster-block [timeout <seconds>] <command> <volname[/blockname]> [<args>] [--json*]

commands:
  create  <volname/blockname> [ha <count>]
                              [auth <enable|disable>]
                              [prealloc <full|no>]
                              [storage <filename>]
                              [ring-buffer <size-in-MB-units>]
                              [block-size <size-in-Byte-units>]
                              [io-timeout <N-in-Second>]
                              <host1[,host2,...]> [size]
        create block device [defaults: ha 1, auth disable, prealloc full, size in bytes,
                             ring-buffer and block-size default size dependends on kernel,
                             io-timeout 43s]

  list    <volname>
        list available block devices.

  info    <volname/blockname>
        details about block device.

  delete  <volname/blockname> [unlink-storage <yes|no>] [force]
        delete block device.

  modify  <volname/blockname> [auth <enable|disable>] [size <size> [force]]
        modify block device.

  replace <volname/blockname> <old-node> <new-node> [force]
        replace operations.

  reload <volname/blockname> [force]
        reload a block device.

  genconfig <volname[,volume2,volume3,...]> enable-tpg <host>
        generate the block volumes target configuration.

  help
        show this message and exit.

  version
        show version info and exit.

common cli options: (fixed formats)
  timeout <seconds>
        it is the time in seconds that cli can wait for daemon to respond.
        [default: timeout 300]
  --json*
        used to request the output result in json format [default: plain text]
        supported JSON formats: --json|--json-plain|--json-spaced|--json-pretty

Example:

The hosts involved:

  • 192.168.1.11, 192.168.1.12, 192.168.1.13: All nodes run gluster-blockd.service and glusterd.service (three nodes to achieve mutipath for HA)
  • 192.168.1.14: Initiator, iSCSI client

Preparation:

  • Create a gluster trusted storage pool of the 3 nodes 192.168.1.11, 192.168.1.12, and 192.168.1.13.
  • Create a block hosting gluster volume called hosting-volume on the gluster cluster.
    • Read More on how to create a gluster volume.
    • We recommend replica 3 volume with group profile applied on it.
      • Helpful command: # gluster vol set <block-hosting-volume> group gluster-block

You can execute gluster-block CLI from any of the 3 nodes where glusterd and gluster-blockd are running.

On the Server/Target node[s]
Create 1G gluster block storage with name 'block-volume'
# gluster-block create hosting-volume/block-volume ha 3 192.168.1.11,192.168.1.12,192.168.1.13 1GiB
IQN: iqn.2016-12.org.gluster-block:aafea465-9167-4880-b37c-2c36db8562ea
PORTAL(S): 192.168.1.11:3260 192.168.1.12:3260 192.168.1.13:3260
RESULT: SUCCESS

Enable Authentication (this can be part of create as well)
# gluster-block modify hosting-volume/block-volume auth enable
IQN: iqn.2016-12.org.gluster-block:aafea465-9167-4880-b37c-2c36db8562ea
USERNAME: aafea465-9167-4880-b37c-2c36db8562ea
PASSWORD: 4a5c9b84-3a6d-44b4-9668-c9a6d699a5e9
SUCCESSFUL ON:  192.168.1.11 192.168.1.12 192.168.1.13
RESULT: SUCCESS

# gluster-block list hosting-volume
block-volume

# gluster-block info hosting-volume/block-volume
NAME: block-volume
VOLUME: hosting-volume
GBID: 6b60c53c-8ce0-4d8d-a42c-5b546bca3d09
SIZE: 1.0 GiB
HA: 3
EXPORTED NODE(S): 192.168.1.11 192.168.1.12 192.168.1.13

NOTE: Block targets created using gluster-block utility will use TPG: 1 and LUN: 0.

On the Client/Initiator node
# dnf install iscsi-initiator-utils device-mapper-multipath
# systemctl start iscsid.service
# systemctl enable iscsid.service
# lsblk (note the available devices)

You can skip configuring multipath, if you choose not to enable mpath.
Below we set mapth in Active/Passive mode; Note currently Active/Active is not supported.
# modprobe dm_multipath
# mpathconf --enable

Please add the below configuration at the end of /etc/multipath.conf file.

For tcmu-runner version < 1.4.0, use:
# LIO iSCSI
devices {
        device {
                vendor "LIO-ORG"
                user_friendly_names "yes" # names like mpatha
                path_grouping_policy "failover" # one path per group
                path_selector "round-robin 0"
                failback immediate
                path_checker "tur"
                prio "const"
                no_path_retry 120
                rr_weight "uniform"
        }
}

For tcmu-runner version >= 1.4.0, use:
# LIO iSCSI
devices {
        device {
                vendor "LIO-ORG"
                user_friendly_names "yes" # names like mpatha
                path_grouping_policy "failover" # one path per group
                hardware_handler "1 alua"
                path_selector "round-robin 0"
                failback immediate
                path_checker "tur"
                prio "alua"
                no_path_retry 120
                rr_weight "uniform"
        }
}

# systemctl restart multipathd
# systemctl enable multipathd

Discovery ...
# iscsiadm -m discovery -t st -p 192.168.1.11

Update Credentials (Skip this step incase if you have not enabled auth)
# iscsiadm -m node -T "iqn.2016-12.org.gluster-block:aafea465-9167-4880-b37c-2c36db8562ea" -o update
 -n node.session.auth.authmethod -v CHAP -n node.session.auth.username -v aafea465-9167-4880-b37c-2c36db8562ea -n node
.session.auth.password -v 4a5c9b84-3a6d-44b4-9668-c9a6d699a5e9

Login ...
# iscsiadm -m node -T "iqn.2016-12.org.gluster-block:aafea465-9167-4880-b37c-2c36db8562ea" -l

# lsblk (note the new devices, let's say sdb, sdc and sdd multipath to mpatha)
# mkfs.xfs /dev/mapper/mpatha
# mount /dev/mapper/mpatha /mnt
On the Server/Target node[s] to resize the block volume
Resizing 1G gluster block volume 'block-volume' to 2G
# gluster-block modify hosting-volume/block-volume size 2GiB
IQN: iqn.2016-12.org.gluster-block:aafea465-9167-4880-b37c-2c36db8562ea
SIZE: 2.0 GiB
SUCCESSFUL ON: 192.168.1.11 192.168.1.12 192.168.1.13
RESULT: SUCCESS
On Initiator side, commands to refresh the device after block volume resizing
Rescan the devices
# iscsiadm -m node -R

Rescan the multipath
# multipathd -k'resize map mpatha'

Grow the filesystem
# xfs_growfs  /mnt
Deleting the block volume
On client node
# umount /mnt
# iscsiadm -m node -u

On the server node
# gluster-block delete hosting-volume/block-volume
SUCCESSFUL ON: 192.168.1.11 192.168.1.12 192.168.1.13
RESULT: SUCCESS

NOTE: gluster-block cannot track iSCSI targets created manually using targetcli.


About Gluster

Gluster is a well known scale-out distributed storage system, flexible in its design and easy to use. One of its key goals is to provide high availability of data. Gluster is very easy to setup and use. Addition and removal of storage servers from a Gluster cluster is intuitive. These capabilities along with other data services that Gluster provides makes it a reliable software defined storage platform.

We can access glusterfs via FUSE module. However to perform a single filesystem operation various context switches are required which can often exhibit performance issues. Libgfapi is a userspace library for accessing data in Glusterfs. It can perform I/O on gluster volumes without the FUSE module, kernel VFS layer and hence requires no context switches. It exposes a filesystem like API for accessing gluster volumes. Samba, NFS-Ganesha, QEMU and now the tcmu-runner all use libgfapi to integrate with Gluster.

A unique distributed storage solution build on traditional filesystems

How we provide block storage in gluster ?

untitled diagram

  1. Create a file in the gluster volume (Block Hosting Volume)
  2. We expose the file in the gluster volume as tcmu backstore using tcmu-runner, exporting the target file as iSCSI LUN and
  3. From the initiator we login to the exported LUN and play with the block device

Background

The SCSI subsystem uses a form of client-server model. The Client/Initiator request I/O happen through target which is a storage device. The SCSI target subsystem enables a computer node to behave as a SCSI storage device, responding to storage requests by other SCSI initiator nodes.

In simple terms SCSI is a set of standards for physically connecting and transferring data between computers and peripheral devices.

The most common implementation of the SCSI target subsystem is an iSCSIserver, iSCSI transports block level data between the iSCSI initiator and the target which resides on the actual storage device. iSCSi protocol wraps up the SCSI commands and sends it over TCP/IP layer. Up on receiving the packets at the other end it disassembles them to form the same SCSI commands, hence on the OS’es it seen as local SCSI device.

In other words iSCSI is SCSI over TCP/IP.

The LIO project began with the iSCSI design as its core objective, and created a generic SCSI target subsystem to support iSCSI. LIO is the SCSI target in the Linux kernel. It is entirely kernel code, and allows exported SCSI logical units (LUNs) to be backed by regular files or block devices.

LIO is Linux IO target, is an implementation of iSCSI target.

TCM is another name for LIO, an in-kernel iSCSI target (server). As we know existing TCM targets run in the kernel. TCMU (TCM in Userspace) allows userspace programs to be written which act as iSCSI targets. These enables wider variety of backstores without kernel code. Hence the TCMU userspace-passthrough backstore allows a userspace process to handle requests to a LUN. TCMU utilizes the traditional UIO subsystem, which is designed to allow device driver development in userspace.

One such backstore with best clustered network storage capabilities is GlusterFS

Any TCMU userspace-passthrough can utilize the TCMU framework handling the messy details of the TCMU interface. One such passthrough is Tcmu-runner (Thanks to Andy Grover). Tcmu-runner has a glusterfs handler that can interact with the backed file in gluster volume over gluster libgfapi interface and can show it as a target (over network).

Some responsibilities of userspace-passthrough include,

Discovering and configuring TCMU UIO devices waiting for the events on the device and managing the command ring buffers

TargetCli is the general management platform for the LIO/TCM/TCMU. TargetCli with its shell interface is used to configure LIO.

Think it like a shell which makes life easy in configuring LIO core


How to quickly bringup gluster-block environment locally ?

Fedora:
# dnf -y install qemu libvirt libvirt-devel ruby-devel gcc vagrant ansible

CentOS:
# yum -y install qemu libvirt libvirt-devel ruby-devel gcc qemu-kvm ansible

Note: Please download and install vagrant package for CentOS from:
https://www.vagrantup.com/downloads.html


Start and enable libvirtd service
# systemctl start libvirtd
# systemctl enable libvirtd

Now install vagrant libvirt plugin
# vagrant plugin install vagrant-libvirt

Make sure you are in gluster-block root directory
# vagrant up

Managing the vagrant Vm's

To check VMs status
# vagrant status

To ssh and get access to a VM
# vagrant ssh {name}

To stop the VMs
# vagrant halt

To destroy the VMs
# vagrant destroy

Check more commands with
# vagrant list-commands

License

gluster-block is licensed to you under your choice of the GNU Lesser General Public License, version 3 or any later version (LGPLv3 or later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation.

Maintainers

See MAINTAINERS file

Community

  • Please join our mailing list
  • To ask a question or start a discussion, you can also raise an issue
  • IRC: #gluster-devel on Freenode

gluster-block's People

Contributors

amarts avatar bhumikagoyal avatar lxbsz avatar nixpanic avatar obnoxxx avatar pkalever avatar potatogim avatar sankarshanmukhopadhyay avatar saravanastoragenetwork avatar vbellur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gluster-block's Issues

Do we need versioning for metafile?

It seems like we need something similar to op-version in glusterd so that gluster-blockds will accept commands that are in all gluster-blockds just like how glusterd does it now.

Authentication for block devices

There is no good way to authenticate initiators logging into block devices with v0.1.1.1. It would be good to add username/password and other forms of authentication for block devices in gluster-block.

Support for snapshots

It would be great if the gluster-block CLI can provide support for snapshots. A naive implementation can create a (full) copy of the file that is used by tcmu-runner. The minimal usable functionality should support the following commands:

  • create-snapshot [--tag=<TAG>] <VOLNAME/BLOCKNAME>: create a copy of the <VOLNAME/BLOCKNAME> file with the optional user provided <TAG> added to the xattrs of the copy (the filename of the snapshot should probably be appended with a UUID for identification)
  • list-snapshots <VOLNAME/BLOCKNAME>: show all snapshots that are available for the <VOLNAME/BLOCKNAME>, and list UUID, creation date and <TAG>
  • restore-snapshot <VOLNAME/BLOCKNAME> <UUID>: deletes/renames the current <VOLUME/BLOCKNAME> and copies the snapshot back to <VOLNAME/BLOCKNAME>
  • delete-snapshot <VOLNAME/BLOCKNAME> <UUID>: deletes the snapshot

This requires gluster-blockd to flush+freeze access to the <VOLNAME/BLOCKNAME> (similar to fsfreeze) while snapshot operations are in progress. This functionality might need to be implemented in targetcli and tcmu-runner.

Future versions of Gluster may offer more efficient methods for storing snapshots of files (reflink?), but the majority of the required functionality will stay the same for most of the other involved components.

gluster-block need the ALUA feature to support the HA.

The alua is a must for gluster-block, because due to the design of the LIO & tcmu, if one path has been blocked for a long time (such as due to the network's reason) then the IO requests on the client side will time-out and try to resend the IO requests through the other available path(HA). Just then if the blocked path recover and if it continue the old IO requests to the backend, then we are prone to overwrite or data crash issues.

NOTE:

Lock Type:
1,An exclusive-lock is needed

Important APIs:
1, glfs_block_lock_get_owners(): One way to get the current owner of the exclusive-lock of the file backend.
2, glfs_block_is_exclusive_lock_owner():One way to check whether the current target in current node is the owner.
3, glfs_block_lock_break(): Try to break the lock owned by one target in another node.
4, glfs_block_lock_acquire(): Try to acquire the lock and to be the lock owner.
5, ....

The tcmu's framework about ALUA's implementing is :
1, If the ALUA is enabled and used, the multipath actually is in AP mode here, the tcmu is just using the ALUA proto to support failover feature, that's all.
2, Only one path could be used and keep alive at a time as we know for the AP mode.
3, If the Active path, in nodeA for example, is timed out or died, the multipath in client side will try another one, nodeB.
4, The nodeB will try to get the owner of the lock and then breaks it, if it is successful then try to acquire the lock.
5, If every thing is okay in nodeB, then the path will be switched to nodeB, that's to say all the old IOs from nodeA should
be discarded by the beckend. To do this maybe we should add one new feature like Ceph's watcher and blacklist.

Then how does Ceph's watcher and blacklist work like? In short:
Firstly, all the tcmu nodes should register a watcher to the Ceph cluster.
Secondly, the ceph cluster will watch all the tcmu nodes and check the health of them.
Lastly, if any of the nodes is died or something wrong, the ceph cluster will add the node to blacklist and then forbid any operation from it before it is removed from the blacklist.

'gluster-block list <volume>' dumps a core when executed as non-root

The following backtrace:

Core was generated by `gluster-block list block'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  ___fprintf_chk (fp=0x0, flag=1, format=0x562a6629deda "[%s] %s: %s [at %s+%d :<%s>]\n") at fprintf_chk.c:30
30        _IO_acquire_lock_clear_flags2 (fp);
(gdb) bt
#0  ___fprintf_chk (fp=0x0, flag=1, format=0x5575324eceda "[%s] %s: %s [at %s+%d :<%s>]\n") at fprintf_chk.c:30
#1  0x00005575324eadf7 in fprintf (__fmt=0x5575324eceda "[%s] %s: %s [at %s+%d :<%s>]\n", __stream=0x0) at /usr/include/bits/stdio2.h:97
#2  glusterBlockCliRPC_1 (cobj=<optimized out>, opt=<optimized out>) at gluster-block.c:159
#3  0x00005575324e992f in glusterBlockList (json=<optimized out>, options=0x7ffe474882f8, argcount=3) at gluster-block.c:425
#4  glusterBlockParseArgs (options=0x7ffe474882f8, count=3) at gluster-block.c:527
#5  main (argc=<optimized out>, argv=0x7ffe474882f8) at gluster-block.c:580
(gdb) f 2
#2  glusterBlockCliRPC_1 (cobj=<optimized out>, opt=<optimized out>) at gluster-block.c:159
159         LOG("cli", GB_LOG_ERROR, "%s", errMsg);
(gdb) p errMsg
$1 = "/var/run/gluster-blockd.socket: connect failed (Permission denied)", '\000' <repeats 1981 times>

It seems the error message is appropriate, but is not logged. Possibly commit a2dff33 fixes the coredump and gives the user the error back?

The best way to allow max block to be settable

@pkalever @pranithk @vbellur @ALL

As we discussed last meeting, if we will allow the max block to be settable for each target device. Which is the best way to do ?

1, intergrated into create command:

commands:
create <volname/blockname> [ha ]
[auth <enable|disable>]
[prealloc <full|no>]
[storage ]
<host1[,host2,...]>
[rb_size <size>]
create block device [defaults: ha 1, auth disable, prealloc no, size in bytes, rb_size as default in kernel]

2, In the config file as a parameter.

NOTE: currently the default RingBuffer size for data block is 8M, and the max settable is 64M for each target device.

Thanks,

glibc will remove bundled rpc/xdr/.. functions, libtirpc should be used instead

Fedora 28 already has an updated glibc package and gluster-block fails to build now (Fedora BZ#1556639).

It seems the following changes are needed:

  • rpcgen is in its own package now (specfile update)
  • the new rpcgen does not support the -M option (Makefile.am changes)
  • libtirpc is needed as a build dependency (specfile and configure.ac change)
  • a change in generated function signatures (calling in block_svc_routines.c needs adjusting)

Support for resizing the block device

Currently we do create the requested size(pre-allocated file) and the the size is kept constant though out the life of that block device.

We can have support for resizing (mostly increasing) a block device.

Auditing of gluster-block commands

Need a file / mechanism to log all requests that gluster-block daemon receives. It would be good to log the network identity of the requestor along with details about the request. Logging response status of requests received would be needed as well.

gluster-block should support a way to create storage Objects from fuse mount dir via FileIO

$ gluster-block help
gluster-block (0.3)
usage:
   gluster-block <volname[/blockname]> [] [--json*]

commands:
   create <volname/blockname> [ha ]
            [type <glfs|fuse>
            [auth <enable|disable>]
            [prealloc <full|no>]
            [storage ]
            <host1[,host2,...]>
      create block device [defaults: ha 1, auth disable, prealloc no, size in bytes]
[...]

$ targetcli ls
o- / ................................................ [...]
o- backstores ..................................... [...]
| o- block ......................... [Storage Objects: 0]
| o- fileio ........................ [Storage Objects: 1]
| | o- block [/var/run/gluster-block/test/block-store/f9774c6b-6249-409d-bd5c-8f6b55173b96 (1.0GiB) write-back activated]
| | o- alua .......................... [ALUA Groups: 1]
| | o- default_tg_pt_gp [ALUA state: Active/optimize
d]
| o- pscsi ......................... [Storage Objects: 0]
| o- ramdisk ....................... [Storage Objects: 0]
| o- user:glfs ..................... [Storage Objects: 0]
o- iscsi ................................... [Targets: 1]
| o- iqn.2016-12.org.gluster-block:f9774c6b-6249-409d-bd5c-8f6b55173b96 [TPGs: 1]
| o- tpg1 ......................... [gen-acls, no-auth]
| o- acls ................................. [ACLs: 0]
| o- luns ................................. [LUNs: 1]
| | o- lun0 [fileio/block (/var/run/gluster-block/test/block-store/f9774c6b-6249-409d-bd5c-8f6b55173b96)
(default_tg_pt_gp)]
| o- portals ........................... [Portals: 1]
| o- 10.215.99.133:3260 ...................... [OK]
o- loopback ................................ [Targets: 0]
o- vhost ................................... [Targets: 0]

Inconsistency seen after reboot during create

I was attempting to create a block-device when one of the nodes rebooted. After the node rebooted, I experience inconsistencies with respect to the block device. Some details below:

1> Output of info soon after node rebooted
gluster-block info nr/ebd
NAME: ebd
VOLUME: nr
GBID: d1dfafbb-7ddd-4941-b1be-d2c05426af2d
SIZE: 322122547200
HA: 2
PASSWORD:
BLOCK CONFIG NODE(S): 10.16.154.39

2> Log output from the node which rebooted during create

[1497349283] INFO: Block create request satisfied for target: d1 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349290] INFO: Block create request satisfied for target: d2 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349298] INFO: Block create request satisfied for target: d3 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349306] INFO: Block create request satisfied for target: d4 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349314] INFO: Block create request satisfied for target: d5 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349322] INFO: Block create request satisfied for target: d6 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349330] INFO: Block create request satisfied for target: d7 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349339] INFO: Block create request satisfied for target: d8 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349347] INFO: Block create request satisfied for target: d9 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349356] INFO: Block create request satisfied for target: d10 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349365] INFO: Block create request satisfied for target: d11 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
[1497349374] INFO: Block create request satisfied for target: d12 on volume nr with given hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1118 :]
...skipping...
or block ebd on volume nr with hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1156 :]
[1497416099] INFO: Trying to serve request for (ebd) on volume nr from spare machines [at block_svc_routines.c+1149 :]
[1497416100] ERROR: failed in remote create for block ebd on host 10.16.154.36 volume (null) [at block_svc_routines.c+497 :]
[1497416100] ERROR: failed in remote create for block ebd on host 10.16.154.39 volume (null) [at block_svc_routines.c+497 :]
[1497416100] WARNING: glusterBlockCreateRemoteAsync: return -1 failed in remote async create for block ebd on volume nr with hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1156 :]
[1497416100] INFO: Trying to serve request for (ebd) on volume nr from spare machines [at block_svc_routines.c+1149 :]
[1497416100] ERROR: failed in remote create for block ebd on host 10.16.154.36 volume (null) [at block_svc_routines.c+497 :]
[1497416100] ERROR: failed in remote create for block ebd on host 10.16.154.39 volume (null) [at block_svc_routines.c+497 :]
[1497416100] WARNING: glusterBlockCreateRemoteAsync: return -1 failed in remote async create for block ebd on volume nr with hosts 10.16.154.36,10.16.154.39 [at block_svc_routines.c+1156 :]
[1497416100] INFO: Trying to serve request for (ebd) on volume nr from spare machines [at block_svc_routines.c+1149 :]
[2017-06-14 04:55:01.309204] ERROR: bind on port 24006 failed (Address already in use) [at gluster-blockd.c+172 :]

root@ose3-master: /var/log/gluster-block # gluster-block --version
gluster-block (0.2.1)
Repository rev: https://github.com/gluster/gluster-block.git
Copyright (c) 2016 Red Hat, Inc. https://redhat.com/
gluster-block comes with ABSOLUTELY NO WARRANTY.
It is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3
or later), or the GNU General Public License, version 2 (GPLv2),
in all cases as published by the Free Software Foundation.

3> Deletion of the device failed and the block config node changed to .36. Previously .39 was being listed as the configured node.

root@ose3-master: /var/log/gluster-block # gluster-block delete nr/ebd
FAILED ON: 10.16.154.36
SUCCESSFUL ON: 10.16.154.39
RESULT: FAIL
root@ose3-master: /var/log/gluster-block #
root@ose3-master: /var/log/gluster-block # gluster-block info nr/ebd
NAME: ebd
VOLUME: nr
GBID: d1dfafbb-7ddd-4941-b1be-d2c05426af2d
SIZE: 322122547200
HA: 2
PASSWORD:
BLOCK CONFIG NODE(S): 10.16.154.36

  1. Output of metadata configuration
    ==========================

root@ose3-master: /mnt/glusterfs # cat block-meta/ebd
VOLUME: nr
GBID: d1dfafbb-7ddd-4941-b1be-d2c05426af2d
SIZE: 322122547200
HA: 2
ENTRYCREATE: INPROGRESS
ENTRYCREATE: SUCCESS
10.16.154.36: CONFIGINPROGRESS
10.16.154.39: CONFIGINPROGRESS
10.16.154.36: CONFIGFAIL
10.16.154.39: CONFIGFAIL
10.16.154.36: CLEANUPINPROGRESS
10.16.154.39: CLEANUPINPROGRESS
10.16.154.36: CLEANUPFAIL
10.16.154.39: CLEANUPFAIL
10.16.154.36: CLEANUPINPROGRESS
10.16.154.39: CLEANUPINPROGRESS
10.16.154.39: CLEANUPSUCCESS

Modify succeeds even when tcmu-runner is not running

root@dhcp35-190 - ~
22:04:52 :( ⚡ gluster-block create r3/1-img ha 1 192.168.122.1 1GiB
IQN: iqn.2016-12.org.gluster-block:799008ab-4bf5-46f7-b2ed-c04320aae32c
PORTAL(S): 192.168.122.1:3260
RESULT: SUCCESS

Bring tcmu-runner down on the node where the block is configured. After that:
root@dhcp35-190 - ~
22:05:50 :) ⚡ gluster-block delete r3/1-img
tcmu-runner is not running in few nodes
RESULT:FAIL

This marks the block as CLEANUPINPROGRESS so next commands won't consider this node for execution, because of this:
root@dhcp35-190 - ~
22:06:45 :( ⚡ gluster-block modify r3/1-img auth enable
IQN: iqn.2016-12.org.gluster-block:799008ab-4bf5-46f7-b2ed-c04320aae32c
USERNAME: 799008ab-4bf5-46f7-b2ed-c04320aae32c
PASSWORD: 1490c6ec-8519-4a53-8524-037781f941c8
RESULT: SUCCESS

gluster-blockd should die giving a good error message when there are errors while coming up

Even when rpc register fails gluster-blockd keeps running but is not operational and doesn't recieve gluster-block rpcs from other servers. Instead when it goes to this state, it should die gracefully giving the reason why it is terminating.

This is the only hint we will find in the logs as to why things are not working as expected.

[2017-06-13 09:04:54.256866] ERROR: unable to register (GLUSTER_BLOCK, GLUSTER_BLOCK_VERS: Invalid argument) [at gluster-blockd.c+188 :]

Redirect Configshell logs to $PATH/var/log/gluster-block/

Currently

$ targetcli get global
GLOBAL CONFIG GROUP
===================
[...]
logfile=hello
-------------
Logfile to use.

loglevel_console=info
---------------------
Log level for messages going to the console.

loglevel_file=debug
-------------------
Log level for messages going to the log file.
[...]

i.e configshell logs are collected at ./hello file.

fix for this issue:
Set logfile="PATH/var/log/gluster-block/gluster-block-configshell.log"

Any betterment at logfile name are appreciated.

cli command to generate the configuration

Add a capability in gluster-block to support regeneration of configuration

$ gluster-block help
gluster-block (e5d3252)
usage:
gluster-block <volname[/blockname]> [] [--json*]

commands:
[...]
regenconfig <volname[,volume2,volume3,...]> enable
regenerate block configuration for volume[s] in list, enabling host.
[...]
supported JSON formats:
--json|--json-plain|--json-spaced|--json-pretty

$ gluster-block regenconfig testvol1,testvol2 enable 10.215.99.133
{
"storage_objects":[
{
"attributes":{
"cmd_time_out":0,
"dev_size":1073741824
},
"config":"glfs/[email protected]/block-store/694c4028-039a-4e28-929e-50a2c0988e95",
"name":"block",
"plugin":"user",
"size":1073741824,
"wwn":"694c4028-039a-4e28-929e-50a2c0988e95"
},
...
}

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1555191

remove PULL_REQUEST_TEMPLATE

As we want to start allowing reviews on github, let us remove the msg mentioning "gluster-block does not use GitHub Pull-Requests" from .github/PULL_REQUEST_TEMPLATE

Add support for node ACL's

The current gluster-block model goes with noAUTH, i.e no authentication required for client to login to a target portal.
Hence Node ACL's support must be added.

[RFC] gluster-block support json response

gluster-block should respond in json foramt to applications who calls gluster-block cli with 'json' argumnet.

Sample output responses for each of the supported command should look like below,

Create response:

# gluster-block create sampleVol/block1 ha 2 dhcp35-1.lab.eng.blr.redhat.com,dhcp35-2.lab.eng.blr.redhat.com 1GiB json
{
   "create":{
      "IQN":"iqn.2016-12.org.gluster-block:1914e2f7-00d7-4314-a4ff-5d25d37cdc13",
      "PORTAL(S)":[
         "dhcp35-1.lab.eng.blr.redhat.com",
         "dhcp35-2.lab.eng.blr.redhat.com"
      ],
      "RESULT":"SUCCESS"
   }
}

List response:

# gluster-block list sampleVol json
{
   "list":{
      "blocks":[
         "block1",
         "block2",
         "block3"
      ]
   }
}

Info response:

# gluster-block info sampleVol/block1 json
{
   "info":{
      "NAME":"block1",
      "volume":"sampleVol",
      "GBID":"1914e2f7-00d7-4314-a4ff-5d25d37cdc13",
      "SIZE":"1073741824",
      "HA":"1",
      "BLOCK CONFIG NODE(S)":[
         "dhcp35-1.lab.eng.blr.redhat.com",
         "dhcp35-2.lab.eng.blr.redhat.com"
      ]
   }
}

Delete Resposnse:

# gluster-block delete sampleVol/block1 json
{
   "delete":{
      "SUCCESSFUL ON":[
         "dhcp35-1.lab.eng.blr.redhat.com",
         "dhcp35-2.lab.eng.blr.redhat.com"
      ],
      "RESULT":"SUCCESS"
   }
}

Please comment your opinion on the syntax and schema.

Gluster-block create fails on f24

[root@gd2-1 gluster-block]# /usr/local/sbin/gluster-block create test/block ha 1 `hostname` 1GiB
(null)
RESULT:FAIL
[root@gd2-1 gluster-block]# tcmu-runner --version
tcmu-runner 1.1.3
[root@gd2-1 gluster-block]# targetcli --version
/bin/targetcli version 2.1.fb43
[root@gd2-1 gluster-block]# cat /etc/redhat-release 
Fedora release 24 (Twenty Four)
[root@gd2-1 gluster-block]# uname -a
Linux gd2-1 4.11.4-100.fc24.x86_64 #1 SMP Wed Jun 7 20:06:39 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

[2017-06-15 05:50:59.423033] INFO: create cli request, volume=test blockname=block mpath=1 blockhosts=gd2-1 authmode=0 size=1073741824 [at block_svc_routines.c+1722 :<block_create_cli_1_svc>]
[2017-06-15 05:50:59.438466] INFO: create request, volume=test blockname=block blockhosts=gd2-1 filename=c0d3a400-83a0-40dd-8e26-8824c5e8aef2 authmode=0 passwd= size=1073741824 [at block_svc_routines.c+1947 :<block_create_1_svc>]
[2017-06-15 05:51:02.308872] INFO: command exit code, 1 [at block_svc_routines.c+2076 :<block_create_1_svc>]
[2017-06-15 05:51:02.312805] ERROR: failed in remote create for block block on host gd2-1 volume test [at block_svc_routines.c+523 :<glusterBlockCreateRemote>]
[2017-06-15 05:51:02.313230] WARNING: glusterBlockCreateRemoteAsync: return -1 failed in remote async create for block block on volume test with hosts gd2-1 [at block_svc_routines.c+1829 :<block_create_cli_1_svc>]
[2017-06-15 05:51:02.314031] WARNING: No Spare nodes to create (block): rollingback creation of target on volume test with given hosts gd2-1 [at block_svc_routines.c+1151 :<glusterBlockAuditRequest>]
[2017-06-15 05:51:02.318241] INFO: delete request, blockname=block filename=c0d3a400-83a0-40dd-8e26-8824c5e8aef2 [at block_svc_routines.c+2256 :<block_delete_1_svc>]
[2017-06-15 05:51:03.136770] INFO: command exit code, 0 [at block_svc_routines.c+2323 :<block_delete_1_svc>]
[2017-06-15 05:51:03.151319] ERROR: glusterBlockAuditRequest: return -1volume: test hosts: gd2-1 blockname block [at block_svc_routines.c+1837 :<block_create_cli_1_svc>]

CLI timeout should be explicitly mentioned

When we execute a CLI like:
gluster-block create v1/block7 ha 1 google.com 1GB --json-pretty

This command will error out after CLI timeout. but the CLI will silently error out with out mentioning any error. We should print an error message that the CLI timedout.

Add suppor for external gateways

Currently we support creating exporting targets only from gluster peer nodes.

By supporting external gateways(exporting LUNS on nodes other than gluster nodes) as an option we can load balance/protest against the cpu strife (on gluster nodes)

Rest interface for gluster-block

Implement a restful api interface in gluster-block.

Will update this issue with the api design | schematics once I have something.

Gluster-block command doesn't errors out or gives message when the gluster-blockd service is not running on the node

Description of problem:


When gluster-blockd service is not running on a system then if a gluster-block command is executed it doesn't errors out or give message about service not running.

systemctl status gluster-blockd
● gluster-blockd.service - Gluster block storage utility
Loaded: loaded (/usr/lib/systemd/system/gluster-blockd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@dhcp46-63 gluster-block]# gluster-block list blockstor

gluster-block-0.1.1-1.x86_64

How reproducible:
Always

Steps to Reproduce:

  1. Stop gluster-block service on any node
  2. execute gluster-block command e.g gluster-block list volname
  3. Check the output

Actual results:


The command just runs and does not gives any output in form of error message.

Expected results:


The command should fail telling gluster-blockd service is not running.

Additional info:

Block create help does not show the new option "prealloc <full|no>

gluster-block create help has no mention of newly added "prealloc <full|no>" option.

[root@dhcp47-121 ~]# gluster-block create
Inadequate arguments for create:
gluster-block create <volname/blockname> [ha ] [auth enable|disable] <HOST1[,HOST2,...]> [--json*]
[root@dhcp47-121 ~]#

"gluster-block help" does list it under the create section though. It seems to have gotten missed adding the same in "gluster-block create help"

Improve output of gluster-block info

Sample output of gluster-block info is as below:

gluster-block info rep/bd1
NAME: bd1
VOLUME: rep
GBID: 4ddce603-c1cc-496e-a0ba-d4f537c26422
SIZE: 53687091200
HA: 3
PASSWORD:
BLOCK CONFIG NODE(S): 10.16.154.60 10.16.154.45 10.16.154.63

Some suggested improvements:

  1. Displaying the size value in the unit it was configured (50 GiB in this case) or in a more human readable way would be nice.

  2. BLOCK CONFIG NODE(S) does not seem very intuitive. A better string like "Exported Node(S)" or something else might make it more intuitive.

clean metafile along with storage when EntryCreate fails

As of now, if an EntryCreate (backend storage create) fails for some reasons
like no space left, we only clean storage, leaving metafile.

$ gluster-block create sample1/block2 prealloc full 192.168.0.105 40GiBNot able to create metadata for sample1/block2[No space left on device]
RESULT:FAIL

$ tree /mnt/
/mnt/
├── block-meta
│   ├── block2
│   └── meta.lock
└── block-store
2 directories, 2 files

$ gluster-block delete sample1/block2
SUCCESSFUL ON: None
RESULT: FAIL

Create a new tpg instead of using the default one(named as default_tg_pt_gp)

To support the resize feature, we must fix the current tcmu-runner's bugs, which will bypass and ignore the default tpg. But the default tpg has some bugs in some kernel version, we'd better create a new tpg instead of the default one.

More detail about this please see tcmu-runner PR: open-iscsi/tcmu-runner#382

/**

  • tcmu_get_alua_grps: Fill group_list with the kernel's port groups.
  • @dev: device to get groups for.
  • @group_list: list allocated by the caller to add groups to.
  • User must call tcmu_release_alua_grps when finished with the list of
  • groups.
  • For now, we will only support ALUA if the user has defined groups.
  • tcmu ALUA support was added in 4.11, but not all fabric modules support
  • it. Depending on the kernel version and tools used we could have:
    1. The default ALUA group, but empty members.
    1. The default ALUA group, and reading/writing to members will return
  • a error or crash the kernel.
    1. The default ALUA group, and members set to it, but some fabric
  • modules did not report the target port group/tag properly so
  • we cannot match groups to ports.
    */

gluster-blockd crashes when we give invalid block-host

These are the steps I did to recreate the bug consistently:

[root@localhost block-meta]# gluster-block create v1/block3 ha 1 google.com 1GB --json-pretty
[root@localhost block-meta]# echo $?
255 <<--- Please note that there was no output.
[root@localhost block-meta]# ls # I was searching why this issue is happening for these two block-files
block1  block3  meta.lock
[root@localhost block-meta]# cat block3 # they have CONFIGINPROGRESS for google.com which will eventually fail and then gluster-blockd crashes
VOLUME: v1
GBID: 3798836d-1e3e-4b70-8e05-e8b187baaa1c
SIZE: 1073741824
HA: 1
ENTRYCREATE: INPROGRESS
ENTRYCREATE: SUCCESS
google.com: CONFIGINPROGRESS
[root@localhost block-meta]# cat block1
VOLUME: v1
GBID: ed260a6f-1550-4d36-b0c6-b35983eb76d0
SIZE: 1073741824
HA: 1
ENTRYCREATE: INPROGRESS
ENTRYCREATE: SUCCESS
google.com: CONFIGINPROGRESS
[root@localhost block-meta]# diff block1 block3
2c2
< GBID: ed260a6f-1550-4d36-b0c6-b35983eb76d0
---
> GBID: 3798836d-1e3e-4b70-8e05-e8b187baaa1c
[root@localhost block-meta]# gluster-block delete v1/block3
[root@localhost block-meta]# ls
block1  block3  meta.lock
[root@localhost block-meta]# systemctl status gluster-blockd
● gluster-blockd.service - Gluster block storage utility
   Loaded: loaded (/usr/lib/systemd/system/gluster-blockd.service; disabled; vendor preset: di
   Active: active (running) since Wed 2017-04-26 16:09:21 IST; 2min 13s ago
 Main PID: 7902 (gluster-blockd)
    Tasks: 13 (limit: 4915)
   CGroup: /system.slice/gluster-blockd.service
           └─7902 /usr/sbin/gluster-blockd

Apr 26 16:09:21 localhost.localdomain systemd[1]: Started Gluster block storage utility.
[root@localhost block-meta]# gluster-block delete v1/block3
[root@localhost block-meta]# systemctl status gluster-blockd
● gluster-blockd.service - Gluster block storage utility
   Loaded: loaded (/usr/lib/systemd/system/gluster-blockd.service; disabled; vendor preset: di
   Active: failed (Result: signal) since Wed 2017-04-26 16:11:37 IST; 10s ago
  Process: 7902 ExecStart=/usr/sbin/gluster-blockd (code=killed, signal=SEGV)
 Main PID: 7902 (code=killed, signal=SEGV)

Apr 26 16:09:21 localhost.localdomain systemd[1]: Started Gluster block storage utility.
Apr 26 16:11:37 localhost.localdomain systemd[1]: gluster-blockd.service: Main process exited,
Apr 26 16:11:37 localhost.localdomain systemd[1]: gluster-blockd.service: Unit entered failed 
Apr 26 16:11:37 localhost.localdomain systemd[1]: gluster-blockd.service: Failed with result '

Crash shows the following bt:
Thread 1 (Thread 0x7f320d44e700 (LWP 7723)):
#0  0x00007f320e46c046 in strlen () from /lib64/libc.so.6
#1  0x00007f320e46bd7e in strdup () from /lib64/libc.so.6
#2  0x00007f320e9adcab in json_object_new_string () from /lib64/libjson-c.so.2
#3  0x00005654cb1c25b9 in block_create_cli_format_response (blk=blk@entry=0x7f320d44d550, 
    errCode=255, errMsg=<optimized out>, savereply=0x7f32000ca4a0, reply=0x7f3200004f10)
    at block_svc_routines.c:975
#4  0x00005654cb1c2a38 in block_create_cli_1_svc (blk=blk@entry=0x7f320d44d550, 
    rqstp=rqstp@entry=0x7f320d44d7b0) at block_svc_routines.c:1185
#5  0x00005654cb1be1bb in gluster_block_cli_1 (rqstp=0x7f320d44d7b0, transp=0x7f3200002bd0)
    at block_svc.c:70
#6  0x00007f320e5192a1 in svc_getreq_common () from /lib64/libc.so.6
#7  0x00007f320e5193e7 in svc_getreq_poll () from /lib64/libc.so.6
#8  0x00007f320e51cd01 in svc_run () from /lib64/libc.so.6
#9  0x00005654cb1be055 in glusterBlockCliThreadProc (vargp=<optimized out>)
    at gluster-blockd.c:101
#10 0x00007f320f7176ca in start_thread () from /lib64/libpthread.so.0
#11 0x00007f320e4e6f6f in clone () from /lib64/libc.so.6
(gdb) fr 3
#3  0x00005654cb1c25b9 in block_create_cli_format_response (blk=blk@entry=0x7f320d44d550, 
    errCode=255, errMsg=<optimized out>, savereply=0x7f32000ca4a0, reply=0x7f3200004f10)
    at block_svc_routines.c:975
975	    json_object_object_add(json_obj, "IQN",
(gdb) l
970	    return;
971	  }
972	
973	  if (blk->json_resp) {
974	    json_obj = json_object_new_object();
975	    json_object_object_add(json_obj, "IQN",
976	                           json_object_new_string(savereply->iqn));
977	
978	    json_array = json_object_new_array();
979	
(gdb) p savereply->iqn
$1 = 0x0
(gdb) p errCode
$2 = 255
(gdb) p errMsg
$3 = <optimized out>

This test was done with an older patchset so the line numbers may not match.

Man page update

update gluster-block Man page with resize, replace, unlink-storage and storage options

single login per target

Currently from the initiator side we need to login to mpath number of node to get multipathed block devices at the client side. This can be minimized to single login per target by configuring all gateways for a particular target in all gateways.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.