mirror of https://github.com/apache/cloudstack.git
Merge branch 'main' into keyboard-shortcuts
This commit is contained in:
commit
b0ecf891f6
|
|
@ -41,6 +41,7 @@ github:
|
|||
features:
|
||||
wiki: true
|
||||
issues: true
|
||||
discussions: true
|
||||
projects: true
|
||||
|
||||
enabled_merge_buttons:
|
||||
|
|
@ -49,15 +50,21 @@ github:
|
|||
rebase: false
|
||||
|
||||
collaborators:
|
||||
- acs-robot
|
||||
- kiranchavala
|
||||
- rajujith
|
||||
- alexandremattioli
|
||||
- vishesh92
|
||||
- GaOrtiga
|
||||
- acs-robot
|
||||
- BryanMLima
|
||||
- SadiJr
|
||||
- JoaoJandre
|
||||
- winterhazel
|
||||
|
||||
protected_branches: ~
|
||||
|
||||
notifications:
|
||||
commits: commits@cloudstack.apache.org
|
||||
issues: commits@cloudstack.apache.org
|
||||
pullrequests: commits@cloudstack.apache.org
|
||||
discussions: users@cloudstack.apache.org
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'apache/cloudstack'
|
||||
|
|
@ -90,6 +93,7 @@ jobs:
|
|||
smoke/test_nic
|
||||
smoke/test_nic_adapter_type
|
||||
smoke/test_non_contigiousvlan
|
||||
smoke/test_object_stores
|
||||
smoke/test_outofbandmanagement
|
||||
smoke/test_outofbandmanagement_nestedplugin
|
||||
smoke/test_over_provisioning
|
||||
|
|
@ -108,7 +112,8 @@ jobs:
|
|||
smoke/test_reset_configuration_settings
|
||||
smoke/test_reset_vm_on_reboot
|
||||
smoke/test_resource_accounting
|
||||
smoke/test_resource_detail",
|
||||
smoke/test_resource_detail
|
||||
smoke/test_global_acls",
|
||||
"smoke/test_router_dhcphosts
|
||||
smoke/test_router_dns
|
||||
smoke/test_router_dnsservice
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-22.04
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
*/
|
||||
package com.cloud.agent.properties;
|
||||
|
||||
import org.apache.cloudstack.utils.security.KeyStoreUtils;
|
||||
|
||||
/**
|
||||
* Class of constant agent's properties available to configure on
|
||||
* "agent.properties".
|
||||
|
|
@ -733,6 +735,13 @@ public class AgentProperties{
|
|||
*/
|
||||
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>
|
||||
|
|
@ -772,6 +781,13 @@ public class AgentProperties{
|
|||
*/
|
||||
public static final Property<Long> KVM_HEARTBEAT_CHECKER_TIMEOUT = new Property<>("kvm.heartbeat.checker.timeout", 360000L);
|
||||
|
||||
/**
|
||||
* Keystore passphrase
|
||||
* Data type: String.<br>
|
||||
* Default value: <code>null</code>
|
||||
*/
|
||||
public static final Property<String> KEYSTORE_PASSPHRASE = new Property<>(KeyStoreUtils.KS_PASSPHRASE_PROPERTY, null, String.class);
|
||||
|
||||
public static class Property <T>{
|
||||
private String name;
|
||||
private T defaultValue;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
@ -29,6 +29,8 @@ import org.apache.cloudstack.api.response.PodResponse;
|
|||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.config.Configuration;
|
||||
import org.apache.cloudstack.ha.HAConfig;
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
import org.apache.cloudstack.usage.Usage;
|
||||
import org.apache.cloudstack.vm.schedule.VMSchedule;
|
||||
|
||||
|
|
@ -318,6 +320,7 @@ public class EventTypes {
|
|||
public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE";
|
||||
public static final String EVENT_DOMAIN_DELETE = "DOMAIN.DELETE";
|
||||
public static final String EVENT_DOMAIN_UPDATE = "DOMAIN.UPDATE";
|
||||
public static final String EVENT_DOMAIN_MOVE = "DOMAIN.MOVE";
|
||||
|
||||
// Snapshots
|
||||
public static final String EVENT_SNAPSHOT_COPY = "SNAPSHOT.COPY";
|
||||
|
|
@ -714,6 +717,16 @@ public class EventTypes {
|
|||
// SystemVM
|
||||
public static final String EVENT_LIVE_PATCH_SYSTEMVM = "LIVE.PATCH.SYSTEM.VM";
|
||||
|
||||
// OBJECT STORE
|
||||
public static final String EVENT_OBJECT_STORE_CREATE = "OBJECT.STORE.CREATE";
|
||||
public static final String EVENT_OBJECT_STORE_DELETE = "OBJECT.STORE.DELETE";
|
||||
public static final String EVENT_OBJECT_STORE_UPDATE = "OBJECT.STORE.UPDATE";
|
||||
|
||||
// BUCKETS
|
||||
public static final String EVENT_BUCKET_CREATE = "BUCKET.CREATE";
|
||||
public static final String EVENT_BUCKET_DELETE = "BUCKET.DELETE";
|
||||
public static final String EVENT_BUCKET_UPDATE = "BUCKET.UPDATE";
|
||||
|
||||
static {
|
||||
|
||||
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
|
||||
|
|
@ -866,6 +879,7 @@ public class EventTypes {
|
|||
entityEventDetails.put(EVENT_DOMAIN_CREATE, Domain.class);
|
||||
entityEventDetails.put(EVENT_DOMAIN_DELETE, Domain.class);
|
||||
entityEventDetails.put(EVENT_DOMAIN_UPDATE, Domain.class);
|
||||
entityEventDetails.put(EVENT_DOMAIN_MOVE, Domain.class);
|
||||
|
||||
// Snapshots
|
||||
entityEventDetails.put(EVENT_SNAPSHOT_CREATE, Snapshot.class);
|
||||
|
|
@ -1151,6 +1165,16 @@ public class EventTypes {
|
|||
entityEventDetails.put(EVENT_IMAGE_STORE_DATA_MIGRATE, ImageStore.class);
|
||||
entityEventDetails.put(EVENT_IMAGE_STORE_OBJECT_DOWNLOAD, ImageStore.class);
|
||||
entityEventDetails.put(EVENT_LIVE_PATCH_SYSTEMVM, "SystemVMs");
|
||||
|
||||
//Object Store
|
||||
entityEventDetails.put(EVENT_OBJECT_STORE_CREATE, ObjectStore.class);
|
||||
entityEventDetails.put(EVENT_OBJECT_STORE_UPDATE, ObjectStore.class);
|
||||
entityEventDetails.put(EVENT_OBJECT_STORE_DELETE, ObjectStore.class);
|
||||
|
||||
//Buckets
|
||||
entityEventDetails.put(EVENT_BUCKET_CREATE, Bucket.class);
|
||||
entityEventDetails.put(EVENT_BUCKET_UPDATE, Bucket.class);
|
||||
entityEventDetails.put(EVENT_BUCKET_DELETE, Bucket.class);
|
||||
}
|
||||
|
||||
public static String getEntityForEvent(String eventName) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import com.cloud.utils.component.Adapter;
|
|||
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 {
|
||||
|
||||
|
|
@ -104,4 +105,25 @@ public interface HypervisorGuru extends Adapter {
|
|||
* @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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,6 +114,8 @@ public interface NetworkService {
|
|||
|
||||
IpAddress getIp(long id);
|
||||
|
||||
IpAddress getIp(String ipAddress);
|
||||
|
||||
Network updateGuestNetwork(final UpdateNetworkCmd cmd);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -69,7 +69,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
|
|||
GuestOs(false, true),
|
||||
NetworkOffering(false, true),
|
||||
VpcOffering(true, false),
|
||||
Domain(false, false, true);
|
||||
Domain(false, false, true),
|
||||
ObjectStore(false, false, true);
|
||||
|
||||
|
||||
ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ package com.cloud.storage;
|
|||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public enum DataStoreRole {
|
||||
Primary("primary"), Image("image"), ImageCache("imagecache"), Backup("backup");
|
||||
Primary("primary"), Image("image"), ImageCache("imagecache"), Backup("backup"), Object("object");
|
||||
|
||||
public boolean isImageStore() {
|
||||
return (role.equalsIgnoreCase("image") || role.equalsIgnoreCase("imagecache")) ? true : false;
|
||||
|
|
@ -45,6 +45,8 @@ public enum DataStoreRole {
|
|||
return ImageCache;
|
||||
} else if (role.equalsIgnoreCase("backup")) {
|
||||
return Backup;
|
||||
} else if (role.equalsIgnoreCase("object")) {
|
||||
return Object;
|
||||
} else {
|
||||
throw new CloudRuntimeException("can't identify the role");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,13 +77,18 @@ public class Storage {
|
|||
}
|
||||
|
||||
public static enum Capability {
|
||||
HARDWARE_ACCELERATION("HARDWARE_ACCELERATION");
|
||||
HARDWARE_ACCELERATION("HARDWARE_ACCELERATION"),
|
||||
ALLOW_MIGRATE_OTHER_POOLS("ALLOW_MIGRATE_OTHER_POOLS");
|
||||
|
||||
private final String capability;
|
||||
|
||||
private Capability(String capability) {
|
||||
this.capability = capability;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.capability;
|
||||
}
|
||||
}
|
||||
|
||||
public static enum ProvisioningType {
|
||||
|
|
@ -150,7 +155,8 @@ public class Storage {
|
|||
ManagedNFS(true, false, false),
|
||||
Linstor(true, true, false),
|
||||
DatastoreCluster(true, true, false), // for VMware, to abstract pool of clusters
|
||||
StorPool(true, true, true);
|
||||
StorPool(true, true, true),
|
||||
FiberChannel(true, true, false); // Fiber Channel Pool for KVM hypervisors is used to find the volume by WWN value (/dev/disk/by-id/wwn-<wwnvalue>)
|
||||
|
||||
private final boolean shared;
|
||||
private final boolean overprovisioning;
|
||||
|
|
|
|||
|
|
@ -24,9 +24,11 @@ import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaint
|
|||
import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeleteObjectStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.SyncStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.UpdateObjectStoragePoolCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
|
|
@ -34,6 +36,11 @@ import com.cloud.exception.InsufficientCapacityException;
|
|||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.exception.ResourceInUseException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import org.apache.cloudstack.api.command.admin.storage.heuristics.CreateSecondaryStorageSelectorCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.heuristics.RemoveSecondaryStorageSelectorCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.heuristics.UpdateSecondaryStorageSelectorCmd;
|
||||
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
|
||||
public interface StorageService {
|
||||
/**
|
||||
|
|
@ -109,4 +116,15 @@ public interface StorageService {
|
|||
|
||||
StoragePool syncStoragePool(SyncStoragePoolCmd cmd);
|
||||
|
||||
Heuristic createSecondaryStorageHeuristic(CreateSecondaryStorageSelectorCmd cmd);
|
||||
|
||||
Heuristic updateSecondaryStorageHeuristic(UpdateSecondaryStorageSelectorCmd cmd);
|
||||
|
||||
void removeSecondaryStorageHeuristic(RemoveSecondaryStorageSelectorCmd cmd);
|
||||
|
||||
ObjectStore discoverObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
|
||||
|
||||
boolean deleteObjectStore(DeleteObjectStoragePoolCmd cmd);
|
||||
|
||||
ObjectStore updateObjectStore(Long id, UpdateObjectStoragePoolCmd cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ import java.util.List;
|
|||
|
||||
import org.apache.cloudstack.api.command.admin.domain.ListDomainChildrenCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.domain.MoveDomainCmd;
|
||||
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
public interface DomainService {
|
||||
|
|
@ -66,4 +68,5 @@ public interface DomainService {
|
|||
*/
|
||||
Domain findDomainByIdOrPath(Long id, String domainPath);
|
||||
|
||||
Domain moveDomainAndChildrenToNewParentDomain(MoveDomainCmd cmd) throws ResourceAllocationException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package com.cloud.vm;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -518,7 +519,8 @@ public interface UserVmService {
|
|||
|
||||
UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemplate template, final String instanceName, final String displayName, final Account owner, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard,
|
||||
final long accountId, final long userId, final ServiceOffering serviceOffering, final String sshPublicKey,
|
||||
final String hostName, final HypervisorType hypervisorType, final Map<String, String> customParameters, final VirtualMachine.PowerState powerState) throws InsufficientCapacityException;
|
||||
final String hostName, final HypervisorType hypervisorType, final Map<String, String> customParameters,
|
||||
final VirtualMachine.PowerState powerState, final LinkedHashMap<String, List<NicProfile>> networkNicMap) throws InsufficientCapacityException;
|
||||
|
||||
/**
|
||||
* Unmanage a guest VM from CloudStack
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public interface VmDetailConstants {
|
|||
// KVM specific (internal)
|
||||
String KVM_VNC_PORT = "kvm.vnc.port";
|
||||
String KVM_VNC_ADDRESS = "kvm.vnc.address";
|
||||
String KVM_VNC_PASSWORD = "kvm.vnc.password";
|
||||
|
||||
// KVM specific, custom virtual GPU hardware
|
||||
String VIDEO_HARDWARE = "video.hardware";
|
||||
|
|
@ -86,4 +87,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ public interface AnnotationService {
|
|||
SERVICE_OFFERING(false), DISK_OFFERING(false), NETWORK_OFFERING(false),
|
||||
ZONE(false), POD(false), CLUSTER(false), HOST(false), DOMAIN(false),
|
||||
PRIMARY_STORAGE(false), SECONDARY_STORAGE(false), VR(false), SYSTEM_VM(false),
|
||||
AUTOSCALE_VM_GROUP(true), MANAGEMENT_SERVER(false),;
|
||||
AUTOSCALE_VM_GROUP(true), MANAGEMENT_SERVER(false), OBJECT_STORAGE(false);
|
||||
|
||||
private final boolean usersAllowed;
|
||||
|
||||
|
|
@ -78,6 +78,7 @@ public interface AnnotationService {
|
|||
list.add(EntityType.VR);
|
||||
list.add(EntityType.SYSTEM_VM);
|
||||
list.add(EntityType.MANAGEMENT_SERVER);
|
||||
list.add(EntityType.OBJECT_STORAGE);
|
||||
if (roleType != RoleType.DomainAdmin) {
|
||||
list.add(EntityType.DOMAIN);
|
||||
list.add(EntityType.SERVICE_OFFERING);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,9 @@ public enum ApiCommandResourceType {
|
|||
VmSnapshot(com.cloud.vm.snapshot.VMSnapshot.class),
|
||||
Role(org.apache.cloudstack.acl.Role.class),
|
||||
VpnCustomerGateway(com.cloud.network.Site2SiteCustomerGateway.class),
|
||||
ManagementServer(org.apache.cloudstack.management.ManagementServerHost.class);
|
||||
ManagementServer(org.apache.cloudstack.management.ManagementServerHost.class),
|
||||
ObjectStore(org.apache.cloudstack.storage.object.ObjectStore.class),
|
||||
Bucket(org.apache.cloudstack.storage.object.Bucket.class);
|
||||
|
||||
private final Class<?> clazz;
|
||||
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -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";
|
||||
|
|
@ -207,7 +210,9 @@ 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 = "host";
|
||||
public static final String HOST_CONTROL_STATE = "hostcontrolstate";
|
||||
public static final String HOSTS_MAP = "hostsmap";
|
||||
public static final String HYPERVISOR = "hypervisor";
|
||||
|
|
@ -779,6 +784,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";
|
||||
|
|
@ -1049,10 +1055,23 @@ public class ApiConstants {
|
|||
public static final String MTU = "mtu";
|
||||
public static final String AUTO_ENABLE_KVM_HOST = "autoenablekvmhost";
|
||||
public static final String LIST_APIS = "listApis";
|
||||
public static final String OBJECT_STORAGE_ID = "objectstorageid";
|
||||
public static final String VERSIONING = "versioning";
|
||||
public static final String OBJECT_LOCKING = "objectlocking";
|
||||
public static final String ENCRYPTION = "encryption";
|
||||
public static final String QUOTA = "quota";
|
||||
public static final String ACCESS_KEY = "accesskey";
|
||||
|
||||
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 DISK_PATH = "diskpath";
|
||||
public static final String IMPORT_SOURCE = "importsource";
|
||||
public static final String TEMP_PATH = "temppath";
|
||||
public static final String OBJECT_STORAGE = "objectstore";
|
||||
|
||||
public static final String HEURISTIC_RULE = "heuristicrule";
|
||||
public static final String HEURISTIC_TYPE_VALID_OPTIONS = "Valid options are: ISO, SNAPSHOT, TEMPLATE and VOLUME.";
|
||||
|
||||
public static final String MANAGEMENT = "management";
|
||||
public static final String IS_VNF = "isvnf";
|
||||
|
|
@ -1066,6 +1085,10 @@ public class ApiConstants {
|
|||
public static final String CLIENT_ID = "clientid";
|
||||
public static final String REDIRECT_URI = "redirecturi";
|
||||
|
||||
public static final String IS_TAG_A_RULE = "istagarule";
|
||||
|
||||
public static final String PARAMETER_DESCRIPTION_IS_TAG_A_RULE = "Whether the informed tag is a JS interpretable rule or not.";
|
||||
|
||||
/**
|
||||
* This enum specifies IO Drivers, each option controls specific policies on I/O.
|
||||
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
|
|||
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
|
||||
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
|
||||
import org.apache.cloudstack.query.QueryService;
|
||||
import org.apache.cloudstack.storage.object.BucketApiService;
|
||||
import org.apache.cloudstack.storage.ImageStoreService;
|
||||
import org.apache.cloudstack.storage.template.VnfTemplateManager;
|
||||
import org.apache.cloudstack.usage.UsageService;
|
||||
|
|
@ -216,6 +217,9 @@ public abstract class BaseCmd {
|
|||
public Ipv6Service ipv6Service;
|
||||
@Inject
|
||||
public VnfTemplateManager vnfTemplateManager;
|
||||
@Inject
|
||||
public BucketApiService _bucketService;
|
||||
|
||||
|
||||
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
|
||||
ResourceAllocationException, NetworkRuleConflictException;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
import org.apache.cloudstack.affinity.AffinityGroup;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupResponse;
|
||||
import org.apache.cloudstack.api.ApiConstants.HostDetails;
|
||||
|
|
@ -37,6 +38,7 @@ import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
|
|||
import org.apache.cloudstack.api.response.BackupOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.BackupResponse;
|
||||
import org.apache.cloudstack.api.response.BackupScheduleResponse;
|
||||
import org.apache.cloudstack.api.response.BucketResponse;
|
||||
import org.apache.cloudstack.api.response.CapacityResponse;
|
||||
import org.apache.cloudstack.api.response.ClusterResponse;
|
||||
import org.apache.cloudstack.api.response.ConditionResponse;
|
||||
|
|
@ -82,6 +84,7 @@ import org.apache.cloudstack.api.response.NetworkPermissionsResponse;
|
|||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.NicResponse;
|
||||
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
|
||||
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||
import org.apache.cloudstack.api.response.OvsProviderResponse;
|
||||
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
|
||||
import org.apache.cloudstack.api.response.PodResponse;
|
||||
|
|
@ -101,6 +104,7 @@ import org.apache.cloudstack.api.response.ResourceTagResponse;
|
|||
import org.apache.cloudstack.api.response.RollingMaintenanceResponse;
|
||||
import org.apache.cloudstack.api.response.RouterHealthCheckResultResponse;
|
||||
import org.apache.cloudstack.api.response.SSHKeyPairResponse;
|
||||
import org.apache.cloudstack.api.response.SecondaryStorageHeuristicsResponse;
|
||||
import org.apache.cloudstack.api.response.SecurityGroupResponse;
|
||||
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.ServiceResponse;
|
||||
|
|
@ -119,6 +123,7 @@ import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
|
|||
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;
|
||||
|
|
@ -145,6 +150,8 @@ import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
|
|||
import org.apache.cloudstack.region.PortableIp;
|
||||
import org.apache.cloudstack.region.PortableIpRange;
|
||||
import org.apache.cloudstack.region.Region;
|
||||
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
import org.apache.cloudstack.usage.Usage;
|
||||
|
||||
import com.cloud.capacity.Capacity;
|
||||
|
|
@ -231,6 +238,7 @@ import com.cloud.vm.Nic;
|
|||
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);
|
||||
|
|
@ -532,5 +540,13 @@ public interface ResponseGenerator {
|
|||
|
||||
FirewallResponse createIpv6FirewallRuleResponse(FirewallRule acl);
|
||||
|
||||
UnmanagedInstanceResponse createUnmanagedInstanceResponse(UnmanagedInstanceTO instance, Cluster cluster, Host host);
|
||||
|
||||
SecondaryStorageHeuristicsResponse createSecondaryStorageSelectorResponse(Heuristic heuristic);
|
||||
|
||||
IpQuarantineResponse createQuarantinedIpsResponse(PublicIpQuarantine publicIp);
|
||||
|
||||
ObjectStoreResponse createObjectStoreResponse(ObjectStore os);
|
||||
|
||||
BucketResponse createBucketResponse(Bucket bucket);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.domain;
|
||||
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
|
||||
@APICommand(name = "moveDomain", description = "Moves a domain and its children to a new parent domain.", since = "4.19.0.0", responseObject = DomainResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin})
|
||||
public class MoveDomainCmd extends BaseCmd {
|
||||
|
||||
private static final String APINAME = "moveDomain";
|
||||
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, required = true, entityType = DomainResponse.class, description = "The ID of the domain to be moved.")
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name = ApiConstants.PARENT_DOMAIN_ID, type = CommandType.UUID, required = true, entityType = DomainResponse.class,
|
||||
description = "The ID of the new parent domain of the domain to be moved.")
|
||||
private Long parentDomainId;
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public Long getParentDomainId() {
|
||||
return parentDomainId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return APINAME.toLowerCase() + BaseCmd.RESPONSE_SUFFIX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceAllocationException {
|
||||
Domain domain = _domainService.moveDomainAndChildrenToNewParentDomain(this);
|
||||
|
||||
if (domain != null) {
|
||||
DomainResponse response = _responseGenerator.createDomainResponse(domain);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move the domain.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -60,6 +60,9 @@ public class UpdateHostCmd extends BaseCmd {
|
|||
@Parameter(name = ApiConstants.HOST_TAGS, type = CommandType.LIST, collectionType = CommandType.STRING, description = "list of tags to be added to the host")
|
||||
private List<String> hostTags;
|
||||
|
||||
@Parameter(name = ApiConstants.IS_TAG_A_RULE, type = CommandType.BOOLEAN, description = ApiConstants.PARAMETER_DESCRIPTION_IS_TAG_A_RULE)
|
||||
private Boolean isTagARule;
|
||||
|
||||
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, description = "the new uri for the secondary storage: nfs://host/path")
|
||||
private String url;
|
||||
|
||||
|
|
@ -90,6 +93,10 @@ public class UpdateHostCmd extends BaseCmd {
|
|||
return hostTags;
|
||||
}
|
||||
|
||||
public Boolean getIsTagARule() {
|
||||
return isTagARule;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,132 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.storage;
|
||||
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
@APICommand(name = "addObjectStoragePool", description = "Adds a object storage pool", responseObject = ObjectStoreResponse.class, since = "4.19.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class AddObjectStoragePoolCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(AddObjectStoragePoolCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name for the object store")
|
||||
private String name;
|
||||
|
||||
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, length = 2048, required = true, description = "the URL for the object store")
|
||||
private String url;
|
||||
|
||||
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, required = true, description = "the object store provider name")
|
||||
private String providerName;
|
||||
|
||||
@Parameter(name = ApiConstants.DETAILS,
|
||||
type = CommandType.MAP,
|
||||
description = "the details for the object store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss")
|
||||
private Map details;
|
||||
|
||||
@Parameter(name = ApiConstants.TAGS, type = CommandType.STRING, description = "the tags for the storage pool")
|
||||
private String tags;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
Map<String, String> detailsMap = null;
|
||||
if (details != null && !details.isEmpty()) {
|
||||
detailsMap = new HashMap<String, String>();
|
||||
Collection<?> props = details.values();
|
||||
Iterator<?> iter = props.iterator();
|
||||
while (iter.hasNext()) {
|
||||
HashMap<String, String> detail = (HashMap<String, String>)iter.next();
|
||||
String key = detail.get(ApiConstants.KEY);
|
||||
String value = detail.get(ApiConstants.VALUE);
|
||||
detailsMap.put(key, value);
|
||||
}
|
||||
}
|
||||
return detailsMap;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
return providerName;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public void setProviderName(String providerName) {
|
||||
this.providerName = providerName;
|
||||
}
|
||||
|
||||
public void setDetails(Map<String, String> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
try{
|
||||
ObjectStore result = _storageService.discoverObjectStore(getName(), getUrl(), getProviderName(), getDetails());
|
||||
ObjectStoreResponse storeResponse = null;
|
||||
if (result != null) {
|
||||
storeResponse = _responseGenerator.createObjectStoreResponse(result);
|
||||
storeResponse.setResponseName(getCommandName());
|
||||
storeResponse.setObjectName("objectstore");
|
||||
setResponseObject(storeResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add object storage");
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
s_logger.error("Exception: ", ex);
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -90,6 +90,9 @@ public class CreateStoragePoolCmd extends BaseCmd {
|
|||
description = "hypervisor type of the hosts in zone that will be attached to this storage pool. KVM, VMware supported as of now.")
|
||||
private String hypervisor;
|
||||
|
||||
@Parameter(name = ApiConstants.IS_TAG_A_RULE, type = CommandType.BOOLEAN, description = ApiConstants.PARAMETER_DESCRIPTION_IS_TAG_A_RULE)
|
||||
private Boolean isTagARule;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -146,6 +149,10 @@ public class CreateStoragePoolCmd extends BaseCmd {
|
|||
return hypervisor;
|
||||
}
|
||||
|
||||
public Boolean isTagARule() {
|
||||
return this.isTagARule;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.storage;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "deleteObjectStoragePool", description = "Deletes an Object Storage Pool", responseObject = SuccessResponse.class, since = "4.19.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class DeleteObjectStoragePoolCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteObjectStoragePoolCmd.class.getName());
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ObjectStoreResponse.class, required = true, description = "The Object Storage ID.")
|
||||
private Long id;
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
boolean result = _storageService.deleteObjectStore(this);
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete object store");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.storage;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "listObjectStoragePools", description = "Lists object storage pools.", responseObject = ObjectStoreResponse.class, since = "4.19.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
|
||||
public class ListObjectStoragePoolsCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListObjectStoragePoolsCmd.class.getName());
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the object store")
|
||||
private String storeName;
|
||||
|
||||
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "the object store provider")
|
||||
private String provider;
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ObjectStoreResponse.class, description = "the ID of the storage pool")
|
||||
private Long id;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public String getStoreName() {
|
||||
return storeName;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ListResponse<ObjectStoreResponse> response = _queryService.searchForObjectStores(this);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.storage;
|
||||
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
|
||||
@APICommand(name = UpdateObjectStoragePoolCmd.APINAME, description = "Updates object storage pool", responseObject = ObjectStoreResponse.class, entityType = {ObjectStore.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0")
|
||||
public class UpdateObjectStoragePoolCmd extends BaseCmd {
|
||||
public static final String APINAME = "updateObjectStoragePool";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ObjectStoreResponse.class, required = true, description = "Object Store ID")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name for the object store")
|
||||
private String name;
|
||||
|
||||
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, description = "the url for the object store")
|
||||
private String url;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ObjectStore result = _storageService.updateObjectStore(getId(), this);
|
||||
|
||||
ObjectStoreResponse storeResponse = null;
|
||||
if (result != null) {
|
||||
storeResponse = _responseGenerator.createObjectStoreResponse(result);
|
||||
storeResponse.setResponseName(getCommandName());
|
||||
storeResponse.setObjectName("objectstore");
|
||||
setResponseObject(storeResponse);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update object storage");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return APINAME;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return CallContext.current().getCallingAccountId();
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.cloudstack.api.command.admin.storage;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -32,6 +33,7 @@ import org.apache.cloudstack.api.response.StoragePoolResponse;
|
|||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@APICommand(name = "updateStoragePool", description = "Updates a storage pool.", responseObject = StoragePoolResponse.class, since = "3.0.0",
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class UpdateStoragePoolCmd extends BaseCmd {
|
||||
|
|
@ -61,6 +63,23 @@ public class UpdateStoragePoolCmd extends BaseCmd {
|
|||
" enable it back.")
|
||||
private Boolean enabled;
|
||||
|
||||
@Parameter(name = ApiConstants.DETAILS,
|
||||
type = CommandType.MAP,
|
||||
required = false,
|
||||
description = "the details for the storage pool",
|
||||
since = "4.19.0")
|
||||
private Map details;
|
||||
|
||||
@Parameter(name = ApiConstants.URL,
|
||||
type = CommandType.STRING,
|
||||
required = false,
|
||||
description = "the URL of the storage pool",
|
||||
since = "4.19.0")
|
||||
private String url;
|
||||
|
||||
@Parameter(name = ApiConstants.IS_TAG_A_RULE, type = CommandType.BOOLEAN, description = ApiConstants.PARAMETER_DESCRIPTION_IS_TAG_A_RULE)
|
||||
private Boolean isTagARule;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -89,6 +108,10 @@ public class UpdateStoragePoolCmd extends BaseCmd {
|
|||
return enabled;
|
||||
}
|
||||
|
||||
public Boolean isTagARule() {
|
||||
return isTagARule;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -108,6 +131,22 @@ public class UpdateStoragePoolCmd extends BaseCmd {
|
|||
return ApiCommandResourceType.StoragePool;
|
||||
}
|
||||
|
||||
public Map<String,String> getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setDetails(Map<String,String> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
StoragePool result = _storageService.updateStoragePool(this);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,93 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.storage.heuristics;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.SecondaryStorageHeuristicsResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
|
||||
|
||||
import static org.apache.cloudstack.api.ApiConstants.HEURISTIC_TYPE_VALID_OPTIONS;
|
||||
|
||||
@APICommand(name = "createSecondaryStorageSelector", description = "Creates a secondary storage selector, described by the heuristic rule.", since = "4.19.0", responseObject =
|
||||
SecondaryStorageHeuristicsResponse.class, entityType = {Heuristic.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = {RoleType.Admin})
|
||||
public class CreateSecondaryStorageSelectorCmd extends BaseCmd{
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, required = true, type = CommandType.STRING, description = "The name identifying the heuristic rule.")
|
||||
private String name;
|
||||
|
||||
@Parameter(name = ApiConstants.DESCRIPTION, required = true, type = BaseCmd.CommandType.STRING, description = "The description of the heuristic rule.")
|
||||
private String description;
|
||||
|
||||
@Parameter(name = ApiConstants.ZONE_ID, required = true, entityType = ZoneResponse.class, type = BaseCmd.CommandType.UUID, description = "The zone in which the heuristic " +
|
||||
"rule will be applied.")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name = ApiConstants.TYPE, required = true, type = BaseCmd.CommandType.STRING, description =
|
||||
"The resource type directed to a specific secondary storage by the selector. " + HEURISTIC_TYPE_VALID_OPTIONS)
|
||||
private String type;
|
||||
|
||||
@Parameter(name = ApiConstants.HEURISTIC_RULE, required = true, type = BaseCmd.CommandType.STRING, description = "The heuristic rule, in JavaScript language. It is required " +
|
||||
"that it returns the UUID of a secondary storage pool. An example of a rule is `if (snapshot.hypervisorType === 'KVM') { '7832f261-c602-4e8e-8580-2496ffbbc45d'; " +
|
||||
"}` would allocate all snapshots with the KVM hypervisor to the specified secondary storage UUID.", length = 65535)
|
||||
private String heuristicRule;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getHeuristicRule() {
|
||||
return heuristicRule;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Heuristic heuristic = _storageService.createSecondaryStorageHeuristic(this);
|
||||
|
||||
if (heuristic == null) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a secondary storage selector.");
|
||||
}
|
||||
|
||||
SecondaryStorageHeuristicsResponse response = _responseGenerator.createSecondaryStorageSelectorResponse(heuristic);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 org.apache.cloudstack.api.command.admin.storage.heuristics;
|
||||
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.SecondaryStorageHeuristicsResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
|
||||
|
||||
import static org.apache.cloudstack.api.ApiConstants.HEURISTIC_TYPE_VALID_OPTIONS;
|
||||
|
||||
@APICommand(name = "listSecondaryStorageSelectors", description = "Lists the secondary storage selectors and their rules.", since = "4.19.0", responseObject =
|
||||
SecondaryStorageHeuristicsResponse.class, requestHasSensitiveInfo = false, entityType = {Heuristic.class}, responseHasSensitiveInfo = false, authorized = {RoleType.Admin})
|
||||
public class ListSecondaryStorageSelectorsCmd extends BaseListCmd {
|
||||
|
||||
@Parameter(name = ApiConstants.ZONE_ID, required = true, entityType = ZoneResponse.class, type = CommandType.UUID, description = "The zone ID to be used in the search filter.")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description =
|
||||
"Whether to filter the selectors by type and, if so, which one. " + HEURISTIC_TYPE_VALID_OPTIONS)
|
||||
private String type;
|
||||
|
||||
@Parameter(name = ApiConstants.SHOW_REMOVED, type = CommandType.BOOLEAN, description = "Show removed heuristics.")
|
||||
private boolean showRemoved = false;
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public boolean isShowRemoved() {
|
||||
return showRemoved;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ListResponse<SecondaryStorageHeuristicsResponse> response = _queryService.listSecondaryStorageSelectors(this);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.storage.heuristics;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.SecondaryStorageHeuristicsResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
|
||||
|
||||
@APICommand(name = "removeSecondaryStorageSelector", description = "Removes an existing secondary storage selector.", since = "4.19.0", responseObject =
|
||||
SecondaryStorageHeuristicsResponse.class, requestHasSensitiveInfo = false, entityType = {Heuristic.class}, responseHasSensitiveInfo = false, authorized = {RoleType.Admin})
|
||||
public class RemoveSecondaryStorageSelectorCmd extends BaseCmd {
|
||||
@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = SecondaryStorageHeuristicsResponse.class, required = true,
|
||||
description = "The unique identifier of the secondary storage selector to be removed.")
|
||||
private Long id;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
_storageService.removeSecondaryStorageHeuristic(this);
|
||||
final SuccessResponse response = new SuccessResponse();
|
||||
response.setResponseName(getCommandName());
|
||||
response.setSuccess(true);
|
||||
setResponseObject(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.storage.heuristics;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.SecondaryStorageHeuristicsResponse;
|
||||
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
|
||||
|
||||
@APICommand(name = "updateSecondaryStorageSelector", description = "Updates an existing secondary storage selector.", since = "4.19.0", responseObject =
|
||||
SecondaryStorageHeuristicsResponse.class, requestHasSensitiveInfo = false, entityType = {Heuristic.class}, responseHasSensitiveInfo = false, authorized = {RoleType.Admin})
|
||||
public class UpdateSecondaryStorageSelectorCmd extends BaseCmd {
|
||||
@Parameter(name = ApiConstants.ID, type = BaseCmd.CommandType.UUID, entityType = SecondaryStorageHeuristicsResponse.class, required = true,
|
||||
description = "The unique identifier of the secondary storage selector.")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.HEURISTIC_RULE, required = true, type = BaseCmd.CommandType.STRING, description = "The heuristic rule, in JavaScript language. It is required " +
|
||||
"that it returns the UUID of a secondary storage pool. An example of a rule is `if (snapshot.hypervisorType === 'KVM') { '7832f261-c602-4e8e-8580-2496ffbbc45d'; " +
|
||||
"}` would allocate all snapshots with the KVM hypervisor to the specified secondary storage UUID.", length = 65535)
|
||||
private String heuristicRule;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getHeuristicRule() {
|
||||
return heuristicRule;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Heuristic heuristic = _storageService.updateSecondaryStorageHeuristic(this);
|
||||
|
||||
if (heuristic == null) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update the secondary storage selector.");
|
||||
}
|
||||
|
||||
SecondaryStorageHeuristicsResponse response = _responseGenerator.createSecondaryStorageSelectorResponse(heuristic);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd {
|
|||
@Parameter(name = ApiConstants.NAME,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "the hypervisor name of the instance")
|
||||
description = "the name of the instance as it is known to the hypervisor")
|
||||
private String name;
|
||||
|
||||
@Parameter(name = ApiConstants.DISPLAY_NAME,
|
||||
|
|
@ -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,
|
||||
|
|
@ -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;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -279,7 +279,8 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Importing unmanaged VM";
|
||||
String vmName = this.name;
|
||||
return String.format("Importing unmanaged VM: %s", vmName);
|
||||
}
|
||||
|
||||
public boolean isForced() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,258 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.vm;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
import org.apache.cloudstack.api.response.VmwareDatacenterResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.vm.VmImportService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@APICommand(name = "importVm",
|
||||
description = "Import virtual machine from a unmanaged host into CloudStack",
|
||||
responseObject = UserVmResponse.class,
|
||||
responseView = ResponseObject.ResponseView.Full,
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = true,
|
||||
authorized = {RoleType.Admin},
|
||||
since = "4.19.0")
|
||||
public class ImportVmCmd extends ImportUnmanagedInstanceCmd {
|
||||
public static final Logger LOGGER = Logger.getLogger(ImportVmCmd.class);
|
||||
|
||||
@Inject
|
||||
public VmImportService vmImportService;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@Parameter(name = ApiConstants.ZONE_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = ZoneResponse.class,
|
||||
required = true,
|
||||
description = "the zone ID")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name = ApiConstants.USERNAME,
|
||||
type = CommandType.STRING,
|
||||
description = "the username for the host")
|
||||
private String username;
|
||||
|
||||
@Parameter(name = ApiConstants.PASSWORD,
|
||||
type = CommandType.STRING,
|
||||
description = "the password for the host")
|
||||
private String password;
|
||||
|
||||
@Parameter(name = ApiConstants.HOST,
|
||||
type = CommandType.STRING,
|
||||
description = "the host name or IP address")
|
||||
private String host;
|
||||
|
||||
@Parameter(name = ApiConstants.HYPERVISOR,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "hypervisor type of the host")
|
||||
private String hypervisor;
|
||||
|
||||
@Parameter(name = ApiConstants.DISK_PATH,
|
||||
type = CommandType.STRING,
|
||||
description = "path of the disk image")
|
||||
private String diskPath;
|
||||
|
||||
@Parameter(name = ApiConstants.IMPORT_SOURCE,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "Source location for Import" )
|
||||
private String importSource;
|
||||
|
||||
@Parameter(name = ApiConstants.NETWORK_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = NetworkResponse.class,
|
||||
description = "the network ID")
|
||||
private Long networkId;
|
||||
|
||||
@Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, description = "Host where local disk is located")
|
||||
private Long hostId;
|
||||
|
||||
@Parameter(name = ApiConstants.STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, description = "Shared storage pool where disk is located")
|
||||
private Long storagePoolId;
|
||||
|
||||
@Parameter(name = ApiConstants.TEMP_PATH,
|
||||
type = CommandType.STRING,
|
||||
description = "Temp Path on external host for disk image copy" )
|
||||
private String tmpPath;
|
||||
|
||||
// Import from Vmware to KVM migration parameters
|
||||
|
||||
@Parameter(name = ApiConstants.EXISTING_VCENTER_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = VmwareDatacenterResponse.class,
|
||||
description = "(only for importing migrated VMs from Vmware to KVM) UUID of a linked existing vCenter")
|
||||
private Long existingVcenterId;
|
||||
|
||||
@Parameter(name = ApiConstants.HOST_IP,
|
||||
type = BaseCmd.CommandType.STRING,
|
||||
description = "(only for importing migrated VMs from Vmware to KVM) VMware ESXi host IP/Name.")
|
||||
private String hostip;
|
||||
|
||||
@Parameter(name = ApiConstants.VCENTER,
|
||||
type = CommandType.STRING,
|
||||
description = "(only for importing migrated VMs from Vmware to KVM) The name/ip of vCenter. Make sure it is IP address or full qualified domain name for host running vCenter server.")
|
||||
private String vcenter;
|
||||
|
||||
@Parameter(name = ApiConstants.DATACENTER_NAME, type = CommandType.STRING,
|
||||
description = "(only for importing migrated VMs from Vmware to KVM) Name of VMware datacenter.")
|
||||
private String datacenterName;
|
||||
|
||||
@Parameter(name = ApiConstants.CLUSTER_NAME, type = CommandType.STRING,
|
||||
description = "(only for importing migrated VMs from Vmware to KVM) Name of VMware cluster.")
|
||||
private String clusterName;
|
||||
|
||||
@Parameter(name = ApiConstants.CONVERT_INSTANCE_HOST_ID, type = CommandType.UUID, entityType = HostResponse.class,
|
||||
description = "(only for importing migrated VMs from Vmware to KVM) optional - the host to perform the virt-v2v migration from VMware to KVM.")
|
||||
private Long convertInstanceHostId;
|
||||
|
||||
@Parameter(name = ApiConstants.CONVERT_INSTANCE_STORAGE_POOL_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class,
|
||||
description = "(only for importing migrated VMs from Vmware to KVM) optional - the temporary storage pool to perform the virt-v2v migration from VMware to KVM.")
|
||||
private Long convertStoragePoolId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public Long getExistingVcenterId() {
|
||||
return existingVcenterId;
|
||||
}
|
||||
|
||||
public String getHostIp() {
|
||||
return hostip;
|
||||
}
|
||||
|
||||
public String getVcenter() {
|
||||
return vcenter;
|
||||
}
|
||||
|
||||
public String getDatacenterName() {
|
||||
return datacenterName;
|
||||
}
|
||||
|
||||
public String getClusterName() {
|
||||
return clusterName;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public Long getConvertInstanceHostId() {
|
||||
return convertInstanceHostId;
|
||||
}
|
||||
|
||||
public Long getConvertStoragePoolId() {
|
||||
return convertStoragePoolId;
|
||||
}
|
||||
|
||||
public String getHypervisor() {
|
||||
return hypervisor;
|
||||
}
|
||||
|
||||
public String getDiskPath() {
|
||||
return diskPath;
|
||||
}
|
||||
|
||||
public String getImportSource() {
|
||||
return importSource;
|
||||
}
|
||||
|
||||
public Long getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
||||
public Long getStoragePoolId() {
|
||||
return storagePoolId;
|
||||
}
|
||||
|
||||
public String getTmpPath() {
|
||||
return tmpPath;
|
||||
}
|
||||
|
||||
public Long getNetworkId() {
|
||||
return networkId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_VM_IMPORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
String vmName = getName();
|
||||
if (ObjectUtils.anyNotNull(vcenter, existingVcenterId)) {
|
||||
String msg = StringUtils.isNotBlank(vcenter) ?
|
||||
String.format("external vCenter: %s - datacenter: %s", vcenter, datacenterName) :
|
||||
String.format("existing vCenter Datacenter with ID: %s", existingVcenterId);
|
||||
return String.format("Importing unmanaged VM: %s from %s - VM: %s", getDisplayName(), msg, vmName);
|
||||
}
|
||||
return String.format("Importing unmanaged VM: %s", vmName);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
UserVmResponse response = vmImportService.importVm(this);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
// 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 org.apache.cloudstack.api.command.admin.vm;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
import com.cloud.exception.NetworkRuleConflictException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.UnmanagedInstanceResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.vm.UnmanagedInstanceTO;
|
||||
import org.apache.cloudstack.vm.VmImportService;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@APICommand(name = "listVmsForImport",
|
||||
description = "Lists virtual machines on a unmanaged host",
|
||||
responseObject = UnmanagedInstanceResponse.class,
|
||||
responseView = ResponseObject.ResponseView.Full,
|
||||
entityType = {UnmanagedInstanceTO.class},
|
||||
requestHasSensitiveInfo = false,
|
||||
responseHasSensitiveInfo = true,
|
||||
authorized = {RoleType.Admin},
|
||||
since = "4.19.0")
|
||||
public class ListVmsForImportCmd extends BaseListCmd {
|
||||
public static final Logger LOGGER = Logger.getLogger(ListVmsForImportCmd.class.getName());
|
||||
|
||||
@Inject
|
||||
public VmImportService vmImportService;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ZONE_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = ZoneResponse.class,
|
||||
required = true,
|
||||
description = "the zone ID")
|
||||
private Long zoneId;
|
||||
|
||||
@Parameter(name = ApiConstants.USERNAME,
|
||||
type = CommandType.STRING,
|
||||
description = "the username for the host")
|
||||
private String username;
|
||||
|
||||
@Parameter(name = ApiConstants.PASSWORD,
|
||||
type = CommandType.STRING,
|
||||
description = "the password for the host")
|
||||
private String password;
|
||||
|
||||
@Parameter(name = ApiConstants.HOST,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "the host name or IP address")
|
||||
private String host;
|
||||
|
||||
@Parameter(name = ApiConstants.HYPERVISOR,
|
||||
type = CommandType.STRING,
|
||||
required = true,
|
||||
description = "hypervisor type of the host")
|
||||
private String hypervisor;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public String getHypervisor() {
|
||||
return hypervisor;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
|
||||
ListResponse<UnmanagedInstanceResponse> response = vmImportService.listVmsForImport(this);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Account account = CallContext.current().getCallingAccount();
|
||||
if (account != null) {
|
||||
return account.getId();
|
||||
}
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
}
|
||||
|
|
@ -46,10 +46,14 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
|
|||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, required = true, description = "the ID of the public IP address"
|
||||
+ " to disassociate")
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = IPAddressResponse.class, description = "the ID of the public IP address"
|
||||
+ " to disassociate. Mutually exclusive with the ipaddress parameter")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, since="4.19.0", description="IP Address to be disassociated."
|
||||
+ " Mutually exclusive with the id parameter")
|
||||
private String ipAddress;
|
||||
|
||||
// unexposed parameter needed for events logging
|
||||
@Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, entityType = AccountResponse.class, expose = false)
|
||||
private Long ownerId;
|
||||
|
|
@ -59,7 +63,18 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
|
|||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getIpAddressId() {
|
||||
return id;
|
||||
if (id != null & ipAddress != null) {
|
||||
throw new InvalidParameterValueException("id parameter is mutually exclusive with ipaddress parameter");
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
return id;
|
||||
} else if (ipAddress != null) {
|
||||
IpAddress ip = getIpAddressByIp(ipAddress);
|
||||
return ip.getId();
|
||||
}
|
||||
|
||||
throw new InvalidParameterValueException("Please specify either IP address or IP address ID");
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -68,12 +83,13 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute() throws InsufficientAddressCapacityException {
|
||||
CallContext.current().setEventDetails("IP ID: " + getIpAddressId());
|
||||
Long ipAddressId = getIpAddressId();
|
||||
CallContext.current().setEventDetails("IP ID: " + ipAddressId);
|
||||
boolean result = false;
|
||||
if (!isPortable(id)) {
|
||||
result = _networkService.releaseIpAddress(getIpAddressId());
|
||||
if (!isPortable()) {
|
||||
result = _networkService.releaseIpAddress(ipAddressId);
|
||||
} else {
|
||||
result = _networkService.releasePortableIpAddress(getIpAddressId());
|
||||
result = _networkService.releasePortableIpAddress(ipAddressId);
|
||||
}
|
||||
if (result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
|
|
@ -85,7 +101,7 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
if (!isPortable(id)) {
|
||||
if (!isPortable()) {
|
||||
return EventTypes.EVENT_NET_IP_RELEASE;
|
||||
} else {
|
||||
return EventTypes.EVENT_PORTABLE_IP_RELEASE;
|
||||
|
|
@ -100,10 +116,7 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
|
|||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
if (ownerId == null) {
|
||||
IpAddress ip = getIpAddress(id);
|
||||
if (ip == null) {
|
||||
throw new InvalidParameterValueException("Unable to find IP address by ID=" + id);
|
||||
}
|
||||
IpAddress ip = getIpAddress();
|
||||
ownerId = ip.getAccountId();
|
||||
}
|
||||
|
||||
|
|
@ -120,11 +133,11 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public Long getSyncObjId() {
|
||||
IpAddress ip = getIpAddress(id);
|
||||
IpAddress ip = getIpAddress();
|
||||
return ip.getAssociatedWithNetworkId();
|
||||
}
|
||||
|
||||
private IpAddress getIpAddress(long id) {
|
||||
private IpAddress getIpAddressById(Long id) {
|
||||
IpAddress ip = _entityMgr.findById(IpAddress.class, id);
|
||||
|
||||
if (ip == null) {
|
||||
|
|
@ -134,6 +147,29 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
|
|||
}
|
||||
}
|
||||
|
||||
private IpAddress getIpAddressByIp(String ipAddress) {
|
||||
IpAddress ip = _networkService.getIp(ipAddress);
|
||||
if (ip == null) {
|
||||
throw new InvalidParameterValueException("Unable to find IP address by IP address=" + ipAddress);
|
||||
} else {
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
|
||||
private IpAddress getIpAddress() {
|
||||
if (id != null & ipAddress != null) {
|
||||
throw new InvalidParameterValueException("id parameter is mutually exclusive with ipaddress parameter");
|
||||
}
|
||||
|
||||
if (id != null) {
|
||||
return getIpAddressById(id);
|
||||
} else if (ipAddress != null){
|
||||
return getIpAddressByIp(ipAddress);
|
||||
}
|
||||
|
||||
throw new InvalidParameterValueException("Please specify either IP address or IP address ID");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandResourceType getApiResourceType() {
|
||||
return ApiCommandResourceType.IpAddress;
|
||||
|
|
@ -144,8 +180,8 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
|
|||
return getIpAddressId();
|
||||
}
|
||||
|
||||
private boolean isPortable(long id) {
|
||||
IpAddress ip = getIpAddress(id);
|
||||
private boolean isPortable() {
|
||||
IpAddress ip = getIpAddress();
|
||||
return ip.isPortable();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,202 @@
|
|||
// 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 org.apache.cloudstack.api.command.user.bucket;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCreateCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.command.user.UserCmd;
|
||||
import org.apache.cloudstack.api.response.BucketResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "createBucket", responseObject = BucketResponse.class,
|
||||
description = "Creates a bucket in the specified object storage pool. ", responseView = ResponseView.Restricted,
|
||||
entityType = {Bucket.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0",
|
||||
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
|
||||
public class CreateBucketCmd extends BaseAsyncCreateCmd implements UserCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateBucketCmd.class.getName());
|
||||
private static final String s_name = "createbucketresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ACCOUNT,
|
||||
type = CommandType.STRING,
|
||||
description = "the account associated with the bucket. Must be used with the domainId parameter.")
|
||||
private String accountName;
|
||||
|
||||
@Parameter(name = ApiConstants.PROJECT_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = ProjectResponse.class,
|
||||
description = "the project associated with the bucket. Mutually exclusive with account parameter")
|
||||
private Long projectId;
|
||||
|
||||
@Parameter(name = ApiConstants.DOMAIN_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = DomainResponse.class,
|
||||
description = "the domain ID associated with the bucket. If used with the account parameter"
|
||||
+ " returns the bucket associated with the account for the specified domain.")
|
||||
private Long domainId;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true,description = "the name of the bucket")
|
||||
private String bucketName;
|
||||
|
||||
@Parameter(name = ApiConstants.OBJECT_STORAGE_ID, type = CommandType.UUID,
|
||||
entityType = ObjectStoreResponse.class, required = true,
|
||||
description = "Id of the Object Storage Pool where bucket is created")
|
||||
private long objectStoragePoolId;
|
||||
|
||||
@Parameter(name = ApiConstants.QUOTA, type = CommandType.INTEGER,description = "Bucket Quota in GB")
|
||||
private Integer quota;
|
||||
|
||||
@Parameter(name = ApiConstants.ENCRYPTION, type = CommandType.BOOLEAN, description = "Enable bucket encryption")
|
||||
private boolean encryption;
|
||||
|
||||
@Parameter(name = ApiConstants.VERSIONING, type = CommandType.BOOLEAN, description = "Enable bucket versioning")
|
||||
private boolean versioning;
|
||||
|
||||
@Parameter(name = ApiConstants.OBJECT_LOCKING, type = CommandType.BOOLEAN, description = "Enable object locking in bucket")
|
||||
private boolean objectLocking;
|
||||
|
||||
@Parameter(name = ApiConstants.POLICY, type = CommandType.STRING,description = "The Bucket access policy")
|
||||
private String policy;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public Long getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public String getBucketName() {
|
||||
return bucketName;
|
||||
}
|
||||
|
||||
private Long getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public long getObjectStoragePoolId() {
|
||||
return objectStoragePoolId;
|
||||
}
|
||||
|
||||
public Integer getQuota() {
|
||||
return quota;
|
||||
}
|
||||
|
||||
public boolean isEncryption() {
|
||||
return encryption;
|
||||
}
|
||||
|
||||
public boolean isVersioning() {
|
||||
return versioning;
|
||||
}
|
||||
|
||||
public boolean isObjectLocking() {
|
||||
return objectLocking;
|
||||
}
|
||||
|
||||
public String getPolicy() {
|
||||
return policy;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
public static String getResultObjectName() {
|
||||
return "bucket";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandResourceType getApiResourceType() {
|
||||
return ApiCommandResourceType.Bucket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
||||
return accountId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_BUCKET_CREATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "creating bucket: " + getBucketName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() throws ResourceAllocationException {
|
||||
Bucket bucket = _bucketService.allocBucket(this);
|
||||
if (bucket != null) {
|
||||
setEntityId(bucket.getId());
|
||||
setEntityUuid(bucket.getUuid());
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create bucket");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
CallContext.current().setEventDetails("Bucket Id: " + getEntityUuid());
|
||||
|
||||
Bucket bucket;
|
||||
try {
|
||||
bucket = _bucketService.createBucket(this);
|
||||
} catch (Exception e) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
|
||||
}
|
||||
if (bucket != null) {
|
||||
BucketResponse response = _responseGenerator.createBucketResponse(bucket);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create bucket with name: "+getBucketName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
// 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 org.apache.cloudstack.api.command.user.bucket;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.BucketResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "deleteBucket", description = "Deletes an empty Bucket.", responseObject = SuccessResponse.class, entityType = {Bucket.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0",
|
||||
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
|
||||
public class DeleteBucketCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteBucketCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ACL(accessType = AccessType.OperateEntry)
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=BucketResponse.class,
|
||||
required=true, description="The ID of the Bucket")
|
||||
private Long id;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public static String getResultObjectName() {
|
||||
return "bucket";
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Bucket Bucket = _entityMgr.findById(Bucket.class, getId());
|
||||
if (Bucket != null) {
|
||||
return Bucket.getAccountId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getApiResourceId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandResourceType getApiResourceType() {
|
||||
return ApiCommandResourceType.Bucket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException {
|
||||
CallContext.current().setEventDetails("Bucket Id: " + this._uuidMgr.getUuid(Bucket.class, getId()));
|
||||
boolean result = _bucketService.deleteBucket(id, CallContext.current().getCallingAccount());
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
response.setSuccess(result);
|
||||
setResponseObject(response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
// 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 org.apache.cloudstack.api.command.user.bucket;
|
||||
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.user.UserCmd;
|
||||
import org.apache.cloudstack.api.response.BucketResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@APICommand(name = "listBuckets", description = "Lists all Buckets.", responseObject = BucketResponse.class, responseView = ResponseView.Restricted, entityType = {
|
||||
Bucket.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0",
|
||||
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
|
||||
public class ListBucketsCmd extends BaseListTaggedResourcesCmd implements UserCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListBucketsCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listbucketsresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = BucketResponse.class, description = "the ID of the bucket")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = BucketResponse.class, description = "the IDs of the Buckets, mutually exclusive with id")
|
||||
private List<Long> ids;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the bucket")
|
||||
private String bucketName;
|
||||
|
||||
@Parameter(name = ApiConstants.OBJECT_STORAGE_ID, type = CommandType.UUID, entityType = StoragePoolResponse.class, description = "the ID of the object storage pool, available to ROOT admin only", authorized = {
|
||||
RoleType.Admin})
|
||||
private Long objectStorageId;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getBucketName() {
|
||||
return bucketName;
|
||||
}
|
||||
|
||||
public Long getObjectStorageId() {
|
||||
return objectStorageId;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandResourceType getApiResourceType() {
|
||||
return ApiCommandResourceType.Bucket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
ListResponse<BucketResponse> response = _queryService.searchForBuckets(this);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
}
|
||||
|
||||
public List<Long> getIds() {
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
// 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 org.apache.cloudstack.api.command.user.bucket;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.BucketResponse;
|
||||
import org.apache.cloudstack.api.response.SuccessResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "updateBucket", description = "Updates Bucket properties", responseObject = SuccessResponse.class, entityType = {Bucket.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.19.0",
|
||||
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
|
||||
public class UpdateBucketCmd extends BaseCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateBucketCmd.class.getName());
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@ACL(accessType = AccessType.OperateEntry)
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=BucketResponse.class,
|
||||
required=true, description="The ID of the Bucket")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.VERSIONING, type = CommandType.BOOLEAN, description = "Enable/Disable Bucket Versioning")
|
||||
private Boolean versioning;
|
||||
|
||||
@Parameter(name = ApiConstants.ENCRYPTION, type = CommandType.BOOLEAN, description = "Enable/Disable Bucket encryption")
|
||||
private Boolean encryption;
|
||||
|
||||
@Parameter(name = ApiConstants.POLICY, type = CommandType.STRING, description = "Bucket Access Policy")
|
||||
private String policy;
|
||||
|
||||
@Parameter(name = ApiConstants.QUOTA, type = CommandType.INTEGER,description = "Bucket Quota in GB")
|
||||
private Integer quota;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public Boolean getVersioning() {
|
||||
return versioning;
|
||||
}
|
||||
|
||||
public Boolean getEncryption() {
|
||||
return encryption;
|
||||
}
|
||||
|
||||
public String getPolicy() {
|
||||
return policy;
|
||||
}
|
||||
|
||||
public Integer getQuota() {
|
||||
return quota;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public static String getResultObjectName() {
|
||||
return "bucket";
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Bucket Bucket = _entityMgr.findById(Bucket.class, getId());
|
||||
if (Bucket != null) {
|
||||
return Bucket.getAccountId();
|
||||
}
|
||||
|
||||
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getApiResourceId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiCommandResourceType getApiResourceType() {
|
||||
return ApiCommandResourceType.Bucket;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() throws ConcurrentOperationException {
|
||||
CallContext.current().setEventDetails("Bucket Id: " + this._uuidMgr.getUuid(Bucket.class, getId()));
|
||||
boolean result = false;
|
||||
try {
|
||||
result = _bucketService.updateBucket(this, CallContext.current().getCallingAccount());
|
||||
} catch (Exception e) {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Error while updating bucket. "+e.getMessage());
|
||||
}
|
||||
if(result) {
|
||||
SuccessResponse response = new SuccessResponse(getCommandName());
|
||||
setResponseObject(response);
|
||||
} else {
|
||||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update bucket");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,7 @@ import org.apache.cloudstack.api.ServerApiException;
|
|||
import org.apache.cloudstack.api.response.GetUploadParamsResponse;
|
||||
import org.apache.cloudstack.api.response.GuestOSResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.InsufficientCapacityException;
|
||||
|
|
@ -54,7 +55,6 @@ public class GetUploadParamsForIsoCmd extends AbstractGetUploadParamsCmd {
|
|||
|
||||
@Parameter(name = ApiConstants.DISPLAY_TEXT,
|
||||
type = BaseCmd.CommandType.STRING,
|
||||
required = true,
|
||||
description = "the display text of the ISO. This is usually used for display purposes.",
|
||||
length = 4096)
|
||||
private String displayText;
|
||||
|
|
@ -85,7 +85,7 @@ public class GetUploadParamsForIsoCmd extends AbstractGetUploadParamsCmd {
|
|||
}
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
return StringUtils.isBlank(displayText) ? getName() : displayText;
|
||||
}
|
||||
|
||||
public Boolean isFeatured() {
|
||||
|
|
|
|||
|
|
@ -97,52 +97,44 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd implements Use
|
|||
public void execute() {
|
||||
Pair<List<? extends UserVm>, List<String>> vmServiceMap = _lbService.listLoadBalancerInstances(this);
|
||||
List<? extends UserVm> result = vmServiceMap.first();
|
||||
s_logger.debug(String.format("A total of [%s] user VMs were obtained when listing the load balancer instances: [%s].", result.size(), result));
|
||||
|
||||
List<String> serviceStates = vmServiceMap.second();
|
||||
s_logger.debug(String.format("A total of [%s] service states were obtained when listing the load balancer instances: [%s].", serviceStates.size(), serviceStates));
|
||||
|
||||
if (!isListLbVmip()) {
|
||||
// list lb instances
|
||||
ListResponse<UserVmResponse> response = new ListResponse<UserVmResponse>();
|
||||
List<UserVmResponse> vmResponses = new ArrayList<UserVmResponse>();
|
||||
if (result != null) {
|
||||
vmResponses = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
|
||||
ListResponse<UserVmResponse> response = new ListResponse<>();
|
||||
List<UserVmResponse> vmResponses = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "loadbalancerruleinstance", result.toArray(new UserVm[0]));
|
||||
|
||||
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
vmResponses.get(i).setServiceState(serviceStates.get(i));
|
||||
}
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
vmResponses.get(i).setServiceState(serviceStates.get(i));
|
||||
}
|
||||
|
||||
response.setResponses(vmResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
|
||||
|
||||
} else {
|
||||
ListResponse<LoadBalancerRuleVmMapResponse> lbRes = new ListResponse<LoadBalancerRuleVmMapResponse>();
|
||||
|
||||
List<UserVmResponse> vmResponses = new ArrayList<UserVmResponse>();
|
||||
List<LoadBalancerRuleVmMapResponse> listlbVmRes = new ArrayList<LoadBalancerRuleVmMapResponse>();
|
||||
|
||||
if (result != null) {
|
||||
vmResponses = _responseGenerator.createUserVmResponse(getResponseView(), "loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
|
||||
|
||||
|
||||
List<String> ipaddr = null;
|
||||
|
||||
for (int i=0;i<result.size(); i++) {
|
||||
LoadBalancerRuleVmMapResponse lbRuleVmIpResponse = new LoadBalancerRuleVmMapResponse();
|
||||
vmResponses.get(i).setServiceState(serviceStates.get(i));
|
||||
lbRuleVmIpResponse.setUserVmResponse(vmResponses.get(i));
|
||||
//get vm id from the uuid
|
||||
VirtualMachine lbvm = _entityMgr.findByUuid(VirtualMachine.class, vmResponses.get(i).getId());
|
||||
lbRuleVmIpResponse.setIpAddr(_lbService.listLbVmIpAddress(getId(), lbvm.getId()));
|
||||
lbRuleVmIpResponse.setObjectName("lbrulevmidip");
|
||||
listlbVmRes.add(lbRuleVmIpResponse);
|
||||
}
|
||||
}
|
||||
|
||||
lbRes.setResponseName(getCommandName());
|
||||
lbRes.setResponses(listlbVmRes);
|
||||
setResponseObject(lbRes);
|
||||
return;
|
||||
}
|
||||
|
||||
ListResponse<LoadBalancerRuleVmMapResponse> lbRes = new ListResponse<>();
|
||||
|
||||
List<UserVmResponse> vmResponses = _responseGenerator.createUserVmResponse(getResponseView(), "loadbalancerruleinstance", result.toArray(new UserVm[0]));
|
||||
List<LoadBalancerRuleVmMapResponse> lbRuleVmMapList = new ArrayList<>();
|
||||
|
||||
for (int i=0; i<result.size(); i++) {
|
||||
LoadBalancerRuleVmMapResponse lbRuleVmIpResponse = new LoadBalancerRuleVmMapResponse();
|
||||
UserVmResponse userVmResponse = vmResponses.get(i);
|
||||
userVmResponse.setServiceState(serviceStates.get(i));
|
||||
lbRuleVmIpResponse.setUserVmResponse(userVmResponse);
|
||||
|
||||
VirtualMachine lbVm = _entityMgr.findByUuid(VirtualMachine.class, userVmResponse.getId());
|
||||
lbRuleVmIpResponse.setIpAddr(_lbService.listLbVmIpAddress(getId(), lbVm.getId()));
|
||||
lbRuleVmIpResponse.setObjectName("lbrulevmidip");
|
||||
lbRuleVmMapList.add(lbRuleVmIpResponse);
|
||||
}
|
||||
|
||||
lbRes.setResponseName(getCommandName());
|
||||
lbRes.setResponses(lbRuleVmMapList);
|
||||
setResponseObject(lbRes);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.network;
|
||||
|
||||
import com.cloud.exception.PermissionDeniedException;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiCommandResourceType;
|
||||
|
|
@ -26,6 +27,7 @@ import org.apache.cloudstack.api.Parameter;
|
|||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.api.response.VpcResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
|
|
@ -35,7 +37,8 @@ import com.cloud.network.vpc.NetworkACL;
|
|||
import com.cloud.network.vpc.Vpc;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "createNetworkACLList", description = "Creates a network ACL for the given VPC", responseObject = NetworkACLResponse.class,
|
||||
@APICommand(name = "createNetworkACLList", description = "Creates a network ACL. If no VPC is given, then it creates a global ACL that can be used by everyone.",
|
||||
responseObject = NetworkACLResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(CreateNetworkACLListCmd.class.getName());
|
||||
|
|
@ -53,7 +56,6 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Parameter(name = ApiConstants.VPC_ID,
|
||||
type = CommandType.UUID,
|
||||
required = true,
|
||||
entityType = VpcResponse.class,
|
||||
description = "ID of the VPC associated with this network ACL list")
|
||||
private Long vpcId;
|
||||
|
|
@ -77,6 +79,10 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
|
|||
return vpcId;
|
||||
}
|
||||
|
||||
public void setVpcId(Long vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplay() {
|
||||
if (display != null) {
|
||||
|
|
@ -92,6 +98,9 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public void create() {
|
||||
if (getVpcId() == null) {
|
||||
setVpcId(0L);
|
||||
}
|
||||
NetworkACL result = _networkACLService.createNetworkACL(getName(), getDescription(), getVpcId(), isDisplay());
|
||||
setEntityId(result.getId());
|
||||
setEntityUuid(result.getUuid());
|
||||
|
|
@ -111,12 +120,21 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Vpc vpc = _entityMgr.findById(Vpc.class, getVpcId());
|
||||
if (vpc == null) {
|
||||
throw new InvalidParameterValueException("Invalid vpcId is given");
|
||||
}
|
||||
Account account;
|
||||
if (isAclAttachedToVpc(this.vpcId)) {
|
||||
Vpc vpc = _entityMgr.findById(Vpc.class, this.vpcId);
|
||||
if (vpc == null) {
|
||||
throw new InvalidParameterValueException(String.format("Invalid VPC ID [%s] provided.", this.vpcId));
|
||||
}
|
||||
account = _accountService.getAccount(vpc.getAccountId());
|
||||
} else {
|
||||
account = CallContext.current().getCallingAccount();
|
||||
if (!Account.Type.ADMIN.equals(account.getType())) {
|
||||
s_logger.warn(String.format("Only Root Admin can create global ACLs. Account [%s] cannot create any global ACL.", account));
|
||||
throw new PermissionDeniedException("Only Root Admin can create global ACLs.");
|
||||
}
|
||||
|
||||
Account account = _accountService.getAccount(vpc.getAccountId());
|
||||
}
|
||||
return account.getId();
|
||||
}
|
||||
|
||||
|
|
@ -139,4 +157,8 @@ public class CreateNetworkACLListCmd extends BaseAsyncCreateCmd {
|
|||
public ApiCommandResourceType getApiResourceType() {
|
||||
return ApiCommandResourceType.NetworkAcl;
|
||||
}
|
||||
|
||||
public boolean isAclAttachedToVpc(Long aclVpcId) {
|
||||
return aclVpcId != null && aclVpcId != 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.offering;
|
||||
|
||||
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
|
||||
import org.apache.cloudstack.api.response.StoragePoolResponse;
|
||||
import org.apache.cloudstack.api.response.VolumeResponse;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
|
|
@ -23,7 +24,6 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListDomainResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.BaseCmd.CommandType;
|
||||
import org.apache.cloudstack.api.response.DiskOfferingResponse;
|
||||
|
|
@ -31,7 +31,7 @@ import org.apache.cloudstack.api.response.ListResponse;
|
|||
|
||||
@APICommand(name = "listDiskOfferings", description = "Lists all available disk offerings.", responseObject = DiskOfferingResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListDiskOfferingsCmd extends BaseListDomainResourcesCmd {
|
||||
public class ListDiskOfferingsCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListDiskOfferingsCmd.class.getName());
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,12 +16,12 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.user.offering;
|
||||
|
||||
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
|
||||
import org.apache.cloudstack.api.response.ZoneResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseListDomainResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.BaseCmd.CommandType;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
|
|
@ -30,7 +30,7 @@ import org.apache.cloudstack.api.response.UserVmResponse;
|
|||
|
||||
@APICommand(name = "listServiceOfferings", description = "Lists all available service offerings.", responseObject = ServiceOfferingResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListServiceOfferingsCmd extends BaseListDomainResourcesCmd {
|
||||
public class ListServiceOfferingsCmd extends BaseListProjectAndAccountResourcesCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import org.apache.cloudstack.api.ServerApiException;
|
|||
import org.apache.cloudstack.api.response.GetUploadParamsResponse;
|
||||
import org.apache.cloudstack.api.response.GuestOSResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
|
|
@ -46,7 +47,7 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd {
|
|||
|
||||
private static final String s_name = "postuploadtemplateresponse";
|
||||
|
||||
@Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, required = true, description = "the display text of the template. This is usually used for display purposes.", length = 4096)
|
||||
@Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the template. This is usually used for display purposes.", length = 4096)
|
||||
private String displayText;
|
||||
|
||||
@Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, required = true, description = "the target hypervisor for the template")
|
||||
|
|
@ -95,7 +96,7 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd {
|
|||
private Boolean deployAsIs;
|
||||
|
||||
public String getDisplayText() {
|
||||
return displayText;
|
||||
return StringUtils.isBlank(displayText) ? getName() : displayText;
|
||||
}
|
||||
|
||||
public String getHypervisor() {
|
||||
|
|
|
|||
|
|
@ -125,6 +125,9 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
|
|||
vpnResponse.setId(vpnUser.getUuid());
|
||||
vpnResponse.setUserName(vpnUser.getUsername());
|
||||
vpnResponse.setAccountName(account.getAccountName());
|
||||
// re-retrieve the vpnuser, as the call to `applyVpnUsers` might have changed the state
|
||||
vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
|
||||
vpnResponse.setState(vpnUser.getState().toString());
|
||||
|
||||
Domain domain = _entityMgr.findById(Domain.class, account.getDomainId());
|
||||
if (domain != null) {
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public class AcquireIPAddressResponse extends BaseResponse implements Controlle
|
|||
private String networkId;
|
||||
|
||||
@SerializedName(ApiConstants.STATE)
|
||||
@Param(description = "State of the ip address. Can be: Allocatin, Allocated and Releasing")
|
||||
@Param(description = "State of the ip address. Can be: Allocating, Allocated and Releasing")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,293 @@
|
|||
// 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 org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponseWithTagInformation;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@EntityReference(value = Bucket.class)
|
||||
@SuppressWarnings("unused")
|
||||
public class BucketResponse extends BaseResponseWithTagInformation implements ControlledViewEntityResponse, ControlledEntityResponse {
|
||||
@SerializedName(ApiConstants.ID)
|
||||
@Param(description = "ID of the Bucket")
|
||||
private String id;
|
||||
@SerializedName(ApiConstants.NAME)
|
||||
@Param(description = "name of the Bucket")
|
||||
private String name;
|
||||
@SerializedName(ApiConstants.CREATED)
|
||||
@Param(description = "the date the Bucket was created")
|
||||
private Date created;
|
||||
@SerializedName(ApiConstants.ACCOUNT)
|
||||
@Param(description = "the account associated with the Bucket")
|
||||
private String accountName;
|
||||
@SerializedName(ApiConstants.PROJECT_ID)
|
||||
@Param(description = "the project id of the bucket")
|
||||
private String projectId;
|
||||
@SerializedName(ApiConstants.PROJECT)
|
||||
@Param(description = "the project name of the bucket")
|
||||
private String projectName;
|
||||
@SerializedName(ApiConstants.DOMAIN_ID)
|
||||
@Param(description = "the ID of the domain associated with the bucket")
|
||||
private String domainId;
|
||||
@SerializedName(ApiConstants.DOMAIN)
|
||||
@Param(description = "the domain associated with the bucket")
|
||||
private String domainName;
|
||||
@SerializedName(ApiConstants.OBJECT_STORAGE_ID)
|
||||
@Param(description = "id of the object storage hosting the Bucket; returned to admin user only")
|
||||
private String objectStoragePoolId;
|
||||
|
||||
@SerializedName(ApiConstants.OBJECT_STORAGE)
|
||||
@Param(description = "Name of the object storage hosting the Bucket; returned to admin user only")
|
||||
private String objectStoragePool;
|
||||
|
||||
@SerializedName(ApiConstants.SIZE)
|
||||
@Param(description = "Total size of objects in Bucket")
|
||||
private Long size;
|
||||
|
||||
@SerializedName(ApiConstants.STATE)
|
||||
@Param(description = "State of the Bucket")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.QUOTA)
|
||||
@Param(description = "Bucket Quota in GB")
|
||||
private Integer quota;
|
||||
|
||||
@SerializedName(ApiConstants.ENCRYPTION)
|
||||
@Param(description = "Bucket Encryption")
|
||||
private Boolean encryption;
|
||||
|
||||
@SerializedName(ApiConstants.VERSIONING)
|
||||
@Param(description = "Bucket Versioning")
|
||||
private Boolean versioning;
|
||||
|
||||
@SerializedName(ApiConstants.OBJECT_LOCKING)
|
||||
@Param(description = "Bucket Object Locking")
|
||||
private Boolean objectLock;
|
||||
|
||||
@SerializedName(ApiConstants.POLICY)
|
||||
@Param(description = "Bucket Access Policy")
|
||||
private String policy;
|
||||
|
||||
@SerializedName(ApiConstants.URL)
|
||||
@Param(description = "Bucket URL")
|
||||
private String bucketURL;
|
||||
|
||||
@SerializedName(ApiConstants.ACCESS_KEY)
|
||||
@Param(description = "Bucket Access Key")
|
||||
private String accessKey;
|
||||
|
||||
@SerializedName(ApiConstants.SECRET_KEY)
|
||||
@Param(description = "Bucket Secret Key")
|
||||
private String secretKey;
|
||||
|
||||
@SerializedName(ApiConstants.PROVIDER)
|
||||
@Param(description = "Object storage provider")
|
||||
private String provider;
|
||||
|
||||
public BucketResponse() {
|
||||
tags = new LinkedHashSet<ResourceTagResponse>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccountName(String accountName) {
|
||||
this.accountName = accountName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDomainId(String domainId) {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDomainName(String domainName) {
|
||||
this.domainName = domainName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setTags(Set<ResourceTagResponse> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public void setObjectStoragePoolId(String objectStoragePoolId) {
|
||||
this.objectStoragePoolId = objectStoragePoolId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public String getAccountName() {
|
||||
return accountName;
|
||||
}
|
||||
|
||||
public String getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public String getProjectName() {
|
||||
return projectName;
|
||||
}
|
||||
|
||||
public String getDomainId() {
|
||||
return domainId;
|
||||
}
|
||||
|
||||
public String getDomainName() {
|
||||
return domainName;
|
||||
}
|
||||
|
||||
public String getObjectStoragePoolId() {
|
||||
return objectStoragePoolId;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
public long getQuota() {
|
||||
return quota;
|
||||
}
|
||||
|
||||
public void setQuota(Integer quota) {
|
||||
this.quota = quota;
|
||||
}
|
||||
|
||||
public boolean isVersioning() {
|
||||
return versioning;
|
||||
}
|
||||
|
||||
public void setVersioning(boolean versioning) {
|
||||
this.versioning = versioning;
|
||||
}
|
||||
|
||||
public boolean isEncryption() {
|
||||
return encryption;
|
||||
}
|
||||
|
||||
public void setEncryption(boolean encryption) {
|
||||
this.encryption = encryption;
|
||||
}
|
||||
|
||||
public boolean isObjectLock() {
|
||||
return objectLock;
|
||||
}
|
||||
|
||||
public void setObjectLock(boolean objectLock) {
|
||||
this.objectLock = objectLock;
|
||||
}
|
||||
|
||||
public String getPolicy() {
|
||||
return policy;
|
||||
}
|
||||
|
||||
public void setPolicy(String policy) {
|
||||
this.policy = policy;
|
||||
}
|
||||
|
||||
public String getBucketURL() {
|
||||
return bucketURL;
|
||||
}
|
||||
|
||||
public void setBucketURL(String bucketURL) {
|
||||
this.bucketURL = bucketURL;
|
||||
}
|
||||
|
||||
public String getAccessKey() {
|
||||
return accessKey;
|
||||
}
|
||||
|
||||
public void setAccessKey(String accessKey) {
|
||||
this.accessKey = accessKey;
|
||||
}
|
||||
|
||||
public String getSecretKey() {
|
||||
return secretKey;
|
||||
}
|
||||
|
||||
public void setSecretKey(String secretKey) {
|
||||
this.secretKey = secretKey;
|
||||
}
|
||||
|
||||
public void setState(Bucket.State state) {
|
||||
this.state = state.toString();
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setObjectStoragePool(String objectStoragePool) {
|
||||
this.objectStoragePool = objectStoragePool;
|
||||
}
|
||||
|
||||
public String getObjectStoragePool() {
|
||||
return objectStoragePool;
|
||||
}
|
||||
|
||||
public String getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
}
|
||||
|
|
@ -221,6 +221,10 @@ public class HostResponse extends BaseResponseWithAnnotations {
|
|||
@Param(description = "comma-separated list of tags for the host")
|
||||
private String hostTags;
|
||||
|
||||
@SerializedName(ApiConstants.IS_TAG_A_RULE)
|
||||
@Param(description = ApiConstants.PARAMETER_DESCRIPTION_IS_TAG_A_RULE)
|
||||
private Boolean isTagARule;
|
||||
|
||||
@SerializedName("hasenoughcapacity")
|
||||
@Param(description = "true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise")
|
||||
private Boolean hasEnoughCapacity;
|
||||
|
|
@ -732,4 +736,12 @@ public class HostResponse extends BaseResponseWithAnnotations {
|
|||
public void setEncryptionSupported(Boolean encryptionSupported) {
|
||||
this.encryptionSupported = encryptionSupported;
|
||||
}
|
||||
|
||||
public Boolean getIsTagARule() {
|
||||
return isTagARule;
|
||||
}
|
||||
|
||||
public void setIsTagARule(Boolean tagARule) {
|
||||
isTagARule = tagARule;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public class IPAddressResponse extends BaseResponseWithAnnotations implements Co
|
|||
private String networkId;
|
||||
|
||||
@SerializedName(ApiConstants.STATE)
|
||||
@Param(description = "State of the ip address. Can be: Allocatin, Allocated and Releasing")
|
||||
@Param(description = "State of the ip address. Can be: Allocating, Allocated, Releasing, Reserved and Free")
|
||||
private String state;
|
||||
|
||||
@SerializedName(ApiConstants.PHYSICAL_NETWORK_ID)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,106 @@
|
|||
// 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 org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.BaseResponseWithAnnotations;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
@EntityReference(value = ObjectStore.class)
|
||||
public class ObjectStoreResponse extends BaseResponseWithAnnotations {
|
||||
@SerializedName("id")
|
||||
@Param(description = "the ID of the object store")
|
||||
private String id;
|
||||
|
||||
@SerializedName("name")
|
||||
@Param(description = "the name of the object store")
|
||||
private String name;
|
||||
|
||||
@SerializedName("url")
|
||||
@Param(description = "the url of the object store")
|
||||
private String url;
|
||||
|
||||
@SerializedName("providername")
|
||||
@Param(description = "the provider name of the object store")
|
||||
private String providerName;
|
||||
|
||||
@SerializedName("storagetotal")
|
||||
@Param(description = "the total size of the object store")
|
||||
private Long storageTotal;
|
||||
|
||||
@SerializedName("storageused")
|
||||
@Param(description = "the object store currently used size")
|
||||
private Long storageUsed;
|
||||
|
||||
public ObjectStoreResponse() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getProviderName() {
|
||||
return providerName;
|
||||
}
|
||||
|
||||
public void setProviderName(String providerName) {
|
||||
this.providerName = providerName;
|
||||
}
|
||||
|
||||
public Long getStorageTotal() {
|
||||
return storageTotal;
|
||||
}
|
||||
|
||||
public void setStorageTotal(Long storageTotal) {
|
||||
this.storageTotal = storageTotal;
|
||||
}
|
||||
|
||||
public Long getStorageUsed() {
|
||||
return storageUsed;
|
||||
}
|
||||
|
||||
public void setStorageUsed(Long storageUsed) {
|
||||
this.storageUsed = storageUsed;
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +68,7 @@ public class PortableIpResponse extends BaseResponse {
|
|||
private Date allocated;
|
||||
|
||||
@SerializedName(ApiConstants.STATE)
|
||||
@Param(description = "State of the ip address. Can be: Allocatin, Allocated and Releasing")
|
||||
@Param(description = "State of the ip address. Can be: Allocating, Allocated, Releasing and Free")
|
||||
private String state;
|
||||
|
||||
public void setRegionId(Integer regionId) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,141 @@
|
|||
//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 org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
import org.apache.cloudstack.secstorage.heuristics.Heuristic;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static org.apache.cloudstack.api.ApiConstants.HEURISTIC_TYPE_VALID_OPTIONS;
|
||||
|
||||
@EntityReference(value = {Heuristic.class})
|
||||
public class SecondaryStorageHeuristicsResponse extends BaseResponse {
|
||||
|
||||
@SerializedName(ApiConstants.ID)
|
||||
@Param(description = "ID of the heuristic.")
|
||||
private String id;
|
||||
|
||||
@SerializedName(ApiConstants.NAME)
|
||||
@Param(description = "Name of the heuristic.")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.DESCRIPTION)
|
||||
@Param(description = "Description of the heuristic.")
|
||||
private String description;
|
||||
|
||||
@SerializedName(ApiConstants.ZONE_ID)
|
||||
@Param(description = "The zone which the heuristic is valid upon.")
|
||||
private String zoneId;
|
||||
|
||||
@SerializedName(ApiConstants.TYPE)
|
||||
@Param(description = "The resource type directed to a specific secondary storage by the selector. " + HEURISTIC_TYPE_VALID_OPTIONS)
|
||||
private String type;
|
||||
|
||||
@SerializedName(ApiConstants.HEURISTIC_RULE)
|
||||
@Param(description = "The heuristic rule, in JavaScript language, used to select a secondary storage to be directed.")
|
||||
private String heuristicRule;
|
||||
|
||||
@SerializedName(ApiConstants.CREATED)
|
||||
@Param(description = "When the heuristic was created.")
|
||||
private Date created;
|
||||
|
||||
@SerializedName(ApiConstants.REMOVED)
|
||||
@Param(description = "When the heuristic was removed.")
|
||||
private Date removed;
|
||||
|
||||
|
||||
public SecondaryStorageHeuristicsResponse(String id, String name, String description, String zoneId, String type, String heuristicRule, Date created, Date removed) {
|
||||
super("heuristics");
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.zoneId = zoneId;
|
||||
this.type = type;
|
||||
this.heuristicRule = heuristicRule;
|
||||
this.created = created;
|
||||
this.removed = removed;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
|
||||
public void setZoneId(String zoneId) {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getHeuristicRule() {
|
||||
return heuristicRule;
|
||||
}
|
||||
|
||||
public void setHeuristicRule(String heuristicRule) {
|
||||
this.heuristicRule = heuristicRule;
|
||||
}
|
||||
|
||||
public Date getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(Date created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
public Date getRemoved() {
|
||||
return removed;
|
||||
}
|
||||
|
||||
public void setRemoved(Date removed) {
|
||||
this.removed = removed;
|
||||
}
|
||||
}
|
||||
|
|
@ -101,6 +101,10 @@ public class StoragePoolResponse extends BaseResponseWithAnnotations {
|
|||
@Param(description = "the tags for the storage pool")
|
||||
private String tags;
|
||||
|
||||
@SerializedName(ApiConstants.IS_TAG_A_RULE)
|
||||
@Param(description = ApiConstants.PARAMETER_DESCRIPTION_IS_TAG_A_RULE)
|
||||
private Boolean isTagARule;
|
||||
|
||||
@SerializedName(ApiConstants.STATE)
|
||||
@Param(description = "the state of the storage pool")
|
||||
private StoragePoolStatus state;
|
||||
|
|
@ -304,6 +308,14 @@ public class StoragePoolResponse extends BaseResponseWithAnnotations {
|
|||
this.tags = tags;
|
||||
}
|
||||
|
||||
public Boolean getIsTagARule() {
|
||||
return isTagARule;
|
||||
}
|
||||
|
||||
public void setIsTagARule(Boolean tagARule) {
|
||||
isTagARule = tagARule;
|
||||
}
|
||||
|
||||
public StoragePoolStatus getState() {
|
||||
return state;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ public class UnmanagedInstanceResponse extends BaseResponse {
|
|||
@Param(description = "the ID of the cluster to which virtual machine belongs")
|
||||
private String clusterId;
|
||||
|
||||
@SerializedName(ApiConstants.CLUSTER_NAME)
|
||||
@Param(description = "the name of the cluster to which virtual machine belongs")
|
||||
private String clusterName;
|
||||
|
||||
@SerializedName(ApiConstants.HOST_ID)
|
||||
@Param(description = "the ID of the host to which virtual machine belongs")
|
||||
private String hostId;
|
||||
|
|
@ -104,6 +108,14 @@ public class UnmanagedInstanceResponse extends BaseResponse {
|
|||
this.clusterId = clusterId;
|
||||
}
|
||||
|
||||
public String getClusterName() {
|
||||
return clusterName;
|
||||
}
|
||||
|
||||
public void setClusterName(String clusterName) {
|
||||
this.clusterName = clusterName;
|
||||
}
|
||||
|
||||
public String getHostId() {
|
||||
return hostId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,11 +166,11 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
|
|||
private String serviceOfferingName;
|
||||
|
||||
@SerializedName(ApiConstants.DISK_OFFERING_ID)
|
||||
@Param(description = "the ID of the disk offering of the virtual machine", since = "4.4")
|
||||
@Param(description = "the ID of the disk offering of the virtual machine. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4")
|
||||
private String diskOfferingId;
|
||||
|
||||
@SerializedName("diskofferingname")
|
||||
@Param(description = "the name of the disk offering of the virtual machine", since = "4.4")
|
||||
@Param(description = "the name of the disk offering of the virtual machine. This parameter should not be used for retrieving disk offering details of DATA volumes. Use listVolumes API instead", since = "4.4")
|
||||
private String diskOfferingName;
|
||||
|
||||
@SerializedName(ApiConstants.BACKUP_OFFERING_ID)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import org.apache.cloudstack.api.ApiConstants;
|
|||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.hypervisor.vmware.VmwareDatacenter;
|
||||
import com.cloud.dc.VmwareDatacenter;
|
||||
import com.cloud.serializer.Param;
|
||||
|
||||
@EntityReference(value = VmwareDatacenter.class)
|
||||
|
|
@ -57,7 +57,7 @@ public class VpnUsersResponse extends BaseResponse implements ControlledEntityRe
|
|||
private String projectName;
|
||||
|
||||
@SerializedName(ApiConstants.STATE)
|
||||
@Param(description = "the state of the Vpn User")
|
||||
@Param(description = "the state of the Vpn User, can be 'Add', 'Revoke' or 'Active'.")
|
||||
private String state;
|
||||
|
||||
public void setId(String id) {
|
||||
|
|
|
|||
|
|
@ -28,14 +28,17 @@ import org.apache.cloudstack.api.command.admin.resource.icon.ListResourceIconCmd
|
|||
import org.apache.cloudstack.api.command.admin.router.GetRouterHealthCheckResultsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListObjectStoragePoolsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.ListStorageTagsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.storage.heuristics.ListSecondaryStorageSelectorsCmd;
|
||||
import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
|
||||
import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
|
||||
import org.apache.cloudstack.api.command.user.address.ListQuarantinedIpsCmd;
|
||||
import org.apache.cloudstack.api.command.user.affinitygroup.ListAffinityGroupsCmd;
|
||||
import org.apache.cloudstack.api.command.user.bucket.ListBucketsCmd;
|
||||
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
|
||||
import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
|
||||
import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
|
||||
|
|
@ -56,6 +59,7 @@ import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd;
|
|||
import org.apache.cloudstack.api.command.user.zone.ListZonesCmd;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.AsyncJobResponse;
|
||||
import org.apache.cloudstack.api.response.BucketResponse;
|
||||
import org.apache.cloudstack.api.response.DetailOptionsResponse;
|
||||
import org.apache.cloudstack.api.response.DiskOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.DomainResponse;
|
||||
|
|
@ -68,6 +72,7 @@ import org.apache.cloudstack.api.response.InstanceGroupResponse;
|
|||
import org.apache.cloudstack.api.response.IpQuarantineResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ManagementServerResponse;
|
||||
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectAccountResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
|
||||
import org.apache.cloudstack.api.response.ProjectResponse;
|
||||
|
|
@ -75,6 +80,7 @@ import org.apache.cloudstack.api.response.ResourceDetailResponse;
|
|||
import org.apache.cloudstack.api.response.ResourceIconResponse;
|
||||
import org.apache.cloudstack.api.response.ResourceTagResponse;
|
||||
import org.apache.cloudstack.api.response.RouterHealthCheckResultResponse;
|
||||
import org.apache.cloudstack.api.response.SecondaryStorageHeuristicsResponse;
|
||||
import org.apache.cloudstack.api.response.SecurityGroupResponse;
|
||||
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
|
||||
import org.apache.cloudstack.api.response.SnapshotResponse;
|
||||
|
|
@ -185,9 +191,15 @@ public interface QueryService {
|
|||
|
||||
List<RouterHealthCheckResultResponse> listRouterHealthChecks(GetRouterHealthCheckResultsCmd cmd);
|
||||
|
||||
ListResponse<SecondaryStorageHeuristicsResponse> listSecondaryStorageSelectors(ListSecondaryStorageSelectorsCmd cmd);
|
||||
|
||||
ListResponse<IpQuarantineResponse> listQuarantinedIps(ListQuarantinedIpsCmd cmd);
|
||||
|
||||
ListResponse<SnapshotResponse> listSnapshots(ListSnapshotsCmd cmd);
|
||||
|
||||
SnapshotResponse listSnapshot(CopySnapshotCmd cmd);
|
||||
|
||||
ListResponse<ObjectStoreResponse> searchForObjectStores(ListObjectStoragePoolsCmd listObjectStoragePoolsCmd);
|
||||
|
||||
ListResponse<BucketResponse> searchForBuckets(ListBucketsCmd listBucketsCmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 org.apache.cloudstack.secstorage.heuristics;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface Heuristic extends InternalIdentity, Identity {
|
||||
|
||||
String getName();
|
||||
|
||||
String getDescription();
|
||||
|
||||
Long getZoneId();
|
||||
|
||||
String getType();
|
||||
|
||||
String getHeuristicRule();
|
||||
|
||||
Date getCreated();
|
||||
|
||||
Date getRemoved();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
// 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 org.apache.cloudstack.secstorage.heuristics;
|
||||
|
||||
/**
|
||||
* The type of the heuristic used in the allocation process of secondary storage resources.
|
||||
* Valid options are: {@link #ISO}, {@link #SNAPSHOT}, {@link #TEMPLATE} and {@link #VOLUME}
|
||||
*/
|
||||
public enum HeuristicType {
|
||||
ISO, SNAPSHOT, TEMPLATE, VOLUME
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
// 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 org.apache.cloudstack.storage.object;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public interface Bucket extends ControlledEntity, Identity, InternalIdentity {
|
||||
|
||||
long getObjectStoreId();
|
||||
|
||||
Date getCreated();
|
||||
|
||||
State getState();
|
||||
|
||||
void setName(String name);
|
||||
|
||||
Long getSize();
|
||||
|
||||
Integer getQuota();
|
||||
|
||||
boolean isVersioning();
|
||||
|
||||
boolean isEncryption();
|
||||
|
||||
boolean isObjectLock();
|
||||
|
||||
String getPolicy();
|
||||
|
||||
String getBucketURL();
|
||||
|
||||
String getAccessKey();
|
||||
|
||||
String getSecretKey();
|
||||
|
||||
public enum State {
|
||||
Allocated, Created, Destroyed;
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name();
|
||||
}
|
||||
|
||||
public boolean equals(String status) {
|
||||
return this.toString().equalsIgnoreCase(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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 org.apache.cloudstack.storage.object;
|
||||
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.cloudstack.api.command.user.bucket.CreateBucketCmd;
|
||||
import org.apache.cloudstack.api.command.user.bucket.UpdateBucketCmd;
|
||||
|
||||
public interface BucketApiService {
|
||||
|
||||
|
||||
/**
|
||||
* Creates the database object for a Bucket based on the given criteria
|
||||
*
|
||||
* @param cmd
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
|
||||
* name)
|
||||
* @return the Bucket object
|
||||
*/
|
||||
Bucket allocBucket(CreateBucketCmd cmd) throws ResourceAllocationException;
|
||||
|
||||
/**
|
||||
* Creates the Bucket based on the given criteria
|
||||
*
|
||||
* @param cmd
|
||||
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
|
||||
* name)
|
||||
* @return the Bucket object
|
||||
*/
|
||||
Bucket createBucket(CreateBucketCmd cmd);
|
||||
|
||||
boolean deleteBucket(long bucketId, Account caller);
|
||||
|
||||
boolean updateBucket(UpdateBucketCmd cmd, Account caller);
|
||||
|
||||
void getBucketUsage();
|
||||
}
|
||||
|
|
@ -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 org.apache.cloudstack.storage.object;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface ObjectStore extends Identity, InternalIdentity {
|
||||
|
||||
/**
|
||||
* @return name of the object store.
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* @return object store provider name
|
||||
*/
|
||||
String getProviderName();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return uri
|
||||
*/
|
||||
String getUrl();
|
||||
|
||||
}
|
||||
|
|
@ -45,6 +45,7 @@ public class UsageTypes {
|
|||
public static final int VOLUME_SECONDARY = 26;
|
||||
public static final int VM_SNAPSHOT_ON_PRIMARY = 27;
|
||||
public static final int BACKUP = 28;
|
||||
public static final int BUCKET = 29;
|
||||
|
||||
public static List<UsageTypeResponse> listUsageTypes() {
|
||||
List<UsageTypeResponse> responseList = new ArrayList<UsageTypeResponse>();
|
||||
|
|
@ -70,6 +71,7 @@ public class UsageTypes {
|
|||
responseList.add(new UsageTypeResponse(VOLUME_SECONDARY, "Volume on secondary storage usage"));
|
||||
responseList.add(new UsageTypeResponse(VM_SNAPSHOT_ON_PRIMARY, "VM Snapshot on primary storage usage"));
|
||||
responseList.add(new UsageTypeResponse(BACKUP, "Backup storage usage"));
|
||||
responseList.add(new UsageTypeResponse(BUCKET, "Bucket storage usage"));
|
||||
return responseList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ public class UnmanagedInstanceTO {
|
|||
|
||||
private PowerState powerState;
|
||||
|
||||
private PowerState cloneSourcePowerState;
|
||||
|
||||
private Integer cpuCores;
|
||||
|
||||
private Integer cpuCoresPerSocket;
|
||||
|
|
@ -45,10 +47,16 @@ public class UnmanagedInstanceTO {
|
|||
|
||||
private String operatingSystem;
|
||||
|
||||
private String clusterName;
|
||||
|
||||
private String hostName;
|
||||
|
||||
private List<Disk> disks;
|
||||
|
||||
private List<Nic> nics;
|
||||
|
||||
private String vncPassword;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
@ -73,6 +81,14 @@ public class UnmanagedInstanceTO {
|
|||
this.powerState = powerState;
|
||||
}
|
||||
|
||||
public PowerState getCloneSourcePowerState() {
|
||||
return cloneSourcePowerState;
|
||||
}
|
||||
|
||||
public void setCloneSourcePowerState(PowerState cloneSourcePowerState) {
|
||||
this.cloneSourcePowerState = cloneSourcePowerState;
|
||||
}
|
||||
|
||||
public Integer getCpuCores() {
|
||||
return cpuCores;
|
||||
}
|
||||
|
|
@ -121,6 +137,22 @@ public class UnmanagedInstanceTO {
|
|||
this.operatingSystem = operatingSystem;
|
||||
}
|
||||
|
||||
public String getClusterName() {
|
||||
return clusterName;
|
||||
}
|
||||
|
||||
public void setClusterName(String clusterName) {
|
||||
this.clusterName = clusterName;
|
||||
}
|
||||
|
||||
public String getHostName() {
|
||||
return hostName;
|
||||
}
|
||||
|
||||
public void setHostName(String hostName) {
|
||||
this.hostName = hostName;
|
||||
}
|
||||
|
||||
public List<Disk> getDisks() {
|
||||
return disks;
|
||||
}
|
||||
|
|
@ -137,6 +169,14 @@ public class UnmanagedInstanceTO {
|
|||
this.nics = nics;
|
||||
}
|
||||
|
||||
public String getVncPassword() {
|
||||
return vncPassword;
|
||||
}
|
||||
|
||||
public void setVncPassword(String vncPassword) {
|
||||
this.vncPassword = vncPassword;
|
||||
}
|
||||
|
||||
public static class Disk {
|
||||
private String diskId;
|
||||
|
||||
|
|
@ -162,6 +202,8 @@ public class UnmanagedInstanceTO {
|
|||
|
||||
private String datastorePath;
|
||||
|
||||
private int datastorePort;
|
||||
|
||||
private String datastoreType;
|
||||
|
||||
public String getDiskId() {
|
||||
|
|
@ -267,6 +309,14 @@ public class UnmanagedInstanceTO {
|
|||
public void setDatastoreType(String datastoreType) {
|
||||
this.datastoreType = datastoreType;
|
||||
}
|
||||
|
||||
public void setDatastorePort(int datastorePort) {
|
||||
this.datastorePort = datastorePort;
|
||||
}
|
||||
|
||||
public int getDatastorePort() {
|
||||
return datastorePort;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Nic {
|
||||
|
|
|
|||
|
|
@ -17,13 +17,20 @@
|
|||
|
||||
package org.apache.cloudstack.vm;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.utils.component.PluggableService;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import static com.cloud.hypervisor.Hypervisor.HypervisorType.KVM;
|
||||
import static com.cloud.hypervisor.Hypervisor.HypervisorType.VMware;
|
||||
|
||||
public interface UnmanagedVMsManager extends VmImportService, UnmanageVMService, PluggableService, Configurable {
|
||||
|
||||
ConfigKey<Boolean> UnmanageVMPreserveNic = new ConfigKey<>("Advanced", Boolean.class, "unmanage.vm.preserve.nics", "false",
|
||||
"If set to true, do not remove VM nics (and its MAC addresses) when unmanaging a VM, leaving them allocated but not reserved. " +
|
||||
"If set to false, nics are removed and MAC addresses can be reassigned", true, ConfigKey.Scope.Zone);
|
||||
|
||||
static boolean isSupported(Hypervisor.HypervisorType hypervisorType) {
|
||||
return hypervisorType == VMware || hypervisorType == KVM;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,28 @@
|
|||
package org.apache.cloudstack.vm;
|
||||
|
||||
import org.apache.cloudstack.api.command.admin.vm.ImportUnmanagedInstanceCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.ImportVmCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.ListUnmanagedInstancesCmd;
|
||||
import org.apache.cloudstack.api.command.admin.vm.ListVmsForImportCmd;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.UnmanagedInstanceResponse;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
|
||||
public interface VmImportService {
|
||||
|
||||
enum ImportSource {
|
||||
UNMANAGED, VMWARE, EXTERNAL, SHARED, LOCAL;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
ListResponse<UnmanagedInstanceResponse> listUnmanagedInstances(ListUnmanagedInstancesCmd cmd);
|
||||
UserVmResponse importUnmanagedInstance(ImportUnmanagedInstanceCmd cmd);
|
||||
|
||||
UserVmResponse importVm(ImportVmCmd cmd);
|
||||
|
||||
ListResponse<UnmanagedInstanceResponse> listVmsForImport(ListVmsForImportCmd cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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 org.apache.cloudstack.api.command.admin.storage;
|
||||
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.storage.StorageService;
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyObject;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class AddObjectStoragePoolCmdTest {
|
||||
public static final Logger s_logger = Logger.getLogger(AddObjectStoragePoolCmdTest.class.getName());
|
||||
|
||||
@Mock
|
||||
StorageService storageService;
|
||||
|
||||
@Mock
|
||||
ObjectStore objectStore;
|
||||
|
||||
@Mock
|
||||
ResponseGenerator responseGenerator;
|
||||
|
||||
@Spy
|
||||
AddObjectStoragePoolCmd addObjectStoragePoolCmdSpy;
|
||||
|
||||
String name = "testObjStore";
|
||||
|
||||
String url = "testURL";
|
||||
|
||||
String provider = "Simulator";
|
||||
|
||||
Map<String, String> details;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
details = new HashMap<>();
|
||||
addObjectStoragePoolCmdSpy = Mockito.spy(new AddObjectStoragePoolCmd());
|
||||
ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "name", name);
|
||||
ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "url", url);
|
||||
ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "providerName", provider);
|
||||
ReflectionTestUtils.setField(addObjectStoragePoolCmdSpy, "details", details);
|
||||
addObjectStoragePoolCmdSpy._storageService = storageService;
|
||||
addObjectStoragePoolCmdSpy._responseGenerator = responseGenerator;
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
CallContext.unregister();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddObjectStore() throws DiscoveryException {
|
||||
Mockito.doReturn(objectStore).when(storageService).discoverObjectStore(Mockito.anyString(),
|
||||
Mockito.anyString(), Mockito.anyString(), anyObject());
|
||||
ObjectStoreResponse objectStoreResponse = new ObjectStoreResponse();
|
||||
Mockito.doReturn(objectStoreResponse).when(responseGenerator).createObjectStoreResponse(anyObject());
|
||||
addObjectStoragePoolCmdSpy.execute();
|
||||
|
||||
Mockito.verify(storageService, Mockito.times(1))
|
||||
.discoverObjectStore(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* 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 org.apache.cloudstack.api.command.admin.storage;
|
||||
|
||||
import com.cloud.storage.StorageService;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.Spy;
|
||||
|
||||
public class DeleteObjectStoragePoolCmdTest {
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteObjectStoragePoolCmdTest.class.getName());
|
||||
@Mock
|
||||
private StorageService storageService;
|
||||
|
||||
@Spy
|
||||
DeleteObjectStoragePoolCmd deleteObjectStoragePoolCmd;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
deleteObjectStoragePoolCmd = Mockito.spy(new DeleteObjectStoragePoolCmd());
|
||||
deleteObjectStoragePoolCmd._storageService = storageService;
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
CallContext.unregister();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteObjectStore() {
|
||||
Mockito.doReturn(true).when(storageService).deleteObjectStore(deleteObjectStoragePoolCmd);
|
||||
deleteObjectStoragePoolCmd.execute();
|
||||
Mockito.verify(storageService, Mockito.times(1))
|
||||
.deleteObjectStore(deleteObjectStoragePoolCmd);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* 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 org.apache.cloudstack.api.command.admin.storage;
|
||||
|
||||
import com.cloud.storage.StorageService;
|
||||
import org.apache.cloudstack.api.ResponseGenerator;
|
||||
import org.apache.cloudstack.api.response.ObjectStoreResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.storage.object.ObjectStore;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.mockito.Spy;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.anyObject;
|
||||
|
||||
public class UpdateObjectStoragePoolCmdTest {
|
||||
public static final Logger s_logger = Logger.getLogger(UpdateObjectStoragePoolCmdTest.class.getName());
|
||||
|
||||
@Mock
|
||||
private StorageService storageService;
|
||||
|
||||
@Spy
|
||||
UpdateObjectStoragePoolCmd updateObjectStoragePoolCmd;
|
||||
|
||||
@Mock
|
||||
ObjectStore objectStore;
|
||||
|
||||
@Mock
|
||||
ResponseGenerator responseGenerator;
|
||||
|
||||
private String name = "testObjStore";
|
||||
|
||||
private String url = "testURL";
|
||||
|
||||
private String provider = "Simulator";
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
updateObjectStoragePoolCmd = Mockito.spy(new UpdateObjectStoragePoolCmd());
|
||||
updateObjectStoragePoolCmd._storageService = storageService;
|
||||
updateObjectStoragePoolCmd._responseGenerator = responseGenerator;
|
||||
ReflectionTestUtils.setField(updateObjectStoragePoolCmd, "name", name);
|
||||
ReflectionTestUtils.setField(updateObjectStoragePoolCmd, "url", url);
|
||||
ReflectionTestUtils.setField(updateObjectStoragePoolCmd, "id", 1L);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
CallContext.unregister();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateObjectStore() {
|
||||
Mockito.doReturn(objectStore).when(storageService).updateObjectStore(1L, updateObjectStoragePoolCmd);
|
||||
ObjectStoreResponse objectStoreResponse = new ObjectStoreResponse();
|
||||
Mockito.doReturn(objectStoreResponse).when(responseGenerator).createObjectStoreResponse(anyObject());
|
||||
updateObjectStoragePoolCmd.execute();
|
||||
Mockito.verify(storageService, Mockito.times(1))
|
||||
.updateObjectStore(1L, updateObjectStoragePoolCmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -71,6 +71,56 @@
|
|||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-agent</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-cluster</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-config</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-db</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-events</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-jobs</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-managed-context</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-security</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-framework-spring-module</artifactId>
|
||||
|
|
@ -81,6 +131,11 @@
|
|||
<artifactId>cloud-framework-spring-lifecycle</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-storage-volume-adaptive</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-storage-volume-solidfire</artifactId>
|
||||
|
|
@ -111,6 +166,16 @@
|
|||
<artifactId>cloud-plugin-storage-volume-storpool</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-storage-volume-primera</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-storage-volume-flasharray</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-server</artifactId>
|
||||
|
|
@ -577,6 +642,31 @@
|
|||
<artifactId>cloud-plugin-shutdown</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-engine-storage-object</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-storage-object-minio</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-plugin-storage-object-simulator</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-usage</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cloudstack</groupId>
|
||||
<artifactId>cloud-utils</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
@ -886,6 +976,7 @@
|
|||
<exclude>mysql:mysql-connector-java</exclude>
|
||||
<exclude>org.apache.cloudstack:cloud-plugin-storage-volume-storpool</exclude>
|
||||
<exclude>org.apache.cloudstack:cloud-plugin-storage-volume-linstor</exclude>
|
||||
<exclude>org.apache.cloudstack:cloud-usage</exclude>
|
||||
<exclude>com.linbit.linstor.api:java-linstor</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
@LogLevel(LogLevel.Log4jLevel.Trace)
|
||||
public class CheckVolumeAnswer extends Answer {
|
||||
|
||||
private long size;
|
||||
|
||||
CheckVolumeAnswer() {
|
||||
}
|
||||
|
||||
public CheckVolumeAnswer(CheckVolumeCommand cmd, String details, long size) {
|
||||
super(cmd, true, details);
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return "CheckVolumeAnswer [size=" + size + "]";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
//
|
||||
// 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.StorageFilerTO;
|
||||
|
||||
@LogLevel(LogLevel.Log4jLevel.Trace)
|
||||
public class CheckVolumeCommand extends Command {
|
||||
|
||||
String srcFile;
|
||||
|
||||
StorageFilerTO storageFilerTO;
|
||||
|
||||
|
||||
public String getSrcFile() {
|
||||
return srcFile;
|
||||
}
|
||||
|
||||
public void setSrcFile(String srcFile) {
|
||||
this.srcFile = srcFile;
|
||||
}
|
||||
|
||||
public CheckVolumeCommand() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return "CheckVolumeCommand [srcFile=" + srcFile + "]";
|
||||
}
|
||||
|
||||
public StorageFilerTO getStorageFilerTO() {
|
||||
return storageFilerTO;
|
||||
}
|
||||
|
||||
public void setStorageFilerTO(StorageFilerTO storageFilerTO) {
|
||||
this.storageFilerTO = storageFilerTO;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 ConvertInstanceAnswer extends Answer {
|
||||
|
||||
public ConvertInstanceAnswer() {
|
||||
super();
|
||||
}
|
||||
private UnmanagedInstanceTO convertedInstance;
|
||||
|
||||
public ConvertInstanceAnswer(Command command, boolean success, String details) {
|
||||
super(command, success, details);
|
||||
}
|
||||
|
||||
public ConvertInstanceAnswer(Command command, UnmanagedInstanceTO convertedInstance) {
|
||||
super(command, true, "");
|
||||
this.convertedInstance = convertedInstance;
|
||||
}
|
||||
|
||||
public UnmanagedInstanceTO getConvertedInstance() {
|
||||
return convertedInstance;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 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;
|
||||
|
||||
public ConvertInstanceCommand() {
|
||||
}
|
||||
|
||||
public ConvertInstanceCommand(RemoteInstanceTO sourceInstance, Hypervisor.HypervisorType destinationHypervisorType,
|
||||
List<String> destinationStoragePools, DataStoreTO conversionTemporaryLocation) {
|
||||
this.sourceInstance = sourceInstance;
|
||||
this.destinationHypervisorType = destinationHypervisorType;
|
||||
this.destinationStoragePools = destinationStoragePools;
|
||||
this.conversionTemporaryLocation = conversionTemporaryLocation;
|
||||
}
|
||||
|
||||
public RemoteInstanceTO getSourceInstance() {
|
||||
return sourceInstance;
|
||||
}
|
||||
|
||||
public Hypervisor.HypervisorType getDestinationHypervisorType() {
|
||||
return destinationHypervisorType;
|
||||
}
|
||||
|
||||
public List<String> getDestinationStoragePools() {
|
||||
return destinationStoragePools;
|
||||
}
|
||||
|
||||
public DataStoreTO getConversionTemporaryLocation() {
|
||||
return conversionTemporaryLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
// 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;
|
||||
|
||||
@LogLevel(LogLevel.Log4jLevel.Trace)
|
||||
public class CopyRemoteVolumeAnswer extends Answer {
|
||||
|
||||
private String remoteIp;
|
||||
private String filename;
|
||||
|
||||
private long size;
|
||||
|
||||
CopyRemoteVolumeAnswer() {
|
||||
}
|
||||
|
||||
public CopyRemoteVolumeAnswer(CopyRemoteVolumeCommand cmd, String details, String filename, long size) {
|
||||
super(cmd, true, details);
|
||||
this.remoteIp = cmd.getRemoteIp();
|
||||
this.filename = filename;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
|
||||
public void setRemoteIp(String remoteIp) {
|
||||
this.remoteIp = remoteIp;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return "CopyRemoteVolumeAnswer [remoteIp=" + remoteIp + "]";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
//
|
||||
// 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.StorageFilerTO;
|
||||
|
||||
@LogLevel(LogLevel.Log4jLevel.Trace)
|
||||
public class CopyRemoteVolumeCommand extends Command {
|
||||
|
||||
String remoteIp;
|
||||
String username;
|
||||
String password;
|
||||
String srcFile;
|
||||
|
||||
String tmpPath;
|
||||
|
||||
StorageFilerTO storageFilerTO;
|
||||
|
||||
public CopyRemoteVolumeCommand(String remoteIp, String username, String password) {
|
||||
this.remoteIp = remoteIp;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
|
||||
public void setRemoteIp(String remoteIp) {
|
||||
this.remoteIp = remoteIp;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getSrcFile() {
|
||||
return srcFile;
|
||||
}
|
||||
|
||||
public void setSrcFile(String srcFile) {
|
||||
this.srcFile = srcFile;
|
||||
}
|
||||
|
||||
public CopyRemoteVolumeCommand() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return "CopyRemoteVolumeCommand [remoteIp=" + remoteIp + "]";
|
||||
}
|
||||
|
||||
public void setTempPath(String tmpPath) {
|
||||
this.tmpPath = tmpPath;
|
||||
}
|
||||
|
||||
public String getTmpPath() {
|
||||
return tmpPath;
|
||||
}
|
||||
|
||||
public StorageFilerTO getStorageFilerTO() {
|
||||
return storageFilerTO;
|
||||
}
|
||||
|
||||
public void setStorageFilerTO(StorageFilerTO storageFilerTO) {
|
||||
this.storageFilerTO = storageFilerTO;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
// 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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@LogLevel(LogLevel.Log4jLevel.Trace)
|
||||
public class GetRemoteVmsAnswer extends Answer {
|
||||
|
||||
private String remoteIp;
|
||||
private HashMap<String, UnmanagedInstanceTO> unmanagedInstances;
|
||||
|
||||
List<String> vmNames;
|
||||
|
||||
GetRemoteVmsAnswer() {
|
||||
}
|
||||
|
||||
public GetRemoteVmsAnswer(GetRemoteVmsCommand cmd, String details, HashMap<String, UnmanagedInstanceTO> unmanagedInstances) {
|
||||
super(cmd, true, details);
|
||||
this.remoteIp = cmd.getRemoteIp();
|
||||
this.unmanagedInstances = unmanagedInstances;
|
||||
}
|
||||
|
||||
public GetRemoteVmsAnswer(GetRemoteVmsCommand cmd, String details, List<String> vmNames) {
|
||||
super(cmd, true, details);
|
||||
this.remoteIp = cmd.getRemoteIp();
|
||||
this.vmNames = vmNames;
|
||||
}
|
||||
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
|
||||
public void setRemoteIp(String remoteIp) {
|
||||
this.remoteIp = remoteIp;
|
||||
}
|
||||
|
||||
public HashMap<String, UnmanagedInstanceTO> getUnmanagedInstances() {
|
||||
return unmanagedInstances;
|
||||
}
|
||||
|
||||
public void setUnmanagedInstances(HashMap<String, UnmanagedInstanceTO> unmanagedInstances) {
|
||||
this.unmanagedInstances = unmanagedInstances;
|
||||
}
|
||||
|
||||
public List<String> getVmNames() {
|
||||
return vmNames;
|
||||
}
|
||||
|
||||
public void setVmNames(List<String> vmNames) {
|
||||
this.vmNames = vmNames;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return "GetRemoteVmsAnswer [remoteIp=" + remoteIp + "]";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
//
|
||||
// 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;
|
||||
|
||||
@LogLevel(LogLevel.Log4jLevel.Trace)
|
||||
public class GetRemoteVmsCommand extends Command {
|
||||
|
||||
String remoteIp;
|
||||
String username;
|
||||
String password;
|
||||
|
||||
public GetRemoteVmsCommand(String remoteIp, String username, String password) {
|
||||
this.remoteIp = remoteIp;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getRemoteIp() {
|
||||
return remoteIp;
|
||||
}
|
||||
|
||||
public void setRemoteIp(String remoteIp) {
|
||||
this.remoteIp = remoteIp;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public GetRemoteVmsCommand() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean executeInSequence() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return "GetRemoteVmsCommand [remoteIp=" + remoteIp + "]";
|
||||
}
|
||||
}
|
||||
|
|
@ -30,6 +30,10 @@ public class GetUnmanagedInstancesAnswer extends Answer {
|
|||
GetUnmanagedInstancesAnswer() {
|
||||
}
|
||||
|
||||
public GetUnmanagedInstancesAnswer(GetUnmanagedInstancesCommand cmd, String details) {
|
||||
super(cmd, false, details);
|
||||
}
|
||||
|
||||
public GetUnmanagedInstancesAnswer(GetUnmanagedInstancesCommand cmd, String details, HashMap<String, UnmanagedInstanceTO> unmanagedInstances) {
|
||||
super(cmd, true, details);
|
||||
this.instanceName = cmd.getInstanceName();
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ public class MigrateCommand extends Command {
|
|||
private boolean executeInSequence = false;
|
||||
private List<MigrateDiskInfo> migrateDiskInfoList = new ArrayList<>();
|
||||
private Map<String, DpdkTO> dpdkInterfaceMapping = new HashMap<>();
|
||||
|
||||
private int newVmCpuShares;
|
||||
|
||||
Map<String, Boolean> vlanToPersistenceMap = new HashMap<>();
|
||||
|
||||
public Map<String, DpdkTO> getDpdkInterfaceMapping() {
|
||||
|
|
@ -138,6 +141,14 @@ public class MigrateCommand extends Command {
|
|||
this.migrateDiskInfoList = migrateDiskInfoList;
|
||||
}
|
||||
|
||||
public int getNewVmCpuShares() {
|
||||
return newVmCpuShares;
|
||||
}
|
||||
|
||||
public void setNewVmCpuShares(int newVmCpuShares) {
|
||||
this.newVmCpuShares = newVmCpuShares;
|
||||
}
|
||||
|
||||
public static class MigrateDiskInfo {
|
||||
public enum DiskType {
|
||||
FILE, BLOCK;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ public class PrepareForMigrationAnswer extends Answer {
|
|||
|
||||
private Map<String, DpdkTO> dpdkInterfaceMapping = new HashMap<>();
|
||||
|
||||
private Integer newVmCpuShares = null;
|
||||
|
||||
protected PrepareForMigrationAnswer() {
|
||||
}
|
||||
|
||||
|
|
@ -50,4 +52,12 @@ public class PrepareForMigrationAnswer extends Answer {
|
|||
public Map<String, DpdkTO> getDpdkInterfaceMapping() {
|
||||
return this.dpdkInterfaceMapping;
|
||||
}
|
||||
|
||||
public Integer getNewVmCpuShares() {
|
||||
return newVmCpuShares;
|
||||
}
|
||||
|
||||
public void setNewVmCpuShares(Integer newVmCpuShares) {
|
||||
this.newVmCpuShares = newVmCpuShares;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Description: CloudStack server library
|
|||
|
||||
Package: cloudstack-agent
|
||||
Architecture: all
|
||||
Depends: ${python:Depends}, ${python3:Depends}, openjdk-11-jre-headless | java11-runtime-headless | java11-runtime | openjdk-11-jre-headless | zulu-11, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, lsb-release, aria2, ufw, apparmor
|
||||
Depends: ${python:Depends}, ${python3:Depends}, openjdk-11-jre-headless | java11-runtime-headless | java11-runtime | openjdk-11-jre-headless | zulu-11, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, lsb-release, ufw, apparmor
|
||||
Recommends: init-system-helpers
|
||||
Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
|
||||
Description: CloudStack agent
|
||||
|
|
|
|||
|
|
@ -168,6 +168,9 @@ public interface VolumeOrchestrationService {
|
|||
DiskProfile importVolume(Type type, String name, DiskOffering offering, Long size, Long minIops, Long maxIops, VirtualMachine vm, VirtualMachineTemplate template,
|
||||
Account owner, Long deviceId, Long poolId, String path, String chainInfo);
|
||||
|
||||
DiskProfile updateImportedVolume(Type type, DiskOffering offering, VirtualMachine vm, VirtualMachineTemplate template,
|
||||
Long deviceId, Long poolId, String path, String chainInfo, DiskProfile diskProfile);
|
||||
|
||||
/**
|
||||
* Unmanage VM volumes
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* 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 org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
import org.apache.cloudstack.storage.object.Bucket;
|
||||
|
||||
public interface BucketInfo extends DataObject, Bucket {
|
||||
|
||||
void addPayload(Object data);
|
||||
|
||||
Object getPayload();
|
||||
|
||||
Bucket getBucket();
|
||||
}
|
||||
|
|
@ -35,6 +35,8 @@ public interface DataStoreManager {
|
|||
|
||||
List<DataStore> getImageStoresByScopeExcludingReadOnly(ZoneScope scope);
|
||||
|
||||
List<DataStore> getImageStoresByZoneIds(Long ... zoneIds);
|
||||
|
||||
DataStore getRandomImageStore(long zoneId);
|
||||
|
||||
DataStore getRandomUsableImageStore(long zoneId);
|
||||
|
|
@ -55,5 +57,7 @@ public interface DataStoreManager {
|
|||
|
||||
boolean isRegionStore(DataStore store);
|
||||
|
||||
DataStore getImageStoreByUuid(String uuid);
|
||||
|
||||
Long getStoreZoneId(long storeId, DataStoreRole role);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public interface DataStoreProvider {
|
|||
String DEFAULT_PRIMARY = "DefaultPrimary";
|
||||
|
||||
enum DataStoreProviderType {
|
||||
PRIMARY, IMAGE, ImageCache
|
||||
PRIMARY, IMAGE, ImageCache, OBJECT
|
||||
}
|
||||
|
||||
DataStoreLifeCycle getDataStoreLifeCycle();
|
||||
|
|
|
|||
|
|
@ -33,4 +33,6 @@ public interface DataStoreProviderManager extends Manager, DataStoreProviderApiS
|
|||
DataStoreProvider getDefaultCacheDataStoreProvider();
|
||||
|
||||
List<DataStoreProvider> getProviders();
|
||||
|
||||
DataStoreProvider getDefaultObjectStoreProvider();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
// 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 org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
public interface ObjectStorageService {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* 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 org.apache.cloudstack.engine.subsystem.api.storage;
|
||||
|
||||
public interface ObjectStoreProvider extends DataStoreProvider {
|
||||
|
||||
}
|
||||
|
|
@ -43,6 +43,8 @@ public class PrimaryDataStoreParameters {
|
|||
private boolean managed;
|
||||
private Long capacityIops;
|
||||
|
||||
private Boolean isTagARule;
|
||||
|
||||
/**
|
||||
* @return the userInfo
|
||||
*/
|
||||
|
|
@ -277,4 +279,12 @@ public class PrimaryDataStoreParameters {
|
|||
public void setUsedBytes(long usedBytes) {
|
||||
this.usedBytes = usedBytes;
|
||||
}
|
||||
|
||||
public Boolean isTagARule() {
|
||||
return isTagARule;
|
||||
}
|
||||
|
||||
public void setIsTagARule(Boolean isTagARule) {
|
||||
this.isTagARule = isTagARule;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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 org.apache.cloudstack.storage.object;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ObjectStoreEntity extends DataStore, ObjectStore {
|
||||
Bucket createBucket(Bucket bucket, boolean objectLock);
|
||||
|
||||
List<Bucket> listBuckets();
|
||||
|
||||
boolean createUser(long accountId);
|
||||
|
||||
boolean deleteBucket(String name);
|
||||
|
||||
boolean setBucketEncryption(String name);
|
||||
|
||||
boolean deleteBucketEncryption(String name);
|
||||
|
||||
boolean setBucketVersioning(String name);
|
||||
|
||||
boolean deleteBucketVersioning(String name);
|
||||
|
||||
void setBucketPolicy(String name, String policy);
|
||||
|
||||
void setQuota(String name, int quota);
|
||||
|
||||
Map<String, Long> getAllBucketsUsage();
|
||||
}
|
||||
|
|
@ -96,6 +96,14 @@ public interface StorageManager extends StorageService {
|
|||
true,
|
||||
ConfigKey.Scope.Global,
|
||||
null);
|
||||
ConfigKey<Integer> ConvertVmwareInstanceToKvmTimeout = new ConfigKey<>(Integer.class,
|
||||
"convert.vmware.instance.to.kvm.timeout",
|
||||
"Storage",
|
||||
"8",
|
||||
"Timeout (in hours) for the instance conversion process from VMware through the virt-v2v binary on a KVM host",
|
||||
true,
|
||||
ConfigKey.Scope.Global,
|
||||
null);
|
||||
ConfigKey<Boolean> KvmAutoConvergence = new ConfigKey<>(Boolean.class,
|
||||
"kvm.auto.convergence",
|
||||
"Storage",
|
||||
|
|
@ -192,6 +200,9 @@ public interface StorageManager extends StorageService {
|
|||
ConfigKey.Scope.Global,
|
||||
null);
|
||||
|
||||
ConfigKey<Long> HEURISTICS_SCRIPT_TIMEOUT = new ConfigKey<>("Advanced", Long.class, "heuristics.script.timeout", "3000",
|
||||
"The maximum runtime, in milliseconds, to execute the heuristic rule; if it is reached, a timeout will happen.", true);
|
||||
|
||||
/**
|
||||
* should we execute in sequence not involving any storages?
|
||||
* @return tru if commands should execute in sequence
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import com.cloud.storage.Storage.TemplateType;
|
|||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.VMTemplateStoragePoolVO;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.VolumeVO;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
|
||||
|
|
@ -116,7 +117,7 @@ public interface TemplateManager {
|
|||
|
||||
Long getTemplateSize(long templateId, long zoneId);
|
||||
|
||||
DataStore getImageStore(String storeUuid, Long zoneId);
|
||||
DataStore getImageStore(String storeUuid, Long zoneId, VolumeVO volume);
|
||||
|
||||
String getChecksum(DataStore store, String templatePath, String algorithm);
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue