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

Added support for vCloud 5.5 and snapshot operations #658

Closed
wants to merge 6 commits into
base: trunk
from

Conversation

Projects
None yet
2 participants
@juanfont
Contributor

juanfont commented Dec 10, 2015

The vCloud 5.5 commit cames from Philip Kershaw (philip.kershaw@stfc.ac.uk), although it seems he never sent it to upstream. He talks about it here http://mail-archives.apache.org/mod_mbox/libcloud-dev/201403.mbox/%3C836226893590734FA88B31162359477F5F7FFE90@EXCHMBX01.fed.cclrc.ac.uk%3E.

The second commit adds snapshot management (create, delete, restore) methods. It also adds 'snapshots' as new field in the 'extra' dict.

@tonybaloney

This comment has been minimized.

Show comment
Hide comment
@tonybaloney

tonybaloney Dec 16, 2015

Contributor

Hi @juanfont this would be a great feature to have but the tests are failing. please check and recommit..

FAIL: test_list_nodes (libcloud.test.compute.test_vcloud.VCloud_1_5_Tests)

Traceback (most recent call last):
File "/home/travis/build/apache/libcloud/libcloud/test/compute/test_vcloud.py", line 157, in test_list_nodes
'os_type': 'rhel5_64Guest'
AssertionError: {'vms': [{'id': 'https://vm-vcloud/api/vApp/vm-dd75d1d3-5b7b-48f0-aff3-69622ab7e045', 'state': 0, 'private_ips': ['65.41.67.2'], 'public_ips': ['65.41.67.2'], 'name': 'testVm', 'os_type': 'rhel5_64Guest'}], 'vdc': 'MyVdc', 'snapshots': []} != {'vms': [{'id': 'https://vm-vcloud/api/vApp/vm-dd75d1d3-5b7b-48f0-aff3-69622ab7e045', 'state': 0, 'private_ips': ['65.41.67.2'], 'public_ips': ['65.41.67.2'], 'name': 'testVm', 'os_type': 'rhel5_64Guest'}], 'vdc': 'MyVdc'}

Contributor

tonybaloney commented Dec 16, 2015

Hi @juanfont this would be a great feature to have but the tests are failing. please check and recommit..

FAIL: test_list_nodes (libcloud.test.compute.test_vcloud.VCloud_1_5_Tests)

Traceback (most recent call last):
File "/home/travis/build/apache/libcloud/libcloud/test/compute/test_vcloud.py", line 157, in test_list_nodes
'os_type': 'rhel5_64Guest'
AssertionError: {'vms': [{'id': 'https://vm-vcloud/api/vApp/vm-dd75d1d3-5b7b-48f0-aff3-69622ab7e045', 'state': 0, 'private_ips': ['65.41.67.2'], 'public_ips': ['65.41.67.2'], 'name': 'testVm', 'os_type': 'rhel5_64Guest'}], 'vdc': 'MyVdc', 'snapshots': []} != {'vms': [{'id': 'https://vm-vcloud/api/vApp/vm-dd75d1d3-5b7b-48f0-aff3-69622ab7e045', 'state': 0, 'private_ips': ['65.41.67.2'], 'public_ips': ['65.41.67.2'], 'name': 'testVm', 'os_type': 'rhel5_64Guest'}], 'vdc': 'MyVdc'}

@juanfont

This comment has been minimized.

Show comment
Hide comment
@juanfont

juanfont Dec 16, 2015

Contributor

@tonybaloney Can you check now? Thank you very much :)

Contributor

juanfont commented Dec 16, 2015

@tonybaloney Can you check now? Thank you very much :)

@tonybaloney

This comment has been minimized.

Show comment
Hide comment
@tonybaloney

tonybaloney Dec 16, 2015

Contributor

Hi @juanfont do you have an API instance you can test this against? Ideally, there should be supporting tests and fixtures for this. See the test methods for the 5.1 API as an example:

