<fix>[eip]: sync eip account
Resolves:
@@ -33,6 +33,31 @@ DELIMITER ;
CALL Alter_SCSI_Table();
DROP PROCEDURE Alter_SCSI_Table;
+DELIMITER $$
+CREATE PROCEDURE Update_Vip_Account()
+ BEGIN
+ DECLARE vipUuid VARCHAR(32);
+ DECLARE eipAccountUuid VARCHAR(32);
+ DECLARE vipAccountUuid VARCHAR(32);
+ DECLARE done INT DEFAULT FALSE;
+ DECLARE cur CURSOR FOR SELECT v.uuid, a.accountUuid, b.accountUuid FROM zstack.EipVO e, zstack.VipVO v, zstack.AccountResourceRefVO a, zstack.AccountResourceRefVO b
+ WHERE e.vipUuid = v.uuid AND a.resourceUuid = e.uuid AND b.resourceUuid = v.uuid AND a.accountUuid != b.accountUuid;
+ DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE;
+ OPEN cur;
+ read_loop: LOOP
+ FETCH cur INTO vipUuid, eipAccountUuid, vipAccountUuid;
+ IF done THEN
+ LEAVE read_loop;
+ END IF;
+ UPDATE zstack.AccountResourceRefVO set accountUuid = eipAccountUuid WHERE accountUuid = vipAccountUuid AND resourceUuid = vipUuid;
+ END LOOP;
+ CLOSE cur;
+ END $$
+DELIMITER ;
+
+CALL Update_Vip_Account();
+DROP PROCEDURE IF EXISTS Update_Vip_Account;
+
UPDATE `zstack`.`VmInstanceVO` t1, `zstack`.`HostVO` t2 set t1.`architecture` = t2.`architecture` where t1.`type` = 'ApplianceVm' and t1.`hostUuid` = t2.`uuid`;
UPDATE `zstack`.`VmInstanceVO` t1, `zstack`.`HostVO` t2 set t1.`architecture` = t2.`architecture` where t1.`type` = 'ApplianceVm' and t1.`architecture` IS NULL and t1.`lastHostUuid` = t2.`uuid`;
