esxi 5.1 をまだ使っている.

HighAvailabilityにて土台にesxiを置いて、その上に仮想マシン2台からなるクラスターを作る.
っで起こりえる スプリットブレイン に対処するため STONITH として 仮想マシン(クラスターノード) から相手を眠らせる必要がある.

っでここでは vSphere Command-Line Interface を使って相手方を眠らせてみた

esxi5.1は既にサポート切れなので記事を書いても仕方ないのだが、当方はいまだこれを使っている.

っで vSphere Command-Line Interface 5.1 をインストールしてみる.

[root@ha01 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
 
[root@ha01 ~]# yum groupinstall "Development tools"
[root@ha01 ~]# yum install epel-release 
[root@ha01 ~]# yum install openssl-devel perl-CPAN perl-Archive-Zip perl-Crypt-SSLeay perl-LWP-Protocol-https perl-XML-LibXML perl-Class-MethodMaker
 
[root@ha01 ~]# cd /apps/src/
[root@ha01 src]# tar xzf VMware-vSphere-CLI-5.1.0-1060453.x86_64.tar.gz && cd vmware-vsphere-cli-distrib/
[root@ha01 vmware-vsphere-cli-distrib]# ls -l
total 260
drwxr-xr-x. 10 root root    124 Mar 20  2013 apps
drwxr-xr-x.  2 root root   4096 Jun  2 03:54 bin
drwxr-xr-x.  3 root root     89 Mar 20  2013 doc
drwxr-xr-x.  2 root root     26 Mar 20  2013 etc
-r--r--r--.  1 root root 253366 Mar 20  2013 FILES
drwxr-xr-x. 28 root root   4096 Mar 20  2013 lib
-r--r--r--.  1 root root   3340 Mar 20  2013 Makefile.PL
drwxr-xr-x.  2 root root     23 Mar 20  2013 man
drwxr-xr-x.  2 root root     87 Mar 20  2013 resources
lrwxrwxrwx.  1 root root     35 Mar 20  2013 vmware-install.pl -> bin/vmware-uninstall-vSphere-CLI.pl
[root@ha01 vmware-vsphere-cli-distrib]#

ここでファイル[vmware-install.pl(-> bin/vmware-uninstall-vSphere-CLI.pl)]を修正する

--- vmware-uninstall-vSphere-CLI.pl.oirg        2013-03-20 12:14:09.000000000 +0900
+++ vmware-uninstall-vSphere-CLI.pl     2020-06-02 03:54:30.181287690 +0900
@@ -2370,7 +2370,7 @@
     {'module' => 'Data::Dumper',                  'version' => '2.121',    'path' => 'Data-Dumper-2.121'},
     {'module' => 'Class::MethodMaker',            'version' => '2.10',     'path' => 'Class-MethodMaker-2.10'},
     {'module' => 'HTML::Parser',                  'version' => '3.60',     'path' => 'HTML-Parser-3.60'},
-    {'module' => 'UUID',                          'version' => '0.03',     'path' => 'UUID-0.03'},
+    {'module' => 'Data::UUID',                    'version' => '0.03',     'path' => 'UUID-0.03'},
     {'module' => 'Data::Dump',                    'version' => '1.15',     'path' => 'Data-Dump-1.15'},
     {'module' => 'SOAP::Lite',                    'version' => '0.710.08', 'path' => 'SOAP-Lite-0.710.08'},
     {'module' => 'URI',                           'version' => '1.37',     'path' => 'URI-1.37'},
@@ -2398,7 +2398,7 @@
      {'module' => 'Data::Dumper',          'version' => '2.121',  'path' => 'Data-Dumper-2.121'},
      {'module' => 'Class::MethodMaker',    'version' => '2.10',   'path' => 'Class-MethodMaker-2.10'},
      {'module' => 'HTML::Parser',           'version' => '3.60',   'path' => 'HTML-Parser-3.60'},
-     {'module' => 'UUID',                  'version' => '0.03',   'path' => 'UUID-0.03'},
+     {'module' => 'Data::UUID',             'version' => '0.03',   'path' => 'UUID-0.03'},
      {'module' => 'Data::Dump',             'version' => '1.15',    'path' => 'Data-Dump-1.15'},
      {'module' => 'SOAP::Lite',             'version' => '0.710.08',  'path' => 'SOAP-Lite-0.710.08'},
      {'module' => 'URI',                   'version' => '1.37',   'path' => 'URI-1.37'},]

その後に

[root@ha01 vmware-vsphere-cli-distrib]# export ftp_proxy=""
[root@ha01 vmware-vsphere-cli-distrib]# export http_proxy=""
 
 
 
[root@ha01 vmware-vsphere-cli-distrib]# ./vmware-install.pl --prefix=/opt/vmware
Creating a new vSphere CLI installer database using the tar4 format.
 
Installing vSphere CLI 5.1.0 build-1060453 for Linux.
 
You must read and accept the vSphere CLI End User License Agreement to
continue.
Press enter to display it.
 
(使用許諾の内容が表示される)
 
Do you accept? (yes/no) yes
 
Thank you.
 
Please wait while configuring CPAN ...
 
Please wait while configuring perl modules using CPAN ...
 
CPAN is downloading and installing pre-requisite Perl module "version" .
 
