Skip to content

Commit

Permalink
Merge pull request #5431 from psafont/poor-man-compat-rev
Browse files Browse the repository at this point in the history
  • Loading branch information
psafont authored Feb 6, 2024
2 parents 004590e + 7051580 commit 2ee9b21
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 47 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ test:
trap "kill $${PSTREE_SLEEP_PID}" SIGINT SIGTERM EXIT; \
timeout --foreground $(TEST_TIMEOUT2) \
dune runtest --profile=$(PROFILE) --error-reporting=twice -j $(JOBS)
ifneq ($(PY_TEST), NO)
dune build @runtest-python --profile=$(PROFILE)
endif

stresstest:
dune build @stresstest --profile=$(PROFILE) --no-buffer -j $(JOBS)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python2

"""
Copyright (C) Citrix Systems, Inc.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3
#!/usr/bin/env python2

"""
Copyright (C) Citrix Systems, Inc.
"""

import os
import sys
import urllib.parse
import urlparse
import xapi.storage.api.volume

import plugin
Expand All @@ -21,11 +21,11 @@ def create(self, dbg, uri, name, description, configuration):
return

def detach(self, dbg, sr):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
return

def ls(self, dbg, sr):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
qr = plugin.Implementation().query(dbg)
return [{
"name": qr['name'],
Expand All @@ -40,7 +40,7 @@ def ls(self, dbg, sr):
}]

def stat(self, dbg, sr):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
qr = plugin.Implementation().query(dbg)
return {
"sr": sr,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
#!/usr/bin/env python2

"""
Copyright (C) Citrix Systems, Inc.
"""

import uuid
import urllib.parse
import urlparse
import os
import sys
import xapi.storage.api.volume
Expand All @@ -17,7 +17,7 @@
class Implementation(xapi.storage.api.volume.Volume_skeleton):

def create(self, dbg, sr, name, description, size):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
voluuid = str(uuid.uuid4())
return {
"name": name,
Expand All @@ -32,11 +32,11 @@ def create(self, dbg, sr, name, description, size):
}

def destroy(self, dbg, sr, key):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
return

def stat(self, dbg, sr, key):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
qr = plugin.Implementation().query(dbg)
return {
"name": qr['name'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env python2

"""
Copyright (C) Citrix Systems, Inc.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3
#!/usr/bin/env python2

"""
Copyright (C) Citrix Systems, Inc.
"""

import os
import sys
import urllib.parse
import urlparse
import xapi.storage.api.v5.volume

import plugin
Expand All @@ -22,11 +22,11 @@ def create(self, dbg, uuid, configuration, name, description):
return configuration

def detach(self, dbg, sr):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
return

def ls(self, dbg, sr):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
qr = plugin.Implementation().query(dbg)
return [{
"name": qr['name'],
Expand All @@ -42,7 +42,7 @@ def ls(self, dbg, sr):
}]

def stat(self, dbg, sr):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
qr = plugin.Implementation().query(dbg)
return {
"sr": sr,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
#!/usr/bin/env python2

"""
Copyright (C) Citrix Systems, Inc.
"""

import uuid
import urllib.parse
import urlparse
import os
import sys
import xapi.storage.api.v5.volume
Expand All @@ -17,7 +17,7 @@
class Implementation(xapi.storage.api.v5.volume.Volume_skeleton):

def create(self, dbg, sr, name, description, size, sharable):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
voluuid = str(uuid.uuid4())
return {
"name": name,
Expand All @@ -33,11 +33,11 @@ def create(self, dbg, sr, name, description, size, sharable):
}

def destroy(self, dbg, sr, key):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
return

def stat(self, dbg, sr, key):
urllib.parse.urlparse(sr)
urlparse.urlparse(sr)
qr = plugin.Implementation().query(dbg)
return {
"name": qr['name'],
Expand Down
7 changes: 0 additions & 7 deletions ocaml/xapi-storage/python/xapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@
import json
import argparse

# pylint: disable=invalid-name,redefined-builtin,undefined-variable
# pyright: reportUndefinedVariable=false
if sys.version_info[0] > 2:
long = int
unicode = str
str = bytes


def success(result):
return {"Status": "Success", "Value": result}
Expand Down
10 changes: 1 addition & 9 deletions ocaml/xapi-storage/python/xapi/storage/api/datapath.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
import argparse
import traceback
import logging

# pylint: disable=invalid-name,redefined-builtin,undefined-variable
# pyright: reportUndefinedVariable=false
if sys.version_info[0] > 2:
long = int
unicode = str
str = bytes

class Unimplemented(Rpc_light_failure):
def __init__(self, arg_0):
Rpc_light_failure.__init__(self, "Unimplemented", [ arg_0 ])
Expand Down Expand Up @@ -406,4 +398,4 @@ def _dispatch(self, method, params):
class datapath_server_test(datapath_server_dispatcher):
"""Create a server which will respond to all calls, returning arbitrary values. This is intended as a marshal/unmarshal test."""
def __init__(self):
datapath_server_dispatcher.__init__(self, Datapath_server_dispatcher(Datapath_test()))
datapath_server_dispatcher.__init__(self, Datapath_server_dispatcher(Datapath_test()))
10 changes: 1 addition & 9 deletions ocaml/xapi-storage/python/xapi/storage/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@
import argparse
import traceback
import logging

# pylint: disable=invalid-name,redefined-builtin,undefined-variable
# pyright: reportUndefinedVariable=false
if sys.version_info[0] > 2:
long = int
unicode = str
str = bytes

class Unimplemented(Rpc_light_failure):
def __init__(self, arg_0):
Rpc_light_failure.__init__(self, "Unimplemented", [ arg_0 ])
Expand Down Expand Up @@ -238,4 +230,4 @@ def _dispatch(self, method, params):
class plugin_server_test(plugin_server_dispatcher):
"""Create a server which will respond to all calls, returning arbitrary values. This is intended as a marshal/unmarshal test."""
def __init__(self):
plugin_server_dispatcher.__init__(self, Plugin_server_dispatcher(Plugin_test()))
plugin_server_dispatcher.__init__(self, Plugin_server_dispatcher(Plugin_test()))

0 comments on commit 2ee9b21

Please sign in to comment.