class VCloud_5_1_Tests(unittest.TestCase, TestCaseMixin):
def setUp(self):
VCloudNodeDriver.connectionCls.host = 'test'
VCloudNodeDriver.connectionCls.conn_classes = (
None, VCloud_1_5_MockHttp)
VCloud_1_5_MockHttp.type = None
self.driver = VCloudNodeDriver(
*VCLOUD_PARAMS, **{'api_version': '5.1'})
self.assertTrue(isinstance(self.driver, VCloud_5_1_NodeDriver))
def _test_create_node_valid_ex_vm_memory(self):
# TODO: Hook up the fixture
values = [4, 1024, 4096]
image = self.driver.list_images()[0]
size = self.driver.list_sizes()[0]
for value in values:
self.driver.create_node(
name='testerpart2',
image=image,
size=size,
vdc='https://services.vcloudexpress.terremark.com/api/v0.8/vdc/224',
network='https://services.vcloudexpress.terremark.com/api/v0.8/network/725',
cpus=2,
ex_vm_memory=value
)
def test_create_node_invalid_ex_vm_memory(self):
values = [1, 3, 7]
image = self.driver.list_images()[0]
size = self.driver.list_sizes()[0]
for value in values:
try:
self.driver.create_node(
name='testerpart2',
image=image,
size=size,
vdc='https://services.vcloudexpress.terremark.com/api/v0.8/vdc/224',
network='https://services.vcloudexpress.terremark.com/api/v0.8/network/725',
cpus=2,
ex_vm_memory=value
)
except ValueError:
pass
else:
self.fail('Exception was not thrown')
def test_list_images(self):
ret = self.driver.list_images()
self.assertEqual(
'https://vm-vcloud/api/vAppTemplate/vappTemplate-ac1bc027-bf8c-4050-8643-4971f691c158', ret[0].id)

Contributor

tonybaloney commented Dec 16, 2015

Hi @juanfont do you have an API instance you can test this against? Ideally, there should be supporting tests and fixtures for this. See the test methods for the 5.1 API as an example:

class VCloud_5_1_Tests(unittest.TestCase, TestCaseMixin):
def setUp(self):
VCloudNodeDriver.connectionCls.host = 'test'
VCloudNodeDriver.connectionCls.conn_classes = (
None, VCloud_1_5_MockHttp)
VCloud_1_5_MockHttp.type = None
self.driver = VCloudNodeDriver(
*VCLOUD_PARAMS, **{'api_version': '5.1'})
self.assertTrue(isinstance(self.driver, VCloud_5_1_NodeDriver))
def _test_create_node_valid_ex_vm_memory(self):
# TODO: Hook up the fixture
values = [4, 1024, 4096]
image = self.driver.list_images()[0]
size = self.driver.list_sizes()[0]
for value in values:
self.driver.create_node(
name='testerpart2',
image=image,
size=size,
vdc='https://services.vcloudexpress.terremark.com/api/v0.8/vdc/224',
network='https://services.vcloudexpress.terremark.com/api/v0.8/network/725',
cpus=2,
ex_vm_memory=value
)
def test_create_node_invalid_ex_vm_memory(self):
values = [1, 3, 7]
image = self.driver.list_images()[0]
size = self.driver.list_sizes()[0]
for value in values:
try:
self.driver.create_node(
name='testerpart2',
image=image,
size=size,
vdc='https://services.vcloudexpress.terremark.com/api/v0.8/vdc/224',
network='https://services.vcloudexpress.terremark.com/api/v0.8/network/725',
cpus=2,
ex_vm_memory=value
)
except ValueError:
pass
else:
self.fail('Exception was not thrown')
def test_list_images(self):
ret = self.driver.list_images()
self.assertEqual(
'https://vm-vcloud/api/vAppTemplate/vappTemplate-ac1bc027-bf8c-4050-8643-4971f691c158', ret[0].id)

@juanfont

This comment has been minimized.

Show comment
Hide comment
@juanfont

juanfont Dec 16, 2015

Contributor

@tonybaloney yes, this has been tested against a real vCloud Director instance. But you are right, I'll provide tests ASAP.

Contributor

juanfont commented Dec 16, 2015

@tonybaloney yes, this has been tested against a real vCloud Director instance. But you are right, I'll provide tests ASAP.

@tonybaloney

This comment has been minimized.

Show comment
Hide comment
@tonybaloney

tonybaloney Feb 14, 2016

Contributor

Hi @juanfont how did you get on with the tests? Would be good to get this closed off since you've already done most of the hard work!

Contributor

tonybaloney commented Feb 14, 2016

Hi @juanfont how did you get on with the tests? Would be good to get this closed off since you've already done most of the hard work!

@juanfont

This comment has been minimized.

Show comment
Hide comment
@juanfont

juanfont Feb 14, 2016

Contributor

@tonybaloney sorry about the delay. Hope it is enough :)

Contributor

juanfont commented Feb 14, 2016

@tonybaloney sorry about the delay. Hope it is enough :)

@tonybaloney

This comment has been minimized.

Show comment
Hide comment
@tonybaloney

tonybaloney Feb 14, 2016

Contributor

Great! thanks @juanfont 👍

Contributor

tonybaloney commented Feb 14, 2016

Great! thanks @juanfont 👍

@asfgit asfgit closed this in 99188f7 Feb 14, 2016

asfgit pushed a commit that referenced this pull request Feb 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment