Removing Old HostedEngine Virtual Machine from Restored Self-Hosted Engine Environment and Enabling New HostedEngine Virtual Machine in the Manager.

Solution Unverified - Updated

Environment

  • Red Hat Enterprise Virtualization 3.5

Issue

Resolution

Note: in RHEV 3.6, the location of vm.conf is different, and it is: /var/run/ovirt-hosted-engine-ha/vm.conf. And this can be verified in /etc/ovirt-hosted-engine/hosted-engine.conf.

  • Adjust present HostedEngine virtual machine setting and reconfigure database.
   On first HostedEngine host:
   
   1. Place the hosts into global maintenance mode:

      # hosted-engine --set-maintenance --mode=global

   2. Edit vmName entry of the vm.conf  change vmname:

      # vi /etc/ovirt-hosted-engine/vm.conf
      Before: 'vmName=HostedEngine'
      After: 'vmName=NewHostedEngine'

   3. Copy the vm.conf to all relevant hosts:

      # scp /etc/ovirt-hosted-engine/vm.conf root@<<hosted_engine_2.example.com>>:/etc/ovirt-hosted-engine/vm.conf

   4. Turn off global maintenance mode:

      # hosted-engine --set-maintenance --mode=none

   5. The HostedEngine virtual machine may need to be shutdown and restarted for this to take effect:
      
      # hosted-engine --vm-shutdown
      # hosted-engine --vm-start

    At this stage you should have the original HostedEngine virtual machine in a down state, 
    and the NewHostedEngine virtual machine ('external-NewHostedEngine') in an Up state. 
    The NewHostedEngine virtual machine ('external-NewHostedEngine') can be migrated between hosts using the Manager.

   6. To remove the old HostedEngine virtual machine, connect HostedEngine virtual machine.

      # ssh root@hosted-engine-virtual machine.example.com

   7. Run this command, replace 'HostedEngine' with the correct name, if different.

      # /usr/share/ovirt-engine/dbscripts/engine-psql.sh -c "select deletevm(vm_guid) from vm_static where vm_name like 'HostedEngine'"

Old HostedEngine virtual machine will disappear from the Administration Portal.

  • Rename the NewHostedEngine virtual machine to original name.
    1. Place the HostedEngine environment into global maintenance mode to disable the high-availability agents: 

        # hosted-engine --set-maintenance --mode=global

    2. Edit the vm.conf file on any one of the hosts in the environment. The default location is /etc/ovirt-hosted-engine/vm.conf

        # vi /etc/ovirt-hosted-engine/vm.conf

    3. Manually copy the updated vm.conf file to all hosts in the HostedEngine environment:

        # scp /etc/ovirt-hosted-engine/vm.conf root@<<hosted_engine_2.example.com>>:/etc/ovirt-hosted-engine/vm.conf

    4. Shut down the HostedEngine virtual machine:

        # hosted-engine --vm-shutdown

    5. Start the HostedEngine virtual machine:

        # hosted-engine --vm-start

    6. Disable maintenance mode to enable the high-availability agents:

        # hosted-engine --set-maintenance --mode=none

    7. Connect to the HostedEngine virtual machine:

        # ssh root@hosted-engine-virtual machine.example.com

    8. Change into the postgres user: 

        #  /usr/share/ovirt-engine/dbscripts/engine-psql.sh -c "update vm_static set vm_name='New_HostedEngine_Name' where vm_name='HostedEngine'"

    9.  On any HostedEngine host, place the HostedEngine environment into global maintenance mode to disable the high-availability agents:

       # hosted-engine --set-maintenance --mode=global

   15. On the HostedEngine virtual machine, restart the ovirt-engine service so that the database changes can be affected in the environment:

       # service ovirt-engine restart

   16. On any HostedEngine host, disable maintenance mode:

       # hosted-engine --set-maintenance --mode=none
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.