Skip to content
Snippets Groups Projects
Commit a9c5449d authored by xiaohua guan's avatar xiaohua guan Committed by Yas Naoi
Browse files

Issue #3251604 by Xiaohua Guan, yas: Delete and bulk delete volume from Cloud...

Issue #3251604 by Xiaohua Guan, yas: Delete and bulk delete volume from Cloud Orchestrator master to workers (AWS Cloud)
parent 72a3dce9
No related branches found
No related tags found
No related merge requests found
......@@ -19,22 +19,33 @@ class VolumeDeleteForm extends AwsDeleteUpdateEntityForm {
$entity = $this->entity;
$this->ec2Service->setCloudContext($entity->getCloudContext());
// Delete volume.
if ($this->ec2Service->deleteVolume([
$form_state->setRedirect("view.{$entity->getEntityTypeId()}.list", ['cloud_context' => $entity->getCloudContext()]);
$result = $this->ec2Service->deleteVolume([
'VolumeId' => $entity->getVolumeId(),
])) {
$entity->delete();
]);
$this->messenger->addStatus($this->getDeletionMessage());
$this->logDeletionMessage();
$this->clearCacheValues($entity->getCacheTags());
$this->dispatchSubmitEvent($entity);
}
else {
// If $result is NULL, some error should have occurred
// when calling the AWS API.
if ($result === NULL) {
$this->processOperationErrorStatus($entity, 'deleted');
return;
}
$form_state->setRedirect("view.{$entity->getEntityTypeId()}.list", ['cloud_context' => $entity->getCloudContext()]);
if (!empty($result['SendToWorker'])) {
$this->messenger->addStatus($this->t('The @type @label has been deleted remotely.', [
'@type' => $entity->getEntityType()->getSingularLabel(),
'@label' => $entity->getName(),
]));
return;
}
$entity->delete();
$this->messenger->addStatus($this->getDeletionMessage());
$this->logDeletionMessage();
$this->clearCacheValues($entity->getCacheTags());
$this->dispatchSubmitEvent($entity);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment