mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
interfaces: prevent CARP IP removal when VHID group is in use by IP alias
This commit is contained in:
parent
ebddde95f4
commit
e415eb8230
@ -186,6 +186,18 @@ class VipSettingsController extends ApiMutableModelControllerBase
|
||||
if (!empty($validations)) {
|
||||
throw new UserException(implode('<br/>', array_slice($validations, 0, 5)), gettext("Item in use by"));
|
||||
}
|
||||
|
||||
if ($node != null && (string)$node->mode == 'carp') {
|
||||
foreach ($this->getModel()->vip->iterateItems() as $vip) {
|
||||
if ((string)$vip->mode == 'ipalias' && (string)$vip->vhid == (string)$node->vhid) {
|
||||
$vhid = (string)$node->vhid;
|
||||
throw new UserException(sprintf(
|
||||
gettext("Cannot delete CARP Virtual IP, IP Alias with VHID Group %s still exists."), $vhid),
|
||||
gettext("Error"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$response = $this->delBase("vip", $uuid);
|
||||
if (($response['result'] ?? '') == 'deleted') {
|
||||
$addr = (string)$node->subnet;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user