Skip to content

Commit 8afc135

Browse files
committed
Merge pull request #507 from iviireczech/master
Add Volume 'tenantId' attribute support
2 parents 9396678 + 3c6e88f commit 8afc135

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public void listVolumesV1() throws Exception {
3131
respondWith("/storage/v1/volumes.json");
3232
List<? extends Volume> volumes = os().blockStorage().volumes().list();
3333
assertEquals(volumes.size(), 3);
34+
assertEquals(volumes.get(0).getTenantId(), "b0b5ed7ae06049688349fe43737796d4");
3435

3536
// Check that the list request is the one we expect
3637
RecordedRequest listRequest = server.takeRequest();
@@ -84,6 +85,8 @@ public void getVolumeV1() throws Exception {
8485
assertEquals(attachments.get(0).getId(), "8a9287b7-4f4d-4213-8d75-63470f19f27c");
8586
assertEquals(attachments.get(0).getServerId(), "eaa6a54d-35c1-40ce-831d-bb61f991e1a9");
8687
assertEquals(attachments.get(0).getVolumeId(), "8a9287b7-4f4d-4213-8d75-63470f19f27c");
88+
89+
assertEquals(volume.getTenantId(), "b0b5ed7ae06049688349fe43737796d4");
8790
}
8891

8992
@SuppressWarnings("unchecked")

core/src/main/java/org/openstack4j/model/storage/block/Volume.java

+5
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,9 @@ public static MigrationStatus fromValue(String migrationStatus) {
146146
* @return the status of volume migrate status, default null
147147
*/
148148
MigrationStatus getMigrateStatus();
149+
150+
/**
151+
* @return the tenant id
152+
*/
153+
String getTenantId();
149154
}

core/src/main/java/org/openstack4j/openstack/storage/block/domain/CinderVolume.java

+11-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ public class CinderVolume implements Volume {
5959
private Map<String, Object> imageMetadata;
6060
@JsonProperty("os-vol-mig-status-attr:migstat")
6161
private MigrationStatus migrateStatus;
62+
@JsonProperty("os-vol-tenant-attr:tenant_id")
63+
private String tenantId;
6264
/**
6365
* {@inheritDoc}
6466
*/
@@ -194,7 +196,15 @@ public Map<String, String> getMetaData() {
194196
public List<? extends VolumeAttachment> getAttachments() {
195197
return attachments;
196198
}
197-
199+
200+
/**
201+
* {@inheritDoc}
202+
*/
203+
@Override
204+
public String getTenantId() {
205+
return tenantId;
206+
}
207+
198208
/**
199209
* {@inheritDoc}
200210
*/

0 commit comments

Comments
 (0)