0

背景知識: Rackspace の Compute/Memory nova インスタンスにはローカル ルート ボリュームが付属していません。Rackspace には、外部 SSD の起動可能なボリュームを使用して作成するポリシーがあります。ここで質問: Rackspace が UI で行うように、pyrax api を使用して Rackspace に Compute フレーバー インスタンスを作成しようとしています ( https://support.rackspace.com/how-to/boot-a-server-from -a-cloud-block-storage-volume/ ) は次のとおりです。

    pyrax.cloudservers.servers.create(hostname,image.id, 
                                      flavor.id,block_device_mapping,
                                      security_groups=security_groups,     
                                      nics=networks, key_name=key)

どこで block_device_mapping = {"vda": "59fb72d5-0b33-46c2-b10b-33fed25c5f74:::1"}、長い 32 桁の数字は、サーバー作成前に作成したボリュームの volume_id です。

pyrax.cloud_blockstorage.create(name=volume_name, size=volume_size,     
                                 volume_type=volume_type).

次のようなエラーが表示されます。

Policy doesn't allow memory_flavor:create:image_backed to be performed.(HTTP 403).

また、ローカル ルート ボリュームに付属する他のフレーバー (言うまでもなく、「block_device_mapping」パラメーターを使用した参照はありません) の場合、インスタンス作成用の pyrax api は正常に動作します。これは、github の pyrax/rackspace リポジトリのトピックに関する小さなスレッドです: https://github.com/rackspace/pyrax/issues/484で、この問題について説明しています。足りないものはありますか?

4

1 に答える 1

0

When a bootable volume is created, image_id(OS image id) should be specified to boot the volume:

pyrax.cloud_blockstorage.create(name=volume_name, size=volume_size,  
                              volume_type=volume_type,image=image.id)

Also The block_device_map needs some more params:

block_device_map = [{
                            'boot_index': '0',
                            'source_type': 'image',
                            'destination_type': 'volume',
                            'delete_on_termination': True,
                            'uuid': image.id,
                            'volume_size': int(requested_size),
                            'device_name': 'vda'
                   }]                  

And here's the final catch in actually not getting a 403 Forbidden error: While creating a server instance, don't specify the image id again in the pyrax call params, otherwise pyrax gets confused with what image to boot the instance. Hence just put a None to image_id in the params for pyrax.cloudservers.servers.create() as:

pyrax.cloudservers.servers.create(
            hostname,
            image=None,
            flavor=flavor.id,
            block_device_mapping_v2=block_device_map,
            security_groups=security_groups,
            nics=networks,
            key_name=key)                          
于 2016-11-06T20:02:36.067 に答える