CPAN is downloading and installing pre-requisite Perl module "Data::UUID" .
 
CPAN is downloading and installing pre-requisite Perl module "Data::Dump" .
 
CPAN is downloading and installing pre-requisite Perl module "SOAP::Lite" .
 
Please wait while copying vSphere CLI files...
 
The installation of vSphere CLI 5.1.0 build-1060453 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command:
"/opt/vmware/bin/vmware-uninstall-vSphere-CLI.pl".
 
This installer has successfully installed both vSphere CLI and the vSphere SDK
for Perl.
 
Enjoy,
 
--the VMware team
 
[root@ha01 vmware-vsphere-cli-distrib]#

これで一応完成

使ってみる

[root@ha01 ~]# /opt/vmware/bin/esxcli
-bash: /opt/vmware/bin/esxcli: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
 
[root@ha01 ~]#

と「/lib/ld-linux.so.2」がないと言われる. どうやら32bit版のlibcが必要なようで

yum install glibc-2.17-307.el7.1.i686

が必要. これで動く.

ESXiサーバで現在動いている仮想マシンのリスト
自分自身 ha01 も含まれている

[root@ha01 ~]# /opt/vmware/bin/esxcli --server 192.168.0.5  -u root -p  xxxxxxxxx vm process list
ha01
   World ID: 609863
   Process ID: 0
   VMX Cartel ID: 609862
   UUID: 56 4d 4b 09 57 54 81 12-8b bd ca fc 61 d5 dc 17
   Display Name: ha01
   Config File: /vmfs/volumes/50bc343e-8cd306e8-877b-6805ca092bc5/ha01/ha01.vmx
 
ha02
   World ID: 606164
   Process ID: 0
   VMX Cartel ID: 606163
   UUID: 56 4d 7a 26 4e 29 56 e8-04 82 f0 02 e8 a0 68 ea
   Display Name: ha02
   Config File: /vmfs/volumes/50bc343e-8cd306e8-877b-6805ca092bc5/ha02/ha02.vmx
[root@ha01 ~]#

仮想マシンha01から 同じく仮想マシンの ha02 をshutdown させる

[root@ha01 ~]# /opt/vmware/bin/esxcli --server 192.168.0.5  -u root -p  xxxxxxxxx  vm process kill --type=soft --world-id=606164

留意 shutdown はできても、reboot に該当するコマンドは見当たらない...

virsh

vSphere Command-Line Interface経由の他にも仮想マシンを眠らせる方法として

virsh 経由で相手方を眠らせる方法もある.

まず可能マシンに "Virtualization Host" 関係のアプリをインストールします.

[root@ha01 ~]# cat /etc/redhat-release
CentOS Linux release 7.7.1908 (Core)
 
[root@ha01 ~]# yum groupinstall "Virtualization Host"
 
[root@ha01 ~]# virsh --version
4.5.0
 
[root@ha01 ~]# virsh -V
Virsh command line tool of libvirt 4.5.0
See web site at https://libvirt.org/
 
Compiled with support for:
 Hypervisors: QEMU/KVM LXC ESX Test
 Networking: Remote Network Bridging Interface netcf Nwfilter VirtualPort
 Storage: Dir Disk Filesystem SCSI Multipath iSCSI LVM RBD Gluster
 Miscellaneous: Daemon Nodedev SELinux Secrets Debug DTrace Readline
 
[root@ha01 ~]#

っで、esxiへ接続してみます

[root@ha01 ~]# virsh -c esx://192.168.0.5/?no_verify=1
Enter username for 192.168.0.5 [root]:
Enter root's password for 192.168.0.5:
Welcome to virsh, the virtualization interactive terminal.
 
Type:  'help' for help with commands
       'quit' to quit
 
virsh #

っと一見すると成功なのだが....

これで esxi のマシンリストとかは得られる. だが、virsh 経由で仮想マシンを起動/停止しようとするとエラーが表示される.

[root@ha01 ~]# virsh -c esx://192.168.0.5/?no_verify=1 list --all
 
[root@ha01 ~]# virsh -c esx://192.168.0.5/?no_verify=1 start ha02
Enter username for 192.168.0.5 [root]:
Enter root's password for 192.168.0.5:
error: Failed to start domain ha02
error: internal error: HTTP response code 500 for call to 'PowerOnVM_Task'. Fault: ServerFaultCode - Current license or ESXi version prohibits execution of the requested operation.
 
[root@ha01 ~]#

ライセンス的な問題で無理みたい.

ならばと「ence agent for VMWare (fence-agents-vmware-soap)」経由でも無理みたい

[root@ha01 ~]# fence_vmware_soap -o list  -a "192.168.0.5" -l "root" -p "xxxxxxxx" -z --ssl-insecure
 
[root@ha01 ~]# fence_vmware_soap -o on  -a "192.168.0.5" -l "root" -p "xxxxxx" -z --ssl-insecure  -n ha02
2020-06-02 19:06:00,072 ERROR: Failed: Timed out waiting to power ON
 
 
[root@ha01 ~]#

参照先

https://cyberground.hu/install-vmware-vsphere-sdk-for-perl-to-centos-7/


トップ   編集 添付 複製 名前変更     ヘルプ   最終更新のRSS
Last-modified: 2020-06-02 (火) 23:45:26 (33d)