Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NAS resources for filesystem, qtree & share #491

Merged
merged 9 commits into from
Mar 12, 2021

Conversation

joseph-v
Copy link
Collaborator

@joseph-v joseph-v commented Feb 17, 2021

What this PR does / why we need it:
Add NAS resource filesystem

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #477

Special notes for your reviewer:

Release note:

REST API tests:

1. Filesystem

Screenshot from 2021-03-03 16-15-04

2. Qtree

Screenshot from 2021-03-03 16-00-23

3. Share

Screenshot from 2021-03-03 16-14-43

@joseph-v joseph-v force-pushed the nas-driver-support branch 2 times, most recently from 6fa64b2 to 930d760 Compare February 17, 2021 06:55
@codecov
Copy link

codecov bot commented Feb 18, 2021

Codecov Report

Merging #491 (e4c64a7) into master (aa77007) will increase coverage by 0.19%.
The diff coverage is 72.01%.

@@            Coverage Diff             @@
##           master     #491      +/-   ##
==========================================
+ Coverage   67.96%   68.15%   +0.19%     
==========================================
  Files         113      119       +6     
  Lines        8218     8806     +588     
  Branches      926      983      +57     
==========================================
+ Hits         5585     6002     +417     
- Misses       2321     2467     +146     
- Partials      312      337      +25     
Impacted Files Coverage Δ
delfin/task_manager/tasks/resources.py 67.76% <39.08%> (-10.07%) ⬇️
delfin/api/views/filesystems.py 42.85% <42.85%> (ø)
delfin/api/views/qtrees.py 42.85% <42.85%> (ø)
delfin/api/views/shares.py 42.85% <42.85%> (ø)
delfin/drivers/driver.py 68.75% <50.00%> (-2.68%) ⬇️
delfin/api/v1/filesystems.py 52.00% <52.00%> (ø)
delfin/api/v1/qtrees.py 52.00% <52.00%> (ø)
delfin/api/v1/shares.py 52.00% <52.00%> (ø)
delfin/drivers/fake_storage/__init__.py 76.74% <53.84%> (-5.08%) ⬇️
delfin/db/sqlalchemy/api.py 79.56% <80.08%> (+0.18%) ⬆️
... and 12 more

@joseph-v joseph-v force-pushed the nas-driver-support branch 2 times, most recently from 5282466 to 84b1cd5 Compare February 18, 2021 05:22
@joseph-v joseph-v changed the title [WIP] Add NAS resource filesystem Add NAS resource filesystem Feb 26, 2021
delfin/api/v1/filesystems.py Show resolved Hide resolved

class QuotaState(object):
NORMAL = 'normal'
SOFT = 'soft_limit'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This state is not clear, Qtree having state= soft_limit means what?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State can be either in normal, soft_limit hit, hard_limit hit. When soft_limit, it is between normal and hard_limit

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Quota State reached Hard limit, what do we call "Hard" or "Abnormal"? Also, for Soft limit "Normal" or "Soft"?

free_capacity = Column(BigInteger)
compression = Column(Boolean)
deduplication = Column(Boolean)
worm = Column(Boolean)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_worm ??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifies if this is WORM filesystem


