From 54b42c3bcb51d111465d5e8f03e4584262aa7d70 Mon Sep 17 00:00:00 2001 From: Chetan Birajdar Date: Wed, 14 Jun 2017 16:42:39 -0700 Subject: [PATCH 1/3] Renamed CinderVolume properties to be compatible with block storage API v2, fixed broken VolumeTests --- .../main/java/org/openstack4j/api/storage/VolumeTests.java | 5 +---- core-test/src/main/resources/storage/v2/volume.json | 2 +- .../openstack/storage/block/domain/CinderVolume.java | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java b/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java index 055848f4f..3e36d97fe 100644 --- a/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java +++ b/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java @@ -63,8 +63,6 @@ public void getVolumeV1() throws Exception { assertTrue(getRequest.getPath().matches("/v[12]/\\p{XDigit}*/volumes/8a9287b7-4f4d-4213-8d75-63470f19f27c")); assertEquals(volume.getId(), "8a9287b7-4f4d-4213-8d75-63470f19f27c"); - assertEquals(volume.getName(), "vol-test"); - assertEquals(volume.getDescription(), "a description"); assertNotNull(volume.getCreated()); assertEquals(volume.getZone(), "nova"); assertEquals(volume.getSize(), 100); @@ -91,7 +89,6 @@ public void getVolumeV1() throws Exception { @SuppressWarnings("unchecked") @Test - @SkipTest(connector = ".*", issue = 395, description = "Volume attribute not recognized when using cinder v2 api") public void getVolumeV2() throws Exception { // Check get volume respondWith("/storage/v2/volume.json"); @@ -101,7 +98,7 @@ public void getVolumeV2() throws Exception { assertTrue(getRequest.getPath().matches("/v[12]/\\p{XDigit}*/volumes/8a9287b7-4f4d-4213-8d75-63470f19f27c")); assertEquals(volume.getId(), "8a9287b7-4f4d-4213-8d75-63470f19f27c"); - assertEquals(volume.getName(), "vol-test"); + assertEquals(volume.getName(), "test-volume"); assertEquals(volume.getDescription(), "a description"); assertNotNull(volume.getCreated()); assertEquals(volume.getZone(), "nova"); diff --git a/core-test/src/main/resources/storage/v2/volume.json b/core-test/src/main/resources/storage/v2/volume.json index 86d148068..366063e18 100644 --- a/core-test/src/main/resources/storage/v2/volume.json +++ b/core-test/src/main/resources/storage/v2/volume.json @@ -3,7 +3,7 @@ "status": "in-use", "user_id": "92ac3530a6cb4d47aa406f1c2c90fca4", "attachments": [{ - "host_name": null, + "host_name": "myhost", "device": "/dev/vdd", "server_id": "eaa6a54d-35c1-40ce-831d-bb61f991e1a9", "id": "8a9287b7-4f4d-4213-8d75-63470f19f27c", diff --git a/core/src/main/java/org/openstack4j/openstack/storage/block/domain/CinderVolume.java b/core/src/main/java/org/openstack4j/openstack/storage/block/domain/CinderVolume.java index fb952a4bb..286420c5d 100644 --- a/core/src/main/java/org/openstack4j/openstack/storage/block/domain/CinderVolume.java +++ b/core/src/main/java/org/openstack4j/openstack/storage/block/domain/CinderVolume.java @@ -27,9 +27,9 @@ public class CinderVolume implements Volume { private static final long serialVersionUID = 1L; private String id; - @JsonProperty("display_name") + @JsonProperty("name") private String name; - @JsonProperty("display_description") + @JsonProperty("description") private String description; private Status status; @JsonInclude(Include.NON_DEFAULT) From f127f81cd9933ede0c6d9c41962e65c2dd243eb3 Mon Sep 17 00:00:00 2001 From: Chetan Birajdar Date: Tue, 20 Jun 2017 18:42:58 -0700 Subject: [PATCH 2/3] git ignore intelliJ generated project files --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 5ada6c6e1..d4f527872 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ pom-shade.xml *.versionsBackup */bin/* *.iml +*.ipr +*.iws From 88fdf169eb6e203d59ff9c901fa7f56256812337 Mon Sep 17 00:00:00 2001 From: Chetan Birajdar Date: Tue, 20 Jun 2017 18:50:30 -0700 Subject: [PATCH 3/3] added display_name and display_description properties to maintain backwards compatibility with deprecated v1 API --- .../openstack4j/api/storage/VolumeTests.java | 2 ++ .../model/storage/block/Volume.java | 12 +++++++++++ .../model/storage/block/VolumeSnapshot.java | 12 +++++++++++ .../storage/block/domain/CinderVolume.java | 20 +++++++++++++++++++ .../block/domain/CinderVolumeSnapshot.java | 20 +++++++++++++++++++ 5 files changed, 66 insertions(+) diff --git a/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java b/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java index 3e36d97fe..d1a0021b7 100644 --- a/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java +++ b/core-test/src/main/java/org/openstack4j/api/storage/VolumeTests.java @@ -63,6 +63,8 @@ public void getVolumeV1() throws Exception { assertTrue(getRequest.getPath().matches("/v[12]/\\p{XDigit}*/volumes/8a9287b7-4f4d-4213-8d75-63470f19f27c")); assertEquals(volume.getId(), "8a9287b7-4f4d-4213-8d75-63470f19f27c"); + assertEquals(volume.getDisplayName(), "vol-test"); + assertEquals(volume.getDisplayDescription(), "a description"); assertNotNull(volume.getCreated()); assertEquals(volume.getZone(), "nova"); assertEquals(volume.getSize(), 100); diff --git a/core/src/main/java/org/openstack4j/model/storage/block/Volume.java b/core/src/main/java/org/openstack4j/model/storage/block/Volume.java index c0639c751..c160481a5 100644 --- a/core/src/main/java/org/openstack4j/model/storage/block/Volume.java +++ b/core/src/main/java/org/openstack4j/model/storage/block/Volume.java @@ -86,11 +86,23 @@ public static MigrationStatus fromValue(String migrationStatus) { */ String getName(); + /** + * @return the display name of the volume + */ + @Deprecated + String getDisplayName(); + /** * @return the description of the volume */ String getDescription(); + /** + * @return the display description of the volume + */ + @Deprecated + String getDisplayDescription(); + /** * @return the status of the volume */ diff --git a/core/src/main/java/org/openstack4j/model/storage/block/VolumeSnapshot.java b/core/src/main/java/org/openstack4j/model/storage/block/VolumeSnapshot.java index d49c585a2..fc9883dc5 100644 --- a/core/src/main/java/org/openstack4j/model/storage/block/VolumeSnapshot.java +++ b/core/src/main/java/org/openstack4j/model/storage/block/VolumeSnapshot.java @@ -24,11 +24,23 @@ public interface VolumeSnapshot extends ModelEntity, Buildable