Skip to content

Commit 019d724

Browse files
committed
Fix VolumeAttachment serialization
The anonymous class based on VolumeAttachment ignores Jackson annotation
1 parent 5882b57 commit 019d724

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

nova-client/src/main/java/com/woorea/openstack/nova/api/ServersResource.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,8 @@ public DisassociateFloatingIp disassociateFloatingIp(String serverId, String flo
421421

422422
public class AttachVolume extends OpenStackRequest<Void> {
423423

424-
public AttachVolume(String serverId, final String volumeId, final String device) {
425-
super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments"), Entity.json(new VolumeAttachment() {{
426-
setVolumeId(volumeId);
427-
setDevice(device);
428-
}}), Void.class);
424+
public AttachVolume(String serverId, final VolumeAttachment volumeAttachment) {
425+
super(CLIENT, HttpMethod.POST, new StringBuilder("/servers/").append(serverId).append("/os-volume_attachments"), Entity.json(volumeAttachment), Void.class);
429426
}
430427

431428
}
@@ -442,8 +439,11 @@ public DetachVolume(String serverId, String volumeId) {
442439

443440
}
444441

445-
public AttachVolume attachVolume(String serverId, String volumeId, String device) {
446-
return new AttachVolume(serverId, volumeId, device);
442+
public AttachVolume attachVolume(String serverId, String volumeId, String device) {
443+
VolumeAttachment volumeAttachment = new VolumeAttachment();
444+
volumeAttachment.setVolumeId(volumeId);
445+
volumeAttachment.setDevice(device);
446+
return new AttachVolume(serverId, volumeAttachment);
447447
}
448448

449449
public DetachVolume detachVolume(String serverId, String volumeId) {

0 commit comments

Comments
 (0)