In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you about how to create instance for openstack e version. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
1. Horizon module:
The lanch of the tables.py is mapped to the LaunchForm of the forms.py through url, and then the parameters are passed in the page. Then call the server_create of nova.py in the api module,
2 、 python-novaclient
Then call create () in the ServerManager class of the python-novaclient module V1.1/servers.py, and _ boot () in the calling base.py to encapsulate the url request.
3. Nova module:
The release module for wsgi is in the nova/api/openstack/compute/__init__.py file. The corresponding relationship of url address after release is as follows:
Self._list () corresponds to the underlying index () function
Self._create () corresponds to the underlying create () function
Self._delete () corresponds to the underlying delete () function
Self._get () corresponds to the underlying show () function
The url of create corresponds to the create () in nova/api/openstack/compute/servers.py
In this function, get parameters such as image, network, flavor, etc., then call self.compute_api.create and then call self._schedule_run_instance, send the run_instance method of rpc_method in message queue, and call the run_instance of manager.py in scheduler module according to FLAGS.scheduler_topic configuration. The configuration file scheduler_driver= FLAGS.scheduler_driver, where the production environment uses-- scheduler_driver=nova.scheduler.simple.SimpleScheduler, so: the schedule_run_instance method in simple.py.
Driver.cast_to_compute_host sends messages to message queues.
The run_instance method of compute/manage.py, _ run_instance, _ spawn and then configure the default='nova.virt.connection.get_connection' of the file compute_driver = FLAGS.compute_driver
In get_connection, t = 'libvirt': conn = libvirt_conn.get_connection (read_only) followed by from nova.virt.libvirt import connection as libvirt_conn
So call the spawn function in libvirt and generate the xml file.
1. Horizon module call process
2. Novaclient module call process
Note: the sentence resp, body= self.api.client.post (url, body=body) is to send a post request. The wsgi in the nova,nova can automatically execute the corresponding function according to this url match.
3. Nova module call process
Note: nova's wsgi releases are all under the / nova/api/openstack/compute folder.
The available_zone parameter is not passed on.
The following statement indicates that scheduler is called
-- scheduler_driver=nova.scheduler.simple.SimpleScheduler is used in the production environment here, so:
Here is the simple scheduling algorithm:
Def _ schedule_instance (self, context, instance_opts, * _ args, * * _ kwargs):
"Picks a host that is up and has the fewest running instances."
Elevated = context.elevated ()
Availability_zone = instance_opts.get ('availability_zone')
Zone, host = FLAGS.default_schedule_zone, None
If availability_zone:
Zone, _ x, host = availability_zone.partition (':')
If host and context.is_admin:
Service = db.service_get_by_args (elevated, host, 'nova-compute')
If not utils.service_is_up (service):
Raise exception.WillNotSchedule (host=host)
Return host
Results = db.service_get_all_compute_sorted (elevated) / / get the host with the least resource utilization
In_isolation = instance_opts ['image_ref'] in FLAGS.isolated_images
Check_cores = not in_isolation or not FLAGS.skip_isolated_core_check
If zone:
Results = [(service, cores) for (service, cores) in results
If service ['availability_zone'] = = zone] / / the availability_zone here is passed to the page
Requested_networks = _ kwargs ['requested_networks']
If requested_networks:
Results = [(service, cores) for (service, cores) in results
If service ['network_ref'] in [network_uuid for (network_uuid, fixed_ip) in requested_networks] / / the requested_networks here is passed to the page
For result in results:
(service, instance_cores) = result
If in_isolation and service ['host'] not in FLAGS.isolated_hosts:
# isloated images run on isolated hosts
Continue
If service ['host'] in FLAGS.isolated_hosts and not in_isolation:
# images that aren't isolated only run on general hosts
Continue
If (check_cores and
Instance_cores + instance_opts ['vcpus'] > FLAGS.max_cores):
Msg = _ ("Not enough allocatable CPU cores remaining")
Raise exception.NoValidHost (reason=msg)
If not self._isenough_subnet (elevated, service):
Continue
If utils.service_is_up (service) and not service ['disabled']:
Return service ['host']
Msg = _ ("Is the appropriate service running?")
Raise exception.NoValidHost (reason=msg)
This is how the openstack e version shared by the editor created instance. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.