Orange Pi 2/armbianでVMware PowerCLIが動いた

先日、「CentOS7環境にPowerShell CoreとVMware PowerCLIをインストール」で書いたように、普通のCentOS7環境でVMware PowerCLIを動かしてみた。

で、ラズパイの上でもPowerShell Coreは動く。
Running PowerShell Core on Raspberry Pi 2

arm32というくくりでは同じだけど、SoCがAllwinner H3のOrange Pi 2でPowerShell Coreが動くか、
また、VMware PowerCLIがインストールでき、仮想マシン操作を行えるかを確認してみた。

現時点では、ARM Linux向けにはtar.gzで固めたものしか出ていないのでgithubのPowerShell Releasesからlinux-arm32.tar.gzとなっているものを入手。

2018/07/13時点だと「wget https://github.com/PowerShell/PowerShell/releases/download/v6.1.0-preview.3/powershell-6.1.0-preview.3-linux-arm32.tar.gz」でダウンロードした。

これを~/powershellディレクトリに展開

# mkdir ~/powershell
# cd ~/powershell
# tar xfz ../powershell-6.1.0-preview.3-linux-arm32.tar.gz
#

そして、PowerShell Coreを実行

PS /root> uname -a
uname -a
Linux orangepi2 4.14.18-sunxi #24 SMP Fri Feb 9 16:24:32 CET 2018 armv7l GNU/Linux
PS /root> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.1.0-preview.3
PSEdition                      Core
GitCommitId                    v6.1.0-preview.3
OS                             Linux 4.14.18-sunxi #24 SMP Fri Feb 9 16:24:3...
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0


PS /root>

普通に動いているようだ。

続いて、PowerCLIのインストール

PS /root> Install-Module -Name VMware.PowerCLI

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this
repository, change its InstallationPolicy value by running the Set-PSRepository
 cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "N"):y
PS /root>

何事もなく終了。
モジュールの確認

PS /root> Install-Module -Name VMware.PowerCLI

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this
repository, change its InstallationPolicy value by running the Set-PSRepository
 cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "N"):y
