Compute manager should create instance
Currently, there is an inconsistency in how instance data is created (compared with other types of data, like user, project, network, etc).
With the exception of instance data, all other models are created using their corresponding "manager" object. For instance, networks are created using network_
The above is all good :)
Unfortunately, for instances, the creation of instances in the database is entirely separate from the manager of instances (compute_manager). So, in order to create instances we create an instance in the data store in the API server:
api/ec2/cloud.py
849: instance_ref = db.instance_
api/openstack/
245: ref = self.db_
After the instance is created in the data store, only then can compute_manager be used, with the run_instance() method.
It would be more consistent to have compute_manager actually create the instance in the data store, instead.
Proposal:
1) Add a create_instance() method to the compute_manager. This will create the instance in the database and return the new instance's identifier to the caller.
2) Add a convenience method create_
3) Remove direct calls to db.instance_