Symptoms

A container running on a Operations Automation (OA) managed Virtuozzo Containers (VZ) server was migrated manually using native Virtuozzo tools.

How can you update the database so OA recognizes the container was migrated?

Resolution

Attention: The instructions below are only if both the source and target vz servers have the same Virtuozzo version installed. To check the Virtuozzo version perform the following select from OA database:

select vzversion from vz_versions where vz_ver_id in (select vz_ver_id from hw_nodes where host_id in (10, 11));

The following tables should be updated in the OA database after container #101 is manually migrated from VZ server #10 to VZ server #11:

  1. Update the table ves - Set a new hw_host_id (where the container was migrated to) and a new ve_id (only if the ID of the container on the destination Virtuozzo server was changed during or after the migration):

    BEGIN;
    UPDATE ves SET ve_id = $NEW_VE_ID, hw_host_id = 11 WHERE ve_host_id = 101;
    COMMIT;
    
  2. Update hw_nodes table - Increase ves_num for the server #11 by 1 (the container was migrated to this server) and decrease ves_num for the server #10 by 1:

    • OA 5.4:

      BEGIN;
      UPDATE hw_nodes SET ves_num = ves_num + 1 WHERE host_id = 11;
      UPDATE hw_nodes SET ves_num = ves_num - 1 WHERE host_id = 10;
      COMMIT;
      
    • OA 5.5 has no row as ves_num in hw_nodes table, so you need to update the table hosts, which contains the record about the VE in question:

      BEGIN;
      UPDATE hosts SET hw_host_id=$NEW_HW_ID WHERE host_id = 101;
      COMMIT;
      
  3. Update the capacities of both Virtuozzo servers:

    • Go to Service Director > Virtuozzo Manager > VPS Hardware Nodes.
    • Click on the server.
    • Switch to the General > Capacities tab.
    • Click the Reload button to make POA schedule and execute the task to update the host capacities.

If the task fails, update the table host_capacities manually:

a) Increase the parameter consumption for the capacity VPS Number per HW node for server #11 and decrease it for server #10:

BEGIN;
UPDATE host_capacities SET consumption = consumption + 1 where host_id =11 and capacity_id in (select capacity_id from capacities where name='VPS Number per HW node');
UPDATE host_capacities SET consumption = consumption - 1 where host_id =10 and capacity_id in (select capacity_id from capacities where name='VPS Number per HW node');
COMMIT;

b) Increase the parameter consumption for the capacity Virtual Memory for server #11 and decrease it for server #10:

BEGIN;
UPDATE host_capacities SET consumption = consumption + $PRIVVM where host_id = 11 and capacity_id in (select capacity_id from capacities where name='Virtual Memory');
UPDATE host_capacities SET consumption = consumption - $PRIVVM where host_id = 10 and capacity_id in (select capacity_id from capacities where name='Virtual Memory');
COMMIT;

(where $PRIVVM is value of the UBC parameter privvmpages of VPS #101)

It is recommended that you update the capacities via the POA UI as opposed to updating the database manually.

Internal content