Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
f327792
New Feature: Migrate VMware VMs to KVM
nvazquez Aug 24, 2023
2dc451a
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Aug 26, 2023
bd8859a
Fix delete template endpoint
nvazquez Aug 26, 2023
3a0ce3c
Address review comments
nvazquez Aug 30, 2023
6cb6565
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Aug 30, 2023
61e08bb
Refactor the list stopped VMs to list all VMs in datacenter and refle…
nvazquez Sep 4, 2023
57b3e04
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Sep 4, 2023
a19546a
Move VmwareDatacenterDaoImpl to engine/schema
nvazquez Sep 6, 2023
633dd53
Remove dao from vmware context xml
nvazquez Sep 6, 2023
18ea73d
Remove console log line
nvazquez Sep 6, 2023
eb9fd47
Minor typo on template details prefix
nvazquez Sep 6, 2023
124715a
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Sep 12, 2023
d4dc72c
Big refactor: import instance instead of register template from conve…
nvazquez Oct 2, 2023
7733d26
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Oct 2, 2023
7e2c0c2
Cleaup
nvazquez Oct 2, 2023
fcd0e2a
Fix missing end of file lines
nvazquez Oct 2, 2023
b7c421e
Polish and last fixes
nvazquez Oct 3, 2023
2294d5d
Reorder Source and Destination view on the Import wizard
nvazquez Oct 3, 2023
493e279
Rename zone, pod, cluster for Migrate from Vmware and filter clusters…
nvazquez Oct 4, 2023
402718a
Pass username and password for every stage of the migrate from vmware…
nvazquez Oct 4, 2023
714dbd2
Rearrange select datacenter items
nvazquez Oct 4, 2023
4f7f177
Remove temporary location after convert instance command is executed
nvazquez Oct 5, 2023
9ee5127
Restore VM to power on state if was previously running and migration …
nvazquez Oct 5, 2023
a073e8e
Fix loading while importing preventing to use the import button
nvazquez Oct 6, 2023
4d2d51d
Fix autocomplete nics if possible and allow selecting any network
nvazquez Oct 6, 2023
76f3051
Do not clone source VM before conversion
nvazquez Oct 6, 2023
adb0450
Do not show template section on import
nvazquez Oct 9, 2023
e6d78ee
Add keyword and pagination search to list vmware instances
nvazquez Oct 9, 2023
46822b7
Fix parsing rng devices without bytes and period
nvazquez Oct 9, 2023
f34d950
Fix for disks out of bound index
nvazquez Oct 10, 2023
48d9012
Revert "Do not clone source VM before conversion"
nvazquez Oct 11, 2023
72b6c92
Several fixes: pagination, list vms on vcenter while cloning operatio…
nvazquez Oct 12, 2023
af838f4
Fix case sensitive search
nvazquez Oct 13, 2023
cd5514c
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Oct 13, 2023
ac36e0c
Add logs for virt-v2v conversion
nvazquez Oct 14, 2023
d73c27b
Add start and completed events to vm import
nvazquez Oct 18, 2023
e3ae24f
Do not consider Disabled hosts for conversion
nvazquez Oct 18, 2023
2b03d47
Fix unit tests
nvazquez Oct 18, 2023
b9e34da
Increase log level to INFO and allow cloning for running VMs except W…
nvazquez Oct 18, 2023
5047857
Remove virt-v2v as a dependency of the cloudstack agent and introduce…
nvazquez Oct 19, 2023
b408d64
Add the option to select the KVM host to perform the conversion
nvazquez Oct 19, 2023
495ac29
Add the option to select a conversion storage destination for virt-v2v
nvazquez Oct 20, 2023
e6a7526
Display a note about the recommended state to import a VM on running VMs
nvazquez Oct 21, 2023
dd229e7
Generate a new mac address in case the forced option is enabled
nvazquez Oct 22, 2023
5de9239
Fix mac generation when forced
nvazquez Oct 22, 2023
c62f114
Fix running VMs CPU speed to allow them select matching or bigger off…
nvazquez Oct 23, 2023
9eb0f8f
Fix mounting and cleanup mounted storage pool after finishing
nvazquez Oct 23, 2023
300025f
Rename global setting for conversion timeout
nvazquez Oct 25, 2023
4e04554
Do not require vmware migration params on importUnmanagedInstance API
nvazquez Oct 25, 2023
f125987
Fix detect disks when parsing fails from storage using name prefix
nvazquez Oct 26, 2023
265528b
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Oct 26, 2023
6b4156f
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Oct 26, 2023
3d0bf4c
Refresh pool before listing and exclude xml from the retrieved list
nvazquez Oct 26, 2023
f153dc7
Improve import UI section
nvazquez Oct 31, 2023
50bfe70
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Nov 2, 2023
b15e576
Allow all offerings for import from VMware
nvazquez Nov 2, 2023
89da121
Fix add virtio controller as the default disk controller when its not…
nvazquez Nov 3, 2023
5784dad
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Nov 3, 2023
b0bcc83
Use virtio as the default nic adapter in case the converted instance …
nvazquez Nov 4, 2023
7fe6e00
Move logic to a new API importVm and improve UI network selection
nvazquez Nov 8, 2023
af9f565
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Nov 8, 2023
c062753
Adding more unit tests
nvazquez Nov 8, 2023
3432ec1
Unit tests for LibvirtConvertInstanceWrapper
nvazquez Nov 8, 2023
c5eccf7
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Nov 8, 2023
dce2865
Remove unused import
nvazquez Nov 8, 2023
40128e0
More tests for LibvirtConvertInstanceWrapper
nvazquez Nov 8, 2023
593d754
Fix lint and add unmanaged response tests
nvazquez Nov 8, 2023
45cd368
Tests for import from Vmware to KVM
nvazquez Nov 9, 2023
0bb0253
Tests for VmwareHelper
nvazquez Nov 9, 2023
5125677
More tests for UnmanagedVMsManagerImpl
nvazquez Nov 9, 2023
480cb12
More unit tests
nvazquez Nov 10, 2023
ce8274e
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Nov 17, 2023
081f39f
Fix allow duplicate mac addresses UI position
nvazquez Nov 30, 2023
ca1c2c3
Update ui/public/locales/en.json
nvazquez Nov 30, 2023
44fa6b4
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Dec 3, 2023
8460850
Merge branch 'main' into migrate-vmw-to-kvm
nvazquez Dec 4, 2023
746ed3c
Improve import export header description
nvazquez Dec 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions agent/conf/agent.properties
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,6 @@ iscsi.session.cleanup.enabled=false

