---
# System prepended metadata

title: 使用 ovftool 工具佈署 Infoblox NIOS
tags: [ovftool, infoblox, govc]

---

:::success
Deploy Infoblox NIOS on VMware using ovftool
:::
[toc]

**Infoblox Network Identity Operating System(NIOS)** 提供了 OVA 檔案格式，可以佈建在 VMware vSphere 環境中，為了能快速佈署 OVA 檔案，不採用 Web Client GUI 的方式，而是採用 **VMware ovftool** 工具，詳細資訊可以參考 [[**使用 OVFTool 啟動 ESXi 主機進行安裝 OVA 檔案**]](https://hackmd.io/@farmer87/ovftool_install_dps)，這裡也就直接使用囉。

:::info
[What is Network Identity Operating System (NIOS)?](https://www.infoblox.com/glossary/network-identity-operating-system-nios/)
:::

# 主要目標
**佈署 NIOS 虛擬機器**，並**同時完成下列所有項目**:
- **佈署指定組態規模的虛擬機器**。
- **同時完成網路 IP 組態設定**。
- **指派測試授權 (temp license)**。
- **開啟遠端終端 SSH 連線**。
- **變更預設 admin 密碼**。
- **置放於指定的虛擬機器資料夾**。


# 安裝 ovftool
ovftool 目前版本有 [[**4.4**]](https://developer.vmware.com/web/tool/4.4.0/ovf) 和 [[**4.6**]](https://developer.vmware.com/web/tool/4.6.0/ovf-tool)，基本上要應用在 **vSphere 8** 只能使用 4.6 版本，因為相容 vSphere 向下版本，就安裝最新版本吧。使用者指南在此下載：[[**4.4**]](https://developer.vmware.com/docs/14678/ovf-tool-user-s-guide), [[**4.6**]](https://developer.vmware.com/docs/18951/vmware-ovf-tool-user-guide)。


請先確認系統正確安裝 ovftool 工具。
```bash
$ ovftool --version
VMware ovftool 4.6.0 (build-21452615)
```


# NIOS OVA 分析
先使用 ovftool 工具解析 OVA 檔案內容。
> infoblox nios 是否是這樣正確稱呼，在這個階段還不是很清楚，但暫時就先這樣吧！

## OVA 檔案內容
許多有用的資訊都藏在 OVA 檔案裡面。等會最主要利用到下列 3 個屬性。
- **Networks**
- **Properties**
- **Deployment Options**

**詳細檔案內容**
```bash
$ ovftool --noSSLVerify --skipManifestCheck --allowExtraConfig --X:enableHiddenProperties --hideEula nios-8.6.2-49947-c076923293a0-2022-06-10-09-59-58-ddi.ova 
OVF version:   1.0
VirtualApp:    false
Name:          vNIOS
Vendor:        Infoblox, Inc.
Vendor URL:    http://www.infoblox.com

Annotation:  NIOS automates the error-prone and time-consuming manual tasks 
             associated with deploying and managing DNS, DHCP and IP address 
             management required for continuous IP network availability and 
             business uptime. 

End-user License Agreements:
  Present:     Yes (1)

Download Size:  Unknown

Deployment Sizes:
  Flat disks:   250.00 GB
  Sparse disks: Unknown

Networks:
  Name:        VM Network
  Description: The network that the production DNS/DHCP queries and responses 
               go over. 

Virtual Machines:
  Name:               VNIOS System
  Operating System:   otherguest64
  Virtual Hardware:
    Families:         vmx-07 vmx-08 vmx-09 vmx-10 
    Number of CPUs:   2
    Cores per socket: automatic
    Memory:           16.00 GB

    Disks:
      Index:          0
      Instance ID:    6
      Capacity:       250.00 GB
      Disk Types:     SCSI-lsilogic 

    NICs:
      Adapter Type:   VmxNet3
      Connection:     VM Network

      Adapter Type:   VmxNet3
      Connection:     VM Network

      Adapter Type:   VmxNet3
      Connection:     VM Network

      Adapter Type:   VmxNet3
      Connection:     VM Network

Properties:
  Key:         hardware_type
  Category:    Options (vApp required)
  Label:       Hardware Type
  Type:        string
  Description: Hardware type can be set to IB-FLEX or left blank.

  Key:         temp_license
  Category:    Options (vApp required)
  Label:       Temp License
  Type:        string
  Description: Space separated list of temp license identifiers.

  Key:         remote_console_enabled
  Category:    Options (vApp required)
  Label:       Enable Remote Console
  Type:        boolean
  Description: Boolean value controlling status of remote console via ssh.
  Value:       False

  Key:         default_admin_password
  Category:    Options (vApp required)
  Label:       Admin Password
  Type:        string
  Description: Default admin password, min length 4.

  Key:         gridmaster-certificate
  Category:    Gridmaster (vApp required)
  Label:       Certificate
  Type:        string
  Description: Grid Master's certificate.

  Key:         gridmaster-ip_addr
  Category:    Gridmaster (vApp required)
  Label:       IP Address
  Type:        string
  Description: Grid Master's IP address.

  Key:         gridmaster-token
  Category:    Gridmaster (vApp required)
  Label:       Token
  Type:        string
  Description: Member token.

  Key:         lan1-v4_addr
  Category:    Networking (vApp required)
  Label:       LAN1 IPv4 Address
  Type:        string
  Description: LAN1 IPv4 IP address.

  Key:         lan1-v4_gw
  Category:    Networking (vApp required)
  Label:       LAN1 IPv4 Default Gateway.
  Type:        string
  Description: LAN1 IPv4 default gateway.

  Key:         lan1-v4_netmask
  Category:    Networking (vApp required)
  Label:       LAN1 IPv4 Netmask
  Type:        string
  Description: LAN1 IPv4 netmask.

  Key:         lan1-v6_cidr
  Category:    Networking (vApp required)
  Label:       LAN1 IPv6 CIDR
  Type:        string
  Description: LAN1 IPv6 CIDR block.

  Key:         lan1-v6_gw
  Category:    Networking (vApp required)
  Label:       LAN1 IPv6 Default Gateway
  Type:        string
  Description: LAN1 IPv6 default gateway.

  Key:         lan1-v6_addr
  Category:    Networking (vApp required)
  Label:       LAN1 IPv6 Address
  Type:        string
  Description: LAN1 IPv6 IP address.

  Key:         mgmt-v4_addr
  Category:    Networking (vApp required)
  Label:       MGMT IPv4 Address
  Type:        string
  Description: MGMT IPv4 IP address.

  Key:         mgmt-v4_gw
  Category:    Networking (vApp required)
  Label:       MGMT IPv4 Default Gateway.
  Type:        string
  Description: MGMT IPv4 default gateway.

  Key:         mgmt-v4_netmask
  Category:    Networking (vApp required)
  Label:       MGMT IPv4 Netmask
  Type:        string
  Description: MGMT IPv4 netmask.

  Key:         mgmt-v6_cidr
  Category:    Networking (vApp required)
  Label:       MGMT IPv6 CIDR
  Type:        string
  Description: MGMT IPv6 CIDR block.

  Key:         mgmt-v6_gw
  Category:    Networking (vApp required)
  Label:       MGMT IPv6 Default Gateway
  Type:        string
  Description: MGMT IPv6 default gateway.

  Key:         mgmt-v6_addr
  Category:    Networking (vApp required)
  Label:       MGMT IPv6 Address
  Type:        string
  Description: MGMT IPv6 IP address.

  Key:         lan2-v4_addr
  Category:    Networking (vApp required)
  Label:       LAN2 IPv4 Address
  Type:        string
  Description: LAN2 IPv4 IP address.

  Key:         lan2-v4_gw
  Category:    Networking (vApp required)
  Label:       LAN2 IPv4 Default Gateway.
  Type:        string
  Description: LAN2 IPv4 default gateway.

  Key:         lan2-v4_netmask
  Category:    Networking (vApp required)
  Label:       LAN2 IPv4 Netmask
  Type:        string
  Description: LAN2 IPv4 netmask.

  Key:         lan2-v6_cidr
  Category:    Networking (vApp required)
  Label:       LAN2 IPv6 CIDR
  Type:        string
  Description: LAN2 IPv6 CIDR block.

  Key:         lan2-v6_gw
  Category:    Networking (vApp required)
  Label:       LAN2 IPv6 Default Gateway
  Type:        string
  Description: LAN2 IPv6 default gateway.

  Key:         lan2-v6_addr
  Category:    Networking (vApp required)
  Label:       LAN2 IPv6 Address
  Type:        string
  Description: LAN2 IPv6 IP address.

Deployment Options:
  Id:          805
  Label:       TR-805
  Description: 
               Use this option for a model TR-805.  It has:
                * 2 virtual CPUs
                * 32768MiB memory
               
               A TR-805 license will need to be applied, and a second disk 
               image will need to be added to the VM definition. 
                     

  Id:          815  (default)
  Label:       TE-815
  Description: 
               Use this option for a model TE-815.  It has:
                * 2 virtual CPUs
                * 16384MiB memory
               
               A TE-815 license will need to be applied.
                     

  Id:          825
  Label:       TE-825
  Description: 
               Use this option for a model TE-825.  It has:
                * 2 virtual CPUs
                * 16384MiB memory
               
               A TE-825 license will need to be applied.
                     

  Id:          CP805
  Label:       CP-V805
  Description: 
               Use this option for a model CP-V805.  It has:
                * 2 virtual CPUs
                * 16384MiB memory
               
               A CP-V805 license will need to be applied.
                     

  Id:          1405
  Label:       TR-1405
  Description: 
               Use this option for a model TR-1405.  It has:
                * 4 virtual CPUs
                * 32768MiB memory
               
               A TR-1405 license will need to be applied.  A second disk image 
               will need to be added to the VM definition. 
                     

  Id:          1415
  Label:       TE-1415
  Description: 
               Use this option for a model TE-1415.  It has:
                * 4 virtual CPUs
                * 32768MiB memory
               
               A TE-1415 license will need to be applied.
                     

  Id:          1425
  Label:       TE-1425
  Description: 
               Use this option for a model TE-1425.  It has:
                * 4 virtual CPUs
                * 32768MiB memory
               
               A TE-1425 license will need to be applied.
                     

  Id:          CP1405
  Label:       CP-V1405
  Description: 
               Use this option for a model CP-V1405.  It has:
                * 4 virtual CPUs
                * 32768MiB memory
               
               A CP-V1405 license will need to be applied.
                     

  Id:          2205
  Label:       TR-2205
  Description: 
               Use this option for a model TR-2205.  It has:
                * 8 virtual CPUs
                * 65536MiB memory
               
               A TR-2205 license will need to be applied.  A second disk image 
               will need to be added to the VM definition. 
                     

  Id:          2215
  Label:       TE-2215
  Description: 
               Use this option for a model TE-2215.  It has:
                * 8 virtual CPUs
                * 65536MiB memory
               
               A TE-2215 license will need to be applied.
                     

  Id:          2225
  Label:       TE-2225
  Description: 
               Use this option for a model TE-2225.  It has:
                * 8 virtual CPUs
                * 65536MiB memory
               
               A TE-2225 license will need to be applied.
                     

  Id:          CP2205
  Label:       CP-V2205
  Description: 
               Use this option for a model CP-V2205.  It has:
                * 8 virtual CPUs
                * 65536MiB memory
               
               A CP-V2205 license will need to be applied.
                     

  Id:          4005
  Label:       TE-4005
  Description: 
               Use this option for a model TE-4005.  It has:
                * 14 virtual CPUs
                * 131072MiB memory
               
               A TE-4005 license will need to be applied.
                     

  Id:          4015
  Label:       TE-4015
  Description: 
               Use this option for a model TE-4015.  It has:
                * 14 virtual CPUs
                * 131072MiB memory
               
               A TE-4015 license will need to be applied.
                     

  Id:          4025
  Label:       TE-4025
  Description: 
               Use this option for a model TE-4025.  It has:
                * 14 virtual CPUs
                * 131072MiB memory
               
               A TE-4025 license will need to be applied.
                     

  Id:          otherModel
  Label:       IB-v5005 or Other Model
  Description: 
               Use this option for a model IB-v5005 or if the model being 
               instantiated is not listed. 
               
               Before powering up, the number of virtual CPUs and the amount of
               memory will have to be set.  An appropriate license will need to
               be applied. 
                     

References:
  File:  vnios-disk.vmdk
```

其實剛剛檢視的內容可以在 **vApp 選項** 檢視，而這些選項也是在使用 WebUI 安裝時會手動輸入的項目。透過 ovftool 工具可以在佈署 OVA 檔案時，直接把指定的參數值予以給定。

![](https://hackmd.io/_uploads/BJ_8Gomth.png)

## 屬性使用
接著了解一下取得的屬性該如何使用。

### Networks
- 格式: **`--net:<OVFName>=<target name>`**
- 若要設定多筆屬性，以 **`空格`** 區隔屬性列出即可。
```yaml
Networks:
  Name:        VM Network
  Description: The network that the production DNS/DHCP queries and responses 
               go over. 
```
- 參數使用: **`--net:'VM Network=PG-INFOBLOX'`** 或 **`--network=PG-INFOBLOX`**

### Properties
- 格式: **`--prop:<key>=<value>`**
- 若要設定多筆屬性，以 **`空格`** 區隔屬性列出即可。
```yaml
Properties:
  Key:         remote_console_enabled
  Category:    Options (vApp required)
  Label:       Enable Remote Console
  Type:        boolean
  Description: Boolean value controlling status of remote console via ssh.
  Value:       False
```
- 參數使用: **`--prop:remote_console_enabled=True`**。
  如果參數中已經有 **`Value`** 表示為**預設值**。

### Deployment Options
- 格式: **`--deploymentOption=<Id>`**
- 根據需求選擇要佈署的規格選項。
```yaml
Deployment Options:
  Id:          4025
  Label:       TE-4025
  Description: 
               Use this option for a model TE-4025.  It has:
                * 14 virtual CPUs
                * 131072MiB memory
               
               A TE-4025 license will need to be applied.
```
- 參數使用: **`--deploymentOption=4025`**。若沒有加上此參數預設佈署規格為 **`TE-815(Id: 815)`**。
- 可使用佈署規模

| ID | <div style="width: 70pt">Label</div> | vCPUs | 記憶體(GB) |
| :-: | :-: | :-: | :-: |
| 805 | TR-805 | 2 | 32 |
| **815(default)** | **TE-815** | **2** | **16** | 
| 825 | TE-825 | 2 | 16 |
| CP805 | CP-V805 | 2 | 16 |
| 1405 | TR-1405 | 4 | 32 |
| 1415 | **TE-1415 | 4 | 32 |
| 1425 | TE-1425 | 4 | 32 |
| CP1405 | CP-V1405 | 4 | 32 |
| 2205 | TR-2205 | 8 | 64 |
| 2215 | TE-2215 | 8 | 64 |
| 2225 | TE-2225 | 8 | 64 |
| CP2205 | CP-V2205 | 8 | 64 |
| 4005 | TE-4005 | 14 | 128 |
| 4015 | TE-4015 | 14 | 128 |
| 4025 | TE-4025 | 14 | 128 |
| otherModel | IB-v5005 or Other Model | 8<br>用戶可自定義<br>(User defined) | 64<br>用戶可自定義 |


# 佈署執行
接著就把剛剛了解到的參數，根據測試環境需求引入指定的參數值，透過 ovftool 工具進行佈署，完成後就會**自動設定指派組態**。

## 設定需求清單

| 組態 | 設定值 |
| --- | --- |
| OVA 存放資料夾 | /home/richard/Projects/infoblox/nios_ova |
| OVA 檔案名稱 | nios-8.6.2-49947-c076923293a0-2022-06-10-09-59-58-ddi.ova |
| 虛擬機器名稱 | Richard-INFOBLOX-NIOS1 |
| 目的地位置(ESXi) | 10.7.150.110 |
| 虛擬機器資料夾 | Richard/Infoblox_Grid (需事先建立存在) |
| 佈署規模 | **TE-1415** |
| 儲存區 | Share_Storage |
| 虛擬磁碟格式 | 精簡佈建 (Thin-Provisioned) |
| 來源網路(標籤) | VM Network |
| 目的地網路 | PG-INFOBLOX-LAN1 (需事先建立存在) |
| Admin 密碼 | VMware1! 預設值: infoblox |
| Remote Console | 啟用 |
| LAN1 IP 位址 | 10.7.150.85 |
| LAN1 網路遮罩 | 255.255.255.0 |
| LAN1 預設閘道 | 10.7.150.254 |
| 測試授權(temp license) | nios IB-V1415 enterprise |
| 部署後電源狀態 | 開啟 |

## 使用 ovftool 佈署
根據以上列出的設定清單，開啟終端機輸入以下 **ovftool 命令**進行佈署。

```bash=
$ /usr/bin/ovftool --acceptAllEulas --allowExtraConfig --noSSLVerify \
--name=Richard-INFOBLOX-NIOS1 \
--datastore=Share_Storage \
--diskMode=thin \
--vmFolder=Richard/Infoblox_Grid \
--net:'VM Network'=PG-INFOBLOX-LAN1 \
--deploymentOption=1415 \
--prop:temp_license="nios IB-V1415 enterprise" \
--prop:default_admin_password="VMware1!" \
--prop:lan1-v4_addr=10.7.150.85 \
--prop:lan1-v4_netmask=255.255.255.0 \
--prop:lan1-v4_gw=10.7.150.254 \
--prop:remote_console_enabled=True \
--powerOn \
/home/richard/Projects/infoblox/nios_ova/nios-8.6.2-49947-c076923293a0-2022-06-10-09-59-58-ddi.ova \
vi://administrator%40vsphere.local:P%40ssw0rd@10.7.150.106/Datacenter/host/Cluster/10.7.150.110
```

好的，稍等幾分鐘佈署時間，虛擬機器會自動開啟電源，使用 VMware Remote Console 連線虛擬機器，系統正在進行開機程序 :+1:。

![](https://hackmd.io/_uploads/H1yjzeEY3.png)

系統正在進行初始化，下圖顯示 LAN1 預設 IP 位址為 **192.168.1.2/255.255.255.0**，預設閘道為 **192.168.1.1**。接著可以看到系統**自動調整成指定 IP 組態** :+1:。

![](https://hackmd.io/_uploads/rk2D7l4Fn.png)

既然已經完成 IP 組態，而且也啟用了 Remote Console 功能，就用 SSH 連線登入 NIOS 測試吧。好的，連 **admin 密碼也已經自動變更完成** :+1:。

輸入 **`show network`**, **`show version`** 和 **`show license`** 檢視相關資訊。

![](https://hackmd.io/_uploads/By-pONHF3.png)

## 使用 Web Client 檢視
先確認一下虛擬機器是否有按照佈署需求達成目標 :100:。  
![](https://hackmd.io/_uploads/SJZlvJ4th.png)

從 vApp 選項來檢視設定組態 :100:。  
![](https://hackmd.io/_uploads/B1sPYVrt2.png)


別忘了，我們還有 **GOVC** 這個好幫手。

![](https://hackmd.io/_uploads/HJr2oxVFn.png)


# 其他玩法
把上面所需的佈署參數值寫在一個**參數組態檔**，再透過**腳本程式**呼叫**使用 ovftool 工具**，同時**讀入參數值**，再進行**佈署 NIOS 虛擬機器**就可以了。我想一般裝機或測試使用這種方式就足夠了。

## 程式範例
### 組態檔 `vnios.conf`
```bash=
owner='Richard'
pod='INFOBLOX'
parentfolder="${owner}"
childfolder='Infoblox_Grid'
## nios
nios_ova_basePath='/home/richard/Projects/infoblox'
nios_ova_file="${nios_ova_basePath}/nios_ova/nios-8.6.2-49947-c076923293a0-2022-06-10-09-59-58-ddi.ova"
deployment_option='1415'
vmname="${owner}-${pod}-NIOS1"
datastore='Share_Storage'
diskmode='thin'
portgroup='PG-INFOBLOX-LAN1'
lan1_v4_ipaddr='10.7.150.85'
lan1_v4_netmask='255.255.255.0'
lan1_v4_gateway='10.7.150.254'
## properties
temp_license="nios IB-V${deployment_option} enterprise"
ssh_enabled='True'
admin_passwd='VMware1!'
## vcenter
vc_user='administrator@vsphere.local'
vc_pass='VMware1!VMware1!'
vc_ip='10.7.150.106'
vc_name='10.7.150.106'
vc_url="$(urlencode ${vc_user}):$(urlencode ${vc_pass})@${vc_ip}"
vc_datacenter='Datacenter'
vc_cluster='Cluster'
located_host='10.7.150.110'
target_host_locator="${vc_url}/${vc_datacenter}/host/${vc_cluster}/${located_host}"
target_folder_locator="${vc_url}/${vc_datacenter}/vm/${parentfolder}/${childfolder}"
```

### 腳本程式檔 `deploy_vNIOS.sh`
```bash=
#!/bin/bash
#
# edited by semigod
#

configFile="${1:-vnios.conf}"

if [ ! -f "${configFile}" ]; then
    echo -e "<!> ${configFile} NOT FOUND"
    exit
fi

source ${configFile}

echo -e "[TASK] Using ovftool to deploy vNIOS"
/usr/bin/ovftool \
--acceptAllEulas \
--allowExtraConfig \
--noSSLVerify \
--skipManifestCheck \
--X:injectOvfEnv \
--name="${vmname}" \
--datastore="${datastore}" \
--diskMode="${diskmode}" \
--vmFolder="${parentfolder}/${childfolder}" \
--net:"VM Network"="${portgroup}" \
--deploymentOption="${deployment_option}" \
--prop:temp_license="${temp_license}" \
--prop:default_admin_password="${admin_passwd}" \
--prop:lan1-v4_addr="${lan1_v4_ipaddr}" \
--prop:lan1-v4_netmask="${lan1_v4_netmask}" \
--prop:lan1-v4_gw="${lan1_v4_gateway}" \
--prop:remote_console_enabled="${ssh_enabled}" \
--powerOn \
"${nios_ova_file}" \
vi://"${target_host_locator}"
```

## 執行結果
第一次比較辛苦需要確認腳本程式執行正確性，之後只要維護參數組態檔應該就會輕鬆許多。而且在測試環境下，只要修改並確認組態檔內容，開啟終端機輸入腳本程式，就可以自動快速地完成佈署作業，立即可用。:sweat_smile:
:::info
如果後續建立網格(Grid)或 RPZ 設定都能用 CLI 完成多好？！初步看來，可能要透過 **expect 命令或透過 API 才能達成了**。現階段沒有這樣的能力和知識。
:::

```bash
$ ./deploy_vNIOS.sh
[TASK] Using ovftool to deploy vNIOS
Opening OVA source: /home/richard/Projects/infoblox/nios_ova/nios-8.6.2-49947-c076923293a0-2022-06-10-09-59-58-ddi.ova
The manifest does not validate
Opening VI target: vi://administrator%40vsphere.local@10.7.150.106:443/Datacenter/host/Cluster/10.7.150.110
Deploying to VI: vi://administrator%40vsphere.local@10.7.150.106:443/Datacenter/host/Cluster/10.7.150.110
Transfer Completed                    
Powering on VM: Richard-INFOBLOX-NIOS1
Task Completed                        
Warning:
 - The manifest is present but user flag causing to skip it
Completed successfully
```

:::danger
**注意**  
- 上述佈署虛擬機器的**目標對象是 vCenter Server**，所以指定的參數項目，無論虛擬機器在佈署完成後是否開啟電源，vCenter 在虛擬機器開機後，會自動完成 vApp 相關配置。
- 但如果佈署虛擬機器的**目標對象是 ESXi 主機**，如果虛擬機器佈署完成後不直接開啟電源，先前透過 ovftool 引入的參數項目將**不會自動完成組態**。但只要同時引入兩個 ovftool 命令參數，便可像 vCenter 一樣讓指定的參數項目完成自動設定：
  - **`-X:injectOvfEnv`**
  - **`--powerOn`** 
:::

# 參考
- [About Infoblox NIOS Virtual Appliance for VMware](https://docs.infoblox.com/space/NVIG/35786250/About+Infoblox+NIOS+Virtual+Appliance+for+VMware)
- [Installing the NIOS Virtual or Reporting Virtual Appliance](https://docs.infoblox.com/space/NVIG/35483668/Installing+the+NIOS+Virtual+or+Reporting+Virtual+Appliance)

# 其他資訊
以下是搭配佈署 NIOS 虛擬機器時有用的 **GOVC 命令**。有興趣的話，可以參考 [[**VMUG: GOVC 實驗指南**]](https://hackmd.io/@farmer87/govc_labguide)。當然也是可以整合在腳本程式中。:tired_face: 

- 在 ESXi 主機中的虛擬交換器上，建立一個網路群組(標籤)。
```bash
$ govc host.portgroup.add -host $host -vswitch $vswitch_name $portgroup
```

- 在資料中心下建立虛擬機器資料夾。
```bash
$ govc folder.create /$datacenter/vm/$partentfolder/$childfolder
```

- 檢視指定的虛擬機器配置。
```bash
$ govc vm.info -r $vm
```

- 列出虛擬機器的磁碟資訊。
```bash
$ govc device.ls -vm $vm 'disk-*'
```

- 在虛擬機器上新增一個指定容量大小的虛擬磁碟。
```bash
$ govc vm.disk.create -vm $vm -name $vm/$disk_name -size $disk_size
```

- 檢視虛擬機器上磁碟資訊。
```bash
$ govc device.info -vm $vm 'disk-*'
```

- 刪除虛擬機器上的虛擬磁碟。
```bash
$ govc device.remove -vm $vm $disk_name
```

# REST API？

[Deployment Guild - REST API](https://www.infoblox.com/wp-content/uploads/infoblox-deployment-infoblox-rest-api.pdf)

[](https://ipam.illinois.edu/wapidoc/additional/sample.html)

```bash
$ login='admin:VMware1!'
$ nios_ip='10.7.150.85'
$ apiVer='v2.12'

$ curl -s -k1 -u ${login} -X GET "https://${nios_ip}/wapi/${apiVer}/member?_return_fields%2B=node_info&_return_as_object=1" | jq
{
  "result": [
    {
      "_ref": "member/b25lLnZpcnR1YWxfbm9kZSQw:infoblox.localdomain",
      "config_addr_type": "IPV4",
      "host_name": "infoblox.localdomain",
      "node_info": [
        {
          "ha_status": "NOT_CONFIGURED",
          "hwid": "4237FC70886143D47E02E80206DD9C65",
          "hwmodel": "",
          "hwplatform": "VMWARE",
          "hwtype": "IB-V1415",
          "lan2_physical_setting": {
            "auto_port_setting_enabled": true
          },
          "lan_ha_port_setting": {
            "ha_port_setting": {
              "auto_port_setting_enabled": true,
              "speed": "10"
            },
            "lan_port_setting": {
              "auto_port_setting_enabled": true
            }
          },
          "mgmt_physical_setting": {
            "auto_port_setting_enabled": true
          },
          "paid_nios": false,
          "physical_oid": "0",
          "service_status": [
            {
              "description": "Running",
              "service": "NODE_STATUS",
              "status": "WORKING"
            },
            {
              "description": "11% - Primary drive usage is OK.",
              "service": "DISK_USAGE",
              "status": "WORKING"
            },
            {
              "description": "10.7.150.85",
              "service": "ENET_LAN",
              "status": "WORKING"
            },
            {
              "description": "Online",
              "service": "REPLICATION",
              "status": "WORKING"
            },
            {
              "description": "0% - Database capacity usage is OK.",
              "service": "DB_OBJECT",
              "status": "WORKING"
            },
            {
              "service": "NTP_SYNC",
              "status": "INACTIVE"
            },
            {
              "description": "CPU Usage: 9%",
              "service": "CPU_USAGE",
              "status": "WORKING"
            },
            {
              "service": "OSPF",
              "status": "INACTIVE"
            },
            {
              "service": "OSPF6",
              "status": "INACTIVE"
            },
            {
              "service": "BGP",
              "status": "INACTIVE"
            },
            {
              "service": "BFD",
              "status": "INACTIVE"
            },
            {
              "description": "No Core Files",
              "service": "CORE_FILES",
              "status": "WORKING"
            },
            {
              "description": "CPU Usage: 9%",
              "service": "CPU_USAGE",
              "status": "WORKING"
            },
            {
              "description": "5% - System memory usage is OK.",
              "service": "MEMORY",
              "status": "WORKING"
            },
            {
              "description": "0% - System swap space usage is OK.",
              "service": "SWAP_USAGE",
              "status": "WORKING"
            },
            {
              "description": "0% - Discovery capacity usage is OK.",
              "service": "DISCOVERY_CAPACITY",
              "status": "WORKING"
            },
            {
              "service": "VPN_CERT",
              "status": "WORKING"
            }
          ],
          "v6_mgmt_network_setting": {
            "auto_router_config_enabled": false,
            "enabled": false
          }
        }
      ],
      "platform": "VNIOS",
      "service_type_configuration": "ALL_V4"
    }
  ]
}
```