Skip to content

Commit 21ce3be

Browse files
devdeepAbhinandan Prateek
authored andcommitted
Storage motion for Xenserver changes: 1. Implemented Api findStoragePoolsForMigration. Added a new response objects to list storage pools available for migration. 2. Updated migrateVolume api for allowing migrating volumes of running vms. These changes are integrated into the latest storage refactoring changes. 3. Added the implementation for findHostsForMigration api. It lists the hosts to which an instance can be migrated, including hosts from within and across clusters to which an instance may be migrated with storage motion. The work of migrating a volume of a running vm is also done in copyAsync. 4. Updated the listHosts api for backward compatibility. 5. Added the implementation for migrateVirtualMachineWithVolume api. It migrates an instance with its volumes within a cluster and also across clusters. Also introduced a new XenServerStorageMotionStrategy for migrating volumes of a vm. When a vm is being migrated with its volumes, the vm is put in migrating state and a request is send to the volume manager to migrate the vm and its volumes. Volume manager calls into the volume service which forwards the request to data motion service after moving all the volumes to migrating state. Data motion service enumerates the strategies and the request reaches the XenServerStorageMotionStrategy. It calls in to the resource to complete the operation. 6. Resolved an issue where storage xenmotion of 2nd VM created from the same template to a host was failing with duplicate_vm exception. Made changes to remove the mac_seed key value pair from other_config when vms are created. This is was storage motion to fail. 7. Updated the db upgrade schema script. 8. Added the right permissions in commands.properties 9. Marvin tests for testing storage motion. Following scenarios are tested. 9.1. A virtual machine is migrated to another host. Its volumes are also migrated to another storage pool. 9.2. Just the volumes of a vm are migrated to another storage pool while the vm continues to run on the same host. 10. Unit tests for testing migration of a vm with its volumes.
Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
1 parent eae22d2 commit 21ce3be

64 files changed

