Skip to content
Open
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
9 changes: 9 additions & 0 deletions conf/serviceConfig/primaryStorage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,16 @@
<message>
<name>org.zstack.header.storage.primary.APICleanUpStorageTrashOnPrimaryStorageMsg</name>
</message>

<message>
<name>org.zstack.header.storage.primary.APIAddStorageProtocolMsg</name>
</message>

<message>
<name>org.zstack.header.storage.primary.APITakeoverPrimaryStorageMsg</name>
</message>

<message>
<name>org.zstack.header.storage.primary.APICheckPrimaryStorageConsistencyMsg</name>
</message>
</service>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.zstack.header.storage.primary;

import org.zstack.header.message.APIEvent;
import org.zstack.header.rest.RestResponse;

@RestResponse(fieldsTo = {"all"})
public class APICheckPrimaryStorageConsistencyEvent extends APIEvent {
private boolean consistent;

public boolean isConsistent() {
return consistent;
}

public void setConsistent(boolean consistent) {
this.consistent = consistent;
}

public APICheckPrimaryStorageConsistencyEvent() {
}

public APICheckPrimaryStorageConsistencyEvent(String apiId) {
super(apiId);
}

public static APICheckPrimaryStorageConsistencyEvent __example__() {
APICheckPrimaryStorageConsistencyEvent event = new APICheckPrimaryStorageConsistencyEvent();
event.setConsistent(true);
return event;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.zstack.header.storage.primary

import org.zstack.header.errorcode.ErrorCode

doc {

title "检查存储一致性返回"

field {
name "consistent"
desc "是否一致"
type "boolean"
since "5.0.0"
}
field {
name "success"
desc ""
type "boolean"
since "5.0.0"
}
ref {
name "error"
path "org.zstack.header.storage.primary.APICheckPrimaryStorageConsistencyEvent.error"
desc "错误码,若不为null,则表示操作失败, 操作成功时该字段为null"
type "ErrorCode"
since "5.0.0"
clz ErrorCode.class
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.zstack.header.storage.primary;

import org.springframework.http.HttpMethod;
import org.zstack.header.message.APIMessage;
import org.zstack.header.message.APIParam;
import org.zstack.header.rest.RestRequest;

@RestRequest(
path = "/primary-storage/{uuid}/consistency",
responseClass = APICheckPrimaryStorageConsistencyEvent.class,
method = HttpMethod.PUT,
isAction = true
)
public class APICheckPrimaryStorageConsistencyMsg extends APIMessage implements PrimaryStorageMessage {
@APIParam(resourceType = PrimaryStorageVO.class)
private String uuid;

@Override
public String getPrimaryStorageUuid() {
return uuid;
}

public String getUuid() {
return uuid;
}

public void setUuid(String uuid) {
this.uuid = uuid;
}

public static APICheckPrimaryStorageConsistencyMsg __example__() {
APICheckPrimaryStorageConsistencyMsg msg = new APICheckPrimaryStorageConsistencyMsg();
msg.setUuid(uuid(PrimaryStorageVO.class));
return msg;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.zstack.header.storage.primary

import org.zstack.header.storage.primary.APICheckPrimaryStorageConsistencyEvent

doc {
title "CheckPrimaryStorageConsistency"

category "storage.primary"

desc """检查存储一致性"""

rest {
request {
url "PUT /v1/primary-storage/{uuid}/consistency"

header (Authorization: 'OAuth the-session-uuid')

clz APICheckPrimaryStorageConsistencyMsg.class

desc """"""

params {

column {
name "uuid"
enclosedIn "checkPrimaryStorageConsistency"
desc "主存储的UUID"
location "url"
type "String"
optional false
since "5.0.0"
}
column {
name "systemTags"
enclosedIn ""
desc "系统标签"
location "body"
type "List"
optional true
since "5.0.0"
}
column {
name "userTags"
enclosedIn ""
desc "用户标签"
location "body"
type "List"
optional true
since "5.0.0"
}
}
}

response {
clz APICheckPrimaryStorageConsistencyEvent.class
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.zstack.header.storage.primary;

import org.zstack.header.message.APIEvent;
import org.zstack.header.rest.RestResponse;

import java.util.Collections;

@RestResponse(allTo = "inventory")
public class APITakeoverPrimaryStorageEvent extends APIEvent {
private PrimaryStorageInventory inventory;

public APITakeoverPrimaryStorageEvent() {
}

public APITakeoverPrimaryStorageEvent(String apiId) {
super(apiId);
}

public PrimaryStorageInventory getInventory() {
return inventory;
}

public void setInventory(PrimaryStorageInventory inventory) {
this.inventory = inventory;
}

public static APITakeoverPrimaryStorageEvent __example__() {
APITakeoverPrimaryStorageEvent event = new APITakeoverPrimaryStorageEvent();

PrimaryStorageInventory ps = new PrimaryStorageInventory();
ps.setName("PS1");
ps.setUrl("/zstack_ps");
ps.setType("LocalStorage");
ps.setAttachedClusterUuids(Collections.singletonList(uuid()));

event.setInventory(ps);
return event;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.zstack.header.storage.primary

import org.zstack.header.storage.primary.PrimaryStorageInventory
import org.zstack.header.errorcode.ErrorCode

doc {

title "接管主存储返回"

ref {
name "inventory"
path "org.zstack.header.storage.primary.APITakeoverPrimaryStorageEvent.inventory"
desc "主存储信息"
type "PrimaryStorageInventory"
since "5.0.0"
clz PrimaryStorageInventory.class
}
field {
name "success"
desc ""
type "boolean"
since "5.0.0"
}
ref {
name "error"
path "org.zstack.header.storage.primary.APITakeoverPrimaryStorageEvent.error"
desc "错误码,若不为null,则表示操作失败, 操作成功时该字段为null"
type "ErrorCode"
since "5.0.0"
clz ErrorCode.class
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.zstack.header.storage.primary;

import org.springframework.http.HttpMethod;
import org.zstack.header.message.APIMessage;
import org.zstack.header.message.APIParam;
import org.zstack.header.rest.RestRequest;

@RestRequest(
path = "/primary-storage/{uuid}/takeover",
responseClass = APITakeoverPrimaryStorageEvent.class,
method = HttpMethod.PUT,
isAction = true
)
public class APITakeoverPrimaryStorageMsg extends APIMessage implements PrimaryStorageMessage {
@APIParam(resourceType = PrimaryStorageVO.class)
private String uuid;

@Override
public String getPrimaryStorageUuid() {
return uuid;
}

public String getUuid() {
return uuid;
}

public void setUuid(String uuid) {
this.uuid = uuid;
}

public static APITakeoverPrimaryStorageMsg __example__() {
APITakeoverPrimaryStorageMsg msg = new APITakeoverPrimaryStorageMsg();
msg.setUuid(uuid(PrimaryStorageVO.class));
return msg;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.zstack.header.storage.primary

import org.zstack.header.storage.primary.APITakeoverPrimaryStorageEvent

doc {
title "TakeoverPrimaryStorage"

category "storage.primary"

desc """接管主存储"""

rest {
request {
url "PUT /v1/primary-storage/{uuid}/takeover"

header (Authorization: 'OAuth the-session-uuid')

clz APITakeoverPrimaryStorageMsg.class

desc """"""

params {

column {
name "uuid"
enclosedIn "takeoverPrimaryStorage"
desc "主存储的UUID"
location "url"
type "String"
optional false
since "5.0.0"
}
column {
name "systemTags"
enclosedIn ""
desc "系统标签"
location "body"
type "List"
optional true
since "5.0.0"
}
column {
name "userTags"
enclosedIn ""
desc "用户标签"
location "body"
type "List"
optional true
since "5.0.0"
}
}
}

response {
clz APITakeoverPrimaryStorageEvent.class
}
}
}
2 changes: 2 additions & 0 deletions sdk/src/main/java/SourceClassMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ public class SourceClassMap {
put("org.zstack.storage.primary.local.APIGetLocalStorageHostDiskCapacityReply$HostDiskCapacity", "org.zstack.sdk.HostDiskCapacity");
put("org.zstack.storage.primary.local.LocalStorageResourceRefInventory", "org.zstack.sdk.LocalStorageResourceRefInventory");
put("org.zstack.storage.primary.sharedblock.SharedBlockCandidateStruct", "org.zstack.sdk.SharedBlockCandidateStruct");
put("org.zstack.storage.primary.sharedblock.SharedBlockGroupLunInfo", "org.zstack.sdk.SharedBlockGroupLunInfo");
put("org.zstack.storage.primary.sharedblock.SharedBlockGroupPrimaryStorageHostRefInventory", "org.zstack.sdk.SharedBlockGroupPrimaryStorageHostRefInventory");
put("org.zstack.storage.primary.sharedblock.SharedBlockGroupPrimaryStorageInventory", "org.zstack.sdk.SharedBlockGroupPrimaryStorageInventory");
put("org.zstack.storage.primary.sharedblock.SharedBlockGroupType", "org.zstack.sdk.SharedBlockGroupType");
Expand Down Expand Up @@ -1075,6 +1076,7 @@ public class SourceClassMap {
put("org.zstack.sdk.SftpBackupStorageInventory", "org.zstack.storage.backup.sftp.SftpBackupStorageInventory");
put("org.zstack.sdk.ShareableVolumeVmInstanceRefInventory", "org.zstack.mevoco.ShareableVolumeVmInstanceRefInventory");
put("org.zstack.sdk.SharedBlockCandidateStruct", "org.zstack.storage.primary.sharedblock.SharedBlockCandidateStruct");
put("org.zstack.sdk.SharedBlockGroupLunInfo", "org.zstack.storage.primary.sharedblock.SharedBlockGroupLunInfo");
put("org.zstack.sdk.SharedBlockGroupPrimaryStorageHostRefInventory", "org.zstack.storage.primary.sharedblock.SharedBlockGroupPrimaryStorageHostRefInventory");
put("org.zstack.sdk.SharedBlockGroupPrimaryStorageInventory", "org.zstack.storage.primary.sharedblock.SharedBlockGroupPrimaryStorageInventory");
put("org.zstack.sdk.SharedBlockGroupType", "org.zstack.storage.primary.sharedblock.SharedBlockGroupType");
Expand Down
Loading