Return correct status when suspended or terminated

feature/node-rewrite
Sven Slootweg 13 years ago
parent 54050535cf
commit aee9034fee

@ -99,21 +99,28 @@ class Container extends CPHPDatabaseRecordClass
public function GetCurrentStatus() public function GetCurrentStatus()
{ {
$command = "vzctl status {$this->sInternalId}"; if($this->sStatus == CVM_STATUS_SUSPENDED || $this->sStatus == CVM_STATUS_TERMINATED)
{
$result = $this->sNode->ssh->RunCommandCached($command, false); return $this->sStatus;
}
if($result->returncode == 0) else
{ {
$values = split_whitespace($result->stdout); $command = "vzctl status {$this->sInternalId}";
if($values[4] == "running") $result = $this->sNode->ssh->RunCommandCached($command, false);
{
return CVM_STATUS_STARTED; if($result->returncode == 0)
}
else
{ {
return CVM_STATUS_STOPPED; $values = split_whitespace($result->stdout);
if($values[4] == "running")
{
return CVM_STATUS_STARTED;
}
else
{
return CVM_STATUS_STOPPED;
}
} }
} }
} }

Loading…
Cancel
Save