HWCloudEngine / hybrid_cloud

6 stars 12 forks source link

FSP问题总结 #107

Open wanggang222501 opened 7 years ago

wanggang222501 commented 7 years ago
  1. novaclient v1_1/servers create方法镜像参数是对象,heat调用时传递的是string: 修改novaclient/v1_1/servers.py 中的if image分支: 改为: if image: if isinstance(image, six.string_types): uuid = image else: uuid = image.id

           bdm_dict = {'uuid': uuid, 'source_type': 'image',
                       'destination_type': 'local', 'boot_index': 0,
                       'delete_on_termination': True}
           block_device_mapping_v2.insert(0, bdm_dict)
  2. heat 对于volume资源创建前,会调用key为cinder.volume 的配置项指向的校验方法去检测卷资源模板信息是否合法。但是FSP版本中该配置项指向的方法在代码中不存在;且heat 卷资源类中也没有相关的校验方法。 目前暂时处理方法是注释掉环境heat中所有如下代码段: constraints.CustomConstraint('cinder.volume')

说明: 1) FSP 中heat对每种资源的校验方法会通过entry_points.txt(如/usr/lib64/python2.6/site-packages/heat-2014.2-py2.6.egg-info/entry_points.txt)配置; 配置内容节选: [heat.constraints] nova.flavor = heat.engine.resources.server:FlavorConstraint nova.keypair = heat.engine.resources.nova_keypair:KeypairConstraint cinder.volume = heat.engine.clients.os.cinder:VolumeConstraint iso_8601 = heat.engine.resources.iso_8601:ISO8601Constraint neutron.network = heat.engine.clients.os.neutron:NetworkConstraint neutron.port = heat.engine.clients.os.neutron:PortConstraint neutron.router = heat.engine.clients.os.neutron:RouterConstraint cinder.vtype = heat.engine.clients.os.cinder:VolumeTypeConstraint neutron.subnet = heat.engine.clients.os.neutron:SubnetConstraint glance.image = heat.engine.clients.os.glance:ImageConstraint cinder.snapshot = heat.engine.clients.os.cinder:VolumeSnapshotConstraint 2) 在server(虚拟机)资源类BDM参数校验或是volume(卷)资源类中都会配置校验方法引用key为cinder.volume; 配置文件中并配置cinder.volume 为heat.engine.clients.os.cinder的VolumeContstrait方法 server BDM参数代码节选(heat/engine/resources/server.py): BLOCK_DEVICE_MAPPING_VOLUMEID: properties.Schema( properties.Schema.STRING, ('The ID of the volume to boot from. Only one ' 'of volume_id or snapshot_id should be ' 'provided.'), constraints=[ constraints.CustomConstraint('cinder.volume') ] )

Volume 资源代码节选(heat/engine/resources/volume.py): SOURCEVOLID: properties.Schema( properties.Schema.STRING, ('If specified, the volume to use as source.'), constraints=[ constraints.CustomConstraint('cinder.volume') ] ) 3) 在heat/engine/clients/os/cinder 中没有VolumeConstraint校验方法;而在开源版本中已加入;即配置文件中配置的方法在代码中不存在

3.一致性组查询时,fsp 把一致性组关联的volume type 在api返回时处理掉了;开源版本有 Fsp 查询一致性组后信息返回处理方法(cinder.api.views.consistencygroups.py): def detail(self, request, consistencygroup): """Detailed view of a single consistency group.""" return { 'consistencygroup': { 'id': consistencygroup.get('id'), 'status': consistencygroup.get('status'), 'availability_zone': consistencygroup.get('availability_zone'), 'created_at': consistencygroup.get('created_at'), 'name': consistencygroup.get('name'), 'description': consistencygroup.get('description') } } 源生openstack代码(cinder.api.views.consistencygroups.py): def detail(self, request, consistencygroup): """Detailed view of a single consistency group.""" if consistencygroup.volume_type_id: volume_types = consistencygroup.volume_type_id.split(",") volume_types = [type_id for type_id in volume_types if type_id] else: volume_types = []

    return {
        'consistencygroup': {
            'id': consistencygroup.id,
            'status': consistencygroup.status,
            'availability_zone': consistencygroup.availability_zone,
            'created_at': consistencygroup.created_at,
            'name': consistencygroup.name,
            'description': consistencygroup.description,
            'volume_types': volume_types,
        }
    }
  1. volume type查询时,fsp把关联的qos信息处理掉,开源版本有 Fsp 查询volume type 查询详情时没有关联qos信息: curl -g -i --insecure -X GET https://volume.az03.shenzhen--fusionsphere.huawei.com:443/v2/ffd0f154381843199b022144158d8420/types/ae28d9b3-9f2d-488d-8e86-13e09e16630c -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: $t" {"volume_type": {"extra_specs": {}, "name": "test", "id": "ae28d9b3-9f2d-488d-8e86-13e09e16630c"}}

源生openstack查询type详细信息时,可以获取关联的qos ID(见qos_specs_id) curl -g -i -X GET http://162.3.140.132:8776/v2/90a30fdd68684a9daf89d5048ef142eb/types/902ff375-8fc9-402a-a9d5-daa3068003cd -H "User-Agent: python-cinderclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}38df46a9df0a1400d25d22fbde61927c2ae5ab77" RESP BODY: {"volume_type": {"name": "type-test", "qos_specs_id": "dbdcefdf-d8e5-4fd8-b059-98d8a261c0d4", "extra_specs": {}, "os-volume-type-access:is_public": true, "is_public": true, "id": "902ff375-8fc9-402a-a9d5-daa3068003cd", "description": null}}

代码对比: Fsp 代码: Cinder/api/views/types show方法 :

def show(self, request, volume_type, brief=False):
    """Trim away extraneous volume type attributes."""
    trimmed = dict(id=volume_type.get('id'),
                name=volume_type.get('name'),
     extra_specs=volume_type.get('extra_specs'))
    return trimmed if brief else dict(volume_type=trimmed)

源生openstack: Cinder/api/v2/views/types show方法: def show(self, request, volume_type, brief=False): """Trim away extraneous volume type attributes.""" context = request.environ['cinder.context'] trimmed = dict(id=volume_type.get('id'), name=volume_type.get('name'), is_public=volume_type.get('is_public'), description=volume_type.get('description')) if context.is_admin: trimmed['qos_specs_id'] = volume_type.get('qos_specs_id') trimmed['extra_specs'] = volume_type.get('extra_specs') return trimmed if brief else dict(volume_type=trimmed)