← All field notes

Simulate Oracle Cloud on KVM/OLVM

We have no idea when Oracle 23ai will be released on premises. And it is a shame, since this database is offering a lot of great features that you probably would like to learn!

One of the solutions is to use Oracle Cloud to learn, another is to use the Oracle Free version… but if you want to experiment in your own KVM or OLVM environment, you can do it quite easily.

When you run STRACE on Oracle Database startup process, you will find, that it checks the following:

ora600@lab ~ / text#01
43872 read(13</sys/devices/virtual/dmi/id/chassis_asset_tag>, "\n", 15) = 1
1 LINESTEXT / UTF-8

In OCI environment, this "file" contains the one entry:

ora600@lab ~ / text#02
OracleCloud.com
1 LINESTEXT / UTF-8

The question is – can I make my VM have the same entry? Of course you can! On a simple KVM you can add an entry to your domain XML under the SYSINFO node:

ora600@lab ~ / text#03
<chassis>
      <entry name='asset'>OracleCloud.com</entry>
</chassis>
3 LINESTEXT / UTF-8

So the SYSINFO should look like this:

ora600@lab ~ / text#04
<sysinfo type='smbios'>
    <system>
      <entry name='manufacturer'>oVirt</entry>
      <entry name='product'>RHEL</entry>
      <entry name='version'>8.10-1.0.7.el8</entry>
      <entry name='serial'>99cb00c0-0eb3-44a2-a9be-e1d7c82e59c5</entry>
      <entry name='uuid'>d454a0d8-de89-4eee-9d95-60ac61cd8ba5</entry>
      <entry name='family'>oVirt</entry>
    </system>
    <chassis>
      <entry name='asset'>OracleCloud.com</entry>
    </chassis>
  </sysinfo>
13 LINESTEXT / UTF-8

It is a bit more challenging to add this to your OLVM (ovirt) machine, but it is not impossible 🙂

OLVM (and oVirt of course) provide hooks – you can think of them as triggers that are executed on specific events. Those hooks are located here:

ora600@lab ~ / bash#05
[root@olvm2 before_vm_start]# ls /usr/libexec/vdsm/hooks
after_device_create               after_update_device                before_get_stats
after_device_destroy              after_update_device_fail           before_get_vm_stats
after_device_migrate_destination  after_vdsm_stop                    before_memory_hotplug
after_device_migrate_source       after_vm_cont                      before_network_setup
after_disk_hotplug                after_vm_dehibernate               before_nic_hotplug
after_disk_hotunplug              after_vm_destroy                   before_nic_hotunplug
after_disk_prepare                after_vm_hibernate                 before_set_num_of_cpus
after_get_all_vm_stats            after_vm_migrate_destination       before_update_device
after_get_caps                    after_vm_migrate_source            before_vdsm_start
after_get_stats                   after_vm_pause                     before_vm_cont
after_get_vm_stats                after_vm_set_ticket                before_vm_dehibernate
after_hostdev_list_by_caps        after_vm_start                     before_vm_destroy
after_memory_hotplug              before_device_create               before_vm_hibernate
after_network_setup               before_device_destroy              before_vm_migrate_destination
after_network_setup_fail          before_device_migrate_destination  before_vm_migrate_source
after_nic_hotplug                 before_device_migrate_source       before_vm_pause
after_nic_hotplug_fail            before_disk_hotplug                before_vm_set_ticket
after_nic_hotunplug               before_disk_hotunplug              before_vm_start
after_nic_hotunplug_fail          before_get_all_vm_stats
after_set_num_of_cpus             before_get_caps
21 LINESBASH / UTF-8

We will create a new file in before_vm_start:

ora600@lab ~ / text#06
/usr/libexec/vdsm/hooks/before_vm_start
1 LINESTEXT / UTF-8

Let’s name the file: 51_oracle_cloud

And this is how it looks like:

ora600@lab ~ / python#07
[root@olvm2 before_vm_start]# cat 51_oracle_cloud 
#!/usr/libexec/platform-python

import os
import hooking

domxml = hooking.read_domxml()

sysinfo = domxml.getElementsByTagName("sysinfo")[0]

chassis = domxml.createElement('chassis')
entry = domxml.createElement('entry')
entry.setAttribute('name','asset')
oracle_cloud = domxml.createTextNode('OracleCloud.com')
entry.appendChild(oracle_cloud)
chassis.appendChild(entry)
sysinfo.appendChild(chassis)

hooking.write_domxml(domxml)
19 LINESPYTHON / UTF-8

That’s it! Now each time a VM starts, a new chassis tag is inserted!

Have fun with your in-house 23ai cloud 😀

END OF FIELD NOTE / 2025-04-12

Keep asking why. Keep looking deeper.

← Back to the blog