Skip to content

Commit b67ce5f

Browse files
author
Daniel Augusto Veronezi Salvador
committed
Merge branch 'backport-incremental-snap' into '4.20.0.0-scclouds'
Port 4.20 - Incremental volume snapshots Closes apache#2400, apache#2296, and apache#2396 See merge request scclouds/scclouds!976
2 parents c6ff8a1 + f525ebc commit b67ce5f

74 files changed

Lines changed: 3131 additions & 570 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

agent/conf/agent.properties

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,3 +437,9 @@ iscsi.session.cleanup.enabled=false
437437

438438
# Implicit host tags managed by agent.properties
439439
# host.tags=
440+
441+
# Timeout (in seconds) to wait for the snapshot reversion to complete.
442+
# revert.snapshot.timeout=10800
443+
444+
# Timeout (in seconds) to wait for the incremental snapshot to complete.
445+
# incremental.snapshot.timeout=10800

agent/src/main/java/com/cloud/agent/properties/AgentProperties.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,16 @@ public Property<Integer> getWorkers() {
832832
*/
833833
public static final Property<Boolean> CREATE_FULL_CLONE = new Property<>("create.full.clone", false);
834834

835+
/**
836+
* Timeout (in seconds) to wait for the incremental snapshot to complete.
837+
* */
838+
public static final Property<Integer> INCREMENTAL_SNAPSHOT_TIMEOUT = new Property<>("incremental.snapshot.timeout", 10800);
839+
840+
/**
841+
* Timeout (in seconds) to wait for the snapshot reversion to complete.
842+
* */
843+
public static final Property<Integer> REVERT_SNAPSHOT_TIMEOUT = new Property<>("revert.snapshot.timeout", 10800);
844+
835845
public static class Property <T>{
836846
private String name;
837847
private T defaultValue;

api/src/main/java/com/cloud/agent/api/to/NfsTO.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
package com.cloud.agent.api.to;
1818

1919
import com.cloud.storage.DataStoreRole;
20-
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
20+
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
21+
import org.apache.commons.lang3.builder.ToStringStyle;
2122

2223
public class NfsTO implements DataStoreTO {
2324

@@ -84,6 +85,6 @@ public void setNfsVersion(String nfsVersion) {
8485

8586
@Override
8687
public String toString() {
87-
return ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "_url", "_role", "uuid", "nfsVersion");
88+
return new ReflectionToStringBuilder(this, ToStringStyle.JSON_STYLE).setExcludeFieldNames("pathSeparator").toString();
8889
}
8990
}

api/src/main/java/com/cloud/storage/Snapshot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public boolean equals(String snapshotType) {
4848
}
4949

5050
public enum State {
51-
Allocated, Creating, CreatedOnPrimary, BackingUp, BackedUp, Copying, Destroying, Destroyed,
51+
Allocated, Creating, CreatedOnPrimary, BackingUp, BackedUp, Copying, Destroying, Destroyed, Hidden,
5252
//it's a state, user can't see the snapshot from ui, while the snapshot may still exist on the storage
5353
Error;
5454

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package com.cloud.agent.api;
21+
22+
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
23+
24+
public class ConvertSnapshotAnswer extends Answer {
25+
26+
private SnapshotObjectTO snapshotObjectTO;
27+
28+
public ConvertSnapshotAnswer(SnapshotObjectTO snapshotObjectTO) {
29+
super(null);
30+
this.snapshotObjectTO = snapshotObjectTO;
31+
}
32+
33+
public SnapshotObjectTO getSnapshotObjectTO() {
34+
return snapshotObjectTO;
35+
}
36+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package com.cloud.agent.api;
21+
22+
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
23+
24+
public class ConvertSnapshotCommand extends Command {
25+
26+
public static final String TEMP_SNAPSHOT_NAME = "_temp";
27+
28+
SnapshotObjectTO snapshotObjectTO;
29+
30+
public SnapshotObjectTO getSnapshotObjectTO() {
31+
return snapshotObjectTO;
32+
}
33+
34+
public ConvertSnapshotCommand(SnapshotObjectTO snapshotObjectTO) {
35+
this.snapshotObjectTO = snapshotObjectTO;
36+
}
37+
38+
@Override
39+
public boolean executeInSequence() {
40+
return true;
41+
}
42+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// Licensed to the Apache Software Foundation (ASF) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The ASF licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
//
19+
20+
package com.cloud.agent.api;
21+
22+
import org.apache.cloudstack.storage.to.VolumeObjectTO;
23+
24+
import java.util.List;
25+
26+
public class RecreateCheckpointsCommand extends Command {
27+
28+
private List<VolumeObjectTO> volumes;
29+
30+
private String vmName;
31+
32+
public RecreateCheckpointsCommand(List<VolumeObjectTO> volumes, String vmName) {
33+
this.volumes = volumes;
34+
this.vmName = vmName;
35+
}
36+
37+
public List<VolumeObjectTO> getDisks() {
38+
return volumes;
39+
}
40+
41+
public String getVmName() {
42+
return vmName;
43+
}
44+
45+
@Override
46+
public boolean executeInSequence() {
47+
return true;
48+
}
49+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//
2+
// Licensed to the Apache Software Foundation (ASF) under one
3+
// or more contributor license agreements. See the NOTICE file
4+
// distributed with this work for additional information
5+
// regarding copyright ownership. The ASF licenses this file
6+
// to you under the Apache License, Version 2.0 (the
7+
// "License"); you may not use this file except in compliance
8+
// with the License. You may obtain a copy of the License at
9+
//
10+
// http://www.apache.org/licenses/LICENSE-2.0
11+
//
12+
// Unless required by applicable law or agreed to in writing,
13+
// software distributed under the License is distributed on an
14+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
// KIND, either express or implied. See the License for the
16+
// specific language governing permissions and limitations
17+
// under the License.
18+
//
19+
20+
package com.cloud.agent.api;
21+
22+
import org.apache.cloudstack.storage.to.SnapshotObjectTO;
23+
24+
public class RemoveBitmapCommand extends Command {
25+
26+
private SnapshotObjectTO snapshotObjectTO;
27+
28+
private boolean isVmRunning;
29+
30+
public RemoveBitmapCommand(SnapshotObjectTO snapshotObjectTO, boolean isVmRunning) {
31+
this.snapshotObjectTO = snapshotObjectTO;
32+
this.isVmRunning = isVmRunning;
33+
}
34+
35+
@Override
36+
public boolean executeInSequence() {
37+
return true;
38+
}
39+
40+
public SnapshotObjectTO getSnapshotObjectTO() {
41+
return snapshotObjectTO;
42+
}
43+
44+
public boolean isVmRunning() {
45+
return isVmRunning;
46+
}
47+
}

core/src/main/java/com/cloud/storage/resource/StorageSubsystemCommandHandlerBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected Answer execute(CreateObjectCommand cmd) {
142142
}
143143
return new CreateObjectAnswer("not supported type");
144144
} catch (Exception e) {
145-
logger.debug("Failed to create object: " + data.getObjectType() + ": " + e.toString());
145+
logger.error("Failed to create object [{}] due to [{}].", data.getObjectType(), e.getMessage(), e);
146146
return new CreateObjectAnswer(e.toString());
147147
}
148148
}

core/src/main/java/com/cloud/storage/template/TemplateConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public final class TemplateConstants {
2424
public static final String DEFAULT_SNAPSHOT_ROOT_DIR = "snapshots";
2525
public static final String DEFAULT_VOLUME_ROOT_DIR = "volumes";
2626
public static final String DEFAULT_TMPLT_FIRST_LEVEL_DIR = "tmpl/";
27+
public static final String DEFAULT_CHECKPOINT_ROOT_DIR = "checkpoints";
2728

2829
public static final String DEFAULT_SYSTEM_VM_TEMPLATE_PATH = "template/tmpl/1/";
2930

0 commit comments

Comments
 (0)