/**
* {@inheritdoc}
* @see \Scalr\Modules\PlatformModuleInterface::GetServerRealStatus()
*/
public function GetServerRealStatus(DBServer $DBServer)
{
$cloudLocation = $DBServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::CLOUD_LOCATION);
$environment = $DBServer->GetEnvironmentObject();
$iid = $DBServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::SERVER_ID);
if (!$iid) {
$status = 'not-found';
} elseif (!$this->instancesListCache[$environment->id][$cloudLocation][$iid]) {
$osClient = $this->getOsClient($environment, $cloudLocation);
try {
$result = $osClient->servers->getServerDetails($DBServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::SERVER_ID));
$status = $result->status;
} catch (\Exception $e) {
if (stristr($e->getMessage(), "404") || stristr($e->getMessage(), "could not be found")) {
$status = 'not-found';
} else {
throw $e;
}
}
} else {
$status = $this->instancesListCache[$environment->id][$cloudLocation][$DBServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::SERVER_ID)];
}
return StatusAdapter::load($status);
}