Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow VMWare import via another host #9787

Draft
wants to merge 14 commits into
base: 4.19
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public class ApiConstants {
public static final String ICMP_TYPE = "icmptype";
public static final String ID = "id";
public static final String IDS = "ids";
public static final String IMPORT_INSTANCE_HOST_ID = "importinstancehostid";
public static final String INDEX = "index";
public static final String INSTANCES_DISKS_STATS_RETENTION_ENABLED = "instancesdisksstatsretentionenabled";
public static final String INSTANCES_DISKS_STATS_RETENTION_TIME = "instancesdisksstatsretentiontime";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@ public class ImportVmCmd extends ImportUnmanagedInstanceCmd {
private String clusterName;

@Parameter(name = ApiConstants.CONVERT_INSTANCE_HOST_ID, type = CommandType.UUID, entityType = HostResponse.class,
description = "(only for importing VMs from VMware to KVM) optional - the host to perform the virt-v2v migration from VMware to KVM.")
description = "(only for importing VMs from VMware to KVM) optional - the host to perform the virt-v2v conversion from VMware to KVM.")
private Long convertInstanceHostId;

@Parameter(name = ApiConstants.IMPORT_INSTANCE_HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, since = "4.19.2",
description = "(only for importing VMs from VMware to KVM) optional - the host to import the converted instance from VMware to KVM.")
private Long importInstanceHostId;

@Parameter(name = ApiConstants.CONVERT_INSTANCE_STORAGE_POOL_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class,
description = "(only for importing VMs from VMware to KVM) optional - the temporary storage pool to perform the virt-v2v migration from VMware to KVM.")
private Long convertStoragePoolId;
Expand Down Expand Up @@ -201,6 +205,10 @@ public Long getConvertInstanceHostId() {
return convertInstanceHostId;
}

public Long getImportInstanceHostId() {
return importInstanceHostId;
}

public Long getConvertStoragePoolId() {
return convertStoragePoolId;
}
Expand Down
17 changes: 6 additions & 11 deletions core/src/main/java/com/cloud/agent/api/ConvertInstanceAnswer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,20 @@
// under the License.
package com.cloud.agent.api;

import org.apache.cloudstack.vm.UnmanagedInstanceTO;

public class ConvertInstanceAnswer extends Answer {

private String temporaryConvertUuid;

public ConvertInstanceAnswer() {
super();
}
private UnmanagedInstanceTO convertedInstance;

public ConvertInstanceAnswer(Command command, boolean success, String details) {
super(command, success, details);
}

public ConvertInstanceAnswer(Command command, UnmanagedInstanceTO convertedInstance) {
public ConvertInstanceAnswer(Command command, String temporaryConvertUuid) {
super(command, true, "");
this.convertedInstance = convertedInstance;
this.temporaryConvertUuid = temporaryConvertUuid;
}

public UnmanagedInstanceTO getConvertedInstance() {
return convertedInstance;
public String getTemporaryConvertUuid() {
return temporaryConvertUuid;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@
import com.cloud.agent.api.to.RemoteInstanceTO;
import com.cloud.hypervisor.Hypervisor;

import java.util.List;

public class ConvertInstanceCommand extends Command {

private RemoteInstanceTO sourceInstance;
private Hypervisor.HypervisorType destinationHypervisorType;
private List<String> destinationStoragePools;
private DataStoreTO conversionTemporaryLocation;
private String templateDirOnConversionLocation;
private boolean checkConversionSupport;
Expand All @@ -36,12 +33,10 @@ public class ConvertInstanceCommand extends Command {
public ConvertInstanceCommand() {
}

public ConvertInstanceCommand(RemoteInstanceTO sourceInstance, Hypervisor.HypervisorType destinationHypervisorType,
List<String> destinationStoragePools, DataStoreTO conversionTemporaryLocation,
public ConvertInstanceCommand(RemoteInstanceTO sourceInstance, Hypervisor.HypervisorType destinationHypervisorType, DataStoreTO conversionTemporaryLocation,
String templateDirOnConversionLocation, boolean checkConversionSupport, boolean exportOvfToConversionLocation) {
this.sourceInstance = sourceInstance;
this.destinationHypervisorType = destinationHypervisorType;
this.destinationStoragePools = destinationStoragePools;
this.conversionTemporaryLocation = conversionTemporaryLocation;
this.templateDirOnConversionLocation = templateDirOnConversionLocation;
this.checkConversionSupport = checkConversionSupport;
Expand All @@ -56,10 +51,6 @@ public Hypervisor.HypervisorType getDestinationHypervisorType() {
return destinationHypervisorType;
}

public List<String> getDestinationStoragePools() {
return destinationStoragePools;
}

public DataStoreTO getConversionTemporaryLocation() {
return conversionTemporaryLocation;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// 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.agent.api;

import org.apache.cloudstack.vm.UnmanagedInstanceTO;

public class ImportConvertedInstanceAnswer extends Answer {

public ImportConvertedInstanceAnswer() {
super();
}
private UnmanagedInstanceTO convertedInstance;

public ImportConvertedInstanceAnswer(Command command, boolean success, String details) {
super(command, success, details);
}

public ImportConvertedInstanceAnswer(Command command, UnmanagedInstanceTO convertedInstance) {
super(command, true, "");
this.convertedInstance = convertedInstance;
}

public UnmanagedInstanceTO getConvertedInstance() {
return convertedInstance;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// 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.agent.api;

import com.cloud.agent.api.to.DataStoreTO;
import com.cloud.agent.api.to.RemoteInstanceTO;

import java.util.List;

public class ImportConvertedInstanceCommand extends Command {

private RemoteInstanceTO sourceInstance;
private List<String> destinationStoragePools;
private DataStoreTO conversionTemporaryLocation;
private String temporaryConvertUuid;

public ImportConvertedInstanceCommand() {
}

public ImportConvertedInstanceCommand(RemoteInstanceTO sourceInstance,
List<String> destinationStoragePools,
DataStoreTO conversionTemporaryLocation, String temporaryConvertUuid) {
this.sourceInstance = sourceInstance;
this.destinationStoragePools = destinationStoragePools;
this.conversionTemporaryLocation = conversionTemporaryLocation;
this.temporaryConvertUuid = temporaryConvertUuid;
}

public RemoteInstanceTO getSourceInstance() {
return sourceInstance;
}

public List<String> getDestinationStoragePools() {
return destinationStoragePools;
}

public DataStoreTO getConversionTemporaryLocation() {
return conversionTemporaryLocation;
}

public String getTemporaryConvertUuid() {
return temporaryConvertUuid;
}

@Override
public boolean executeInSequence() {
return false;
}
}
Loading
Loading