Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public class UnmanagedInstanceResponse extends BaseResponse {
@Param(description = "the ID of the host to which virtual machine belongs")
private String hostId;

@SerializedName(ApiConstants.HOST_NAME)
@Param(description = "the name of the host to which virtual machine belongs")
private String hostName;

@SerializedName(ApiConstants.POWER_STATE)
@Param(description = "the power state of the virtual machine")
private String powerState;
Expand Down Expand Up @@ -108,6 +112,14 @@ public void setHostId(String hostId) {
this.hostId = hostId;
}

public String getHostName() {
return hostName;
}

public void setHostName(String hostName) {
this.hostName = hostName;
}

public String getPowerState() {
return powerState;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@

import javax.inject.Inject;

import com.cloud.agent.api.PrepareUnmanageVMInstanceAnswer;
import com.cloud.agent.api.PrepareUnmanageVMInstanceCommand;
import com.cloud.event.ActionEvent;
import com.cloud.exception.UnsupportedServiceException;
import com.cloud.storage.Snapshot;
import com.cloud.storage.SnapshotVO;
import com.cloud.storage.dao.SnapshotDao;
import com.cloud.vm.NicVO;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.snapshot.dao.VMSnapshotDao;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.ResponseGenerator;
Expand All @@ -59,12 +48,15 @@
import org.apache.cloudstack.utils.volume.VirtualMachineDiskInfo;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;

import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.GetUnmanagedInstancesAnswer;
import com.cloud.agent.api.GetUnmanagedInstancesCommand;
import com.cloud.agent.api.PrepareUnmanageVMInstanceAnswer;
import com.cloud.agent.api.PrepareUnmanageVMInstanceCommand;
import com.cloud.capacity.CapacityManager;
import com.cloud.configuration.Config;
import com.cloud.configuration.Resource;
Expand All @@ -75,6 +67,7 @@
import com.cloud.deploy.DeployDestination;
import com.cloud.deploy.DeploymentPlanner;
import com.cloud.deploy.DeploymentPlanningManager;
import com.cloud.event.ActionEvent;
import com.cloud.event.EventTypes;
import com.cloud.event.UsageEventUtils;
import com.cloud.exception.InsufficientAddressCapacityException;
Expand All @@ -83,6 +76,7 @@
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.UnsupportedServiceException;
import com.cloud.host.Host;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
Expand All @@ -103,6 +97,8 @@
import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.storage.GuestOS;
import com.cloud.storage.GuestOSHypervisor;
import com.cloud.storage.Snapshot;
import com.cloud.storage.SnapshotVO;
import com.cloud.storage.StoragePool;
import com.cloud.storage.VMTemplateStoragePoolVO;
import com.cloud.storage.VMTemplateVO;
Expand All @@ -112,6 +108,7 @@
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.GuestOSDao;
import com.cloud.storage.dao.GuestOSHypervisorDao;
import com.cloud.storage.dao.SnapshotDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VMTemplatePoolDao;
import com.cloud.storage.dao.VolumeDao;
Expand All @@ -127,15 +124,19 @@
import com.cloud.utils.net.NetUtils;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.NicProfile;
import com.cloud.vm.NicVO;
import com.cloud.vm.UserVmManager;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineManager;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.VirtualMachineProfileImpl;
import com.cloud.vm.VmDetailConstants;
import com.cloud.vm.dao.NicDao;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDao;
import com.cloud.vm.snapshot.dao.VMSnapshotDao;
import com.google.common.base.Strings;
import com.google.gson.Gson;

Expand Down Expand Up @@ -243,6 +244,7 @@ private UnmanagedInstanceResponse createUnmanagedInstanceResponse(UnmanagedInsta
}
if (host != null) {
response.setHostId(host.getUuid());
response.setHostName(host.getName());
}
response.setPowerState(instance.getPowerState().toString());
response.setCpuCores(instance.getCpuCores());
Expand Down Expand Up @@ -1078,6 +1080,10 @@ public ListResponse<UnmanagedInstanceResponse> listUnmanagedInstances(ListUnmana
if (cluster.getHypervisorType() != Hypervisor.HypervisorType.VMware) {
throw new InvalidParameterValueException(String.format("VM ingestion is currently not supported for hypervisor: %s", cluster.getHypervisorType().toString()));
}
String keyword = cmd.getKeyword();
if (StringUtils.isNotEmpty(keyword)) {
keyword = keyword.toLowerCase();
}
List<HostVO> hosts = resourceManager.listHostsInClusterByStatus(clusterId, Status.Up);
List<String> additionalNameFilters = getAdditionalNameFilters(cluster);
List<UnmanagedInstanceResponse> responses = new ArrayList<>();
Expand All @@ -1097,11 +1103,15 @@ public ListResponse<UnmanagedInstanceResponse> listUnmanagedInstances(ListUnmana
continue;
}
GetUnmanagedInstancesAnswer unmanagedInstancesAnswer = (GetUnmanagedInstancesAnswer) answer;
HashMap<String, UnmanagedInstanceTO> unmanagedInstances = new HashMap<>();
unmanagedInstances.putAll(unmanagedInstancesAnswer.getUnmanagedInstances());
HashMap<String, UnmanagedInstanceTO> unmanagedInstances = new HashMap<>(unmanagedInstancesAnswer.getUnmanagedInstances());
Set<String> keys = unmanagedInstances.keySet();
for (String key : keys) {
responses.add(createUnmanagedInstanceResponse(unmanagedInstances.get(key), cluster, host));
UnmanagedInstanceTO instance = unmanagedInstances.get(key);
if (StringUtils.isNotEmpty(keyword) &&
!instance.getName().toLowerCase().contains(keyword)) {
continue;
}
responses.add(createUnmanagedInstanceResponse(instance, cluster, host));
}
}
ListResponse<UnmanagedInstanceResponse> listResponses = new ListResponse<>();
Expand Down
34 changes: 33 additions & 1 deletion ui/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"label.action.lock.account.processing": "Locking account....",
"label.action.manage.cluster": "Manage Cluster",
"label.action.manage.cluster.processing": "Managing Cluster....",
"label.action.import.export.instances":"Import-Export Instances",
"label.action.migrate.instance": "Migrate Instance",
"label.action.migrate.instance.processing": "Migrating Instance....",
"label.action.migrate.router": "Migrate Router",
Expand Down Expand Up @@ -276,6 +277,8 @@
"label.action.unmanage.cluster": "Unmanage Cluster",
"label.action.unmanage.cluster.processing": "Unmanaging Cluster....",
"label.action.unmanage.virtualmachine": "Unmanage VM",
"label.action.unmanage.instance": "Unmanage Instance",
"label.action.unmanage.instances": "Unmanage Instances",
"label.action.update.offering.access": "Update Offering Access",
"label.action.update.os.preference": "Update OS Preference",
"label.action.update.os.preference.processing": "Updating OS Preference....",
Expand Down Expand Up @@ -461,6 +464,8 @@
"label.asyncbackup": "Async Backup",
"label.author.email": "Author e-mail",
"label.author.name": "Author name",
"label.auto.assign.diskoffering.disk.size": "Automatically assign offering matching the disk size",
"label.auto.assign.random.ip": "Automatically assign a random IP address",
"label.autoscale": "AutoScale",
"label.autoscale.configuration.wizard": "AutoScale Configuration Wizard",
"label.availability": "Availability",
Expand Down Expand Up @@ -773,6 +778,7 @@
"label.disk.offering.access": "Disk offering access",
"label.disk.offering.details": "Disk offering details",
"label.disk.offerings": "Disk Offerings",
"label.disk.selection": "Disk Selection",
"label.disk.size": "Disk Size",
"label.disk.volume": "Disk Volume",
"label.diskbytesreadrate": "Disk Read Rate (BPS)",
Expand Down Expand Up @@ -1057,6 +1063,7 @@
"label.ikeversion": "IKE Version",
"label.images": "Images",
"label.import.backup.offering": "Import Backup Offering",
"label.import.instance": "Import Instance",
"label.import.offering": "Import Offering",
"label.import.role": "Import Role",
"label.in.progress": "in progress",
Expand Down Expand Up @@ -1301,6 +1308,7 @@
"label.manage.resources": "Manage Resources",
"label.manage.vpn.user": "Manage VPN Users",
"label.managedstate": "Managed State",
"label.managed.instances": "Managed Instances",
"label.management": "Management",
"label.management.ips": "Management IP Addresses",
"label.management.server": "Management Server",
Expand Down Expand Up @@ -1383,6 +1391,7 @@
"label.metrics.network.usage": "Network Usage",
"label.metrics.network.write": "Write",
"label.metrics.num.cpu.cores": "Cores",
"label.migrate.allowed": "Migrate Allowed",
"label.migrate.data.from.image.store": "Migrate Data from Image store",
"label.migrate.instance.to": "Migrate instance to",
"label.migrate.instance.to.host": "Migrate instance to another host",
Expand Down Expand Up @@ -1453,6 +1462,7 @@
"label.network.offering.display.text": "Network Offering Display Text",
"label.network.offering.name": "Network Offering Name",
"label.network.offerings": "Network Offerings",
"label.network.selection": "Network Selection",
"label.network.service.providers": "Network Service Providers",
"label.networkcidr": "Network CIDR",
"label.networkdevicetype": "Type",
Expand Down Expand Up @@ -1493,6 +1503,7 @@
"label.nfscachepath": "Path",
"label.nfscachezoneid": "Zone",
"label.nfsserver": "NFS Server",
"label.nic": "NIC",
"label.nicadaptertype": "NIC adapter type",
"label.nicira.controller.address": "Controller Address",
"label.nicira.nvp.details": "Nicira NVP details",
Expand Down Expand Up @@ -1844,6 +1855,7 @@
"label.rolename": "Role",
"label.roles": "Roles",
"label.roletype": "Role Type",
"label.rootdisk": "ROOT disk",
"label.rootdisksize": "Root disk size (GB)",
"label.root.certificate": "Root certificate",
"label.root.disk.offering": "Root Disk Offering",
Expand Down Expand Up @@ -2133,6 +2145,8 @@
"label.templatesubject": "Subject",
"label.templatetotal": "Template",
"label.templatetype": "Template Type",
"label.template.temporary.import": "Use a temporary template for import",
"label.template.select.existing": "Select an existing template",
"label.tftp.dir": "TFTP Directory",
"label.tftpdir": "Tftp root directory",
"label.theme.default": "Default Theme",
Expand All @@ -2151,6 +2165,7 @@
"label.to": "to",
"label.token": "Token",
"label.token.for.dashboard.login": "Token for dashboard login can be retrieved using following command",
"label.tools": "Tools",
"label.total": "Total",
"label.total.hosts": "Total Hosts",
"label.total.memory": "Total Memory",
Expand All @@ -2177,6 +2192,9 @@
"label.unit": "Usage Unit",
"label.unknown": "Unknown",
"label.unlimited": "Unlimited",
"label.unmanage.instance": "Unmanage Instance",
"label.unmanaged.instance": "Unmanaged Instance",
"label.unmanaged.instances": "Unmanaged Instances",
"label.untagged": "Untagged",
"label.update.instance.group": "Update Instance Group",
"label.update.physical.network": "Update Physical Network",
Expand Down Expand Up @@ -2487,7 +2505,10 @@
"message.action.stop.router": "All services provided by this virtual router will be interrupted. Please confirm that you want to stop this router.",
"message.action.stop.systemvm": "Please confirm that you want to stop this system VM.",
"message.action.unmanage.cluster": "Please confirm that you want to unmanage the cluster.",
"message.action.unmanage.instance": "Please confirm that you want to unmanage the instance.",
"message.action.unmanage.instances": "Please confirm that you want to unmanage the instances.",
"message.action.unmanage.virtualmachine": "Please confirm that you want to unmanage the virtual machine.",
"message.action.unmanage.virtualmachines": "Please confirm that you want to unmanage the virtual machines.",
"message.action.vmsnapshot.create": "Please confirm that you want to take a snapshot of this instance. <br>Please notice that the instance will be paused during the snapshoting, and resumed after snapshotting, if it runs on KVM.",
"message.action.vmsnapshot.delete": "Please confirm that you want to delete this VM snapshot. <br>Please notice that the instance will be paused before the snapshot deletion, and resumed after deletion, if it runs on KVM.",
"message.action.vmsnapshot.revert": "Revert VM snapshot",
Expand Down Expand Up @@ -2786,6 +2807,7 @@
"message.enabling.zone.dots": "Enabling zone...",
"message.enter.seperated.list.multiple.cidrs": "Please enter a comma separated list of CIDRs if more than one",
"message.enter.token": "Please enter the token that you were given in your invite e-mail.",
"message.enter.valid.nic.ip": "Please enter a valid IP address for NIC",
"message.error.access.key": "Please enter Access Key",
"message.error.add.guest.network": "Either IPv4 fields or IPv6 fields need to be filled when adding a guest network",
"message.error.add.secondary.ipaddress": "There was an error adding the secondary IP Address",
Expand Down Expand Up @@ -2917,6 +2939,7 @@
"message.guestnetwork.state.shutdown": "Indicates the network configuration is being destroyed",
"message.host.dedicated": "Host Dedicated",
"message.host.dedication.released": "Host dedication released",
"message.desc.importexportinstancewizard": "Import and export instances to/from an existing VMware zone.<br/><br/>This feature only applies Cloudstack VMware zones. By choosing to Manage an instance, CloudStack takes over the orchestration of that instance. The instance is left running and not physically moved. Unmanaging instances, removes CloudStack ability to mange them (but they are left running and not destroyed)",
"message.info.cloudian.console": "Cloudian Management Console should open in another window",
"message.installwizard.click.retry": "Click the button to retry launch.",
"message.installwizard.copy.whatisacluster": "A cluster provides a way to group hosts. The hosts in a cluster all have identical hardware, run the same hypervisor, are on the same subnet, and access the same shared storage. Virtual machine instances (VMs) can be live-migrated from one host to another within the same cluster, without interrupting service to the user. A cluster is the third-largest organizational unit within a CloudStack™; deployment. Clusters are contained within pods, and pods are contained within zones.<br/><br/>CloudStack™; allows multiple clusters in a cloud deployment, but for a Basic Installation, we only need one cluster.",
Expand Down Expand Up @@ -2952,10 +2975,13 @@
"message.installwizard.tooltip.configureguesttraffic.guestnetmask": "The netmask in use on the subnet that the guests should use",
"message.installwizard.tooltip.configureguesttraffic.gueststartip": "The range of IP addresses that will be available for allocation to guests in this zone. If one NIC is used, these IPs should be in the same CIDR as the pod CIDR.",
"message.installwizard.tooltip.configureguesttraffic.name": "A name for your network",
"message.instance.scaled.up.confirm": "Do you really want to scale Up your instance ?",
"message.instances.managed": "Instances or VMs controlled by CloudStack",
"message.instances.scaled.up.confirm": "Do you really want to scale Up your instance ?",
"message.instances.unmanaged": "Instances or VMs not controlled by CloudStack",
"message.instancewizard.notemplates": "You do not have any templates available; please add a compatible template, and re-launch the instance wizard.",
"message.interloadbalance.not.return.elementid": "error: listInternalLoadBalancerElements API doesn't return Internal LB Element Id",
"message.ip.address.changed": "Your IP addresses may have changed; would you like to refresh the listing? Note that in this case the details pane will close.",
"message.ip.address.changes.effect.after.vm.restart": "IP address changes takes effect only after VM restart.",
"message.iso.desc": "Disc image containing data or bootable media for OS",
"message.join.project": "You have now joined a project. Please switch to Project view to see the project.",
"message.kubeconfig.cluster.not.available": "Kubernetes cluster kubeconfig not available currently",
Expand Down Expand Up @@ -3037,6 +3063,7 @@
"message.pending.projects.2": "To view, please go to the projects section, then select invitations from the drop-down.",
"message.please.add.at.lease.one.traffic.range": "Please add at least one traffic range.",
"message.please.confirm.remove.ssh.key.pair": "Please confirm that you want to remove this SSH Key Pair",
"message.please.enter.valid.value": "Please enter a valid value",
"message.please.enter.value": "Please enter values",
"message.please.proceed": "Please proceed to the next step.",
"message.please.select.a.configuration.for.your.zone": "Please select a configuration for your zone.",
Expand Down Expand Up @@ -3110,10 +3137,12 @@
"message.select.a.zone": "A zone typically corresponds to a single datacenter. Multiple zones help make the cloud more reliable by providing physical isolation and redundancy.",
"message.select.affinity.groups": "Please select any affinity groups you want this VM to belong to:",
"message.select.destination.image.stores": "Please select Image Store(s) to which data is to be migrated to",
"message.select.disk.offering": "Please select a disk offering for disk",
"message.select.instance": "Please select an instance.",
"message.select.iso": "Please select an ISO for your new virtual instance.",
"message.select.item": "Please select an item.",
"message.select.migration.policy": "Please select a migration Policy",
"message.select.nic.network": "Please select a network for NIC",
"message.select.security.groups": "Please select security group(s) for your new VM",
"message.select.template": "Please select a template for your new virtual instance.",
"message.select.tier": "Please select a tier",
Expand Down Expand Up @@ -3184,6 +3213,7 @@
"message.success.edit.acl": "Successfully edited ACL rule",
"message.success.edit.rule": "Successfully edited rule",
"message.success.enable.saml.auth": "Successfully enabled SAML Authorization",
"message.success.import.instance": "Successfully imported instance",
"message.success.migrate.volume": "Successfully migrated volume",
"message.success.migrating": "Migration completed successfully for",
"message.success.move.acl.order": "Successfully moved ACL rule",
Expand Down Expand Up @@ -3213,6 +3243,7 @@
"message.success.upload.iso.description": "This ISO file has been uploaded. Please check its status in the Images > ISOs menu",
"message.success.upload.template.description": "This template file has been uploaded. Please check its status at Templates menu",
"message.success.upload.volume.description": "This Volume has been uploaded. Please check its status in the Volumes menu",
"message.success.unmanage.instance": "Successfully unmanaged instance",
"message.suspend.project": "Are you sure you want to suspend this project?",
"message.sussess.discovering.feature": "Discovered all available features!",
"message.switch.to": "Switched to",
Expand All @@ -3221,6 +3252,7 @@
"message.template.copying": "Template is being copied.",
"message.template.desc": "OS image that can be used to boot VMs",
"message.template.iso": "Please select a template or ISO to continue",
"message.template.import.vm.temporary": "If a temporary template is used, reset VM operation will not work after import.",
"message.tier.required": "Tier is required",
"message.tooltip.dns.1": "Name of a DNS server for use by VMs in the zone. The public IP addresses for the zone must have a route to this server.",
"message.tooltip.dns.2": "A second DNS server name for use by VMs in the zone. The public IP addresses for the zone must have a route to this server.",
Expand Down
Loading