IP adding/removing stuff

feature/node-rewrite
Sven Slootweg 13 years ago
parent 54c897b004
commit 96b2f27dee

@ -225,6 +225,25 @@ class Container extends CPHPDatabaseRecordClass
} }
} }
public function RemoveIp($ip)
{
$command = shrink_command("vzctl set {$this->sInternalId}
--ipdel {$ip}
--save
");
$result = $this->sNode->ssh->RunCommand($command, false);
if($result->returncode == 0)
{
return true;
}
else
{
throw new ContainerIpRemoveException($result->stderr, $result->returncode, $this->sInternalId);
}
}
public function EnableTunTap() public function EnableTunTap()
{ {
// TODO: Finish EnableTunTap function, check whether tun module is available on host // TODO: Finish EnableTunTap function, check whether tun module is available on host

@ -42,4 +42,5 @@ class ContainerConfigureException extends ContainerException {}
class ContainerStartException extends ContainerException {} class ContainerStartException extends ContainerException {}
class ContainerStopException extends ContainerException {} class ContainerStopException extends ContainerException {}
class ContainerIpAddException extends ContainerException {} class ContainerIpAddException extends ContainerException {}
class ContainerIpRemoveException extends ContainerException {}
?> ?>

@ -23,6 +23,14 @@ elseif($_GET['action'] == "bw")
$values = split_whitespace($lines[0]); $values = split_whitespace($lines[0]);
pretty_dump($values); pretty_dump($values);
} }
elseif($_GET['action'] == "ip")
{
$sContainer->AddIp($_GET['ip']);
}
else
{
echo("idk");
}
echo("Done!"); echo("Done!");
?> ?>

Loading…
Cancel
Save