As you learned how the Globex retails system stands up the application portfolio, the Oracle database
is still running on the virtual machine to manage the customers data. After you have refactored the customers application, you will need to deploy the application to the OpenShift cluster along with the modernization path for the containerization.
The goal is to migrate the Oracle virtual machine from Red Hat Virtualization
(RHV) to OpenShift Virtualization
using the Migration Toolkit for Virtualization (MTV).
Download the CA Certificate for your RHV environment. You need to do that on your laptop because you will need to drag the file into the Migration Toolkit for the MTV web console later.
Set this variable to the RHV hostname from the shared environment detail page.
Open a new browser to access the following URL. Make sure to replace RHV_HOSTNAME
with the hostname from the shared environment detail page (e.g., rhvm.dev.cnv.infra.opentlc.com).
https://<RHV_HOSTNAME>/ovirt-engine/services/pki-resource?resource=ca-certificate&format=X509-PEM-CA
On most systems this will download a file pki-resource.cer
into your Downloads
folder. Take a note where this file got downloaded to. You will need it a little bit later.
The shared cluster already has projects for all users available. But you are migrating a VM as administrator. Therefore you need to create your own project to migrate the VM into.
Switch to a terminal window where you are logged in as admin.
The shared OpenShift cluster has only one or two nodes that are capable of running VMs. These are metal instances on AWS. To ensure that only VMs are running on these nodes the nodes are tainted. Which means you must add a matching toleration to your VM to allow it to run on the metal nodes.
Create the target project for your migrated VM.
oc new-project retail
The easiest way of adding a matching toleration is to automatically add the toleration to all pods in a project. This can be done by adding an annotation to the namespace that underlies your project.
oc annotate namespace retail scheduler.alpha.kubernetes.io/defaultTolerations='[{"operator": "Exists", "key": "metal"}]'
Warning
|
If your namespace does not have the correct toleration the migration process will fail and your VM will not start. |
Log into the OpenShift Web Console from the shared environment detail page.
-
Username:
admin
-
Password:
r3dh4t1!
Go to Virtualization
on the left menu and click on Virtual Machines
. From the Projects drop down select the previously created retail project. There are no Virtual Machines yet.
Click Launch Migration Tool
to launch the OpenShift Migration Toolkit for Virtualization.
Log in using your admin credentials.
-
Username:
admin
-
Password:
r3dh4t1!
If this is the first time you are logging in, click on Get started
button.
Click Add provider
on the list of Providers.
Select Red Hat Virtualization from the list of providers. Fill in the information in the shared environment detail page.
-
Name:
rhv
-
RHV Manager host name or IP address: The hostname in the shared environment detail page (e.g.,
rhvm.dev.cnv.infra.opentlc.com
) -
RHV Manager user name: the username in the shared environment detail page. (e.g.,
migrateuser-96trd@internal
) -
RHV Manager password: the password in the shared environment detail page. (e.g.,
ThvA2Ioa6Q4G
) -
CA Certificate: Drop the previously downloaded CA Certificate File
Click Add
.
MTV will validate your provider and after a few seconds the status should switch to Ready.
Go to Migration Plans
in the Migration Toolkit for Virtualization console. Click Create Plan
.
On the General settings page use the following parameters.
-
Plan name:
customers-database
-
Source provider:
rhv
-
Target provider:
host
(the OpenShift cluster you are currently on) -
Target namespace:
retail
Click Next
.
Check All datacenters
on the Filter by VM location. Click Next
.
Select the Oracle VM (e.g. oracle-96trd) in the shared environment detail page on the Select VMs page. Click Next
.
Click on Select a network mapping on the Network Mapping page. Then, Select Create a network mapping
. Leave the defaults and click Next
.
Click on Select a storage mapping on the Storage Mapping page. Select Create a storage mapping
.
Change the Target Storage Class to gp2-csi
and click Next
.
Select Cold migration
on the Migration type page. Click Next
.
Click Next
on the Hooks page.
Click Finish
on the Review page.
Now your Migration Plan is ready to use. To execute the plan click on Start
button in the customers-database migration plan.
Confirm by clicking the blue Start
button in the popup window.
Because you are running a cold migration the VM in RHV gets shutdown first.
The migration will take about 15 - 25 minutes after which you will have a running Oracle database VM in your OpenShift cluster.
Once the migration succeeds you will find a VM called oracle-xxxxx
in your retail namespace.
Initially the migrated VM is not yet reachable from other applications on the cluster. You will need to add a label to the VM and then create a service to be able to connect to the database on the VM.
Note
|
The workshop environment has already created multiple virtual machines separately for the workshop participants. So you will see the unique ID (GUID) for your oracle virtual machine (e.g. oracle-96trd) for the provision Message page. |
Set your GUID as an environment value to avoid repeatable replacement in the following command lines.
Replace GUID
with your GUID from the shared environment detail page. (e.g. 96trd).
export GUID=YOUR_GUID
Make sure you are in the retail
project:
oc project retail
Make the VM accessible from within the OpenShift cluster:
virtctl expose vm oracle-${GUID} --port=1521 --name=oracle-${GUID} --type=ClusterIP
Make sure your service has the endpoint for the Oracle VM pod as an Endpoint:
oc describe svc oracle-${GUID} -n retail
-
Sample Output
Name: oracle-96trd
Namespace: retail
Labels: app=oracle-96trd
Annotations: <none>
Selector: app=oracle-96trd
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 172.30.99.143
IPs: 172.30.99.143
Port: 1521-1521 1521/TCP
TargetPort: 1521/TCP
Endpoints: 10.128.1.156:1521
Port: 2022-22 2022/TCP
TargetPort: 22/TCP
Endpoints: 10.128.1.156:22
Session Affinity: None
Events: <none>
⬅️ 4. Refactor