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()
{
$command = "vzctl status {$this->sInternalId}";
$result = $this->sNode->ssh->RunCommandCached($command, false);
if($result->returncode == 0)
if($this->sStatus == CVM_STATUS_SUSPENDED || $this->sStatus == CVM_STATUS_TERMINATED)
{
return $this->sStatus;
}
else
{
$values = split_whitespace($result->stdout);
$command = "vzctl status {$this->sInternalId}";
if($values[4] == "running")
{
return CVM_STATUS_STARTED;
}
else
$result = $this->sNode->ssh->RunCommandCached($command, false);
if($result->returncode == 0)
{
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