PS /root>
PS /root> Get-Module                                                            
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clea...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-T...
Script     1.1.7.0    PackageManagement                   {Find-Package, Fin...
Script     1.6.0      PowerShellGet                       {Find-Command, Fin...
Script     2.0.0      PSReadLine                          {Get-PSReadLineKey...


PS /root> Get-Module -ListAvailable


    Directory: /usr/local/share/powershell/Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     6.7.0.8... VMware.DeployAutomation             {Add-DeployRule, A...
Script     6.7.0.8... VMware.ImageBuilder                 {Add-EsxSoftwareDe...
Manifest   10.1.1.... VMware.PowerCLI
Script     6.7.0.8... VMware.Vim
Script     10.1.0.... VMware.VimAutomation.Cis.Core       {Connect-CisServer...
Script     10.0.0.... VMware.VimAutomation.Cloud          {Add-CIDatastore, ...
Script     10.1.0.... VMware.VimAutomation.Common
Script     10.1.0.... VMware.VimAutomation.Core           {Add-PassthroughDe...
Script     6.5.4.7... VMware.VimAutomation.HA             Get-DrmInfo
Script     7.5.0.8... VMware.VimAutomation.HorizonView    {Connect-HVServer,...
Script     10.0.0.... VMware.VimAutomation.License        Get-LicenseDataMan...
Script     10.1.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServe...
Script     10.0.0.... VMware.VimAutomation.PCloud         {Connect-PIServer,...
Script     10.1.0.... VMware.VimAutomation.Sdk
Script     10.0.0.... VMware.VimAutomation.Srm            {Connect-SrmServer...
Script     10.1.0.... VMware.VimAutomation.Storage        {Add-KeyManagement...
Script     1.2.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Script     10.1.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysi...
Script     10.0.0.... VMware.VimAutomation.Vmc            {Connect-Vmc, Disc...
Script     10.0.0.... VMware.VimAutomation.vROps          {Connect-OMServer,...
Script     6.5.1.7... VMware.VumAutomation                {Add-EntityBaselin...


    Directory: /root/powershell/Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.1.0.0    Microsoft.PowerShell.Archive        {Compress-Archive,...
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript,...
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clea...
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Credential, G...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Form...
Script     1.1.7.0    PackageManagement                   {Find-Package, Get...
Script     1.6.0      PowerShellGet                       {Install-Module, F...
Script     0.0        PSDesiredStateConfiguration         {ThrowError, Node,...
Script     2.0.0      PSReadLine                          {Get-PSReadLineKey...


PS /root>

で・・・画面は省略しますが、connect-viserverして、get-vmして、とか普通に動きました。

CentOS7環境にPowerShell CoreとVMware PowerCLIをインストール

以前、PowerShell CoreとVMware PowerCLI Coreに関する記事を書いた。
現在は、VMware PowerCLI Coreが標準のVMware PowerCLIに統合され、またインストール手法も変わっている。
そこで、久しぶりにインストールしてみた。

まずは「Linux への PowerShell Core のインストール」記載の手順に従いインストール

1. Microsoftレポジトリの登録
「curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo」

[root@centos7 ~]# curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   193  100   193    0     0     70      0  0:00:02  0:00:02 --:--:--    70
[packages-microsoft-com-prod]
name=packages-microsoft-com-prod
baseurl=https://packages.microsoft.com/rhel/7/prod/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
[root@centos7 ~]#

2. PowerShellのインストール
「yum install -y powershell」

[root@centos7 ~]# yum install -y powershell
読み込んだプラグイン:fastestmirror
Determining fastest mirrors
<略>
依存性を解決しました

================================================================================
 Package    アーキテクチャー
                   バージョン                 リポジトリー                 容量
================================================================================
インストール中:
 powershell x86_64 6.1.0~preview.2-1.rhel.7   packages-microsoft-com-prod  50 M
依存性関連でのインストールをします:
 libunwind  x86_64 2:1.2-2.el7                base                         57 k

トランザクションの要約
================================================================================
インストール  1 パッケージ (+1 個の依存関係のパッケージ)

総ダウンロード容量: 50 M
インストール容量: 50 M
<略>
https://packages.microsoft.com/keys/microsoft.asc から鍵を取得中です。
Importing GPG key 0xBE1229CF:
 Userid     : "Microsoft (Release signing) <gpgsecurity@microsoft.com>"
 Fingerprint: bc52 8686 b50d 79e3 39d3 721c eb3e 94ad be12 29cf
 From       : https://packages.microsoft.com/keys/microsoft.asc
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  インストール中          : 2:libunwind-1.2-2.el7.x86_64                    1/2
  インストール中          : powershell-6.1.0~preview.2-1.rhel.7.x86_64      2/2
  検証中                  : 2:libunwind-1.2-2.el7.x86_64                    1/2
  検証中                  : powershell-6.1.0~preview.2-1.rhel.7.x86_64      2/2

インストール:
  powershell.x86_64 0:6.1.0~preview.2-1.rhel.7

依存性関連をインストールしました:
  libunwind.x86_64 2:1.2-2.el7

完了しました!
[root@centos7 ~]#

これでPowerShellを「pwsh」で実行できるようになりました。

続いてvSphere環境をコントロールするためにPowerCLI
VMware PowerCLI 10.11

といっても、以前はパッケージをダウンロードしてインストールという形態だったものが、現状は、MicrosoftのPowerShellギャラリーに登録されています。
PowerShell Gallery「VMware.PowerCLI

インストール方法もとっても簡単。
「Install-Module -Name VMware.PowerCLI」を実行するだけ。
途中で「Untrusted repositoryからのインストールを行うか」という質問に「y」と答える必要があります。

[root@centos7 ~]# pwsh
PowerShell v6.1.0-preview.2
Copyright (c) Microsoft Corporation. All rights reserved.

https://aka.ms/pscore6-docs
Type 'help' to get help.

PS /root> Install-Module -Name VMware.PowerCLI

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this
repository, change its InstallationPolicy value by running the Set-PSRepository
 cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "N"):y

<いろんなVMwareモジュールを追加インストール>

PS /root>

まずは、初期状態で読み込まれているモジュールを確認

PS /root> Get-Module

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clea...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Add-Member, Add-T...
Script     1.1.7.0    PackageManagement                   {Find-Package, Fin...
Script     1.6.0      PowerShellGet                       {Find-Command, Fin...
Script     1.2        PSReadLine                          {Get-PSReadlineKey...


PS /root>

現在使えるモジュールを確認。

PS /root> Get-Module -ListAvailable


    Directory: /usr/local/share/powershell/Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     6.7.0.8... VMware.DeployAutomation             {Add-DeployRule, A...
Script     6.7.0.8... VMware.ImageBuilder                 {Add-EsxSoftwareDe...
Manifest   10.1.1.... VMware.PowerCLI
Script     6.7.0.8... VMware.Vim
Script     10.1.0.... VMware.VimAutomation.Cis.Core       {Connect-CisServer...
Script     10.0.0.... VMware.VimAutomation.Cloud          {Add-CIDatastore, ...
Script     10.1.0.... VMware.VimAutomation.Common
Script     10.1.0.... VMware.VimAutomation.Core           {Add-PassthroughDe...
Script     6.5.4.7... VMware.VimAutomation.HA             Get-DrmInfo
Script     7.5.0.8... VMware.VimAutomation.HorizonView    {Connect-HVServer,...
Script     10.0.0.... VMware.VimAutomation.License        Get-LicenseDataMan...
Script     10.1.0.... VMware.VimAutomation.Nsxt           {Connect-NsxtServe...
Script     10.0.0.... VMware.VimAutomation.PCloud         {Connect-PIServer,...
Script     10.1.0.... VMware.VimAutomation.Sdk
Script     10.0.0.... VMware.VimAutomation.Srm            {Connect-SrmServer...
Script     10.1.0.... VMware.VimAutomation.Storage        {Add-KeyManagement...
Script     1.2.0.0    VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Script     10.1.0.... VMware.VimAutomation.Vds            {Add-VDSwitchPhysi...
Script     10.0.0.... VMware.VimAutomation.Vmc            {Connect-Vmc, Disc...
Script     10.0.0.... VMware.VimAutomation.vROps          {Connect-OMServer,...
Script     6.5.1.7... VMware.VumAutomation                {Add-EntityBaselin...


    Directory: /opt/microsoft/powershell/6.1.0~preview.2/Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.1.0.0    Microsoft.PowerShell.Archive        {Compress-Archive,...
Manifest   3.0.0.0    Microsoft.PowerShell.Host           {Start-Transcript,...
Manifest   3.1.0.0    Microsoft.PowerShell.Management     {Add-Content, Clea...
Manifest   3.0.0.0    Microsoft.PowerShell.Security       {Get-Credential, G...
Manifest   3.1.0.0    Microsoft.PowerShell.Utility        {Format-List, Form...
Script     1.1.7.0    PackageManagement                   {Find-Package, Get...
Script     1.6.0      PowerShellGet                       {Install-Module, F...
Script     0.0        PSDesiredStateConfiguration         {Get-PublicKeyFrom...
Script     1.2        PSReadLine                          {Get-PSReadlineKey...


PS /root>

以前、「PowerCLIとPowerCLI Coreの双方で動くPowerShellスクリプトの作り方」では、それぞれでモジュール名が異なっていた。
PowerCLI Coreでのモジュール名変更は無かったことになった模様。

とりあえず、VI-Connectで接続をかけてみる・・・

PS /root> Connect-VIServer -Server IPアドレス -User root -Password password -WarningAction 0
Connect-VIServer : 2018/07/06 14:29:03  Connect-VIServer                Error: Invalid server certificate. Use Set-PowerCLIConfiguration to set the value for the InvalidCertificateAction option to Ignore to ignore the certificate errors for this connection.
Additional Information: Could not establish trust relationship for the SSL/TLS secure channel with authority 'IPアドレス'.
At line:1 char:1
+ Connect-VIServer -Server IPアドレス -User root -Password password - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : SecurityError: (:) [Connect-VIServer], ViSecurityNegotiationException
+ FullyQualifiedErrorId : Client20_ConnectivityServiceImpl_Reconnect_CertificateError,VMware.VimAutomation.ViCore.Cmdlets.Commands.ConnectVIServer

PS /root>

おや?
デフォルト証明書の場合の取り扱いが変わった模様。

VMware PowerCLI Blog「New Release: VMware PowerCLI 10.0.0」の「Default Certificate Handling」に記載がある。

エラーメッセージもあるように「Set-PowerCLIConfiguration -InvalidCertificateAction Ignore」を実行して無視するようにする、と。

PS /root> Set-PowerCLIConfiguration -InvalidCertificateAction Ignore

Perform operation?
Performing operation 'Update PowerCLI configuration.'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help
(default is "Y"):y

Scope    ProxyPolicy     DefaultVIServerMode InvalidCertificateAction  DisplayD
                                                                       eprecati
                                                                       onWarnin
                                                                       gs
-----    -----------     ------------------- ------------------------  --------
Session  UseSystemProxy  Multiple            Ignore                    True
User                                         Ignore
AllUsers


PS /root>

改めて接続を実行

PS /root> Connect-VIServer -Server IPアドレス -User root -Password password   
Name                           Port  User
----                           ----  ----
IPアドレス                     443   root


PS /root>

問題なく動作しましたね。

ESXi Embedded Host ClientのダウンロードURL

最近のvSphereにはWindowsアプリのvSphere Clientが無い。
ESXiサーバに直接つないで管理および仮想マシンコンソールを開くにはどうするかというと、ESXiサーバ上にインストールされたWeb管理画面ESXi Embedded Host Clientを使用する必要がある。

ESXi 5.5 Patch 9 以降、ESXi 6.0 Update 2以降、ESXi 6.5は標準でHost Clientが搭載されているが、それ以前ではHost ClientのVIBパッケージをインストールすることで使える様になる。
また、時々バージョンアップもしているので、ESXi通常パッケージとは別にHost Clientをアップするともできる。

入手は下記から行う。
ESXi Embedded Host Client

また、Host Clientで使えるコンソールはHTML5ベースのブラウザ内で操作できるようになるものだが、VMware Remote Consoleというアプリケーションとしてコンソールを開けるようになるものも提供されている。
こちらはVMwareアカウントにログインする必要があるが、下記からダウンロードできる。
VMware Remote Console (VMRC)

Backup ExecでHyper-V仮想マシンバックアップ/リストア時にGRT用テンポラリディレクトリは使われるのか?

Backup ExecではHyper-V/vSphereの仮想マシンバックアップを仮想レイヤーの方からバックアップを行った場合、その仮想マシンの上でWindowsが動いている場合は、ファイル単位でのリストアを行えるGRT機能というのをサポートしている。

で・・・Backup Execの設定を見ていくと、全体設定の中に
・Granular Recover Technology
  バックアップ時にBackup Execが一時的にデータを保存するパス C:\TEMP
  リストア時にBackup Execが一時的にデータを保存するパス   C:\TEMP
というものがある。

仮想マシンバックアップ時にC:\TEMPを観察してみたけど、使用している様子が見受けられない。
不思議に思って調べてみた

Veritas Backup Exec 管理者ガイド「Granular Recovery Technology」の「Granular Recovery Technology を使うバックアップ用の推奨デバイス」

ディスクデバイス、重複排除デバイス、およびディスクカートリッジデバイスに送信された GRT 対応のバックアップジョブの暗号化を有効にすると、Backup Exec は詳細バックアップセットを暗号化された形式でディスクに格納しません。GRT 非対応のバックアップソースのバックアップセットのみが暗号化型式で格納されます。 クラウド、OpenStorage、およびテープデバイスに送信されるバックアップジョブのすべてのバックアップセットは、暗号化型式で格納されます。

ファイルサイズの制限があるボリューム上でディスクストレージデバイスを使う必要がある場合、Backup Exec ではステージングの場所が必要です。 Backup Exec はバックアップジョブの実行中に少しのメタデータをステージングの場所に一時的に格納します。 バックアップが終了したら、ステージングの場所からデータを削除します。 ただし、ファイルサイズの制限がないボリューム上のディスクストレージデバイスを宛先として使う場合、ステージングの場所は必要ありません。

ステージングの場所のデフォルトのパスは C:\temp です。

テープ装置などを使っている場合はステージングの場所が必要。
ローカルのNTFSディスクやCIFS共有を使っている場合は、「ファイルサイズの制限に制限がないボリューム」なので、ステージングの場所は不要。

というわけで、今回テストした環境は、CIFS共有をバックアップ保存先としていたため、ステージング領域が不要であった。ということのようでした。

BackupExec / NetBackupでWinPEを使った起動ディスクで仮想マシンをリカバリするとNIC設定が消える場合がある

BackupExec 20.1を使ってHyper-V上のWindows Serverのバックアップを行った。
最初、Hyper-V経由で仮想マシンとしてのバックアップにしようと考えていたのだが、BackupExecでは特定のドライブのバックアップを取らないという設定が出来ず、必ず全ドライブをバックアップする必要があることが分かった。
このため、対象サーバにBackupExec Agentをインストールして、エージェント経由でのバックアップを取ることにした。

で、Windows ADKを使用したSDR起動ディスクを作って、フルリストアのテストを行ったところ問題発生。
NICが2つついている場合、片側につけたIPアドレス設定がリカバリされない。

いろいろ条件をかえて試してみたけど、必ず発生している。

どうやら仕様らしい。

Veritasのサイト上だとNetBackup / vSphere環境での話として、「After restore a Windows Virtual Machine to original or alternate location, Virtual NIC settings may be changed or lost.」というのが掲載されている。

回避方法はなく、手動で再設定しろ、だそうな