From acd398d1745770d18e6203d76aa262087c5ef07e Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Wed, 19 Jun 2013 22:19:32 +0200 Subject: [PATCH] Add Vps::Unterminate function --- frontend/classes/vps.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/frontend/classes/vps.php b/frontend/classes/vps.php index c87a235..75973fa 100644 --- a/frontend/classes/vps.php +++ b/frontend/classes/vps.php @@ -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) { $command = array("sudo", "vzctl", "set", $this->sInternalId, "--ipadd", $ip, "--save");