public function GetServersList(Scalr_Environment $environment, $region, $skipCache = false)
{
if (!$region) {
return array();
}
if (!$this->instancesListCache[$environment->id][$region] || $skipCache) {
$cs = $environment->cloudstack($this->platform);
try {
$results = $cs->instance->describe(array('zoneid' => $region));
} catch (Exception $e) {
throw new Exception(sprintf("Cannot get list of servers for platform {$this->platform}: %s", $e->getMessage()));
}
if (count($results) > 0) {
foreach ($results as $item) {
$this->instancesListCache[$environment->id][$region][$item->id] = $item->state;
}
}
}
return $this->instancesListCache[$environment->id][$region];
}