Add Vps::Unterminate function

feature/node-rewrite
Sven Slootweg 12 years ago
parent 2c61f0da36
commit acd398d174

@ -604,6 +604,27 @@ class Vps extends CPHPDatabaseRecordClass
} }
} }
public function Unterminate()
{
if($this->sStatus == CVM_STATUS_TERMINATED)
{
try
{
$this->Start(true);
$this->uStatus = CVM_STATUS_STARTED;
$this->InsertIntoDatabase();
}
catch (VpsStartException $e)
{
throw new VpsUnterminateException("Untermination failed as the VPS could not be started.", 1, $this->sInternalId, $e);
}
}
else
{
throw new VpsUnterminateException("The VPS is not terminated.", 1, $this->sInternalId);
}
}
public function AddIp($ip) public function AddIp($ip)
{ {
$command = array("sudo", "vzctl", "set", $this->sInternalId, "--ipadd", $ip, "--save"); $command = array("sudo", "vzctl", "set", $this->sInternalId, "--ipadd", $ip, "--save");

Loading…
Cancel
Save