You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2018/04/03 09:08:10 UTC

[GitHub] marcaurele commented on a change in pull request #1709: CLOUDSTACK-7982: KVM live migration with local storage

marcaurele commented on a change in pull request #1709: CLOUDSTACK-7982: KVM live migration with local storage
URL: https://github.com/apache/cloudstack/pull/1709#discussion_r178758112
 
 

 ##########
 File path: plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateWithStorageCommandWrapper.java
 ##########
 @@ -0,0 +1,56 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+//
+
+package com.cloud.hypervisor.kvm.resource.wrapper;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.MigrateWithStorageAnswer;
+import com.cloud.agent.api.MigrateWithStorageCommand;
+import com.cloud.agent.api.to.DataTO;
+import com.cloud.agent.api.to.DiskTO;
+import com.cloud.agent.api.to.VirtualMachineTO;
+import com.cloud.hypervisor.kvm.resource.LibvirtComputingResource;
+import com.cloud.resource.CommandWrapper;
+import com.cloud.resource.ResourceWrapper;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+@ResourceWrapper(handles = MigrateWithStorageCommand.class)
+public final class  LibvirtMigrateWithStorageCommandWrapper extends CommandWrapper<MigrateWithStorageCommand, Answer, LibvirtComputingResource> {
+
+    @Override
+    public Answer execute(final MigrateWithStorageCommand command, final LibvirtComputingResource libvirtComputingResource) {
+        List<VolumeObjectTO> volumes = new ArrayList<>();
+        VirtualMachineTO vm = command.getVirtualMachine();
+        List<DiskTO> disks = Arrays.asList(vm.getDisks());
+        for (DiskTO disk : disks) {
+            DataTO data = disk.getData();
+            if (data instanceof VolumeObjectTO) {
+                volumes.add((VolumeObjectTO) data);
+            }
+        }
+
+        final String result = LibvirtMigrationHelper.executeMigrationWithFlags(libvirtComputingResource, vm.getName(), command.getTargetHost(), libvirtComputingResource.getMigrateWithStorageFlags(), null, true);
 
 Review comment:
   @wido shortcut here with `null, true` as last parameters

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services