openebs-archive / libcstor

CAS Data Engine - Library to serve IOs on uZFS with synchronous replication, snapshots and clones
https://www.openebs.io
Apache License 2.0
18 stars 27 forks source link

feat(list_snap): LIST_SNAP uzfs ioctl implementation #49

Closed vishnuitta closed 4 years ago

vishnuitta commented 4 years ago

This PR adds the LIST_SNAP uzfs ioctl implementation. For command zfs listsnap <dataset>, output will be in json format as:

vitta@vitta-laptop:~/openebs/lzfs$ ./cmd/zfs/zfs listsnap pool1/ds0 | jq
{
  "name": "pool1/ds0",
  "snaplist": {
    "istgt1": null,
    "snap4": null,
    "istgt2": null,
    "snap1": null,
    "snap2": null,
    "istgt3": null,
    "snap3": null
  }
}

This will NOT list the snapshots created through 'zfs snapshot' until the zrepl is restarted. However, it lists the snapshots created through istgt iscsi target.

This command implementation reads the snapshot list from disk once and caches the list. This cache will be updated with snapshot name for every SNAP_CREATE command from istgt. This cache will be served for every trigger of this ioctl.

Working on testcases.

vishnuitta commented 4 years ago

Related PR to this in cstor: https://github.com/openebs/cstor/pull/295

mittachaitu commented 4 years ago

Can you update the PR description with updated sample JSON output?

Ok it was updated

pawanpraka1 commented 4 years ago

merged this, travis the failing as there is dependency on https://github.com/openebs/cstor/pull/295.