Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,15 @@ public interface BlockVolumeService extends RestService {
* @return
*/
ActionResponse forceDetach(String volumeId, String initiator,String attachmentId );


/**
* Detach volume from server
* @author capitek-xuning(首信科技-徐宁)
* @param volumeId
* @param attachmentId
* @return
*/
ActionResponse detach(String volumeId, String attachmentId);

/**
* Update volume bootable status.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public class CinderVolumeAttachment implements VolumeAttachment {

@JsonProperty
private String server_id;

@JsonProperty
private String attachment_id;

@JsonProperty
private String volume_id;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package org.openstack4j.openstack.storage.block.domain;

import org.openstack4j.model.ModelEntity;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;

/**
* os-detach
* @author capitek-xuning(首信科技-徐宁)
*
*/
@JsonRootName("os-detach")
public class DetachAction implements ModelEntity {

private static final long serialVersionUID = 1L;

/**
* The ID of the attachment.
*/
@JsonProperty("attachment_id")
private String attachmentId;

/**
* @author capitek-xuning(首信科技-徐宁)
* @param attachmentId The ID of the attachment.
*/
public DetachAction(String attachmentId) {
super();
this.attachmentId = attachmentId;
}

public String getAttachmentId() {
return attachmentId;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,20 @@ public ActionResponse forceDetach(String volumeId, String initiator, String atta
ForceDetachAction detach = new ForceDetachAction(attachmentId, connector);
return post(ActionResponse.class, uri("/volumes/%s/action", volumeId)).entity(detach).execute();
}

/**
* Detach volume from server
* @author capitek-xuning(首信科技-徐宁)
* @param volumeId
* @param attachmentId
* @return
*/
@Override
public ActionResponse detach(String volumeId, String attachmentId) {
checkNotNull(volumeId);
checkNotNull(attachmentId);
DetachAction detach = new DetachAction(attachmentId);
return post(ActionResponse.class, uri("/volumes/%s/action", volumeId)).entity(detach).execute();
}

}