Home > openstack > VM creation process in OpenStack nova

VM creation process in OpenStack nova

VM creation process in Openstack nova – a step by step guide

1. **** Python Nova-Client **** :
nova boot –image cirros-0.3.1-x86_64-uec-kernel –flavor m1.tiny s2

2. **** Nova API **** :
a. /opt/stack/nova/nova/api/openstack/compute/servers.py M: create() Description: Gather information about new vm (flavor, network and so on)
b. /opt/stack/nova/nova/compute/api.py M : create() Description: check vm create policies, call rpc to send message to scheduler
c. /opt/stack/nova/nova/compute/rpcapi.py M: run_instance Description: cast the vm createtion message to the scheulder
d. An entry is made in the dababase setting the vm status “BUILD” / “Swapning”

 

openstack_vm_creation

 

 

when Intercepted from rabbitmq VM creattion Message looks like:

"_context_request_id":"req-105fe9dd-9f34-4377-bc23-fa9bf6ffe71b",
"_context_quota_class":null,
"user_id":"aa59e71cc3a24abb86c9aefc1f72342e",
"display_description":"s2",
"project_id":"73640f0046794110936a345e2576601e",
"display_name":"s2",
"memo ry_mb":512,
"image_ref":"71b14bd0-7793-4b07-a8cf-db4b2c46e56d",
"_unique_id":"70b9c5f59a074578b2a578907a616f7d",
"_context_project_name":"demo",
"_context_project_id":"73640f0046794110936a345e2576601e",
"_context_user":"aa59e71cc3a24abb86c9aefc1f72342e",
"_context_user_ name":"demo",
"method":"run_instance",
"_context_remote_address":"10.245.122.50"
}

3. ****NOVA_SCHEDULDER****:

At the scheduler side:
a. RPC Dispatcher OpenStack/common/rpc/dispatcher.py dispatches the message to the worker.
b. /opt/stack/nova/nova/scheduler/manager.py M: run_instance() is called to create and run the VM
c. /opt/stack/nova/nova/scheduler/filter_scheduler.py M: schedule_run_instance() is called to find eligible host where new vm can be created and run.
d. If possible VM is created & run and in the database the status of the machine is changed to Active / Error or something else.
d. The status of the creation process is also send through notifier.notify() method.
f. /opt/stack/nova/nova/openstack/common/notifier/api.py M: notify() is called which put the message in the message queue.

A nofication (of type Info) message (truncated) stating VM creation error is following:

"_context_request_id":"req-105fe9dd-9f34-4377-bc23-fa9bf6ffe71b",
"_unique_id":"70b9c5f59a074578b2a578907a616f7d",
"_context_timestamp":"2014-01-07T21:23:07.811452",
"_context_user_id":"aa59e71cc3a24abb86c9aefc1f72342e",
"_context_project_name":"demo",
"_context_read_deleted":"no",
"_contex t_auth_token":"b194a1b3275f407d9dfdaf5013b59267",
"_context_tenant":"73640f0046794110936a345e2576601e",
"_context_instance_lock_checked":false,
"_context_is_ admin":false,
"version":"2.0",
"_context_project_id":"73640f0046794110936a345e2576601e",
"_context_user":"aa59e71cc3a24abb86c9aefc1f72342e",
"_context_user_ name":"demo",
"method":"run_instance",
"_context_remote_address":"10.245.122.50"
}

Note that both message has the same request id which is shown by the field _context_request_id and both message refer to the same VM which is dictated by the field _unique_id. So, upon receiving the message, the notification system may know the status of vm creation process.

Advertisements
Categories: openstack Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s