How to Manually Recreate vm.cfg file of a Oracle VM


If vm.cfg configuration file for VM which is stored under /OVS/Repositories/<repo uuid>/VirtualMachines/<vm uuid>/ in OVM server on which the VM is hosted or was last hosted is deleted or removed by mistake.

As for a running VM, a missing vm.cfg file will not affect its running. However, to start the VM again after a poweroff, it needs the configuration file.



1) If VM is still present in OVM Manager GUI.

Find the VM's config file in OVM Manager GUI by selecting the VM-> right-click and select 'Display VM config file Content'.

In Demo/OVM Server:

Find the configuration options of concerned VM inside xend.log. Use the concerned VM name or uuid as keyword.




Output for a VM:

[2019-12-03 13:29:20 2767] DEBUG (XendDomainInfo:163) XendDomainInfo.create(['vm', ['name', '0004fb0000060000deb2c783822360ff'], ['memory', 1048], ['maxmem', 2048], ['on_poweroff', 'destroy'], ['on_reboot', 'restart'], ['on_crash', 'restart'], ['on_xend_start', 'ignore'], ['on_xend_stop', 'ignore'], ['vcpu_avail', '3'], ['vcpus', 2], ['uuid', '<UUID>'], ['cpu_cap', 0], ['cpu_weight', 27500], ['oos', 1], ['image', ['hvm', ['videoram', 4], ['serial', 'pty'], ['bios', 'rombios'], ['acpi', 1], ['apic', 1], ['boot', 'c'], ['cpuid_check', []], ['fda', ''], ['fdb', ''], ['guest_os_type', 'linux'], ['hap', 1], ['hpet', 0], ['isa', 0], ['keymap', 'en-us'], ['localtime', 0], ['nestedhvm', 0], ['nographic', 0], ['oos', 1], ['pae', 1], ['pci', []], ['pci_msitranslate', 1], ['pci_power_mgmt', 0], ['rtc_timeoffset', 0], ['soundhw', ''], ['stdvga', 0], ['timer_mode', 1], ['usb', 0], ['usbdevice', 'tablet'], ['vcpus', 2], ['vnc', 1], ['vnclisten', '127.0.0.1'], ['vncunused', 1], ['viridian', 0], ['vpt_align', 1], ['xauthority', '/root/.Xauthority'], ['xen_platform_pci', 1], ['memory_sharing', 0], ['ib_pfs', []], ['override_mem_relocate', 0], ['tsc_mode', 0], ['nomigrate', 0]]], ['s3_integrity', 1], ['device', ['vbd', ['uname', 'file:/OVS/Repositories/0004fb00000300002467098a2bffa3ff/VirtualDisks/0004fb000012000072849fefa68f1d2b.img'], ['dev', 'xvda'], ['mode', 'w']]], ['device', ['vbd', ['uname', 'phy:/dev/mapper/14f504e46494c45527866454143752d4a61306f2d4a336b72'], ['dev', 'xvdc'], ['mode', 'w!']]], ['device', ['vif', ['bridge', '0ab21400'], ['mac', '<MAC_ID>']]]])



b. Verify a vm.cfg file from another VM and create a temporary vm.cfg file based on the information collected earlier



vif = ['mac=<MAC_ID>,bridge=0ab21400']

OVM_simple_name = 'Test'

vnclisten = '127.0.0.1'

serial = 'pty'

disk = ['file:/OVS/Repositories/0004fb00000300002467098a2bffa3ff/VirtualDisks/0004fb000012000072849fefa68f1d2b.img,xvda,w', 'phy:/dev/mapper/14f504e46494c45527866454143752d4a61306f2d4a336b72,xvdc,w!']

vncunused = 1

uuid = '<UUID>'

on_reboot = 'restart'

boot = 'c'

name = '0004fb0000060000deb2c783822360ff'

cpu_weight = 27500

memory = 1048

cpu_cap = 0

maxvcpus = 2

OVM_high_availability = False

maxmem = 2048

vnc = 1

OVM_description = 'Oracle Linux OL6 update 9 for x86'

on_poweroff = 'destroy'

on_crash = 'restart'

guest_os_type = 'linux'

usbdevice = 'tablet'

builder = 'hvm'

vcpus = 2

keymap = 'en-us'

OVM_os_type = 'Oracle Linux 6'

OVM_cpu_compat_group = ''

OVM_domain_type = ‘xen_hvm_pv'





Copy the contents to a file named as vm.cfg and save it under /OVS/Repositories/<repo uuid>/VirtualMachines/<vm uuid>/.


The recreation/recovering of the VM's config file is thus successful.





If you like please follow and comment