Skip to content

Commit e10e9f5

Browse files
GreatSnoopysysradium
authored andcommitted
Image.allocate is missing parameter datastore which is required. (python-oca#25)
* Image.allocate is missing parameter datastore which is required. Without this parameter, Image.allocate gives xmlrpclib.Fault: <Fault -501: 'Not enough parameters'> * Add datastore parameter to test_image.py
1 parent baf234c commit e10e9f5

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

oca/image.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Image(PoolElement):
6666
ELEMENT_NAME = 'IMAGE'
6767

6868
@staticmethod
69-
def allocate(client, template):
69+
def allocate(client, template, datastore):
7070
'''
7171
Allocates a new image in OpenNebula
7272
@@ -77,8 +77,10 @@ def allocate(client, template):
7777
7878
``template``
7979
a string containing the template of the image
80+
``datastore``
81+
the datastore id where the image is to be allocated
8082
'''
81-
image_id = client.call(Image.METHODS['allocate'], template)
83+
image_id = client.call(Image.METHODS['allocate'], template, datastore)
8284
return image_id
8385

8486
def __init__(self, xml, client):

oca/tests/test_image.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
PUBLIC = YES
1414
DESCRIPTION = "Ubuntu 10.04 desktop for students."'''
1515

16+
DEFAULT_IMG_DATASTORE = 1
1617

1718
class TestImage(unittest.TestCase):
1819
def setUp(self):
@@ -22,7 +23,7 @@ def setUp(self):
2223

2324
def test_allocate(self):
2425
self.client.call = Mock(return_value=2)
25-
assert oca.Image.allocate(self.client, IMAGE_TEMPLATE) == 2
26+
assert oca.Image.allocate(self.client, IMAGE_TEMPLATE, DEFAULT_IMG_DATASTORE) == 2
2627

2728
def test_enable(self):
2829
self.client.call = Mock(return_value='')

0 commit comments

Comments
 (0)