Installing VMware Mobility CLI on ProtonOS VM

Mindwatering Incorporated

Author: Tripp W Black

Created: 06/01/2020 at 05:41 PM

 

Category:
VMWare
Other

Task:
Installation and testing of VMware Mobility CLI client installed on a ProtonOS VM.

Notes:
JVM 11 (OpenJDK11U-jdk_x64_linux_hotspot_11.0.7_10.tar.gz) didn't included the xml.ws libraries, which metro-jax-ws and jaxws-ri included. The latter had missing dependancies, which required us to drop in jarkarta.jws and jarkartw.ws.rs. Afterwards, the dependancies were resolved, and the code started.

With JVM 9 (OpenJDK9U-jdk_x64_linux_hotspot_9.0.4_11.tar.gz), the ws modules needed for the Mobility CLI are disabled. Adding a call to load all of them fixed the dependancies, and the code started.

In both cases, the CLI fails to perform a relocation.
[ /usr/local/xvc-mobility ]# sh xvc-mobility.sh -op relocate -svc esxserver2 -su root -dvc esxserver1 -du root -vms Test -dh esxserver1 -dds NASVM3
/usr/local/jdk9-0-4
NOTE: Picked up JDK_JAVA_OPTIONS: --add-modules java.se.ee
20:09:10.766 [main] INFO c.v.xvcprov.CrossVcProvDataParser - Given details for relocate operation.
20:09:10.768 [main] INFO com.vmware.xvcprov.ConfigData - dvc=[esxserver1], op=[relocate], svc=[esxserver2], du=[root], su=[root], dds=[NASSHAREDStor1], dh=[esxserver1], vms=[Test]

20:09:10.793 [main] INFO c.v.xvcprov.CrossVcProvDataParser - Reading password from console
Enter source VC password:

20:09:15.192 [main] INFO c.v.xvcprov.CrossVcProvDataParser - Reading password from console
Enter destination VC password:
20:09:17.579 [main] INFO com.vmware.sdkclient.VcConnection - logging into vCenter vm2
20:09:25.469 [main] INFO com.vmware.sdkclient.VcConnection - Successfully logged into vCenter
20:09:25.472 [main] INFO com.vmware.sdkclient.VcConnection - logging into vCenter vm1
20:09:28.663 [main] INFO com.vmware.sdkclient.VcConnection - Successfully logged into vCenter
20:09:28.665 [main] ERROR com.vmware.xvcprov.CrossVCProvClient - java.lang.NullPointerException
20:09:28.668 [main] ERROR com.vmware.xvcprov.CrossVCProvClient - Please check xvc-mob-errstack.log file for more details

[ /usr/local/xvc-mobility ]# cat xvc-mob-errstack.log
java.lang.NullPointerException
at com.vmware.xvcprov.CrossVCProvClient.login(CrossVCProvClient.java:151)


_________________


Steps:
1. Create a new VM using the VCSA or VMware Fusion using the OVA

VMware Fusion:
File --> New --> Select option Import an existing virtual machine --> Click Continue --> Click Choose File, and navigate to the ProtonOS OVA file and click Open --> Continue to create the VM, and customize at the completion prompt if desired. Click the Play icon to start the VM.


2. Login to the VM and change the default root/changeme password to something better.
login: root
... <enter existing, then new password twice to change>


3. Update the OS:
# tdnf update

Notes:
- You can also install packages like:
# tdnf install vim
(VI/VIM is already installed. This is just an example.)
- BTW, Docker is already installed. It should be disabled, and not running. This sandbox project will not be using Docker. We just like that Docker is already installed.
# systemctl status docker
.... Loaded ... disabled ...
# systemctl enable docker
# systemctl start docker


4. Transfer a JVM to the VM.
e.g. Filezilla to server, to the root/tmp folder.
# pwd
/root/
# mkdir /root/tmp/
< transfer file to the tmp folder>


5. Extract tar and move the JVM into place:
# ls -l
... OpenJDK9U-jdk_x64_linux_hotspot_9.0.4_11.tar.gz
# tdnf install tar
# tar xvzf OpenJDK9U-jdk_x64_linux_hotspot_9.0.4_11.tar.gz
# rm *.gz

