Skip to content

Commit 2f36226

Browse files
committed
make sure resourceUuid is unique while migration
1 parent 6a5d183 commit 2f36226

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

plugin/localstorage/src/main/java/org/zstack/storage/primary/local/LocalStorageKvmBackend.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ public static class GetMd5TO {
503503
public static class GetMd5Cmd extends AgentCommand {
504504
public List<GetMd5TO> md5s;
505505
public String sendCommandUrl;
506+
public String volumeUuid;
506507
}
507508

508509
public static class Md5TO {
@@ -520,6 +521,7 @@ public static class GetMd5Rsp extends AgentResponse {
520521
public static class CheckMd5sumCmd extends AgentCommand {
521522
public List<Md5TO> md5s;
522523
public String sendCommandUrl;
524+
public String volumeUuid;
523525
}
524526

525527
@ApiTimeout(apiClasses = {APILocalStorageMigrateVolumeMsg.class})
@@ -1950,6 +1952,7 @@ public void run(final FlowTrigger trigger, Map data) {
19501952
to.resourceUuid = "backing-file";
19511953
to.path = context.backingFilePath;
19521954
cmd.md5s = list(to);
1955+
cmd.volumeUuid = struct.getVolume().getUuid();
19531956

19541957
httpCall(GET_MD5_PATH, struct.getSrcHostUuid(), cmd, false, GetMd5Rsp.class, new ReturnValueCompletion<GetMd5Rsp>(trigger) {
19551958
@Override
@@ -2100,6 +2103,7 @@ public void run(final FlowTrigger trigger, Map data) {
21002103

21012104
CheckMd5sumCmd cmd = new CheckMd5sumCmd();
21022105
cmd.md5s = list(to);
2106+
cmd.volumeUuid = struct.getVolume().getUuid();
21032107

21042108
httpCall(CHECK_MD5_PATH, struct.getDestHostUuid(), cmd, false, AgentResponse.class, new ReturnValueCompletion<AgentResponse>(trigger) {
21052109
@Override
@@ -2124,6 +2128,7 @@ public void fail(ErrorCode errorCode) {
21242128
public void run(final FlowTrigger trigger, Map data) {
21252129
GetMd5Cmd cmd = new GetMd5Cmd();
21262130
cmd.sendCommandUrl = restf.getSendCommandUrl();
2131+
cmd.volumeUuid = struct.getVolume().getUuid();
21272132
cmd.md5s = CollectionUtils.transformToList(struct.getInfos(), new Function<GetMd5TO, ResourceInfo>() {
21282133
@Override
21292134
public GetMd5TO call(ResourceInfo arg) {
@@ -2232,6 +2237,7 @@ public void run(final FlowTrigger trigger, Map data) {
22322237
CheckMd5sumCmd cmd = new CheckMd5sumCmd();
22332238
cmd.sendCommandUrl = restf.getSendCommandUrl();
22342239
cmd.md5s = context.getMd5Rsp.md5s;
2240+
cmd.volumeUuid = struct.getVolume().getUuid();
22352241
httpCall(CHECK_MD5_PATH, struct.getDestHostUuid(), cmd, false, AgentResponse.class, new ReturnValueCompletion<AgentResponse>(trigger) {
22362242
@Override
22372243
public void success(AgentResponse rsp) {

0 commit comments

Comments
 (0)