Lolizeppelin's Blog

OpenStack Mitaka从零开始 nova的配置

Posted on By gcy

ComputeManager在初始化开始

class ComputeManager(manager.Manager):
    """Manages the running instances from creation to destruction."""

    target = messaging.Target(version='4.11')

    # How long to wait in seconds before re-issuing a shutdown
    # signal to an instance during power off.  The overall
    # time to wait is set by CONF.shutdown_timeout.
    SHUTDOWN_RETRY_INTERVAL = 10

    def __init__(self, compute_driver=None, *args, **kwargs):
        """Load configuration options and connect to the hypervisor."""
        self.virtapi = ComputeVirtAPI(self)
        self.network_api = network.API()
        self.volume_api = volume.API()
        self.image_api = image.API()
        self.conductor_api = conductor.API()

volume的api实际是

def API():
    volume_api_class = oslo_config.cfg.CONF.volume_api_class
    cls = importutils.import_class(volume_api_class)
    return cls()

默认情况下

volume_api_class=nova.volume.cinder.API

可以看到,cinder的相关api在nova-computer在服启动的时候就已经初始化了. 同理,glance、conductor、network也是一样在启动的时候初始化过

network默认还是用nove-network,neutronv已经是虚拟化最重要的一个部分了,自然要用上. 所以我们这里要位置为使用neutron,配置位置可以看到在

    use_neutron = oslo_config.cfg.CONF.use_neutron

  1. block device不是local的时候才会连接到cinder,也就是说只用local盘不需要cinder组件
vol_bdms = [bdm for bdm in bdms if bdm.is_volume]
def is_volume(self):
    return (self.destination_type ==
                fields.BlockDeviceDestinationType.VOLUME)
class BlockDeviceDestinationType(Enum):
    """Represents possible destination_type values for a BlockDeviceMapping."""

    LOCAL = 'local'
    VOLUME = 'volume'

[DEFAULT]

vendordata_jsonfile_path=<None>
auth_strategy=keystone

osapi_compute_link_prefix=<None>
osapi_glance_link_prefix=<None>
use_neutron_default_nets=True
use_neutron=True
max_local_block_devices=-1
compute_driver=libvirt.LibvirtDriver

rpc_backend = rabbit
control_exchange = nova
rpc_response_timeout = 60
executor_thread_pool_size = 64

[oslo_messaging_rabbit]
rabbit_host = 192.168.2.202
rabbit_port = 5673
rabbit_userid = openstack
rabbit_password = openstack
rabbit_virtual_host = openstack

[oslo_messaging_notifications]
driver = messagingv2

[keystone_authtoken]
auth_uri = http://openstack.szdiyibo.com:5000/v3
auth_version = 3.0
delay_auth_decision = false
http_connect_timeout = 5
http_request_max_retries = 3
region_name = 1008
memcached_servers = 192.168.2.202:11211


[glance]
api_servers=http://openstack.szdiyibo.com:9292/v2
allowed_direct_url_schemes=[file, http]

[cinder]
# separated values of the form: <service_type>:<service_name>:<endpoint_type>
# 表示从keystone的catalog里获取cinder的位置
# 所以我们的在keystone添加的服务要type、那么要用volumev2和cinderv2
# 从这里可以看出,glance可以不用再keystone里注册生成service和endpoint?
catalog_info=volumev2:cinderv2:publicURL
os_region_name = 1008

[neutron]
url=http://127.0.0.1:9696
region_name=1008
auth_url=
default_domain_name=
domain_id=
domain_name=
project_domain_id=
project_domain_name=
project_id=
project_name=
tenant_id=
tenant_name=
user_domain_id=
user_domain_name=
user_id=
username=