Skip to content

#PR2- CP-47869-Update XAPI code to python3. #5668

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

Merged
merged 24 commits into from
Jun 12, 2024
Merged

#PR2- CP-47869-Update XAPI code to python3. #5668

merged 24 commits into from
Jun 12, 2024

Conversation

ashwin9390
Copy link
Contributor

@ashwin9390 ashwin9390 commented Jun 3, 2024

Main ticket:CP-47869 -Clean up XAPI code

Sub task :CP-49681

  • Convert the existing code to python3 in XAPI

Split2 from #5662

Test done in PR 5662 holds good.

Test result -198930 (Dev Run)
Ring0 BST - 8.4.0-206415 (pbb-ashwinh-xapiclean) (repo) run 30 May 2024
Tests Executed (excludes blocked): 47
Tests Failed: 1
Tests Errored: 0
Tests Blocked: 0
Tests Not Executed: 0
Test failed due to production issues: 0
Pass rate (excluding failures due to non product issues): 100.0%
Pass rate (of testcases XenRT was able to resource): 97.9%
Pass rate (of all test cases): 97.9%
Percentage of nightly complete: 100.0%
Tests excluded from numbers: 0

Signed-off-by: Ashwinh ashwin.h@cloud.com

@liulinC @stephenchengCloud @psafont

…storage/_index.md b/doc/content/xapi/storage/_index.md

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…otocol.md b/ocaml/doc/wire-protocol.md

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…s/datapath/block/Datapath.activate

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…/datapath/block/Datapath.deactivate

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…s/datapath/block/Datapath.attach

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…s/datapath/block/Datapath.detach

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…s/datapath/loop+blkback/datapath.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…ge/python/examples/datapath/loop+blkback/plugin.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…e/python/examples/volume/org.xen.xapi.storage.simple-file/sr.py

- Changed shebhang and copyright in /ocaml/xapi-storage/python/examples/volume/org.xen.xapi.storage.simple-file/plugin.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
Copy link

codecov bot commented Jun 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Additional details and impacted files
@@              Coverage Diff               @@
##           feature/py3   #5668      +/-   ##
==============================================
- Coverage         86.0%   68.6%   -17.4%     
==============================================
  Files               13      30      +17     
  Lines             2130    3557    +1427     
==============================================
+ Hits              1832    2441     +609     
- Misses             298    1116     +818     

see 35 files with indirect coverage changes

Flag Coverage Δ
python2.7 46.5% <ø> (-12.6%) ⬇️
python3.11 76.1% <ø> (-12.8%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

ashwin9390 added 12 commits June 5, 2024 09:00
…s/volume/org.xen.xapi.storage.simple-file/volume.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…storage/__init__.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…storage/common.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…storage/api/v5/__init__.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…thon/provision.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…init__.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…torage/api/__init__.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…/action.yml

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…le-attr] in /scripts/examples/python/mini-xenrt.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…in scripts/examples/smapiv2.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…in pyproject.toml

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
@@ -72,7 +72,7 @@ class XenAPIException(Exception):

def __init__(self, code, params):
Exception.__init__(self)
if not isinstance(code, str) and not isinstance(code, unicode):
if not isinstance(code, str) and not isinstance(code, str):
Copy link
Contributor

Choose a reason for hiding this comment

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

This file keeps py2 and py3 compatiblity by adding:

if sys.version_info[0] > 2:
    long = int
    unicode = str

So just leave it as it is.

Copy link
Member

Choose a reason for hiding this comment

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

Do we care about python 2 compatibility in this case?

Copy link
Contributor

Choose a reason for hiding this comment

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

This file somehow upgrades to python3 in this way ( which I don't like). Since it works, better not to change it, except if we change it completely.

@@ -139,7 +139,7 @@ def __init__(self, name):

def is_long(x):
try:
long(x)
int(x)
Copy link
Contributor

Choose a reason for hiding this comment

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

The same as previous one.

…/xapi/__init__.py"

This reverts commit d73690d.

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
…__init__.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
import urllib
import urlparse
import urllib.request, urllib.parse, urllib.error
import urllib.parse
Copy link
Contributor

Choose a reason for hiding this comment

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

pylint: Reimport 'urllib.parse'

…s/volume/org.xen.xapi.storage.simple-file/sr.py

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
@liulinC liulinC merged commit ccf4431 into xapi-project:feature/py3 Jun 12, 2024
14 checks passed
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