@Override public String getHostUuid() { return getSrcHostUuid(); }
private MigrateStruct buildMigrateStuct(final MigrateVmOnHypervisorMsg msg){ MigrateStruct s = new MigrateStruct(); s.vmUuid = msg.getVmInventory().getUuid(); s.srcHostUuid = msg.getSrcHostUuid(); s.dstHostUuid = msg.getDestHostInventory().getUuid(); s.storageMigrationPolicy = msg.getStorageMigrationPolicy(); s.migrateFromDestition = msg.isMigrateFromDestination(); MigrateNetworkExtensionPoint.MigrateInfo migrateIpInfo = null; for (MigrateNetworkExtensionPoint ext: pluginRgty.getExtensionList(MigrateNetworkExtensionPoint.class)) { MigrateNetworkExtensionPoint.MigrateInfo r = ext.getMigrationAddressForVM(s.srcHostUuid, s.dstHostUuid); if (r == null) { continue; } migrateIpInfo = r; } s.dstHostMnIp = msg.getDestHostInventory().getManagementIp(); s.dstHostMigrateIp = migrateIpInfo == null ? s.dstHostMnIp : migrateIpInfo.dstMigrationAddress; s.srcHostMnIp = Q.New(HostVO.class).eq(HostVO_.uuid, msg.getSrcHostUuid()).select(HostVO_.managementIp).findValue(); s.srcHostMigrateIp = migrateIpInfo == null ? s.srcHostMnIp : migrateIpInfo.srcMigrationAddress; return s; }
private void handle(MigrateVmOnHypervisorMsg msg) { MigrateVmOnHypervisorReply reply = new MigrateVmOnHypervisorReply(); if (!config.migrateSuccess) { reply.setError(operr("on purpose")); } else { logger.debug(String.format("Successfully migrate vm[uuid:%s] on simulator host[uuid:%s] to host[uuid:%s]", msg.getVmInventory().getUuid(), self.getUuid(), msg.getDestHostInventory().getUuid())); config.removeVm(msg.getSrcHostUuid(), msg.getVmInventory().getUuid()); config.putVm(msg.getDestHostInventory().getUuid(), msg.getVmInventory().getUuid(), VmInstanceState.Running); } bus.reply(msg, reply); }