Lines changed: 4109 additions & 85 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.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.util.List;
20+
import com.cloud.agent.api.to.VolumeTO;
21+
22+
public class MigrateWithStorageAnswer extends Answer {
23+
24+
List<VolumeTO> volumeTos;
25+
26+
public MigrateWithStorageAnswer(MigrateWithStorageCommand cmd, Exception ex) {
27+
super(cmd, ex);
28+
volumeTos = null;
29+
}
30+
31+
public MigrateWithStorageAnswer(MigrateWithStorageCommand cmd, List<VolumeTO> volumeTos) {
32+
super(cmd, true, null);
33+
this.volumeTos = volumeTos;
34+
}
35+
36+
public List<VolumeTO> getVolumeTos() {
37+
return volumeTos;
38+
}
39+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.util.Map;
20+
import com.cloud.agent.api.to.VirtualMachineTO;
21+
import com.cloud.agent.api.to.VolumeTO;
22+
import com.cloud.agent.api.to.StorageFilerTO;
23+
24+
public class MigrateWithStorageCommand extends Command {
25+
VirtualMachineTO vm;
26+
Map<VolumeTO, StorageFilerTO> volumeToFiler;
27+
28+
public MigrateWithStorageCommand(VirtualMachineTO vm, Map<VolumeTO, StorageFilerTO> volumeToFiler) {
29+
this.vm = vm;
30+
this.volumeToFiler = volumeToFiler;
31+
}
32+
33+
public VirtualMachineTO getVirtualMachine() {
34+
return vm;
35+
}
36+
37+
public Map<VolumeTO, StorageFilerTO> getVolumeToFiler() {
38+
return volumeToFiler;
39+
}
40+
41+
@Override
42+
public boolean executeInSequence() {
43+
return true;
44+
}
45+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.util.List;
20+
import com.cloud.agent.api.to.VolumeTO;
21+
22+
public class MigrateWithStorageCompleteAnswer extends Answer {
23+
List<VolumeTO> volumeTos;
24+
25+
public MigrateWithStorageCompleteAnswer(MigrateWithStorageCompleteCommand cmd, Exception ex) {
26+
super(cmd, ex);
27+
volumeTos = null;
28+
}
29+
30+
public MigrateWithStorageCompleteAnswer(MigrateWithStorageCompleteCommand cmd, List<VolumeTO> volumeTos) {
31+
super(cmd, true, null);
32+
this.volumeTos = volumeTos;
33+
}
34+
35+
public List<VolumeTO> getVolumeTos() {
36+
return volumeTos;
37+
}
38+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import com.cloud.agent.api.to.VirtualMachineTO;
20+
21+
public class MigrateWithStorageCompleteCommand extends Command {
22+
VirtualMachineTO vm;
23+
24+
public MigrateWithStorageCompleteCommand(VirtualMachineTO vm) {
25+
this.vm = vm;
26+
}
27+
28+
public VirtualMachineTO getVirtualMachine() {
29+
return vm;
30+
}
31+
32+
@Override
33+
public boolean executeInSequence() {
34+
return false;
35+
}
36+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.util.Map;
20+
import com.cloud.agent.api.to.VolumeTO;
21+
import com.cloud.agent.api.to.NicTO;
22+
23+
public class MigrateWithStorageReceiveAnswer extends Answer {
24+
25+
Map<VolumeTO, Object> volumeToSr;
26+
Map<NicTO, Object> nicToNetwork;
27+
Map<String, String> token;
28+
29+
public MigrateWithStorageReceiveAnswer(MigrateWithStorageReceiveCommand cmd, Exception ex) {
30+
super(cmd, ex);
31+
volumeToSr = null;
32+
nicToNetwork = null;
33+
token = null;
34+
}
35+
36+
public MigrateWithStorageReceiveAnswer(MigrateWithStorageReceiveCommand cmd, Map<VolumeTO, Object> volumeToSr,
37+
Map<NicTO, Object> nicToNetwork, Map<String, String> token) {
38+
super(cmd, true, null);
39+
this.volumeToSr = volumeToSr;
40+
this.nicToNetwork = nicToNetwork;
41+
this.token = token;
42+
}
43+
44+
public Map<VolumeTO, Object> getVolumeToSr() {
45+
return volumeToSr;
46+
}
47+
48+
public Map<NicTO, Object> getNicToNetwork() {
49+
return nicToNetwork;
50+
}
51+
52+
public Map<String, String> getToken() {
53+
return token;
54+
}
55+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.util.Map;
20+
import com.cloud.agent.api.to.VirtualMachineTO;
21+
import com.cloud.agent.api.to.VolumeTO;
22+
import com.cloud.agent.api.to.StorageFilerTO;
23+
24+
public class MigrateWithStorageReceiveCommand extends Command {
25+
VirtualMachineTO vm;
26+
Map<VolumeTO, StorageFilerTO> volumeToFiler;
27+
28+
public MigrateWithStorageReceiveCommand(VirtualMachineTO vm, Map<VolumeTO, StorageFilerTO> volumeToFiler) {
29+
this.vm = vm;
30+
this.volumeToFiler = volumeToFiler;
31+
}
32+
33+
public VirtualMachineTO getVirtualMachine() {
34+
return vm;
35+
}
36+
37+
public Map<VolumeTO, StorageFilerTO> getVolumeToFiler() {
38+
return volumeToFiler;
39+
}
40+
41+
@Override
42+
public boolean executeInSequence() {
43+
return true;
44+
}
45+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.util.Set;
20+
import com.cloud.agent.api.to.VolumeTO;
21+
22+
public class MigrateWithStorageSendAnswer extends Answer {
23+
24+
Set<VolumeTO> volumeToSet;
25+
26+
public MigrateWithStorageSendAnswer(MigrateWithStorageSendCommand cmd, Exception ex) {
27+
super(cmd, ex);
28+
volumeToSet = null;
29+
}
30+
31+
public MigrateWithStorageSendAnswer(MigrateWithStorageSendCommand cmd, Set<VolumeTO> volumeToSet) {
32+
super(cmd, true, null);
33+
this.volumeToSet = volumeToSet;
34+
}
35+
36+
public Set<VolumeTO> getVolumeToSet() {
37+
return volumeToSet;
38+
}
39+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package com.cloud.agent.api;
18+
19+
import java.util.Map;
20+
import com.cloud.agent.api.to.VirtualMachineTO;
21+
import com.cloud.agent.api.to.VolumeTO;
22+
import com.cloud.agent.api.to.NicTO;
23+
24+
public class MigrateWithStorageSendCommand extends Command {
25+
VirtualMachineTO vm;
26+
Map<VolumeTO, Object> volumeToSr;
27+
Map<NicTO, Object> nicToNetwork;
28+
Map<String, String> token;
29+
30+
public MigrateWithStorageSendCommand(VirtualMachineTO vm, Map<VolumeTO, Object> volumeToSr,
31+
Map<NicTO, Object> nicToNetwork, Map<String, String> token) {
32+
this.vm = vm;
33+
this.volumeToSr = volumeToSr;
34+
this.nicToNetwork = nicToNetwork;
35+
this.token = token;
36+
}
37+
38+
public VirtualMachineTO getVirtualMachine() {
39+
return vm;
40+
}
41+
42+
public Map<VolumeTO, Object> getVolumeToSr() {
43+
return volumeToSr;
44+
}
45+
46+
public Map<NicTO, Object> getNicToNetwork() {
47+
return nicToNetwork;
48+
}
49+
50+
public Map<String, String> getToken() {
51+
return token;
52+
}
53+
54+
@Override
55+
public boolean executeInSequence() {
56+
return true;
57+
}
58+
}

0 commit comments

Comments
 (0)