rackspace/pyrax — pull request #8 by calebgroom (2013-02-04 22:43:21+00:00)
Title: Cloud Databases: Add instance.get_disk_usage()

I've been searching for a way to get the disk usage of a Cloud DB instance. The information returned by an instance listing only contains the volume size, not the usage value:

```python
>>> import os
>>> import pyrax
>>> pyrax.set_credential_file(os.path.expanduser("~/.rackspace_cloud_credentials"))
>>> cdb = pyrax.connect_to_cloud_databases(region='ORD')
>>> instance = cdb.list()[0]
>>> print instance.volume
{u'size': 1}
```

With this patch:

```python
>>> import os
>>> import pyrax
>>> pyrax.set_credential_file(os.path.expanduser("~/.rackspace_cloud_credentials"))
>>> cdb = pyrax.connect_to_cloud_databases(region='ORD')
>>> instance = cdb.list()[0]
>>> print instance.volume
{u'size': 1}
>>> print instance.get_disk_usage()
0.141017913818
```

If there's another way to get disk usage without this patch I'd love to know because I suspect its staring me in the face.