在具有来宾信息属性的 VMWare 环境中进行 ovf 部署



我正在尝试使用 OVF 配置部署虚拟机,我的目标是使用 VMware guestinfo 将用户在 OVF 环境中提供的键值传递给虚拟机。

以下是我添加到 OVF 文件中的设置/属性

<ProductSection ovf:required="false">
<Info>Virtual Appliance</Info>
<Property ovf:userConfigurable="true" ovf:type="string"
ovf:key="guestinfo.hello" ovf:value="">
<Label>hello</Label>
<Description>enter some string</Description>
</Property>
</ProductSection>
....
<VirtualHardwareSection ovf:transport="com.vmware.guestInfo">
....

部署虚拟机后,我可以在虚拟机 vApp 选项下的 OVF 环境中验证属性。这是我看到的

<?xml version="1.0" encoding="UTF-8"?>
<Environment
xmlns="http://schemas.dmtf.org/ovf/environment/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:oe="http://schemas.dmtf.org/ovf/environment/1"
xmlns:ve="http://www.vmware.com/schema/ovfenv"
oe:id=""
ve:vCenterId="vm-xxxx">
<PlatformSection>
<Kind>VMware ESXi</Kind>
<Version>6.0.0</Version>
<Vendor>VMware, Inc.</Vendor>
<Locale>en</Locale>
</PlatformSection>
<PropertySection>
<Property oe:key="guestinfo.hello" oe:value="world"/>
</PropertySection>
<ve:EthernetAdapterSection>
<ve:Adapter ve:mac="00:50:56:b2:d2:8a" ve:network="VLAN1804- 
xxx.xxx.xxx.0/25" ve:unitNumber="7"/>
<ve:Adapter ve:mac="00:50:56:b2:83:ea" ve:network="VLAN1804- 
xxx.xxx.xxx.0/25" ve:unitNumber="8"/>
</ve:EthernetAdapterSection>
</Environment>

最后,当我登录到该框并尝试使用 vmtoolsd cmd 获取来宾信息属性时vmtoolsd --cmd "info-get hello"我正在得到No value found

我需要帮助调试此问题。不太确定我的 OVF 配置中是否缺少某些内容。提前谢谢。感谢您的帮助!

我想没有直接的方法可以专门获取密钥,但我能够在我的盒子上运行vmtoolsd --cmd "info-get guestinfo.ovfenv"并且输出是

<?xml version="1.0" encoding="UTF-8"?>
<Environment
xmlns="http://schemas.dmtf.org/ovf/environment/1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:oe="http://schemas.dmtf.org/ovf/environment/1"
xmlns:ve="http://www.vmware.com/schema/ovfenv"
oe:id=""
ve:vCenterId="vm-xxxx">
<PlatformSection>
<Kind>VMware ESXi</Kind>
<Version>6.0.0</Version>
<Vendor>VMware, Inc.</Vendor>
<Locale>en</Locale>
</PlatformSection>
<PropertySection>
<Property oe:key="guestinfo.hello" oe:value="world"/>
</PropertySection>
<ve:EthernetAdapterSection>
<ve:Adapter ve:mac="00:50:56:b2:d2:8a" ve:network="VLAN1804- 
xxx.xxx.xxx.0/25" ve:unitNumber="7"/>
<ve:Adapter ve:mac="00:50:56:b2:83:ea" ve:network="VLAN1804- 
xxx.xxx.xxx.0/25" ve:unitNumber="8"/>
</ve:EthernetAdapterSection>
</Environment>

这是我在 OVF 环境中看到的 vcenter 虚拟机。假设这可能是使用 vmtools 从 vm 获取键值的一种方法

最新更新