@check_deleted()
@set_synced_after()
def sync(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sync will be called for each subclass of StorageResourceTask ! how do we make sure it is called only if it the driver is an instance of NAS driver ?

@joseph-v joseph-v changed the title Add NAS resource filesystem Add NAS resources for filesystem, qtree & share Mar 3, 2021
@joseph-v joseph-v force-pushed the nas-driver-support branch 2 times, most recently from 5be7fcb to 1f63916 Compare March 3, 2021 10:47
ALL = (NORMAL, FAULTY)


class WORMType(object):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very clear as WORM is basically compliance or protection. Can we call it WORMProtection?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is Filesystem's worm type. Filesystem can be either worm or non_worm, if Filesystem is worm we give the type of worm.


class QuotaState(object):
NORMAL = 'normal'
SOFT = 'soft_limit'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Quota State reached Hard limit, what do we call "Hard" or "Abnormal"? Also, for Soft limit "Normal" or "Soft"?

@joseph-v joseph-v force-pushed the nas-driver-support branch 2 times, most recently from 6464ccc to f307e2c Compare March 10, 2021 13:40
Copy link
Collaborator

@wisererik wisererik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the driver definition, please consider it carefully



@six.add_metaclass(abc.ABCMeta)
class NASDriver(StorageDriver):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is an impact for sync storage api by defining sub driver, it will fail because sync api use subclass to generate the resource task.
plz check

delfin/common/constants.py Show resolved Hide resolved
CIFS = 'cifs'
NFS = 'nfs'
FTP = 'ftp'
UNKNOWN = 'unknown'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protocol should not be unkown. should be specificy.

suggest add hdfs as one of protocols

storage_id = Column(String(36))
native_filesystem_id = Column(String(255))
native_pool_id = Column(String(255))
status = Column(String(255))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please put accociated object info to the last location

storage_id = Column(String(36))
native_qtree_id = Column(String(255))
native_filesystem_id = Column(String(255))
path = Column(String(255))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

delfin/db/sqlalchemy/models.py Show resolved Hide resolved

def list_filesystems(self, context):
"""List all filesystems from storage system."""
raise exception.StorageDriverAPINotImplemented("list_filesystems()")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use

raise NotImplementedError() 



class StorageDriverAPINotImplemented(DelfinException):
msg_fmt = _("Storage driver do not support API: {0}.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please remove it

@joseph-v joseph-v force-pushed the nas-driver-support branch 3 times, most recently from 58fdbb3 to 85723c5 Compare March 11, 2021 12:16
@@ -115,3 +115,18 @@ def list_alerts(self, context, query_para=None):
def clear_alert(self, context, sequence_number):
"""Clear alert from storage system."""
pass

@abc.abstractmethod
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest remove @abc.abstractmethod, otherewise you need to add method for all drivers


if add_list:
db.filesystems_create(self.context, add_list)
except AttributeError as e:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotImplementedErr should be catched and ignored(using pass) same with other resource tasks

except AttributeError as e:
LOG.error(e)
except NotImplementedError as e:
LOG.info(e)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using pass, suggest not log info, because there will be many NotImplementError from storages.

# Ignore this exception because driver may not support it.
pass

Copy link
Collaborator

@wisererik wisererik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, @NajmudheenCT please squash and merge it

Copy link
Member

@NajmudheenCT NajmudheenCT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@NajmudheenCT NajmudheenCT merged commit 89b4179 into sodafoundation:master Mar 12, 2021
AmitRoushan pushed a commit to AmitRoushan/delfin that referenced this pull request Mar 12, 2021
* Add NAS resource filesystem

* Separate drivers to NAS, SAN and Unified

* Fix formatting

* Add Qtree resource support to delfin

* Add Share resource support to delfin

* Add quota limit params to qtree

* Update unit tests

* Update model changes

* Implement review comments
NajmudheenCT added a commit that referenced this pull request Mar 12, 2021
…e addition (#503)

* db changes for task template addition

* db changes for task instance addition

* Fix for travis CI issue on cryptography dependency (#494)

* Fix CI Issue on cryptography dependency

* Removing python_version check on crytography package requirement

* Add MIXED storage pool type (#482)

* Add NAS resources for filesystem, qtree & share (#491)

* Add NAS resource filesystem

* Separate drivers to NAS, SAN and Unified

* Fix formatting

* Add Qtree resource support to delfin

* Add Share resource support to delfin

* Add quota limit params to qtree

* Update unit tests

* Update model changes

* Implement review comments

* update db model with task and failed task schema

* Fix some comments and name changes

* Unit test changes

Co-authored-by: Najmudheen <45681499+NajmudheenCT@users.noreply.github.com>
Co-authored-by: Joseph Vazhappilly <josephvp@gmail.com>
Co-authored-by: Amit Roushan <amit.roushan@huawei.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Design and Framework for NAS storage support
4 participants