summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortermie <github@anarkystic.com>2011-04-20 12:00:21 -0700
committertermie <github@anarkystic.com>2011-04-20 12:00:21 -0700
commit98b8a800b16a1e6699b1d4c7ce0e4ab61319be6e (patch)
treeca1baf2f5581e5efdb42efc19c17841246d0d34c
parent1a814ba56a696ce796ab7707eacc2ee065c448e8 (diff)
downloadnova-98b8a800b16a1e6699b1d4c7ce0e4ab61319be6e.tar.gz
nova-98b8a800b16a1e6699b1d4c7ce0e4ab61319be6e.tar.xz
nova-98b8a800b16a1e6699b1d4c7ce0e4ab61319be6e.zip
docstring cleanup, nova/db dir
-rw-r--r--nova/db/api.py61
-rw-r--r--nova/db/base.py8
-rw-r--r--nova/db/migration.py2
3 files changed, 38 insertions, 33 deletions
diff --git a/nova/db/api.py b/nova/db/api.py
index 63901e94d..1b33d8932 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -15,8 +15,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-"""
-Defines interface for DB access.
+
+"""Defines interface for DB access.
The underlying driver is loaded as a :class:`LazyPluggable`.
@@ -30,6 +30,7 @@ The underlying driver is loaded as a :class:`LazyPluggable`.
:enable_new_services: when adding a new service to the database, is it in the
pool of available hardware (Default: True)
+
"""
from nova import exception
@@ -86,7 +87,7 @@ def service_get(context, service_id):
def service_get_by_host_and_topic(context, host, topic):
- """Get a service by host it's on and topic it listens to"""
+ """Get a service by host it's on and topic it listens to."""
return IMPL.service_get_by_host_and_topic(context, host, topic)
@@ -113,7 +114,7 @@ def service_get_all_compute_by_host(context, host):
def service_get_all_compute_sorted(context):
"""Get all compute services sorted by instance count.
- Returns a list of (Service, instance_count) tuples.
+ :returns: a list of (Service, instance_count) tuples.
"""
return IMPL.service_get_all_compute_sorted(context)
@@ -122,7 +123,7 @@ def service_get_all_compute_sorted(context):
def service_get_all_network_sorted(context):
"""Get all network services sorted by network count.
- Returns a list of (Service, network_count) tuples.
+ :returns: a list of (Service, network_count) tuples.
"""
return IMPL.service_get_all_network_sorted(context)
@@ -131,7 +132,7 @@ def service_get_all_network_sorted(context):
def service_get_all_volume_sorted(context):
"""Get all volume services sorted by volume count.
- Returns a list of (Service, volume_count) tuples.
+ :returns: a list of (Service, volume_count) tuples.
"""
return IMPL.service_get_all_volume_sorted(context)
@@ -241,7 +242,7 @@ def floating_ip_count_by_project(context, project_id):
def floating_ip_deallocate(context, address):
- """Deallocate an floating ip by address"""
+ """Deallocate an floating ip by address."""
return IMPL.floating_ip_deallocate(context, address)
@@ -253,7 +254,7 @@ def floating_ip_destroy(context, address):
def floating_ip_disassociate(context, address):
"""Disassociate an floating ip from a fixed ip by address.
- Returns the address of the existing fixed ip.
+ :returns: the address of the existing fixed ip.
"""
return IMPL.floating_ip_disassociate(context, address)
@@ -294,22 +295,22 @@ def floating_ip_update(context, address, values):
####################
def migration_update(context, id, values):
- """Update a migration instance"""
+ """Update a migration instance."""
return IMPL.migration_update(context, id, values)
def migration_create(context, values):
- """Create a migration record"""
+ """Create a migration record."""
return IMPL.migration_create(context, values)
def migration_get(context, migration_id):
- """Finds a migration by the id"""
+ """Finds a migration by the id."""
return IMPL.migration_get(context, migration_id)
def migration_get_by_instance_and_status(context, instance_id, status):
- """Finds a migration by the instance id its migrating"""
+ """Finds a migration by the instance id its migrating."""
return IMPL.migration_get_by_instance_and_status(context, instance_id,
status)
@@ -579,7 +580,9 @@ def network_create_safe(context, values):
def network_delete_safe(context, network_id):
"""Delete network with key network_id.
+
This method assumes that the network is not associated with any project
+
"""
return IMPL.network_delete_safe(context, network_id)
@@ -674,7 +677,6 @@ def project_get_network(context, project_id, associate=True):
network if one is not found, otherwise it returns None.
"""
-
return IMPL.project_get_network(context, project_id, associate)
@@ -722,7 +724,9 @@ def iscsi_target_create_safe(context, values):
The device is not returned. If the create violates the unique
constraints because the iscsi_target and host already exist,
- no exception is raised."""
+ no exception is raised.
+
+ """
return IMPL.iscsi_target_create_safe(context, values)
@@ -1050,10 +1054,7 @@ def project_delete(context, project_id):
def host_get_networks(context, host):
- """Return all networks for which the given host is the designated
- network host.
-
- """
+ """All networks for which the given host is the network host."""
return IMPL.host_get_networks(context, host)
@@ -1115,38 +1116,40 @@ def console_get(context, console_id, instance_id=None):
def instance_type_create(context, values):
- """Create a new instance type"""
+ """Create a new instance type."""
return IMPL.instance_type_create(context, values)
def instance_type_get_all(context, inactive=False):
- """Get all instance types"""
+ """Get all instance types."""
return IMPL.instance_type_get_all(context, inactive)
def instance_type_get_by_id(context, id):
- """Get instance type by id"""
+ """Get instance type by id."""
return IMPL.instance_type_get_by_id(context, id)
def instance_type_get_by_name(context, name):
- """Get instance type by name"""
+ """Get instance type by name."""
return IMPL.instance_type_get_by_name(context, name)
def instance_type_get_by_flavor_id(context, id):
- """Get instance type by name"""
+ """Get instance type by name."""
return IMPL.instance_type_get_by_flavor_id(context, id)
def instance_type_destroy(context, name):
- """Delete a instance type"""
+ """Delete a instance type."""
return IMPL.instance_type_destroy(context, name)
def instance_type_purge(context, name):
- """Purges (removes) an instance type from DB
- Use instance_type_destroy for most cases
+ """Purges (removes) an instance type from DB.
+
+ Use instance_type_destroy for most cases
+
"""
return IMPL.instance_type_purge(context, name)
@@ -1183,15 +1186,15 @@ def zone_get_all(context):
def instance_metadata_get(context, instance_id):
- """Get all metadata for an instance"""
+ """Get all metadata for an instance."""
return IMPL.instance_metadata_get(context, instance_id)
def instance_metadata_delete(context, instance_id, key):
- """Delete the given metadata item"""
+ """Delete the given metadata item."""
IMPL.instance_metadata_delete(context, instance_id, key)
def instance_metadata_update_or_create(context, instance_id, metadata):
- """Create or update instance metadata"""
+ """Create or update instance metadata."""
IMPL.instance_metadata_update_or_create(context, instance_id, metadata)
diff --git a/nova/db/base.py b/nova/db/base.py
index a0f2180c6..a0d055d5b 100644
--- a/nova/db/base.py
+++ b/nova/db/base.py
@@ -16,20 +16,20 @@
# License for the specific language governing permissions and limitations
# under the License.
-"""
-Base class for classes that need modular database access.
-"""
+"""Base class for classes that need modular database access."""
from nova import utils
from nova import flags
+
FLAGS = flags.FLAGS
flags.DEFINE_string('db_driver', 'nova.db.api',
'driver to use for database access')
class Base(object):
- """DB driver is injected in the init method"""
+ """DB driver is injected in the init method."""
+
def __init__(self, db_driver=None):
if not db_driver:
db_driver = FLAGS.db_driver
diff --git a/nova/db/migration.py b/nova/db/migration.py
index e54b90cd8..ccd06cffe 100644
--- a/nova/db/migration.py
+++ b/nova/db/migration.py
@@ -15,11 +15,13 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+
"""Database setup and migration commands."""
from nova import flags
from nova import utils
+
FLAGS = flags.FLAGS
flags.DECLARE('db_backend', 'nova.db.api')