/** * Check if instances are valid * * @throws ValidationErrorException */ protected function validate() { $farm = $this->farmRole->getFarm(); if ($farm->status != Entity\Farm::STATUS_RUNNING) { throw new ValidationErrorException('Farm should be in the Running state to import the Instance.'); } $role = $this->farmRole->getRole(); if ($role->isScalarized) { throw new ValidationErrorException('Only non-scalarized Roles are supported.'); } if ($this->farmRole->getImage()->id != $this->orphaned->imageId) { throw new ValidationErrorException('ID of the FarmRole Image must match ID of the Image of the Instance.'); } if ($this->farmRole->settings[Entity\FarmRoleSetting::SCALING_ENABLED] == 1) { throw new ValidationErrorException('Scaling should be set to manual before importing instance'); } }