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

utils_misc: Reorg disk related APIs into utils_disk #2103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

balamuruhans
Copy link
Member

@balamuruhans balamuruhans commented Jun 4, 2019

Reorganise disk related method to utils_disk and break circular
imports caused with respect to disk related APIs in utils_misc and
gluster, move some of storage apis to utils_disk and utils_storage
for better work flow. Rename utils_disk.py to disk.py

Signed-off-by: Srikanth Aithal [email protected]
Signed-off-by: Balamuruhan S [email protected]

@balamuruhans balamuruhans changed the title utils_disk: move new_disk_vol_name() to utils_disk utils_test/libvirt: move new_disk_vol_name() to utils_disk Jun 4, 2019
@lgtm-com
Copy link

lgtm-com bot commented Jun 4, 2019

This pull request introduces 12 alerts when merging 3c5ffd6 into 3852a5c - view on LGTM.com

new alerts:

  • 12 for Module-level cyclic import

virttest/utils_disk.py Outdated Show resolved Hide resolved
@balamuruhans balamuruhans force-pushed the utils_disk_org branch 3 times, most recently from 7a34ecb to 3093a9d Compare June 5, 2019 14:31
@lgtm-com
Copy link

lgtm-com bot commented Jun 5, 2019

This pull request introduces 1 alert when merging 3093a9d into 3852a5c - view on LGTM.com

new alerts:

  • 1 for Module-level cyclic import

@lgtm-com
Copy link

lgtm-com bot commented Jun 7, 2019

This pull request introduces 1 alert when merging 0dee3e5 into cb277eb - view on LGTM.com

new alerts:

  • 1 for Unused import

@balamuruhans balamuruhans changed the title utils_test/libvirt: move new_disk_vol_name() to utils_disk utils_test/libvirt: Reorg disk related APIs into utils_disk Jun 7, 2019
@balamuruhans
Copy link
Member Author

@vivianQizhu I have worked to reorganize disk related methods to avoid circular imports and to cleanup utils_misc.py. I have moved most of your code in this reorganization work, I would request for your review and acknowledgement. Thanks!

@lgtm-com
Copy link

lgtm-com bot commented Jul 9, 2019

This pull request introduces 1 alert when merging 03fe125 into 509ca09 - view on LGTM.com

new alerts:

  • 1 for Variable defined multiple times

@balamuruhans
Copy link
Member Author

@luckyh request for your review. This is part of cleaning up utlils_misc.py, there is no logical changes I have moved the disk related APIs to organise it.

@luckyh
Copy link
Contributor

luckyh commented Jul 10, 2019

@balamuruhans ok, I see there are several problems been solved in this PR, so let's put them into individual commits, thanks.

@lgtm-com
Copy link

lgtm-com bot commented Aug 19, 2019

This pull request introduces 2 alerts and fixes 1 when merging 07144ed into 5c83fe5 - view on LGTM.com

new alerts:

  • 1 for Unused import
  • 1 for Modification of parameter with default

fixed alerts:

  • 1 for Modification of parameter with default

@balamuruhans balamuruhans changed the title utils_test/libvirt: Reorg disk related APIs into utils_disk utils_misc: Reorg disk related APIs into utils_disk Aug 19, 2019
@lgtm-com
Copy link

lgtm-com bot commented Aug 19, 2019

This pull request introduces 1 alert and fixes 1 when merging 25afa10 into 5c83fe5 - view on LGTM.com

new alerts:

  • 1 for Modification of parameter with default

fixed alerts:

  • 1 for Modification of parameter with default

@balamuruhans
Copy link
Member Author

@luckyh I have separated out commits and included @bssrikanth's patch work with this PR to avoid CI failure/checks. request for your review.

Copy link
Contributor

@luckyh luckyh left a comment

Choose a reason for hiding this comment

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

@balamuruhans I like this improvement, but we should take care about these things for preventing it breaking our current and future testing, let's consider more about that, thanks!

virttest/gluster.py Outdated Show resolved Hide resolved
virttest/storage.py Outdated Show resolved Hide resolved
virttest/utils_disk.py Outdated Show resolved Hide resolved
if ostype == "windows":
return format_windows_disk(session, did, mountpoint, size, fstype)
return format_linux_disk(session, did, all_disks_did, partition,
mountpoint, size, fstype)
Copy link
Contributor

Choose a reason for hiding this comment

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

We should take care of the above 5 functions for moving out them from this module since there are several test scripts using them currently.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bssrikanth is working on some more disk related functions into utils_disk with #2148. I thought of getting in this first and he can rebase the PR #2148.

virttest/utils_storage.py Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Aug 20, 2019

This pull request introduces 1 alert when merging 8b35297 into 3f08daa - view on LGTM.com

new alerts:

  • 1 for Module-level cyclic import

@balamuruhans
Copy link
Member Author

balamuruhans commented Aug 20, 2019

@luckyh Thanks for reviewing, the reason that I forgot why I moved some APIs from gluster.py to utils_disk.py is to avoid the above cyclic import issue,
libvirt.py
libvirt_storage.py
storage.py
gluster.py
utils_disk.py
pool_xml.py
libvirt_storage.py

If the APIs file_exists() and glusterfs_mount() to utils_disk.py this can be fixed. If you think on any other solution please help me on it.

@balamuruhans
Copy link
Member Author

@luckyh could you help to review the changes. Thanks!

selftests/unit/test_libvirt_xml.py Outdated Show resolved Hide resolved
@@ -204,80 +201,6 @@ def gluster_brick_delete(brick_path, session=None):
logging.error("Not able to delete brick folder %s", details)


@error_context.context_aware
def gluster_vol_create(vol_name, hostname, brick_path, force=False, session=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

If you just want to avoid circular imports, it's better to look for calling alternatives rather than move these things out

Copy link
Member Author

Choose a reason for hiding this comment

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

I could not get about this idea, can you help me to explain it ?

virttest/utils_disk.py Show resolved Hide resolved
virttest/utils_disk.py Show resolved Hide resolved
@balamuruhans balamuruhans force-pushed the utils_disk_org branch 2 times, most recently from 5170a81 to 609f52f Compare August 28, 2019 11:45
Reorganise disk related method to utils_disk and break circular
imports caused with respect to disk related APIs in utils_misc and
gluster to utils_disk for better work flow. Rename utils_disk.py to
disk.py

Signed-off-by: Srikanth Aithal <[email protected]>
Signed-off-by: Balamuruhan S <[email protected]>
Copy link
Member

@sathnaga sathnaga left a comment

Choose a reason for hiding this comment

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

LGTM, minor, change commit heading to Reorg disk related APIs otherwords, avoid utils_disk from commit heading, as anyways it has been renamed to disk.py

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.

4 participants