2017-12-20 13 views
5

私は、OVFライブラリ項目から新しい仮想マシンを配備するためにVMWare vCenter REST APIを使用しています。 APIの一部でadditional_paramatersが許可されていますが、正しく機能するようにはできません。具体的には、カスタムOVFテンプレートのプロパティをPropertyParamsに設定したいと思います。OVFからVMを配備するときのPropertyParams

OVFからVMを展開する場合、私は次のREST API使用しています:私は多くの構造を試してみましたが、続くが、パラメータは完全に無視、または500内部サーバーエラーでPOSTで終わるのいずれかいる POST https://{server}/rest/com/vmware/vcenter/ovf/library-item/id:{ovf_library_item_id}?~action=deploy

構造体のフィールド「プロパティ」を変換できませんでした「com.vmware.vcenter.ovf.property_params」

properties構造を変換するのに失敗したというメッセージを持ちます(上記のが、エラーで失敗)のドキュメントから正しいようだ

ペイロード:

deployment_spec : { 
    /* ... */ 

    additional_parameters : [ 
    { 
     type : 'PropertyParams', 
     properties : [ 
     { 
      id : 'my_property_name', 
      value : 'foo', 
     } 
     ] 
    } 
    ] 
} 

OVFを考えると、以下が含まれます。

<ProductSection> 
    <Info>Information about the installed software</Info> 
    <Product>MyProduct</Product> 
    <Vendor>MyCompany</Vendor> 
    <Version>1.0</Version> 
    <Category>Config</Category> 
    <Property ovf:userConfigurable="true" ovf:type="string" ovf:key="my_property_name" ovf:value=""> 
    <Label>My Property</Label> 
    <Description>A custom property</Description> 
    </Property> 
</ProductSection> 

これはまたのような他のプロパティタイプのために失敗しましたboolean

I have posted on the vCenter forums as wellに注意してください。

答えて

1

私は、ここでVAPI構造に/com/vmware/vapi/metadata/metamodel/structure/id:<idstructure>

を閲覧することによってそれを解決するために、私の成功は私の発見同じ問題であった:まず

、フィルタAPIを使用して、プロパティの構造を得る:

https://{{vc}}/rest/com/vmware/vcenter/ovf/library-item/id:300401a5-4561-4c3d-ac67-67bc7a1a6

次に、展開するにはcom.vmware.vcenter.ovh.property_paramsクラスを使用します。具体例でもっと明確になります:

{ 
"deployment_spec": { 
    "accept_all_EULA": true, 
    "name": "clientok", 
    "default_datastore_id": "datastore-10", 
    "additional_parameters": [ 
    { 
     "@class": "com.vmware.vcenter.ovf.property_params", 
      "properties": 
      [ 
       { 
        "instance_id": "", 
        "class_id": "", 
        "description": "The gateway IP for this virtual appliance.", 
        "id": "gateway", 
        "label": "Default Gateway Address", 
        "category": "LAN", 
        "type": "ip", 
        "value": "10.1.2.1", 
        "ui_optional": true 
       } 

      ], 
     "type": "PropertyParams" 
     } 
    ] 
} 
関連する問題