We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Turn all States into string values instead of ints
@Kami

Luckily, most tests already used the constants. I found a couple sloppy drivers, especially the ProfitBricks driver, which uses NodeState for everything, including Volumes and Snapshots. Maybe we fix that, maybe we leave it. It doesn't really matter.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `libcloud/compute/types.py`
Content:
```
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License.  You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 """
16 Base types used by other parts of libcloud
17 """
18 
19 from libcloud.common.types import LibcloudError, MalformedResponseError
20 from libcloud.common.types import InvalidCredsError, InvalidCredsException
21 
22 __all__ = [
23     "Provider",
24     "NodeState",
25     "DeploymentError",
26     "DeploymentException",
27 
28     # @@TR: should the unused imports below be exported?
29     "LibcloudError",
30     "MalformedResponseError",
31     "InvalidCredsError",
32     "InvalidCredsException",
33     "DEPRECATED_RACKSPACE_PROVIDERS",
34     "OLD_CONSTANT_TO_NEW_MAPPING"
35 ]
36 
37 
38 class Provider(object):
39     """
40     Defines for each of the supported providers
41 
42     :cvar DUMMY: Example provider
43     :cvar EC2_US_EAST: Amazon AWS US N. Virgina
44     :cvar EC2_US_WEST: Amazon AWS US N. California
45     :cvar EC2_EU_WEST: Amazon AWS EU Ireland
46     :cvar RACKSPACE: Rackspace next-gen OpenStack based Cloud Servers
47     :cvar RACKSPACE_FIRST_GEN: Rackspace First Gen Cloud Servers
48     :cvar GCE: Google Compute Engine
49     :cvar GOGRID: GoGrid
50     :cvar VPSNET: VPS.net
51     :cvar LINODE: Linode.com
52     :cvar VCLOUD: vmware vCloud
53     :cvar RIMUHOSTING: RimuHosting.com
54     :cvar ECP: Enomaly
55     :cvar IBM: IBM Developer Cloud
56     :cvar OPENNEBULA: OpenNebula.org
57     :cvar ELASTICHOSTS: ElasticHosts.com
58     :cvar CLOUDSIGMA: CloudSigma
59     :cvar NIMBUS: Nimbus
60     :cvar BLUEBOX: Bluebox
61     :cvar OPSOURCE: Opsource Cloud
62     :cvar DIMENSIONDATA: Dimension Data Cloud
63     :cvar NINEFOLD: Ninefold
64     :cvar TERREMARK: Terremark
65     :cvar EC2_US_WEST_OREGON: Amazon AWS US West 2 (Oregon)
66     :cvar CLOUDSTACK: CloudStack
67     :cvar CLOUDSIGMA_US: CloudSigma US Las Vegas
68     :cvar LIBVIRT: Libvirt driver
69     :cvar JOYENT: Joyent driver
70     :cvar VCL: VCL driver
71     :cvar KTUCLOUD: kt ucloud driver
72     :cvar GRIDSPOT: Gridspot driver
73     :cvar ABIQUO: Abiquo driver
74     :cvar NEPHOSCALE: NephoScale driver
75     :cvar EXOSCALE: Exoscale driver.
76     :cvar IKOULA: Ikoula driver.
77     :cvar OUTSCALE_SAS: Outscale SAS driver.
78     :cvar OUTSCALE_INC: Outscale INC driver.
79     :cvar PROFIT_BRICKS: ProfitBricks driver.
80     :cvar VULTR: vultr driver.
81     :cvar AZURE: Azure driver.
82     :cvar AURORACOMPUTE: Aurora Compute driver.
83     """
84     AZURE = 'azure'
85     DUMMY = 'dummy'
86     EC2 = 'ec2_us_east'
87     RACKSPACE = 'rackspace'
88     GCE = 'gce'
89     GOGRID = 'gogrid'
90     VPSNET = 'vpsnet'
91     LINODE = 'linode'
92     VCLOUD = 'vcloud'
93     RIMUHOSTING = 'rimuhosting'
94     VOXEL = 'voxel'
95     SOFTLAYER = 'softlayer'
96     EUCALYPTUS = 'eucalyptus'
97     ECP = 'ecp'
98     IBM = 'ibm'
99     OPENNEBULA = 'opennebula'
100     ELASTICHOSTS = 'elastichosts'
101     BRIGHTBOX = 'brightbox'
102     CLOUDSIGMA = 'cloudsigma'
103     NIMBUS = 'nimbus'
104     BLUEBOX = 'bluebox'
105     GANDI = 'gandi'
106     OPSOURCE = 'opsource'
107     DIMENSIONDATA = 'dimensiondata'
108     OPENSTACK = 'openstack'
109     SKALICLOUD = 'skalicloud'
110     SERVERLOVE = 'serverlove'
111     NINEFOLD = 'ninefold'
112     TERREMARK = 'terremark'
113     CLOUDSTACK = 'cloudstack'
114     LIBVIRT = 'libvirt'
115     JOYENT = 'joyent'
116     VCL = 'vcl'
117     KTUCLOUD = 'ktucloud'
118     GRIDSPOT = 'gridspot'
119     RACKSPACE_FIRST_GEN = 'rackspace_first_gen'
120     HOSTVIRTUAL = 'hostvirtual'
121     ABIQUO = 'abiquo'
122     DIGITAL_OCEAN = 'digitalocean'
123     NEPHOSCALE = 'nephoscale'
124     CLOUDFRAMES = 'cloudframes'
125     EXOSCALE = 'exoscale'
126     IKOULA = 'ikoula'
127     OUTSCALE_SAS = 'outscale_sas'
128     OUTSCALE_INC = 'outscale_inc'
129     VSPHERE = 'vsphere'
130     PROFIT_BRICKS = 'profitbricks'
131     VULTR = 'vultr'
132     AURORACOMPUTE = 'aurora_compute'
133     CLOUDWATT = 'cloudwatt'
134     PACKET = 'packet'
135     RUNABOVE = 'runabove'
136 
137     # OpenStack based providers
138     HPCLOUD = 'hpcloud'
139     CLOUDWATT = 'cloudwatt'
140     KILI = 'kili'
141     ONAPP = 'onapp'
142 
143     # Deprecated constants which are still supported
144     EC2_US_EAST = 'ec2_us_east'
145     EC2_EU = 'ec2_eu_west'  # deprecated name
146     EC2_EU_WEST = 'ec2_eu_west'
147     EC2_US_WEST = 'ec2_us_west'
148     EC2_AP_SOUTHEAST = 'ec2_ap_southeast'
149     EC2_AP_NORTHEAST = 'ec2_ap_northeast'
150     EC2_US_WEST_OREGON = 'ec2_us_west_oregon'
151     EC2_SA_EAST = 'ec2_sa_east'
152     EC2_AP_SOUTHEAST2 = 'ec2_ap_southeast_2'
153 
154     ELASTICHOSTS_UK1 = 'elastichosts_uk1'
155     ELASTICHOSTS_UK2 = 'elastichosts_uk2'
156     ELASTICHOSTS_US1 = 'elastichosts_us1'
157     ELASTICHOSTS_US2 = 'elastichosts_us2'
158     ELASTICHOSTS_US3 = 'elastichosts_us3'
159     ELASTICHOSTS_CA1 = 'elastichosts_ca1'
160     ELASTICHOSTS_AU1 = 'elastichosts_au1'
161     ELASTICHOSTS_CN1 = 'elastichosts_cn1'
162 
163     CLOUDSIGMA_US = 'cloudsigma_us'
164 
165     # Deprecated constants which aren't supported anymore
166     RACKSPACE_UK = 'rackspace_uk'
167     RACKSPACE_NOVA_BETA = 'rackspace_nova_beta'
168     RACKSPACE_NOVA_DFW = 'rackspace_nova_dfw'
169     RACKSPACE_NOVA_LON = 'rackspace_nova_lon'
170     RACKSPACE_NOVA_ORD = 'rackspace_nova_ord'
171 
172     # Removed
173     # SLICEHOST = 'slicehost'
174 
175 
176 DEPRECATED_RACKSPACE_PROVIDERS = [Provider.RACKSPACE_UK,
177                                   Provider.RACKSPACE_NOVA_BETA,
178                                   Provider.RACKSPACE_NOVA_DFW,
179                                   Provider.RACKSPACE_NOVA_LON,
180                                   Provider.RACKSPACE_NOVA_ORD]
181 OLD_CONSTANT_TO_NEW_MAPPING = {
182     Provider.RACKSPACE: Provider.RACKSPACE_FIRST_GEN,
183     Provider.RACKSPACE_UK: Provider.RACKSPACE_FIRST_GEN,
184 
185     Provider.RACKSPACE_NOVA_BETA: Provider.RACKSPACE,
186     Provider.RACKSPACE_NOVA_DFW: Provider.RACKSPACE,
187     Provider.RACKSPACE_NOVA_LON: Provider.RACKSPACE,
188     Provider.RACKSPACE_NOVA_ORD: Provider.RACKSPACE
189 }
190 
191 
192 class NodeState(object):
193     """
194     Standard states for a node
195 
196     :cvar RUNNING: Node is running.
197     :cvar REBOOTING: Node is rebooting.
198     :cvar TERMINATED: Node is terminated. This node can't be started later on.
199     :cvar STOPPED: Node is stopped. This node can be started later on.
200     :cvar PENDING: Node is pending.
201     :cvar SUSPENDED: Node is suspended.
202     :cvar ERROR: Node is an error state. Usually no operations can be performed
203                  on the node once it ends up in the error state.
204     :cvar PAUSED: Node is paused.
205     :cvar UNKNOWN: Node state is unknown.
206     """
207     RUNNING = 0
208     REBOOTING = 1
209     TERMINATED = 2
210     PENDING = 3
211     UNKNOWN = 4
212     STOPPED = 5
213     SUSPENDED = 6
214     ERROR = 7
215     PAUSED = 8
216 
217     @classmethod
218     def tostring(cls, value):
219         values = cls.__dict__
220         values = dict([(key, string) for key, string in values.items() if
221                        not key.startswith('__')])
222 
223         for item_key, item_value in values.items():
224             if value == item_value:
225                 return item_key
226 
227     @classmethod
228     def fromstring(cls, value):
229         return getattr(cls, value.upper(), None)
230 
231 
232 class StorageVolumeState(object):
233     """
234     Standard states of a StorageVolume
235     """
236     AVAILABLE = "available"
237     ERROR = "error"
238     INUSE = "in_use"
239     CREATING = "creating"
240     DELETING = "deleting"
241     DELETED = "deleted"
242     BACKUP = "backup"
243     ATTACHING = "attaching"
244     UNKNOWN = "unknown"
245 
246 
247 class VolumeSnapshotState(object):
248     """
249     Standard states of VolumeSnapshots
250     """
251     AVAILABLE = 0
252     ERROR = 1
253     CREATING = 2
254     DELETING = 3
255     RESTORING = 4
256     UNKNOWN = 5
257 
258 
259 class Architecture(object):
260     """
261     Image and size architectures.
262 
263     :cvar I386: i386 (32 bt)
264     :cvar X86_64: x86_64 (64 bit)
265     """
266     I386 = 0
267     X86_X64 = 1
268 
269 
270 class DeploymentError(LibcloudError):
271     """
272     Exception used when a Deployment Task failed.
273 
274     :ivar node: :class:`Node` on which this exception happened, you might want
275                 to call :func:`Node.destroy`
276     """
277     def __init__(self, node, original_exception=None, driver=None):
278         self.node = node
279         self.value = original_exception
280         self.driver = driver
281 
282     def __str__(self):
283         return self.__repr__()
284 
285     def __repr__(self):
286         return (('<DeploymentError: node=%s, error=%s, driver=%s>'
287                 % (self.node.id, str(self.value), str(self.driver))))
288 
289 
290 class KeyPairError(LibcloudError):
291     error_type = 'KeyPairError'
292 
293     def __init__(self, name, driver):
294         self.name = name
295         self.value = 'Key pair with name %s does not exist' % (name)
296         super(KeyPairError, self).__init__(value=self.value, driver=driver)
297 
298     def __str__(self):
299         return self.__repr__()
300 
301     def __repr__(self):
302         return ('<%s name=%s, value=%s, driver=%s>' %
303                 (self.error_type, self.name, self.value, self.driver.name))
304 
305 
306 class KeyPairDoesNotExistError(KeyPairError):
307     error_type = 'KeyPairDoesNotExistError'
308 
309 
310 """Deprecated alias of :class:`DeploymentException`"""
311 DeploymentException = DeploymentError
312
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py
--- a/libcloud/compute/types.py
+++ b/libcloud/compute/types.py
@@ -35,7 +35,27 @@
 ]
 
 
-class Provider(object):
+class Type(object):
+    @classmethod
+    def tostring(cls, value):
+        """Return the string representation of the state object attribute
+        :param str value: the state object to turn into string
+        :return: the uppercase string that represents the state object
+        :rtype: str
+        """
+        return value.upper()
+
+    @classmethod
+    def fromstring(cls, value):
+        """Return the state object attribute that matches the string
+        :param str value: the string to look up
+        :return: the state object attribute that matches the string
+        :rtype: str
+        """
+        return getattr(cls, value.upper(), None)
+
+
+class Provider(Type):
     """
     Defines for each of the supported providers
 
@@ -189,7 +209,7 @@
 }
 
 
-class NodeState(object):
+class NodeState(Type):
     """
     Standard states for a node
 
@@ -204,56 +224,42 @@
     :cvar PAUSED: Node is paused.
     :cvar UNKNOWN: Node state is unknown.
     """
-    RUNNING = 0
-    REBOOTING = 1
-    TERMINATED = 2
-    PENDING = 3
-    UNKNOWN = 4
-    STOPPED = 5
-    SUSPENDED = 6
-    ERROR = 7
-    PAUSED = 8
-
-    @classmethod
-    def tostring(cls, value):
-        values = cls.__dict__
-        values = dict([(key, string) for key, string in values.items() if
-                       not key.startswith('__')])
-
-        for item_key, item_value in values.items():
-            if value == item_value:
-                return item_key
-
-    @classmethod
-    def fromstring(cls, value):
-        return getattr(cls, value.upper(), None)
-
-
-class StorageVolumeState(object):
+    RUNNING = 'running'
+    REBOOTING = 'rebooting'
+    TERMINATED = 'terminated'
+    PENDING = 'pending'
+    UNKNOWN = 'unknown'
+    STOPPED = 'stopped'
+    SUSPENDED = 'suspended'
+    ERROR = 'error'
+    PAUSED = 'paused'
+
+
+class StorageVolumeState(Type):
     """
     Standard states of a StorageVolume
     """
-    AVAILABLE = "available"
-    ERROR = "error"
-    INUSE = "in_use"
-    CREATING = "creating"
-    DELETING = "deleting"
-    DELETED = "deleted"
-    BACKUP = "backup"
-    ATTACHING = "attaching"
-    UNKNOWN = "unknown"
-
-
-class VolumeSnapshotState(object):
+    AVAILABLE = 'available'
+    ERROR = 'error'
+    INUSE = 'inuse'
+    CREATING = 'creating'
+    DELETING = 'deleting'
+    DELETED = 'deleted'
+    BACKUP = 'backup'
+    ATTACHING = 'attaching'
+    UNKNOWN = 'unknown'
+
+
+class VolumeSnapshotState(Type):
     """
     Standard states of VolumeSnapshots
     """
-    AVAILABLE = 0
-    ERROR = 1
-    CREATING = 2
-    DELETING = 3
-    RESTORING = 4
-    UNKNOWN = 5
+    AVAILABLE = 'available'
+    ERROR = 'error'
+    CREATING = 'creating'
+    DELETING = 'deleting'
+    RESTORING = 'restoring'
+    UNKNOWN = 'unknown'
 
 
 class Architecture(object):

{"golden_diff": "diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py\n--- a/libcloud/compute/types.py\n+++ b/libcloud/compute/types.py\n@@ -35,7 +35,27 @@\n ]\n \n \n-class Provider(object):\n+class Type(object):\n+    @classmethod\n+    def tostring(cls, value):\n+        \"\"\"Return the string representation of the state object attribute\n+        :param str value: the state object to turn into string\n+        :return: the uppercase string that represents the state object\n+        :rtype: str\n+        \"\"\"\n+        return value.upper()\n+\n+    @classmethod\n+    def fromstring(cls, value):\n+        \"\"\"Return the state object attribute that matches the string\n+        :param str value: the string to look up\n+        :return: the state object attribute that matches the string\n+        :rtype: str\n+        \"\"\"\n+        return getattr(cls, value.upper(), None)\n+\n+\n+class Provider(Type):\n     \"\"\"\n     Defines for each of the supported providers\n \n@@ -189,7 +209,7 @@\n }\n \n \n-class NodeState(object):\n+class NodeState(Type):\n     \"\"\"\n     Standard states for a node\n \n@@ -204,56 +224,42 @@\n     :cvar PAUSED: Node is paused.\n     :cvar UNKNOWN: Node state is unknown.\n     \"\"\"\n-    RUNNING = 0\n-    REBOOTING = 1\n-    TERMINATED = 2\n-    PENDING = 3\n-    UNKNOWN = 4\n-    STOPPED = 5\n-    SUSPENDED = 6\n-    ERROR = 7\n-    PAUSED = 8\n-\n-    @classmethod\n-    def tostring(cls, value):\n-        values = cls.__dict__\n-        values = dict([(key, string) for key, string in values.items() if\n-                       not key.startswith('__')])\n-\n-        for item_key, item_value in values.items():\n-            if value == item_value:\n-                return item_key\n-\n-    @classmethod\n-    def fromstring(cls, value):\n-        return getattr(cls, value.upper(), None)\n-\n-\n-class StorageVolumeState(object):\n+    RUNNING = 'running'\n+    REBOOTING = 'rebooting'\n+    TERMINATED = 'terminated'\n+    PENDING = 'pending'\n+    UNKNOWN = 'unknown'\n+    STOPPED = 'stopped'\n+    SUSPENDED = 'suspended'\n+    ERROR = 'error'\n+    PAUSED = 'paused'\n+\n+\n+class StorageVolumeState(Type):\n     \"\"\"\n     Standard states of a StorageVolume\n     \"\"\"\n-    AVAILABLE = \"available\"\n-    ERROR = \"error\"\n-    INUSE = \"in_use\"\n-    CREATING = \"creating\"\n-    DELETING = \"deleting\"\n-    DELETED = \"deleted\"\n-    BACKUP = \"backup\"\n-    ATTACHING = \"attaching\"\n-    UNKNOWN = \"unknown\"\n-\n-\n-class VolumeSnapshotState(object):\n+    AVAILABLE = 'available'\n+    ERROR = 'error'\n+    INUSE = 'inuse'\n+    CREATING = 'creating'\n+    DELETING = 'deleting'\n+    DELETED = 'deleted'\n+    BACKUP = 'backup'\n+    ATTACHING = 'attaching'\n+    UNKNOWN = 'unknown'\n+\n+\n+class VolumeSnapshotState(Type):\n     \"\"\"\n     Standard states of VolumeSnapshots\n     \"\"\"\n-    AVAILABLE = 0\n-    ERROR = 1\n-    CREATING = 2\n-    DELETING = 3\n-    RESTORING = 4\n-    UNKNOWN = 5\n+    AVAILABLE = 'available'\n+    ERROR = 'error'\n+    CREATING = 'creating'\n+    DELETING = 'deleting'\n+    RESTORING = 'restoring'\n+    UNKNOWN = 'unknown'\n \n \n class Architecture(object):\n", "issue": "Turn all States into string values instead of ints\n@Kami\n\nLuckily, most tests already used the constants. I found a couple sloppy drivers, especially the ProfitBricks driver, which uses NodeState for everything, including Volumes and Snapshots. Maybe we fix that, maybe we leave it. It doesn't really matter.\n\n", "before_files": [{"content": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements.  See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License.  You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"\nBase types used by other parts of libcloud\n\"\"\"\n\nfrom libcloud.common.types import LibcloudError, MalformedResponseError\nfrom libcloud.common.types import InvalidCredsError, InvalidCredsException\n\n__all__ = [\n    \"Provider\",\n    \"NodeState\",\n    \"DeploymentError\",\n    \"DeploymentException\",\n\n    # @@TR: should the unused imports below be exported?\n    \"LibcloudError\",\n    \"MalformedResponseError\",\n    \"InvalidCredsError\",\n    \"InvalidCredsException\",\n    \"DEPRECATED_RACKSPACE_PROVIDERS\",\n    \"OLD_CONSTANT_TO_NEW_MAPPING\"\n]\n\n\nclass Provider(object):\n    \"\"\"\n    Defines for each of the supported providers\n\n    :cvar DUMMY: Example provider\n    :cvar EC2_US_EAST: Amazon AWS US N. Virgina\n    :cvar EC2_US_WEST: Amazon AWS US N. California\n    :cvar EC2_EU_WEST: Amazon AWS EU Ireland\n    :cvar RACKSPACE: Rackspace next-gen OpenStack based Cloud Servers\n    :cvar RACKSPACE_FIRST_GEN: Rackspace First Gen Cloud Servers\n    :cvar GCE: Google Compute Engine\n    :cvar GOGRID: GoGrid\n    :cvar VPSNET: VPS.net\n    :cvar LINODE: Linode.com\n    :cvar VCLOUD: vmware vCloud\n    :cvar RIMUHOSTING: RimuHosting.com\n    :cvar ECP: Enomaly\n    :cvar IBM: IBM Developer Cloud\n    :cvar OPENNEBULA: OpenNebula.org\n    :cvar ELASTICHOSTS: ElasticHosts.com\n    :cvar CLOUDSIGMA: CloudSigma\n    :cvar NIMBUS: Nimbus\n    :cvar BLUEBOX: Bluebox\n    :cvar OPSOURCE: Opsource Cloud\n    :cvar DIMENSIONDATA: Dimension Data Cloud\n    :cvar NINEFOLD: Ninefold\n    :cvar TERREMARK: Terremark\n    :cvar EC2_US_WEST_OREGON: Amazon AWS US West 2 (Oregon)\n    :cvar CLOUDSTACK: CloudStack\n    :cvar CLOUDSIGMA_US: CloudSigma US Las Vegas\n    :cvar LIBVIRT: Libvirt driver\n    :cvar JOYENT: Joyent driver\n    :cvar VCL: VCL driver\n    :cvar KTUCLOUD: kt ucloud driver\n    :cvar GRIDSPOT: Gridspot driver\n    :cvar ABIQUO: Abiquo driver\n    :cvar NEPHOSCALE: NephoScale driver\n    :cvar EXOSCALE: Exoscale driver.\n    :cvar IKOULA: Ikoula driver.\n    :cvar OUTSCALE_SAS: Outscale SAS driver.\n    :cvar OUTSCALE_INC: Outscale INC driver.\n    :cvar PROFIT_BRICKS: ProfitBricks driver.\n    :cvar VULTR: vultr driver.\n    :cvar AZURE: Azure driver.\n    :cvar AURORACOMPUTE: Aurora Compute driver.\n    \"\"\"\n    AZURE = 'azure'\n    DUMMY = 'dummy'\n    EC2 = 'ec2_us_east'\n    RACKSPACE = 'rackspace'\n    GCE = 'gce'\n    GOGRID = 'gogrid'\n    VPSNET = 'vpsnet'\n    LINODE = 'linode'\n    VCLOUD = 'vcloud'\n    RIMUHOSTING = 'rimuhosting'\n    VOXEL = 'voxel'\n    SOFTLAYER = 'softlayer'\n    EUCALYPTUS = 'eucalyptus'\n    ECP = 'ecp'\n    IBM = 'ibm'\n    OPENNEBULA = 'opennebula'\n    ELASTICHOSTS = 'elastichosts'\n    BRIGHTBOX = 'brightbox'\n    CLOUDSIGMA = 'cloudsigma'\n    NIMBUS = 'nimbus'\n    BLUEBOX = 'bluebox'\n    GANDI = 'gandi'\n    OPSOURCE = 'opsource'\n    DIMENSIONDATA = 'dimensiondata'\n    OPENSTACK = 'openstack'\n    SKALICLOUD = 'skalicloud'\n    SERVERLOVE = 'serverlove'\n    NINEFOLD = 'ninefold'\n    TERREMARK = 'terremark'\n    CLOUDSTACK = 'cloudstack'\n    LIBVIRT = 'libvirt'\n    JOYENT = 'joyent'\n    VCL = 'vcl'\n    KTUCLOUD = 'ktucloud'\n    GRIDSPOT = 'gridspot'\n    RACKSPACE_FIRST_GEN = 'rackspace_first_gen'\n    HOSTVIRTUAL = 'hostvirtual'\n    ABIQUO = 'abiquo'\n    DIGITAL_OCEAN = 'digitalocean'\n    NEPHOSCALE = 'nephoscale'\n    CLOUDFRAMES = 'cloudframes'\n    EXOSCALE = 'exoscale'\n    IKOULA = 'ikoula'\n    OUTSCALE_SAS = 'outscale_sas'\n    OUTSCALE_INC = 'outscale_inc'\n    VSPHERE = 'vsphere'\n    PROFIT_BRICKS = 'profitbricks'\n    VULTR = 'vultr'\n    AURORACOMPUTE = 'aurora_compute'\n    CLOUDWATT = 'cloudwatt'\n    PACKET = 'packet'\n    RUNABOVE = 'runabove'\n\n    # OpenStack based providers\n    HPCLOUD = 'hpcloud'\n    CLOUDWATT = 'cloudwatt'\n    KILI = 'kili'\n    ONAPP = 'onapp'\n\n    # Deprecated constants which are still supported\n    EC2_US_EAST = 'ec2_us_east'\n    EC2_EU = 'ec2_eu_west'  # deprecated name\n    EC2_EU_WEST = 'ec2_eu_west'\n    EC2_US_WEST = 'ec2_us_west'\n    EC2_AP_SOUTHEAST = 'ec2_ap_southeast'\n    EC2_AP_NORTHEAST = 'ec2_ap_northeast'\n    EC2_US_WEST_OREGON = 'ec2_us_west_oregon'\n    EC2_SA_EAST = 'ec2_sa_east'\n    EC2_AP_SOUTHEAST2 = 'ec2_ap_southeast_2'\n\n    ELASTICHOSTS_UK1 = 'elastichosts_uk1'\n    ELASTICHOSTS_UK2 = 'elastichosts_uk2'\n    ELASTICHOSTS_US1 = 'elastichosts_us1'\n    ELASTICHOSTS_US2 = 'elastichosts_us2'\n    ELASTICHOSTS_US3 = 'elastichosts_us3'\n    ELASTICHOSTS_CA1 = 'elastichosts_ca1'\n    ELASTICHOSTS_AU1 = 'elastichosts_au1'\n    ELASTICHOSTS_CN1 = 'elastichosts_cn1'\n\n    CLOUDSIGMA_US = 'cloudsigma_us'\n\n    # Deprecated constants which aren't supported anymore\n    RACKSPACE_UK = 'rackspace_uk'\n    RACKSPACE_NOVA_BETA = 'rackspace_nova_beta'\n    RACKSPACE_NOVA_DFW = 'rackspace_nova_dfw'\n    RACKSPACE_NOVA_LON = 'rackspace_nova_lon'\n    RACKSPACE_NOVA_ORD = 'rackspace_nova_ord'\n\n    # Removed\n    # SLICEHOST = 'slicehost'\n\n\nDEPRECATED_RACKSPACE_PROVIDERS = [Provider.RACKSPACE_UK,\n                                  Provider.RACKSPACE_NOVA_BETA,\n                                  Provider.RACKSPACE_NOVA_DFW,\n                                  Provider.RACKSPACE_NOVA_LON,\n                                  Provider.RACKSPACE_NOVA_ORD]\nOLD_CONSTANT_TO_NEW_MAPPING = {\n    Provider.RACKSPACE: Provider.RACKSPACE_FIRST_GEN,\n    Provider.RACKSPACE_UK: Provider.RACKSPACE_FIRST_GEN,\n\n    Provider.RACKSPACE_NOVA_BETA: Provider.RACKSPACE,\n    Provider.RACKSPACE_NOVA_DFW: Provider.RACKSPACE,\n    Provider.RACKSPACE_NOVA_LON: Provider.RACKSPACE,\n    Provider.RACKSPACE_NOVA_ORD: Provider.RACKSPACE\n}\n\n\nclass NodeState(object):\n    \"\"\"\n    Standard states for a node\n\n    :cvar RUNNING: Node is running.\n    :cvar REBOOTING: Node is rebooting.\n    :cvar TERMINATED: Node is terminated. This node can't be started later on.\n    :cvar STOPPED: Node is stopped. This node can be started later on.\n    :cvar PENDING: Node is pending.\n    :cvar SUSPENDED: Node is suspended.\n    :cvar ERROR: Node is an error state. Usually no operations can be performed\n                 on the node once it ends up in the error state.\n    :cvar PAUSED: Node is paused.\n    :cvar UNKNOWN: Node state is unknown.\n    \"\"\"\n    RUNNING = 0\n    REBOOTING = 1\n    TERMINATED = 2\n    PENDING = 3\n    UNKNOWN = 4\n    STOPPED = 5\n    SUSPENDED = 6\n    ERROR = 7\n    PAUSED = 8\n\n    @classmethod\n    def tostring(cls, value):\n        values = cls.__dict__\n        values = dict([(key, string) for key, string in values.items() if\n                       not key.startswith('__')])\n\n        for item_key, item_value in values.items():\n            if value == item_value:\n                return item_key\n\n    @classmethod\n    def fromstring(cls, value):\n        return getattr(cls, value.upper(), None)\n\n\nclass StorageVolumeState(object):\n    \"\"\"\n    Standard states of a StorageVolume\n    \"\"\"\n    AVAILABLE = \"available\"\n    ERROR = \"error\"\n    INUSE = \"in_use\"\n    CREATING = \"creating\"\n    DELETING = \"deleting\"\n    DELETED = \"deleted\"\n    BACKUP = \"backup\"\n    ATTACHING = \"attaching\"\n    UNKNOWN = \"unknown\"\n\n\nclass VolumeSnapshotState(object):\n    \"\"\"\n    Standard states of VolumeSnapshots\n    \"\"\"\n    AVAILABLE = 0\n    ERROR = 1\n    CREATING = 2\n    DELETING = 3\n    RESTORING = 4\n    UNKNOWN = 5\n\n\nclass Architecture(object):\n    \"\"\"\n    Image and size architectures.\n\n    :cvar I386: i386 (32 bt)\n    :cvar X86_64: x86_64 (64 bit)\n    \"\"\"\n    I386 = 0\n    X86_X64 = 1\n\n\nclass DeploymentError(LibcloudError):\n    \"\"\"\n    Exception used when a Deployment Task failed.\n\n    :ivar node: :class:`Node` on which this exception happened, you might want\n                to call :func:`Node.destroy`\n    \"\"\"\n    def __init__(self, node, original_exception=None, driver=None):\n        self.node = node\n        self.value = original_exception\n        self.driver = driver\n\n    def __str__(self):\n        return self.__repr__()\n\n    def __repr__(self):\n        return (('<DeploymentError: node=%s, error=%s, driver=%s>'\n                % (self.node.id, str(self.value), str(self.driver))))\n\n\nclass KeyPairError(LibcloudError):\n    error_type = 'KeyPairError'\n\n    def __init__(self, name, driver):\n        self.name = name\n        self.value = 'Key pair with name %s does not exist' % (name)\n        super(KeyPairError, self).__init__(value=self.value, driver=driver)\n\n    def __str__(self):\n        return self.__repr__()\n\n    def __repr__(self):\n        return ('<%s name=%s, value=%s, driver=%s>' %\n                (self.error_type, self.name, self.value, self.driver.name))\n\n\nclass KeyPairDoesNotExistError(KeyPairError):\n    error_type = 'KeyPairDoesNotExistError'\n\n\n\"\"\"Deprecated alias of :class:`DeploymentException`\"\"\"\nDeploymentException = DeploymentError\n", "path": "libcloud/compute/types.py"}], "after_files": [{"content": "# Licensed to the Apache Software Foundation (ASF) under one or more\n# contributor license agreements.  See the NOTICE file distributed with\n# this work for additional information regarding copyright ownership.\n# The ASF licenses this file to You under the Apache License, Version 2.0\n# (the \"License\"); you may not use this file except in compliance with\n# the License.  You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"\nBase types used by other parts of libcloud\n\"\"\"\n\nfrom libcloud.common.types import LibcloudError, MalformedResponseError\nfrom libcloud.common.types import InvalidCredsError, InvalidCredsException\n\n__all__ = [\n    \"Provider\",\n    \"NodeState\",\n    \"DeploymentError\",\n    \"DeploymentException\",\n\n    # @@TR: should the unused imports below be exported?\n    \"LibcloudError\",\n    \"MalformedResponseError\",\n    \"InvalidCredsError\",\n    \"InvalidCredsException\",\n    \"DEPRECATED_RACKSPACE_PROVIDERS\",\n    \"OLD_CONSTANT_TO_NEW_MAPPING\"\n]\n\n\nclass Type(object):\n    @classmethod\n    def tostring(cls, value):\n        \"\"\"Return the string representation of the state object attribute\n        :param str value: the state object to turn into string\n        :return: the uppercase string that represents the state object\n        :rtype: str\n        \"\"\"\n        return value.upper()\n\n    @classmethod\n    def fromstring(cls, value):\n        \"\"\"Return the state object attribute that matches the string\n        :param str value: the string to look up\n        :return: the state object attribute that matches the string\n        :rtype: str\n        \"\"\"\n        return getattr(cls, value.upper(), None)\n\n\nclass Provider(Type):\n    \"\"\"\n    Defines for each of the supported providers\n\n    :cvar DUMMY: Example provider\n    :cvar EC2_US_EAST: Amazon AWS US N. Virgina\n    :cvar EC2_US_WEST: Amazon AWS US N. California\n    :cvar EC2_EU_WEST: Amazon AWS EU Ireland\n    :cvar RACKSPACE: Rackspace next-gen OpenStack based Cloud Servers\n    :cvar RACKSPACE_FIRST_GEN: Rackspace First Gen Cloud Servers\n    :cvar GCE: Google Compute Engine\n    :cvar GOGRID: GoGrid\n    :cvar VPSNET: VPS.net\n    :cvar LINODE: Linode.com\n    :cvar VCLOUD: vmware vCloud\n    :cvar RIMUHOSTING: RimuHosting.com\n    :cvar ECP: Enomaly\n    :cvar IBM: IBM Developer Cloud\n    :cvar OPENNEBULA: OpenNebula.org\n    :cvar ELASTICHOSTS: ElasticHosts.com\n    :cvar CLOUDSIGMA: CloudSigma\n    :cvar NIMBUS: Nimbus\n    :cvar BLUEBOX: Bluebox\n    :cvar OPSOURCE: Opsource Cloud\n    :cvar DIMENSIONDATA: Dimension Data Cloud\n    :cvar NINEFOLD: Ninefold\n    :cvar TERREMARK: Terremark\n    :cvar EC2_US_WEST_OREGON: Amazon AWS US West 2 (Oregon)\n    :cvar CLOUDSTACK: CloudStack\n    :cvar CLOUDSIGMA_US: CloudSigma US Las Vegas\n    :cvar LIBVIRT: Libvirt driver\n    :cvar JOYENT: Joyent driver\n    :cvar VCL: VCL driver\n    :cvar KTUCLOUD: kt ucloud driver\n    :cvar GRIDSPOT: Gridspot driver\n    :cvar ABIQUO: Abiquo driver\n    :cvar NEPHOSCALE: NephoScale driver\n    :cvar EXOSCALE: Exoscale driver.\n    :cvar IKOULA: Ikoula driver.\n    :cvar OUTSCALE_SAS: Outscale SAS driver.\n    :cvar OUTSCALE_INC: Outscale INC driver.\n    :cvar PROFIT_BRICKS: ProfitBricks driver.\n    :cvar VULTR: vultr driver.\n    :cvar AZURE: Azure driver.\n    :cvar AURORACOMPUTE: Aurora Compute driver.\n    \"\"\"\n    AZURE = 'azure'\n    DUMMY = 'dummy'\n    EC2 = 'ec2_us_east'\n    RACKSPACE = 'rackspace'\n    GCE = 'gce'\n    GOGRID = 'gogrid'\n    VPSNET = 'vpsnet'\n    LINODE = 'linode'\n    VCLOUD = 'vcloud'\n    RIMUHOSTING = 'rimuhosting'\n    VOXEL = 'voxel'\n    SOFTLAYER = 'softlayer'\n    EUCALYPTUS = 'eucalyptus'\n    ECP = 'ecp'\n    IBM = 'ibm'\n    OPENNEBULA = 'opennebula'\n    ELASTICHOSTS = 'elastichosts'\n    BRIGHTBOX = 'brightbox'\n    CLOUDSIGMA = 'cloudsigma'\n    NIMBUS = 'nimbus'\n    BLUEBOX = 'bluebox'\n    GANDI = 'gandi'\n    OPSOURCE = 'opsource'\n    DIMENSIONDATA = 'dimensiondata'\n    OPENSTACK = 'openstack'\n    SKALICLOUD = 'skalicloud'\n    SERVERLOVE = 'serverlove'\n    NINEFOLD = 'ninefold'\n    TERREMARK = 'terremark'\n    CLOUDSTACK = 'cloudstack'\n    LIBVIRT = 'libvirt'\n    JOYENT = 'joyent'\n    VCL = 'vcl'\n    KTUCLOUD = 'ktucloud'\n    GRIDSPOT = 'gridspot'\n    RACKSPACE_FIRST_GEN = 'rackspace_first_gen'\n    HOSTVIRTUAL = 'hostvirtual'\n    ABIQUO = 'abiquo'\n    DIGITAL_OCEAN = 'digitalocean'\n    NEPHOSCALE = 'nephoscale'\n    CLOUDFRAMES = 'cloudframes'\n    EXOSCALE = 'exoscale'\n    IKOULA = 'ikoula'\n    OUTSCALE_SAS = 'outscale_sas'\n    OUTSCALE_INC = 'outscale_inc'\n    VSPHERE = 'vsphere'\n    PROFIT_BRICKS = 'profitbricks'\n    VULTR = 'vultr'\n    AURORACOMPUTE = 'aurora_compute'\n    CLOUDWATT = 'cloudwatt'\n    PACKET = 'packet'\n    RUNABOVE = 'runabove'\n\n    # OpenStack based providers\n    HPCLOUD = 'hpcloud'\n    CLOUDWATT = 'cloudwatt'\n    KILI = 'kili'\n    ONAPP = 'onapp'\n\n    # Deprecated constants which are still supported\n    EC2_US_EAST = 'ec2_us_east'\n    EC2_EU = 'ec2_eu_west'  # deprecated name\n    EC2_EU_WEST = 'ec2_eu_west'\n    EC2_US_WEST = 'ec2_us_west'\n    EC2_AP_SOUTHEAST = 'ec2_ap_southeast'\n    EC2_AP_NORTHEAST = 'ec2_ap_northeast'\n    EC2_US_WEST_OREGON = 'ec2_us_west_oregon'\n    EC2_SA_EAST = 'ec2_sa_east'\n    EC2_AP_SOUTHEAST2 = 'ec2_ap_southeast_2'\n\n    ELASTICHOSTS_UK1 = 'elastichosts_uk1'\n    ELASTICHOSTS_UK2 = 'elastichosts_uk2'\n    ELASTICHOSTS_US1 = 'elastichosts_us1'\n    ELASTICHOSTS_US2 = 'elastichosts_us2'\n    ELASTICHOSTS_US3 = 'elastichosts_us3'\n    ELASTICHOSTS_CA1 = 'elastichosts_ca1'\n    ELASTICHOSTS_AU1 = 'elastichosts_au1'\n    ELASTICHOSTS_CN1 = 'elastichosts_cn1'\n\n    CLOUDSIGMA_US = 'cloudsigma_us'\n\n    # Deprecated constants which aren't supported anymore\n    RACKSPACE_UK = 'rackspace_uk'\n    RACKSPACE_NOVA_BETA = 'rackspace_nova_beta'\n    RACKSPACE_NOVA_DFW = 'rackspace_nova_dfw'\n    RACKSPACE_NOVA_LON = 'rackspace_nova_lon'\n    RACKSPACE_NOVA_ORD = 'rackspace_nova_ord'\n\n    # Removed\n    # SLICEHOST = 'slicehost'\n\n\nDEPRECATED_RACKSPACE_PROVIDERS = [Provider.RACKSPACE_UK,\n                                  Provider.RACKSPACE_NOVA_BETA,\n                                  Provider.RACKSPACE_NOVA_DFW,\n                                  Provider.RACKSPACE_NOVA_LON,\n                                  Provider.RACKSPACE_NOVA_ORD]\nOLD_CONSTANT_TO_NEW_MAPPING = {\n    Provider.RACKSPACE: Provider.RACKSPACE_FIRST_GEN,\n    Provider.RACKSPACE_UK: Provider.RACKSPACE_FIRST_GEN,\n\n    Provider.RACKSPACE_NOVA_BETA: Provider.RACKSPACE,\n    Provider.RACKSPACE_NOVA_DFW: Provider.RACKSPACE,\n    Provider.RACKSPACE_NOVA_LON: Provider.RACKSPACE,\n    Provider.RACKSPACE_NOVA_ORD: Provider.RACKSPACE\n}\n\n\nclass NodeState(Type):\n    \"\"\"\n    Standard states for a node\n\n    :cvar RUNNING: Node is running.\n    :cvar REBOOTING: Node is rebooting.\n    :cvar TERMINATED: Node is terminated. This node can't be started later on.\n    :cvar STOPPED: Node is stopped. This node can be started later on.\n    :cvar PENDING: Node is pending.\n    :cvar SUSPENDED: Node is suspended.\n    :cvar ERROR: Node is an error state. Usually no operations can be performed\n                 on the node once it ends up in the error state.\n    :cvar PAUSED: Node is paused.\n    :cvar UNKNOWN: Node state is unknown.\n    \"\"\"\n    RUNNING = 'running'\n    REBOOTING = 'rebooting'\n    TERMINATED = 'terminated'\n    PENDING = 'pending'\n    UNKNOWN = 'unknown'\n    STOPPED = 'stopped'\n    SUSPENDED = 'suspended'\n    ERROR = 'error'\n    PAUSED = 'paused'\n\n\nclass StorageVolumeState(Type):\n    \"\"\"\n    Standard states of a StorageVolume\n    \"\"\"\n    AVAILABLE = 'available'\n    ERROR = 'error'\n    INUSE = 'inuse'\n    CREATING = 'creating'\n    DELETING = 'deleting'\n    DELETED = 'deleted'\n    BACKUP = 'backup'\n    ATTACHING = 'attaching'\n    UNKNOWN = 'unknown'\n\n\nclass VolumeSnapshotState(Type):\n    \"\"\"\n    Standard states of VolumeSnapshots\n    \"\"\"\n    AVAILABLE = 'available'\n    ERROR = 'error'\n    CREATING = 'creating'\n    DELETING = 'deleting'\n    RESTORING = 'restoring'\n    UNKNOWN = 'unknown'\n\n\nclass Architecture(object):\n    \"\"\"\n    Image and size architectures.\n\n    :cvar I386: i386 (32 bt)\n    :cvar X86_64: x86_64 (64 bit)\n    \"\"\"\n    I386 = 0\n    X86_X64 = 1\n\n\nclass DeploymentError(LibcloudError):\n    \"\"\"\n    Exception used when a Deployment Task failed.\n\n    :ivar node: :class:`Node` on which this exception happened, you might want\n                to call :func:`Node.destroy`\n    \"\"\"\n    def __init__(self, node, original_exception=None, driver=None):\n        self.node = node\n        self.value = original_exception\n        self.driver = driver\n\n    def __str__(self):\n        return self.__repr__()\n\n    def __repr__(self):\n        return (('<DeploymentError: node=%s, error=%s, driver=%s>'\n                % (self.node.id, str(self.value), str(self.driver))))\n\n\nclass KeyPairError(LibcloudError):\n    error_type = 'KeyPairError'\n\n    def __init__(self, name, driver):\n        self.name = name\n        self.value = 'Key pair with name %s does not exist' % (name)\n        super(KeyPairError, self).__init__(value=self.value, driver=driver)\n\n    def __str__(self):\n        return self.__repr__()\n\n    def __repr__(self):\n        return ('<%s name=%s, value=%s, driver=%s>' %\n                (self.error_type, self.name, self.value, self.driver.name))\n\n\nclass KeyPairDoesNotExistError(KeyPairError):\n    error_type = 'KeyPairDoesNotExistError'\n\n\n\"\"\"Deprecated alias of :class:`DeploymentException`\"\"\"\nDeploymentException = DeploymentError\n", "path": "libcloud/compute/types.py"}]}