VMware VIM IPv6

VMware VIM IPv6

这是基于另一个 post。 clone vm change network identity

构建虚拟机时需要设置IPv6地址。我找到了属性,但它不允许我设置值。

$FirstNic.Adapter.IpV6Spec = New-Object VMware.Vim.CustomizationIPSettingsIpV6AddressSpec 
$FirstNic.Adapter.IpV6Spec.Ip = New-Object VMware.Vim.CustomizationFixedIpV6 
$FirstNic.Adapter.IpV6Spec.Ip.IpAddress = "::1"

The property 'IpAddress' cannot be found on this object. Verify that the property exists and can be set. At line:33 char:4 + $FirstNic.Adapter.IpV6Spec.Ip.IpAddress = "::1" + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

这是成员:TypeName:VMware.Vim.CustomizationFixedIpV6

Name    MemberType  Definition
----        ----------  ----------
Equals      Method      bool Equals(System.Object obj)
GetHashCode     Method      int GetHashCode()
GetType     Method      type GetType()
ToString    Method      string ToString()
DynamicProperty Property    VMware.Vim.DynamicProperty[] DynamicProperty {get;set;}
DynamicType     Property    string DynamicType {get;set;}
IpAddress   Property    string IpAddress {get;set;}
SubnetMask  Property    int SubnetMask {get;set;}

快速测试表明直接在 VMware.Vim.CustomizationFixedIpV6 上设置 属性 似乎有效。之后将其分配给 VMware.Vim.CustomizationIPSettingsIpV6AddressSpec 对象似乎也有效。

> $ip = New-Object vmware.vim.customizationfixedipv6
> $ip.IpAddress = "::1"
> $ipv6spec = new-object vmware.vim.customizationipsettingsipv6addressspec
> $ipv6spec.ip = $ip
> $ipv6spec.ip.ipaddress
::1
> $ipv6spec.ip.ipaddress = "::2"
Property 'ipaddress' cannot be found on this object; make sure it exists and is settable
At line:1 char:1
+ $ipv6spec.ip.ipaddress = "::2"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

但是 VMware.Vim.CustomizationIPSettingsIpV6AddressSpecIp 属性 似乎没有 VMware.Vim.CustomizationFixedIpV6 作为它的类型。它有 VMware.Vim.CustomizationIpV6Generator 而不是。

所以我想知道这是不是一个类型specification/inheritance/etc。问题。