openstack:nova中“从镜像启动”创建虚拟机的流程

原文文章:http://blog.csdn.net/xiangpingli/article/details/47912041

openstack版本为K版本。

从镜像启动虚拟机之:创建镜像+创建虚拟机并开机的流程

[plain]  view plain copy
  1. nova.api.openstack.compute.servers.Controller.create  
  2. ->nova.compute.api.API.create  
  3. ->nova.compute.api.API._create_instance  
  4. ->nova.comductor.ComputeTaskAPI.build_instances  
  5. ->nova.conductor. rpcapi.ComputeTaskAPI.build_instances  
  6. ->nova.conductor. manager.ComputeTaskAPI.build_instances  
  7. ->nova.compute.rpcapi.ComputeAPI.build_and_run_instance  
  8. ->nova.compute.manager.ComputeAPI.build_and_run_instance  
  9. ->nova.compute.manager.ComputeAPI._locked_do_build_and_run_instance  
  10. ->nova.compute.manager.ComputeAPI._do_build_and_run_instance  
  11. ->nova.compute.manager.ComputeAPI._build_and_run_instance  
  12. ->nova.virt.libvirt.driver.LibvirtDriver.spawn  
  13. ->Nova.virt.libvirt.driver._create_image //创建系统盘  
  14.  ->Nova.virt.libvirt.driver._try_fetch_image_cache  
  15.  ->Nova.virt.libvirt.imagebackend.Image.cache  
  16.  ->Nova.virt.libvirt.imagebackend.Qcow2.create_image  
  17.    ->Nova.virt.libvirt.imagebackend.Qcow2.create_image:prepare_template即fetch_image  
  18.      ->Nova.virt.libvirt.utils.fetch_image  
  19.        ->Nova.virt.images.fetch_to_raw  
  20.          ->Nova.virt.images.fetch        #下载系统镜像到/var/lib/nova/instances/_base/目录  
  21.            ->nova.image.glance.GlanceImageService.download  
  22.              ->nova.image.glance.GlanceClientWrapper.call  
  23.   ->Nova.virt.images.convert_image    #若镜像不是raw格式,且nova.conf中force_raw_images=True,则将backing file强制转换为raw格式  
  24.   ->Nova.virt.libvirt.imagebackend.Qcow2.create_image:copy_qcow2_image  
  25.   ->nova.virt.libvirt.utils.create_cow_image  
  26. ->nova.virt.libvirt.driver._get_guest_xml //创建虚拟机的xml文件  
  27. ->nova.virt.libvirt.driver._create_domain_and_network //创建主机和主机网络  
  28. ->nova.virt.driver.block_device_info_get_mapping //块设备映射  
  29. ->nova.virt.driver.get_image_from_system_metadata //获取镜像和元数据  
  30. ->nova.virt.libvirt.driver.LibvirtDriver.attach_volume //挂载云硬盘  
  31. ->nova.virt.libvirt.firewall.prepare_instance_filter //准备网络  
  32. ->nova.virt.libvirt.driver.LibvirtDriver._create_domain //创建主机  
  33. ->nova.virt.libvirt.driver.LibvirtDriver._create_domain :domain = self._conn.defineXML  
  34. ->/usr/lib64/python2.7/site-packages/libvirt.py:defineXML  
  35. ->nova.virt.libvirt.firewall.apply_instance_filter//使用网络,实际上全在prepare_instance_filter中做了,这里都是空  
  36. ->nova.virt.libvirt.driver.power_on //开机  

你可能感兴趣的:(OpenStack)