NTNX>日記

個人的な趣味による Nutanix Community Edition 日記。Japanese のみですみません。

Nutanix Guest Tools をインストールしてみる。(ce-2018.05.01-stable / Linux 編)

Nutanix CE ce-2018.05.01-stable の Nutanix Guest Tools を Linux VM にインストールしてみます。 

以前の投稿(下記)のときとは異なり、最近の NGT では python-setuptools がインストールされていなくても、インストールできます。

VM への NGT インストーラ ISO イメージの接続

Prism で NGT のインストール対象の VM を選択し、「Manage Guest Tools」で NGT のインストーラ ISO イメージを VM に接続(マウント)します。

f:id:gowatana:20181224134907p:plain

Linux ゲスト OS 側での ISO イメージのマウント

今回は Oracle Linux 7.5 です。python-setuptools はインストールしていない状態です。

[root@ol7-on-ahv ~]# cat /etc/oracle-release
Oracle Linux Server release 7.5
[root@ol7-on-ahv ~]# python -V
Python 2.7.5
[root@ol7-on-ahv ~]# rpm -q python-setuptools
パッケージ python-setuptools はインストールされていません。

ISO イメージをマウントします。

[root@ol7-on-ahv ~]# mount /dev/cdrom /mnt/
mount: /dev/sr0 is write-protected, mounting read-only
[root@ol7-on-ahv ~]# ls /mnt
autorun.inf  config  installer  ngt_autorun.ico  rr_moved  setup.exe

Prism のアドレスなどが、ISO イメージに含まれています。

[root@ol7-on-ahv ~]# cat /mnt/config/ngt_config.json

{
        "cluster_ip" : "192.168.20.10",
        "data_services_ip" : "192.168.20.13",
        "ngt_uuid" : "d6f7f8e9-53bb-4129-a491-67a85ff524c3",
        "ngt_version" : "1.2.1",
        "port" : "2074"
}

NGT のインストール

NGT をインストールします。root ユーザで、install_ngt.py を実行します。

[root@ol7-on-ahv ~]# /mnt/installer/linux/install_ngt.py
Using Linux Installer for red hat enterprise linux server linux distribution.
Setting up Nutanix Guest Tools - VM mobility drivers.
Successfully set up Nutanix Guest Tools - VM mobility drivers.
Installing Nutanix Guest Agent Service.
Successfully installed Nutanix Guest Agent Service.
Installing Nutanix Self Service Restore Service.
Successfully installed Nutanix Self Service Restore Service.
Waiting for Nutanix Guest Agent Service to start...
Waiting for Nutanix Self Service Restore Service to start...
Nutanix Guest Agent Service successfully started in the background.
Nutanix Self Service Restore Service successfully started in the background.
[root@ol7-on-ahv ~]#

ngt_guest_agent を有効化して、起動します。NGT と Prism は接続されている必要がありますが、Prism と接続性がない状態でもサービス起動は成功してしまいます。

[root@ol7-on-ahv ~]# systemctl enable ngt_guest_agent
ngt_guest_agent.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig ngt_guest_agent on
[root@ol7-on-ahv ~]# systemctl start ngt_guest_agent

サービスが起動された状態です。

[root@ol7-on-ahv ~]# systemctl is-enabled ngt_guest_agent
ngt_guest_agent.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig ngt_guest_agent --level=5
enabled
[root@ol7-on-ahv ~]# systemctl is-active ngt_guest_agent
active

NGT は、NGT に同梱された Python を利用しているようです。

[root@ol7-on-ahv ~]# ps -ef | grep nutanix
root      12331      1  0 22:40 pts/0    00:00:05 /usr/local/nutanix/ngt/python27/python -E /usr/local nutanix/ngt/ssr/ssr_gateway/ssr_gateway_linux_service.py start
root      12374  12331  9 22:40 pts/0    00:04:29 /usr/local/nutanix/ngt/python27/python -E /usr/local nutanix/ngt/ssr/ssr_gateway/ssr_gateway_linux_service.py start
root      12375  12331  0 22:40 pts/0    00:00:00 /usr/local/nutanix/ngt/python27/python -E /usr/local nutanix/ngt/ssr/ssr_gateway/ssr_gateway_linux_service.py start
root      12379  12331  4 22:40 pts/0    00:02:13 /usr/local/nutanix/ngt/python27/python -E /usr/local nutanix/ngt/ssr/ssr_gateway/ssr_gateway_linux_service.py start
root      12598   2107  0 23:12 pts/0    00:00:00 tail -f /usr/local/nutanix/ngt/logs/guest_agent_service.log
root      12668      1  0 23:12 ?        00:00:00 /usr/local/nutanix/ngt/python27/python -E /usr/local nutanix/ngt/python/bin/guest_agent_monitor_linux.py
root      12679  12668  0 23:12 ?        00:00:01 /usr/local/nutanix/ngt/python27/python -E /usr/local nutanix/ngt/python/bin/guest_agent_monitor_linux.py
root      13316  12604  0 23:27 pts/1    00:00:00 grep --color=auto nutanix

ゲスト OS 側では、ISO は自動的にアンマウントされます。

[root@ol7-on-ahv ~]# ls /mnt
[root@ol7-on-ahv ~]# 

そして、Prism 側でも ISO が外された状態になります。

f:id:gowatana:20181224142300p:plain

ちなみに、Systemd の Unit 定義です。

[root@ol7-on-ahv ~]# systemctl cat ngt_guest_agent
# /run/systemd/generator.late/ngt_guest_agent.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/rc.d/init.d/ngt_guest_agent
Description=LSB: Starts, stops Nutanix Guest Agent.
Before=runlevel2.target
Before=runlevel3.target
Before=runlevel4.target
Before=runlevel5.target
Before=shutdown.target
After=network-online.target
Conflicts=shutdown.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/rc.d/init.d/ngt_guest_agent start
ExecStop=/etc/rc.d/init.d/ngt_guest_agent stop

おまけ

CentOS 7 Cloud Image へのインストール

CentOS 7 の Cloud Image のような、導入パッケージが最小限となっている OS イメージを利用する場合、NGT のインストール要件となる RPM が不足していることがあります。

Nutanix AHV に手軽に Linux VM を用意する。(REST API & Python3) - NTNX>日記

RPM 追加していない CentOS 7 Cloud Image に NGT をインストールすると、lvm2 の不足によりエラーになります。

[root@vm01 ~]# /mnt/installer/linux/install_ngt.py
Using Linux Installer for centos linux linux distribution.
Required package lvm2 not installed. Please install lvm2 and retry installation.
ERROR: Failed to install Nutanix Guest Tools. Check /tmp/ngt_install_log_20201217154412.txt  for logs.

そこで、事前インストールが必要です。

[root@vm01 ~]# yum install -y lvm2

NGT と Self-Service Restore

NGT によって、Linux ゲスト OS にも Self-Service Restore 機能が提供されます。保護ドメイン スナップショットが表示できたりします。

[root@ol7-on-ahv ~]# /usr/local/nutanix/ngt/ngtcli/ngtcli.py ssr list-snapshots
Communicating with Nutanix Data Protection Service...
Snapshot Id  Disk Labels  Logical Drives       Create Time
------------ ------------ -------------------- --------------------
842          scsi0:0      /dev/sda:/boot /dev/sda:/ 2018.12.24 02:33 PM

以上。

©2023 gowatana
クリエイティブ・コモンズ・ライセンスこの 作品 は クリエイティブ・コモンズ 表示 4.0 国際 ライセンスの下に提供されています。