Scalr\Modules\Platforms\Cloudstack\CloudstackPlatformModule::GetServerRealStatus PHP Метод

GetServerRealStatus() публичный Метод

См. также: Scalr\Modules\PlatformModuleInterface::GetServerRealStatus()
public GetServerRealStatus ( DBServer $DBServer )
$DBServer DBServer
    public function GetServerRealStatus(DBServer $DBServer)
    {
        $region = $this->GetServerCloudLocation($DBServer);
        $iid = $DBServer->GetProperty(CLOUDSTACK_SERVER_PROPERTIES::SERVER_ID);
        if (!$iid || !$region) {
            $status = 'not-found';
        } elseif (!$this->instancesListCache[$DBServer->GetEnvironmentObject()->id][$region][$iid]) {
            $cs = $DBServer->GetEnvironmentObject()->cloudstack($this->platform);
            try {
                $iinfo = $cs->instance->describe(array('id' => $iid));
                $iinfo = !empty($iinfo) ? $iinfo[0] : null;
                if (!empty($iinfo)) {
                    $status = $iinfo->state;
                } else {
                    $status = 'not-found';
                }
            } catch (NotFoundException $e) {
                $status = 'not-found';
            }
        } else {
            $status = $this->instancesListCache[$DBServer->GetEnvironmentObject()->id][$region][$DBServer->GetProperty(CLOUDSTACK_SERVER_PROPERTIES::SERVER_ID)];
        }
        return StatusAdapter::load($status);
    }