Scalr\Modules\Platforms\Openstack\OpenstackPlatformModule::GetServerRealStatus PHP Méthode

GetServerRealStatus() public méthode

See also: Scalr\Modules\PlatformModuleInterface::GetServerRealStatus()
public GetServerRealStatus ( DBServer $DBServer )
$DBServer DBServer
    public function GetServerRealStatus(DBServer $DBServer)
    {
        $cloudLocation = $DBServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::CLOUD_LOCATION);
        $iid = $DBServer->GetProperty(\OPENSTACK_SERVER_PROPERTIES::SERVER_ID);
        if (!$iid) {
            $status = 'not-found';
        } elseif (empty($this->instancesListCache[$DBServer->envId][$cloudLocation][$iid])) {
            $osClient = $this->getOsClient($DBServer->GetEnvironmentObject(), $cloudLocation);
            try {
                $result = $osClient->servers->getServerDetails($iid);
                $status = $result->status;
            } catch (NotFoundException $e) {
                $status = 'not-found';
            }
        } else {
            $status = $this->instancesListCache[$DBServer->envId][$cloudLocation][$iid];
        }
        return StatusAdapter::load($status);
    }