# Timeout (in milliseconds) of the KVM heartbeat checker.
# kvm.heartbeat.checker.timeout=360000

# Instance Conversion from Vmware to KVM through virt-v2v. Enable verbose mode
# virtv2v.verbose.enabled=false
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,13 @@ public Property<Integer> getWorkers() {
*/
public static final Property<Integer> IOTHREADS = new Property<>("iothreads", 1);

/**
* Enable verbose mode for virt-v2v Instance Conversion from Vmware to KVM
* Data type: Boolean.<br>
* Default value: <code>false</code>
*/
public static final Property<Boolean> VIRTV2V_VERBOSE_ENABLED = new Property<>("virtv2v.verbose.enabled", false);

/**
* BGP controll CIDR
* Data type: String.<br>
Expand Down
88 changes: 88 additions & 0 deletions api/src/main/java/com/cloud/agent/api/to/RemoteInstanceTO.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* 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.to;

import com.cloud.agent.api.LogLevel;
import com.cloud.hypervisor.Hypervisor;

import java.io.Serializable;

public class RemoteInstanceTO implements Serializable {

private Hypervisor.HypervisorType hypervisorType;
private String hostName;
private String instanceName;

// Vmware Remote Instances parameters
// TODO: cloud.agent.transport.Request#getCommands() cannot handle gsoc decode for polymorphic classes
private String vcenterUsername;
@LogLevel(LogLevel.Log4jLevel.Off)
private String vcenterPassword;
private String vcenterHost;
private String datacenterName;
private String clusterName;

public RemoteInstanceTO() {
}

public RemoteInstanceTO(String hostName, String instanceName, String vcenterHost,
String datacenterName, String clusterName,
String vcenterUsername, String vcenterPassword) {
this.hypervisorType = Hypervisor.HypervisorType.VMware;
this.hostName = hostName;
this.instanceName = instanceName;
this.vcenterHost = vcenterHost;
this.datacenterName = datacenterName;
this.clusterName = clusterName;
this.vcenterUsername = vcenterUsername;
this.vcenterPassword = vcenterPassword;
}

public Hypervisor.HypervisorType getHypervisorType() {
return this.hypervisorType;
}

public String getInstanceName() {
return this.instanceName;
}

public String getHostName() {
return this.hostName;
}

public String getVcenterUsername() {
return vcenterUsername;
}

public String getVcenterPassword() {
return vcenterPassword;
}

public String getVcenterHost() {
return vcenterHost;
}

public String getDatacenterName() {
return datacenterName;
}

public String getClusterName() {
return clusterName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.

package com.cloud.hypervisor.vmware;
package com.cloud.dc;

import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
Expand Down
22 changes: 22 additions & 0 deletions api/src/main/java/com/cloud/hypervisor/HypervisorGuru.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import com.cloud.vm.NicProfile;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import org.apache.cloudstack.vm.UnmanagedInstanceTO;

public interface HypervisorGuru extends Adapter {

Expand Down Expand Up @@ -104,4 +105,25 @@ boolean attachRestoredVolumeToVirtualMachine(long zoneId, String location, Backu
* @return a list of commands to perform for a successful migration
*/
List<Command> finalizeMigrate(VirtualMachine vm, Map<Volume, StoragePool> volumeToPool);


/**
* Will perform a clone of a VM on an external host (if the guru can handle)
* @param hostIp VM's source host IP
* @param vmName name of the source VM to clone from
* @param params hypervisor specific additional parameters
* @return a reference to the cloned VM
*/
UnmanagedInstanceTO cloneHypervisorVMOutOfBand(String hostIp, String vmName,
Map<String, String> params);

/**
* Removes a VM created as a clone of a VM on an external host
* @param hostIp VM's source host IP
* @param vmName name of the VM to remove
* @param params hypervisor specific additional parameters
* @return true if the operation succeeds, false if not
*/
boolean removeClonedHypervisorVMOutOfBand(String hostIp, String vmName,
Map<String, String> params);
}
12 changes: 12 additions & 0 deletions api/src/main/java/com/cloud/vm/VmDetailConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,16 @@ public interface VmDetailConstants {
String DEPLOY_AS_IS_CONFIGURATION = "configurationId";
String KEY_PAIR_NAMES = "keypairnames";
String CKS_CONTROL_NODE_LOGIN_USER = "controlNodeLoginUser";

// VMware to KVM VM migrations specific
String VMWARE_TO_KVM_PREFIX = "vmware-to-kvm";
String VMWARE_VCENTER_HOST = String.format("%s-vcenter", VMWARE_TO_KVM_PREFIX);
String VMWARE_DATACENTER_NAME = String.format("%s-datacenter", VMWARE_TO_KVM_PREFIX);
String VMWARE_CLUSTER_NAME = String.format("%s-cluster", VMWARE_TO_KVM_PREFIX);
String VMWARE_VCENTER_USERNAME = String.format("%s-username", VMWARE_TO_KVM_PREFIX);
String VMWARE_VCENTER_PASSWORD = String.format("%s-password", VMWARE_TO_KVM_PREFIX);
String VMWARE_VM_NAME = String.format("%s-vmname", VMWARE_TO_KVM_PREFIX);
String VMWARE_HOST_NAME = String.format("%s-host", VMWARE_TO_KVM_PREFIX);
String VMWARE_DISK = String.format("%s-disk", VMWARE_TO_KVM_PREFIX);
String VMWARE_MAC_ADDRESSES = String.format("%s-mac-addresses", VMWARE_TO_KVM_PREFIX);
}
6 changes: 6 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public class ApiConstants {
public static final String CERTIFICATE_SERIALNUM = "serialnum";
public static final String CERTIFICATE_SUBJECT = "subject";
public static final String CERTIFICATE_VALIDITY = "validity";
public static final String CONVERT_INSTANCE_HOST_ID = "convertinstancehostid";
public static final String CONVERT_INSTANCE_STORAGE_POOL_ID = "convertinstancepoolid";
public static final String ENABLED_REVOCATION_CHECK = "enabledrevocationcheck";
public static final String CONTROLLER = "controller";
public static final String CONTROLLER_UNIT = "controllerunit";
Expand Down Expand Up @@ -120,6 +122,7 @@ public class ApiConstants {
public static final String MIN_IOPS = "miniops";
public static final String MAX_IOPS = "maxiops";
public static final String HYPERVISOR_SNAPSHOT_RESERVE = "hypervisorsnapshotreserve";
public static final String DATACENTER_NAME = "datacentername";
public static final String DATADISK_OFFERING_LIST = "datadiskofferinglist";
public static final String DEFAULT_VALUE = "defaultvalue";
public static final String DESCRIPTION = "description";
Expand Down Expand Up @@ -207,6 +210,7 @@ public class ApiConstants {
public static final String HIDE_IP_ADDRESS_USAGE = "hideipaddressusage";
public static final String HOST_ID = "hostid";
public static final String HOST_IDS = "hostids";
public static final String HOST_IP = "hostip";
public static final String HOST_NAME = "hostname";
public static final String HOST_CONTROL_STATE = "hostcontrolstate";
public static final String HOSTS_MAP = "hostsmap";
Expand Down Expand Up @@ -779,6 +783,7 @@ public class ApiConstants {
public static final String VSM_CONFIG_STATE = "vsmconfigstate";
public static final String VSM_DEVICE_STATE = "vsmdevicestate";
public static final String VCENTER = "vcenter";
public static final String EXISTING_VCENTER_ID = "existingvcenterid";
public static final String ADD_VSM_FLAG = "addvsmflag";
public static final String END_POINT = "endpoint";
public static final String REGION_ID = "regionid";
Expand Down Expand Up @@ -1059,6 +1064,7 @@ public class ApiConstants {
public static final String SOURCE_NAT_IP = "sourcenatipaddress";
public static final String SOURCE_NAT_IP_ID = "sourcenatipaddressid";
public static final String HAS_RULES = "hasrules";
public static final String IMPORT_SOURCE = "importsource";
public static final String OBJECT_STORAGE = "objectstore";

public static final String HEURISTIC_RULE = "heuristicrule";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.TrafficMonitorResponse;
import org.apache.cloudstack.api.response.TrafficTypeResponse;
import org.apache.cloudstack.api.response.UnmanagedInstanceResponse;
import org.apache.cloudstack.api.response.UpgradeRouterTemplateResponse;
import org.apache.cloudstack.api.response.UsageRecordResponse;
import org.apache.cloudstack.api.response.UserDataResponse;
Expand Down Expand Up @@ -237,6 +238,7 @@
import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.snapshot.VMSnapshot;
import org.apache.cloudstack.vm.UnmanagedInstanceTO;

public interface ResponseGenerator {
UserResponse createUserResponse(UserAccount user);
Expand Down Expand Up @@ -538,6 +540,8 @@ List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachine

FirewallResponse createIpv6FirewallRuleResponse(FirewallRule acl);

UnmanagedInstanceResponse createUnmanagedInstanceResponse(UnmanagedInstanceTO instance, Cluster cluster, Host host);

SecondaryStorageHeuristicsResponse createSecondaryStorageSelectorResponse(Heuristic heuristic);

IpQuarantineResponse createQuarantinedIpsResponse(PublicIpQuarantine publicIp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd {
type = CommandType.UUID,
entityType = ServiceOfferingResponse.class,
required = true,
description = "the ID of the service offering for the virtual machine")
description = "the service offering for the virtual machine")
private Long serviceOfferingId;

@Parameter(name = ApiConstants.NIC_NETWORK_LIST,
Expand Down Expand Up @@ -154,7 +154,7 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd {

@Parameter(name = ApiConstants.FORCED,
type = CommandType.BOOLEAN,
description = "VM is imported despite some of its NIC's MAC addresses are already present")
description = "VM is imported despite some of its NIC's MAC addresses are already present, in case the MAC address exists then a new MAC address is generated")
private Boolean forced;

/////////////////////////////////////////////////////
Expand Down Expand Up @@ -279,7 +279,8 @@ public String getEventType() {

@Override
public String getEventDescription() {
return "Importing unmanaged VM";
String vmName = this.name;
return String.format("Importing unmanaged VM: %s", vmName);
}

public boolean isForced() {
Expand Down
Loading