Project

General

Profile

« Previous | Next » 

Revision e7d35d84

Added by Ermal LUÇI over 11 years ago

Convert ipaliases over carp to new world order

View differences:

etc/inc/upgrade_config.inc
3264 3264
	}
3265 3265
}
3266 3266

  
3267
function upgrade_105_to_106() {
3268
	global $config;
3269

  
3270
	if (is_array($config['virtualip']) && is_array($config['virtualip']['vip'])) {
3271
		foreach ($config['virtualip']['vip'] as $vipidx => $vip) {
3272
			if ($vip['mode'] == "ipalias" && strstr("$vip['interface'], "_vip")) {
3273
				/* Convert to a carp with same properties as its carp version */
3274
				$converted = false;
3275
				foreach ($config['virtualip']['vip'] as $bvip) {
3276
					if ($bvip['mode'] == "carp" && "{$bvip['interface']}_vip{$bvip['vhid']} == $vip['interface']) {
3277
						$ipaaddr = $vip['subnet'];
3278
						$ipamask = $vip['subnet_bits'];
3279
						$config['virtualip']['vip'][$vipidx] = $bvip;
3280
						$config['virtualip']['vip'][$vipidx]['subnet'] = $ipaaddr;
3281
						$config['virtualip']['vip'][$vipidx]['subnet_bits'] = $ipamask;
3282
						$converted = true;
3283
						break;
3284
					}
3285
				}
3286
				if ($converted === false)
3287
					log_error("WARNING: IPalias {$vip['subnet']}/{$vip['subnet_bits']} was not completed successfully. Upgrading it yourself is the only remaining option!");
3288
			}
3289
		}
3290
		unset($vip, $bvip, $vipidx);
3291
	}
3292
}
3293

  
3267 3294
?>

Also available in: Unified diff