Skip to content

Commit

Permalink
Merge branch 'trunk' of https://github.com/apache/libcloud into libvi…
Browse files Browse the repository at this point in the history
…rt/LibvirtNodeDriver_cleanup_and_tests
  • Loading branch information
Rene Kjellerup committed Jul 12, 2016
2 parents 7307763 + bb202a2 commit cc06e06
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 10 deletions.
11 changes: 10 additions & 1 deletion CHANGES.rst
Expand Up @@ -11,6 +11,10 @@ Compute
(GITHUB-833)
[Juan Font Alonso]

- Add Barcelona (Spain) region to the Aurora Compute driver.
(GITHUB-835)
[Wido den Hollander]

DNS
~~~

Expand All @@ -22,13 +26,18 @@ DNS
(GITHUB-829)
[Wido den Hollander]

- Add support for DS, PTR, SSFHFP and TLSA record type to the Aurora DNS
driver.
(GITHUB-834)
[Wido den Hollander]

Container
~~~~~~~~~

- Add network mode and labels when creating containers within
docker driver
(GITHUB-831)
[Jamie Cressey]
[Jamie Cressey]


Changes with Apache Libcloud 1.1.0
Expand Down
7 changes: 7 additions & 0 deletions doap_libcloud.rdf
Expand Up @@ -300,6 +300,13 @@
<created>2016-06-21</created>
<revision>v1.0.0</revision>
</Version>
</release>
<release>
<Version>
<name>1.1.0</name>
<created>2016-07-07</created>
<revision>v1.1.0</revision>
</Version>
</release>
<repository>
<SVNRepository>
Expand Down
15 changes: 15 additions & 0 deletions docs/compute/drivers/auroracompute.rst
Expand Up @@ -11,6 +11,7 @@ The datacenters / availability zones are located in:
- Miami (US)
- Los Angelos (US)
- Tokyo (JP)
- Barcelona (ES)


.. figure:: /_static/images/provider_logos/pcextreme.png
Expand Down Expand Up @@ -41,6 +42,20 @@ With these credentials you can instantiate a driver:
:language: python


Create a Virtual Machine (node)
-------------------------------

Creating a Virtual Machine on AuroraCompute using libcloud works the same as on any
other platform. This example is just to show exactly that.

This example will create a Virtual Machine in Amsterdam. Should you want to create
one in one of our other regions you should take a look at the example below which
shows how to use our different regions.

.. literalinclude:: /examples/compute/auroracompute/create_node.py
:language: python


Using a different region
------------------------

Expand Down
22 changes: 22 additions & 0 deletions docs/examples/compute/auroracompute/create_node.py
@@ -0,0 +1,22 @@
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

apikey = 'mykey'
secretkey = 'mysecret'

Driver = get_driver(Provider.AURORACOMPUTE)
driver = Driver(key=apikey, secret=secretkey)

images = driver.list_images()
sizes = driver.list_sizes()

# Find a Agile Offering with 2GB of Memory
size = [s for s in sizes if s.ram == 2048 and s.name.startswith('Agile')][0]

# Search for the Ubuntu 16.04 image
image = [i for i in images if i.name == 'Ubuntu 16.04'][0]

# Create the new Virtual Machine
node = driver.create_node(image=image, size=size)

print(node)
4 changes: 3 additions & 1 deletion libcloud/compute/drivers/auroracompute.py
Expand Up @@ -28,14 +28,16 @@ class AuroraComputeRegion(object):
MIA = 'Miami'
LAX = 'Los Angeles'
TYO = 'Tokyo'
BCN = 'Barcelona'


REGION_ENDPOINT_MAP = {
AuroraComputeRegion.AMS: '/ams',
AuroraComputeRegion.RTD: '/rtd',
AuroraComputeRegion.MIA: '/mia',
AuroraComputeRegion.LAX: '/lax',
AuroraComputeRegion.TYO: '/tyo'
AuroraComputeRegion.TYO: '/tyo',
AuroraComputeRegion.BCN: '/bcn'
}


Expand Down
2 changes: 1 addition & 1 deletion libcloud/compute/drivers/gce.py
Expand Up @@ -4369,7 +4369,7 @@ def ex_get_image_from_family(self, image_family, ex_project_list=None,
:param ex_project_list: The name of the project to list for images.
Examples include: 'debian-cloud'.
:type ex_project_List: ``str``, ``list`` of ``str``, or ``None``
:type ex_project_list: ``list`` of ``str``, or ``None``
:param ex_standard_projects: If true, check in standard projects if
the image is not found.
Expand Down
18 changes: 11 additions & 7 deletions libcloud/dns/drivers/auroradns.py
Expand Up @@ -250,9 +250,12 @@ class AuroraDNSDriver(DNSDriver):
RecordType.MX: 'MX',
RecordType.NS: 'NS',
RecordType.SOA: 'SOA',
RecordType.SPF: 'SPF',
RecordType.SRV: 'SRV',
RecordType.TXT: 'TXT',
RecordType.DS: 'DS',
RecordType.PTR: 'PTR',
RecordType.SSHFP: 'SSHFP',
RecordType.TLSA: 'TLSA'
}

HEALTHCHECK_TYPE_MAP = {
Expand All @@ -266,19 +269,13 @@ def iterate_zones(self):
for zone in res.parse_body():
yield self.__res_to_zone(zone)

def list_zones(self):
return list(self.iterate_zones())

def iterate_records(self, zone):
self.connection.set_context({'resource': 'zone', 'id': zone.id})
res = self.connection.request('/zones/%s/records' % zone.id)

for record in res.parse_body():
yield self.__res_to_record(zone, record)

def list_records(self, zone):
return list(self.iterate_records(zone))

def get_zone(self, zone_id):
self.connection.set_context({'resource': 'zone', 'id': zone_id})
res = self.connection.request('/zones/%s' % zone_id)
Expand Down Expand Up @@ -337,6 +334,13 @@ def delete_record(self, record):
method='DELETE')
return True

def list_record_types(self):
types = []
for record_type in self.RECORD_TYPE_MAP.keys():
types.append(record_type)

return types

def update_record(self, record, name, type, data, extra=None):
rdata = {}

Expand Down
16 changes: 16 additions & 0 deletions libcloud/test/dns/test_auroradns.py
Expand Up @@ -87,6 +87,22 @@ def test_res_to_record(self):
self.assertEqual(zone, record.zone)
self.assertEqual(self.driver, record.driver)

def test_record_types(self):
types = self.driver.list_record_types()
self.assertEqual(len(types), 12)
self.assertTrue(RecordType.A in types)
self.assertTrue(RecordType.AAAA in types)
self.assertTrue(RecordType.MX in types)
self.assertTrue(RecordType.NS in types)
self.assertTrue(RecordType.SOA in types)
self.assertTrue(RecordType.TXT in types)
self.assertTrue(RecordType.CNAME in types)
self.assertTrue(RecordType.SRV in types)
self.assertTrue(RecordType.DS in types)
self.assertTrue(RecordType.SSHFP in types)
self.assertTrue(RecordType.PTR in types)
self.assertTrue(RecordType.TLSA in types)

def test_list_zones(self):
zones = self.driver.list_zones()
self.assertEqual(len(zones), 2)
Expand Down

0 comments on commit cc06e06

Please sign in to comment.