labunix's blog

labunixのラボUnix

ESXi6.0U1をSSH経由のCLIでU2にアップデートしてみる。

■ESXi6.0U1をSSH経由のCLIでU2にアップデートしてみる。
 通常はISOインストーラで起動したメニューから[upgrade]を選択する。
 今回はvCenterServerの無い環境でのESXi単体のパッチ適用を想定したテスト。

# uname -a
VMkernel hp-vmhost 6.0.0 #1 SMP Release build-3029758 Aug 31 2015 00:54:00 x86_64 x86_64 x86_64 ESXi

# vim-cmd hostsvc/hostsummary | grep fullName
         fullName = "VMware ESXi 6.0.0 build-3029758", 

# esxcli system version get
   Product: VMware ESXi
   Version: 6.0.0
   Build: Releasebuild-3029758
   Update: 1
   Patch: 17

■下記は5.1.0からのアップデートだが、やり方の基本は同じ

 esxi に update2パッチを適用する方法
 http://www.rem-system.com/post-1038/

■WebUIのコンソールは以下で使えるが、
 編集や仮想マシンの電源ONなどの管理操作が出来ない。

 hypervisor6.0update1を「ESXi Embedded Host Client」で管理する。
 http://labunix.hateblo.jp/entry/20151113/1447349852

■SSH経由でCLIコマンドによる仮想マシンの電源の管理は以下のように出来る。

# vim-cmd vmsvc/getallvms | grep jessie
1      jessie     [datastore1] jessie/jessie.vmx       debian8_64Guest         vmx-11

# vim-cmd vmsvc/power.on 1
Powering on VM:

# vim-cmd vmsvc/power.getstate 1
Retrieved runtime info
Powered on

# vim-cmd vmsvc/power.
Invalid command 'vmsvc/power.'.
Maybe you meant one of the following commands:
power.on             power.suspendResume  power.hibernate      
power.off            power.suspend        power.shutdown       
power.reset          power.reboot         power.getstate

■vSphere Hipervisor無償版にNICは別にインストールしたもの。
 NIC自体は最新版。上述の「ESXi Embedded Host Client」(esx-ui)のログもある。

 VMWare hypervisor無償版にssh経由でNICドライバを追加する。
 http://labunix.hateblo.jp/entry/20151113/1447340548
 
# esxcli software profile get | grep -A 1 installed
      installed:
        esx-ui        1.1.0-3731936
--
      installed:
        net51-r8169   6.011.00-2vft.510.0.0.799733
--
      installed:
        esx-ui        0.0.2-0.1.3172496

# lspci -v | grep Ether
0000:00:19.0 Ethernet controller Network controller: Intel Corporation 82567LM-3 Gigabit Network Connection [vmnic0]
0000:10:00.0 Ethernet controller Network controller: Realtek Realtek 8169 Gigabit Ethernet [vmnic1]

# esxcli software vib list | awk '/net51/{print $0}'
net51-r8169                    6.011.00-2vft.510.0.0.799733          VFrontDe  CommunitySupported  2015-11-28

$ w3m -dump https://vibsdepot.v-front.de/wiki/index.php/Net51-r8169 | grep "VIB File"
  • VIB File of version 6.011.00

■ベンダーとモデルを確認する。

# vim-cmd hostsvc/hosthardware | head -4
(vim.host.HardwareInfo) {
   systemInfo = (vim.host.SystemInfo) {
      vendor = "Hewlett-Packard", 
      model = "HP Compaq 6000 Pro SFF PC", 

■vSphereホストとは異なるマシンから、ベンダーカスタマイズ版Offline Bundle(depot)をダウンロード。

 HPE Custom Image for ESXi 6.0 U2 Install CD
 https://my.vmware.com/jp/group/vmware/details?downloadGroup=OEM-ESXI60U2-HPE&productId=491

■SCPでコピーする。

# mkdir /vmfs/volumes/datastore1/update2
# exit

$ sudo mount -o loop VMware-VMvisor-Installer-6.0.0.update02-3620759.x86_64.iso ~/usb0/

$ scp VMware-ESXi-6.0.0-Update2-3620759-HPE-600.9.5.0.48-Apr2016-depot.zip root@hp-host:/vmfs/volumes/datastore1/update2
Password: 
VMware-ESXi-6.0.0-Update2-3620759-HPE-600.9.5 100%  370MB  61.6MB/s   00:06 

■仮想マシンの停止の確認

# vim-cmd vmsvc/power.getstate 1
Retrieved runtime info
Powered off

■メンテナンスモードへの変更

# esxcli system maintenanceMode get
Disabled

# esxcli system maintenanceMode set -e true
# esxcli system maintenanceMode get
Enabled

■アップデートを中止してメンテナンスモードを終了する場合

# esxcli system maintenanceMode set -e false
# esxcli system maintenanceMode get
Disabled 

■プロファイル名の確認

# esxcli software sources profile list -d /vmfs/volumes/datast
ore1/update2/VMware-ESXi-6.0.0-Update2-3620759-HPE-600.9.5.0.48-Apr2016-depot.zi
p 
Name                                 Vendor                      Acceptance Level
-----------------------------------  --------------------------  ----------------
HPE-ESXi-6.0.0-Update2-600.9.5.0.48  Hewlett Packard Enterprise  PartnerSupported

■確認したdepotとプロファイル名をしてupdateを行う。
 ※installでは無い点に注意。

# esxcli software profile update \
  -d /vmfs/volumes/datastore1/update2/VMware-ESXi-6.0.0-Update2-3620759-HPE-600.9.5.0.48-Apr2016-depot.zip \
  -p HPE-ESXi-6.0.0-Update2-600.9.5.0.48
Update Result
   Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
   Reboot Required: true
   VIBs Installed: ...
   VIBs Removed: ...
   VIBs Skipped: ...

# esxcli system shutdown reboot -r "update to ESXi6.0U2" && exit

■pingで監視するなどして再起動を待って、再起動後の確認。
 WebUIからメンテナンスモードを終了したり、
 仮想マシンの電源のOFF/ONができるようになった。

# uname -a
VMkernel hp-vmhost 6.0.0 #1 SMP Release build-3620759 Mar  3 2016 18:41:52 x86_64 x86_64 x86_64 ESXi
# vim-cmd hostsvc/hostsummary | grep fullName
         fullName = "VMware ESXi 6.0.0 build-3620759", 
# esxcli system version get
   Product: VMware ESXi
   Version: 6.0.0
   Build: Releasebuild-3620759
   Update: 2
   Patch: 34
# esxcli software profile get | grep -A 1 installed
      installed:
        scsi-bfa      3.2.5.0-1OEM.550.0.0.1331820
--
      installed:
        esx-ui        1.1.0-3731936
--
      installed:
        net51-r8169   6.011.00-2vft.510.0.0.799733
--
      installed:
        esx-ui        0.0.2-0.1.3172496