Skip to content

Commit

Permalink
Merge pull request #507 from iviireczech/master
Browse files Browse the repository at this point in the history
Add Volume 'tenantId' attribute support
  • Loading branch information
gondor committed Nov 15, 2015
2 parents 9396678 + 3c6e88f commit 8afc135
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void listVolumesV1() throws Exception {
respondWith("/storage/v1/volumes.json");
List<? extends Volume> volumes = os().blockStorage().volumes().list();
assertEquals(volumes.size(), 3);
assertEquals(volumes.get(0).getTenantId(), "b0b5ed7ae06049688349fe43737796d4");

// Check that the list request is the one we expect
RecordedRequest listRequest = server.takeRequest();
Expand Down Expand Up @@ -84,6 +85,8 @@ public void getVolumeV1() throws Exception {
assertEquals(attachments.get(0).getId(), "8a9287b7-4f4d-4213-8d75-63470f19f27c");
assertEquals(attachments.get(0).getServerId(), "eaa6a54d-35c1-40ce-831d-bb61f991e1a9");
assertEquals(attachments.get(0).getVolumeId(), "8a9287b7-4f4d-4213-8d75-63470f19f27c");

assertEquals(volume.getTenantId(), "b0b5ed7ae06049688349fe43737796d4");
}

@SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,9 @@ public static MigrationStatus fromValue(String migrationStatus) {
* @return the status of volume migrate status, default null
*/
MigrationStatus getMigrateStatus();

/**
* @return the tenant id
*/
String getTenantId();
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ public class CinderVolume implements Volume {
private Map<String, Object> imageMetadata;
@JsonProperty("os-vol-mig-status-attr:migstat")
private MigrationStatus migrateStatus;
@JsonProperty("os-vol-tenant-attr:tenant_id")
private String tenantId;
/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -194,7 +196,15 @@ public Map<String, String> getMetaData() {
public List<? extends VolumeAttachment> getAttachments() {
return attachments;
}


/**
* {@inheritDoc}
*/
@Override
public String getTenantId() {
return tenantId;
}

/**
* {@inheritDoc}
*/
Expand Down

0 comments on commit 8afc135

Please sign in to comment.