Return-Path: X-Original-To: apmail-libcloud-commits-archive@www.apache.org Delivered-To: apmail-libcloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2A22E10B4D for ; Sun, 2 Feb 2014 17:25:15 +0000 (UTC) Received: (qmail 87354 invoked by uid 500); 2 Feb 2014 17:25:14 -0000 Delivered-To: apmail-libcloud-commits-archive@libcloud.apache.org Received: (qmail 87308 invoked by uid 500); 2 Feb 2014 17:25:14 -0000 Mailing-List: contact commits-help@libcloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@libcloud.apache.org Delivered-To: mailing list commits@libcloud.apache.org Received: (qmail 87286 invoked by uid 99); 2 Feb 2014 17:25:13 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 02 Feb 2014 17:25:13 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AC48D8C124A; Sun, 2 Feb 2014 17:25:13 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tomaz@apache.org To: commits@libcloud.apache.org Date: Sun, 02 Feb 2014 17:25:13 -0000 Message-Id: <709b71e7553b4ae8938d92b37c34a45b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: LIBCLOUD-506: Added the resource extra attribute mapping to the CloudStack driver and implemented it for networks, nodes and volumes. I also went ahead and added a number of additional properties for each of the three resource types. Updated Branches: refs/heads/trunk 2840b6f5a -> 45a7e94fa LIBCLOUD-506: Added the resource extra attribute mapping to the CloudStack driver and implemented it for networks, nodes and volumes. I also went ahead and added a number of additional properties for each of the three resource types. Closes #239. Signed-off-by: Tomaz Muraus Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/39ffb83d Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/39ffb83d Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/39ffb83d Branch: refs/heads/trunk Commit: 39ffb83d3552829ddaa90f942fa28746eb6a830e Parents: 2840b6f Author: Chris DeRamus Authored: Sun Feb 2 09:59:52 2014 -0500 Committer: Tomaz Muraus Committed: Sun Feb 2 18:20:13 2014 +0100 ---------------------------------------------------------------------- libcloud/compute/drivers/cloudstack.py | 257 +++++++++++++++++++++++++--- 1 file changed, 236 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/39ffb83d/libcloud/compute/drivers/cloudstack.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/cloudstack.py b/libcloud/compute/drivers/cloudstack.py index 4e6a36b..f7e1847 100644 --- a/libcloud/compute/drivers/cloudstack.py +++ b/libcloud/compute/drivers/cloudstack.py @@ -31,6 +31,167 @@ from libcloud.compute.types import KeyPairDoesNotExistError from libcloud.utils.networking import is_private_subnet +""" +Define the extra dictionary for specific resources +""" +RESOURCE_EXTRA_ATTRIBUTES_MAP = { + 'network': { + 'broadcast_domain_type': { + 'key_name': 'broadcastdomaintype', + 'transform_func': str + }, + 'traffic_type': { + 'key_name': 'traffictype', + 'transform_func': str + }, + 'zone_name': { + 'key_name': 'zonename', + 'transform_func': str + }, + 'network_offering_name': { + 'key_name': 'networkofferingname', + 'transform_func': str + }, + 'network_offeringdisplay_text': { + 'key_name': 'networkofferingdisplaytext', + 'transform_func': str + }, + 'network_offering_availability': { + 'key_name': 'networkofferingavailability', + 'transform_func': str + }, + 'is_system': { + 'key_name': 'issystem', + 'transform_func': str + }, + 'state': { + 'key_name': 'state', + 'transform_func': str + }, + 'dns1': { + 'key_name': 'dns1', + 'transform_func': str + }, + 'dns2': { + 'key_name': 'dns2', + 'transform_func': str + }, + 'type': { + 'key_name': 'type', + 'transform_func': str + }, + 'acl_type': { + 'key_name': 'acltype', + 'transform_func': str + }, + 'subdomain_access': { + 'key_name': 'subdomainaccess', + 'transform_func': str + }, + 'network_domain': { + 'key_name': 'networkdomain', + 'transform_func': str + }, + 'physical_network_id': { + 'key_name': 'physicalnetworkid', + 'transform_func': str + }, + 'can_use_for_deploy': { + 'key_name': 'canusefordeploy', + 'transform_func': str + } + }, + 'node': { + 'haenable': { + 'key_name': 'haenable', + 'transform_func': str + }, + 'zone_id': { + 'key_name': 'zoneid', + 'transform_func': str + }, + 'zone_name': { + 'key_name': 'zonename', + 'transform_func': str + }, + 'key_name': { + 'key_name': 'keypair', + 'transform_func': str + }, + 'password': { + 'key_name': 'password', + 'transform_func': str + }, + 'image_id': { + 'key_name': 'templateid', + 'transform_func': str + }, + 'image_name': { + 'key_name': 'templatename', + 'transform_func': str + }, + 'template_display_text': { + 'key_name': 'templatdisplaytext', + 'transform_func': str + }, + 'password_enabled': { + 'key_name': 'passwordenabled', + 'transform_func': str + }, + 'size_id': { + 'key_name': 'serviceofferingid', + 'transform_func': str + }, + 'size_name': { + 'key_name': 'serviceofferingname', + 'transform_func': str + }, + 'root_device_id': { + 'key_name': 'rootdeviceid', + 'transform_func': str + }, + 'root_device_type': { + 'key_name': 'rootdevicetype', + 'transform_func': str + }, + 'hypervisor': { + 'key_name': 'hypervisor', + 'transform_func': str + } + }, + 'volume': { + 'created': { + 'key_name': 'created', + 'transform_func': str + }, + 'device_id': { + 'key_name': 'deviceid', + 'transform_func': int + }, + 'instance_id': { + 'key_name': 'serviceofferingid', + 'transform_func': str + }, + 'state': { + 'key_name': 'state', + 'transform_func': str + }, + 'volume_type': { + 'key_name': 'type', + 'transform_func': str + }, + 'zone_id': { + 'key_name': 'zoneid', + 'transform_func': str + }, + 'zone_name': { + 'key_name': 'zonename', + 'transform_func': str + } + } +} + + class CloudStackNode(Node): """ Subclass of Node so we can expose our extension methods. @@ -225,13 +386,14 @@ class CloudStackNetwork(object): """ def __init__(self, displaytext, name, networkofferingid, id, zoneid, - driver): + driver, extra=None): self.displaytext = displaytext self.name = name self.networkofferingid = networkofferingid self.id = id self.zoneid = zoneid self.driver = driver + self.extra = extra or {} def __repr__(self): return (('