Compute manager should create instance

Registered by Jay Pipes

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_manager.create_networks(), where network_manager is the flag-defined manager object for networks. Similarly, users and projects are created with the auth manager with auth_manager.create_user() and auth_manager.create_project().

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_create(context, base_options)

api/openstack/servers.py
245: ref = self.db_driver.instance_create(ctxt, inst)

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_and_run_instance() to compute_manager that would combine create_instance() and run_instance()
3) Remove direct calls to db.instance_create() in both API's cloud controllers. Replace with above calls to the compute manager.

Blueprint information

Status:
Complete
Approver:
Jay Pipes
Priority:
Low
Drafter:
Jay Pipes
Direction:
Needs approval
Assignee:
Jay Pipes
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Jay Pipes
Completed by
Jay Pipes

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.