Skip to content
Snippets Groups Projects
Commit 71ce98cc authored by baldwinlouie's avatar baldwinlouie Committed by Yas Naoi
Browse files

Issue #3326682 by baldwinlouie, yas: Fix CreateSnapshot BDD error, when there...

Issue #3326682 by baldwinlouie, yas: Fix CreateSnapshot BDD error, when there are no volumes in the system
parent 7acba136
Branches
Tags
3 merge requests!1759Issue #3356778: Release 5.1.1,!1679Issue #3349074: Fix the OpenStack Project create and edit form in SPA that "Member" cannot be saved due to a validation error,!1607Issue #3343582: Add the function to preview OpenStack stack in the SPA
...@@ -741,12 +741,7 @@ class Ec2Service extends CloudServiceBase implements Ec2ServiceInterface { ...@@ -741,12 +741,7 @@ class Ec2Service extends CloudServiceBase implements Ec2ServiceInterface {
*/ */
public function createSnapshot(array $params = [], array $credentials = []): ?ResultInterface { public function createSnapshot(array $params = [], array $credentials = []): ?ResultInterface {
if (!empty($params['DryRun']) && count($params) === 1) { if (!empty($params['DryRun']) && count($params) === 1) {
$volumes = $this->describeVolumes([], $credentials); $params['VolumeId'] = "vol-{$this->random->name(32, TRUE)}";
if (empty($volumes['Volumes'][0]['VolumeId'])) {
throw new Ec2ServiceException('Failed to test createSnapshot() on getting a required parameter, VolumeId, by calling describeVolumes().',
'createSnapshot', 'UnauthorizedOperation');
}
$params['VolumeId'] = $volumes['Volumes'][0]['VolumeId'];
} }
return $this->execute('CreateSnapshot', $params, $credentials); return $this->execute('CreateSnapshot', $params, $credentials);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment