[Openstack] some question with nova schedule

gong yong sheng gongysh at linux.vnet.ibm.com
Fri Oct 12 02:14:51 UTC 2012


read on:
we will send the host to compute manager:

     def _provision_resource(self, context, weighted_host, request_spec,
             filter_properties, requested_networks, injected_files,
             admin_password, is_first_time, instance_uuid=None):
         """Create the requested resource in this Zone."""
         # Add a retry entry for the selected compute host:
         self._add_retry_host(filter_properties, 
weighted_host.host_state.host)

         self._add_oversubscription_policy(filter_properties,
                 weighted_host.host_state)

         payload = dict(request_spec=request_spec,
                        weighted_host=weighted_host.to_dict(),
                        instance_id=instance_uuid)
         notifier.notify(context, notifier.publisher_id("scheduler"),
                         'scheduler.run_instance.scheduled', notifier.INFO,
                         payload)

         updated_instance = driver.instance_update_db(context, 
instance_uuid)

         self.compute_rpcapi.run_instance(context, 
instance=updated_instance,
                 host=weighted_host.host_state.host,
                 request_spec=request_spec, 
filter_properties=filter_properties,
                 requested_networks=requested_networks,
                 injected_files=injected_files,
                 admin_password=admin_password, is_first_time=is_first_time)
On 10/12/2012 09:54 AM, 韦远科 wrote:
> hi,
>
> I read the following code in nova scheduler and have some questions 
> with the code marked in yellow.
> the following code can be found at 
> "https://github.com/openstack/nova/blob/master/nova/scheduler/filter_scheduler.py"
>
> def _provision_resource(self, context, weighted_host, request_spec,
>
>
> filter_properties, requested_networks, injected_files,
>
>
> admin_password, is_first_time, instance_uuid=None):
>
>
> """Create the requested resource in this Zone."""
>
>
> # Add a retry entry for the selected compute host:
>
>
> self._add_retry_host(filter_properties, weighted_host.host_state.host)
>
>
> self._add_oversubscription_policy(filter_properties,
>
>
> weighted_host.host_state)
>
>
> payload = dict(request_spec=request_spec,
>
>
> weighted_host=weighted_host.to_dict(),
>
>
> instance_id=instance_uuid)
>
>
> notifier.notify(context, notifier.publisher_id("scheduler"),
>
>
> 'scheduler.run_instance.scheduled', notifier.INFO,
>
>
> payload)
>
>
> updated_instance = driver.instance_update_db(context, instance_uuid)
>
>
> #at this point, we already know the host which will provision the 
> instance, that is recorded in variable /weighted_host./
>
>
> //But actually, the /instance_update_db/ function only update "values 
> = {'host': None, 'scheduled_at': now}" in database,
>
>
> So why????
>
>
>
>
> can someone give me some help? thanks very much!
>
>
> -----------------------------------------------------------------
> 韦远科
> 中国科学院 计算机网络信息中心
> 北京市海淀区中关村南四街四号 349信箱(100190)
>
> Yuanke Wei (Wei)
> Computer Network Information Center,Chinese Academy of Sciences
> 4 Zhongguancun Nansijie, Haidian District, Beijing 100190, China
> P.O. Box 349
> gtalk: weiyuanke123 at gmail.com <mailto:weiyuanke123 at gmail.com>
> msn: weiyuanke123 at hotmail.com <mailto:weiyuanke123 at hotmail.com>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack at lists.launchpad.net
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20121012/a064642c/attachment.html>


More information about the Openstack mailing list