Optional: clean-up folder name a bit.
# mv jdk-9.0.4+11/ jdk9-0-4/

Move to a bin folder. We are going to use /usr/local/
# mv jdk9-0-4/ /usr/local/
# cd /usr/local/
# ls
... jdk9-0-4 ...

Add JVM to all user paths:
# vi /etc/profile.d/mw_jdk.sh
<i to insert>
export JAVA_HOME=/usr/local/jdk9-0-4
export PATH=$JAVA_HOME/bin:$PATH
export JDK_JAVA_OPTIONS='--add-modules java.se.ee'
<esc :wq>

Update the profiles immediately so as not to have to end SSH session:
# source /etc/profile

Test Java
# cd /root/tmp/
# java -version
openjdk version ...


6. Transfer Mobility archive to the VM and set-up.
e.g. Filezilla to server, to the root/tmp folder.
# cd/root/tmp/
< transfer folder to the tmp folder e.g. xvc-mobility1-6-1>

7. Move the folder the API into place:
# mv /root/tmp/xvc-mobility1-6-1/ /usr/local/
# cd /usr/local/xvc-mobility1-6-1/
# chmod 755 xvc-mobility.sh

Test the API
# cd /usr/local/xvc-mobility1-6-1/
# ./xvc-mobility.sh



VMware help doc:
Command:
xvc-mobility -svc <source-vc-ip> -su <source-vc-username> -dvc <destination-vc-ip> -du <destination-vc-username> -vms <vm-names> -dh <destination-host> -dds <destination-datastore> -op relocate

Note :- This tool is not recommended for migrating linked clone vms between two VCs.

Parameters:
-op : operation - <required> {relocate, clone, bulk-relocate, bulk-clone}
-svc : source vc ip/dns name/url - <required>
-su : source vc username - <required>
-dvc : destination vc ip/dns name/url - <required>
-du : destination vc username - <required>
-vms : one or more vm names separated by comma - <required>
-cln : clone vm name - [required for clone operation]
-dcl : destination drs cluster - [required when dest host is not given]
-dh : destination host - [required when dest drs-cluster is not given]
-dds : destination datastore - [optional but required for multiple vms to relocate]
-drp : destination resource pool - [optional]
-pod : destination storage pod - [optional and valid only when dest drs-cluster is given]
-swt : destination switch type - [optional {vss / vds}]
-dnw : destination network switch name - [required when switch type is given]
-vmf : destination vm folder - [optional]
-df : bulk-relocate/clone xml data-file [required when -op is bulk-relocate / bulk-clone]

Note:
1. Arguments can be specified either through command line or config/config.properties, command line arguments take precedence
2. For bulk-relocate and bulk-clone operations, arguments can be specified in config/bulk-relocate.xml, config/bulk-clone.xml respectively.
Or pass the xml file with argument -df. Check the instructions page for examples. Only either bulk-relocate or bulk-clone operation can be performed at a time.
3. -dcl or -dh must be provided.
if -dh is provided and -dds is not provided
then vm's datastore is assumed to be shared between source and destination hosts and migrate happens only at host level.
if -dcl is provided and -dds is specified
then -pod will be ignored if specified. -dds argument takes precedence over -pod argument.
4. Both -dh and -dds are mandatory for multiple vms to relocate.
5. If -op is clone, then -cln(clone vm name) is mandatory
6. Only one vm can be cloned at a time, but one vm can be cloned to multiple copies
7. Special characters must be enclosed in double quotes.
8. VC Passwords will be asked on the command prompt which is highly recommended. However passwords can be passed as an argument on command line or through
config.properties. Arguments are -spw, -dpw for source and destination VC passwords respectively.

Supported Operations
--------------------
- Migrate one or more VMs by specifying destination host, datastore, vm folder, network switch.
- Migrate a VM by specifying destination DRS enabled cluster and/or datastore(Cluster Placement)
- Migrate a VM by specifying destination DRS enabled cluster and storage cluster/pod(Cluster Placement)
- Migrate a VM by specifying only destination host (Shared vMotion)
- Clone a VM by specifying destination host and datastore
- Clone a VM by specifying destination DRS enabled cluster and/or datastore
- Clone a VM by specifying only destination host
- Bulk-relocate / Bulk-clone vms with all above options





previous page