mirror of https://github.com/apache/cloudstack.git
Remove methods of searching for secondary storages from host table from
SecondaryStorageManagerImpl.
This commit is contained in:
parent
8a5bd9e8f8
commit
2812873ffa
|
|
@ -33,4 +33,5 @@ public interface DataStoreManager {
|
|||
public List<DataStore> getImageStoresByProvider(String provider);
|
||||
public List<DataStore> getImageCacheStores(Scope scope);
|
||||
public DataStore registerDataStore(Map<String, String> params, String providerUuid);
|
||||
public List<DataStore> listImageStores();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
import javax.persistence.TableGenerator;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.storage.ScopeType;
|
||||
|
|
@ -66,20 +63,21 @@ public class ImageStoreVO implements ImageStore {
|
|||
@Enumerated(value = EnumType.STRING)
|
||||
private ScopeType scope;
|
||||
|
||||
@Column(name=GenericDao.CREATED_COLUMN)
|
||||
@Column(name = GenericDao.CREATED_COLUMN)
|
||||
private Date created;
|
||||
|
||||
@Column(name=GenericDao.REMOVED_COLUMN)
|
||||
@Column(name = GenericDao.REMOVED_COLUMN)
|
||||
private Date removed;
|
||||
|
||||
@Column(name = "role")
|
||||
@Enumerated(value = EnumType.STRING)
|
||||
private DataStoreRole role;
|
||||
|
||||
@Column(name="parent")
|
||||
@Column(name = "parent")
|
||||
private String parent;
|
||||
|
||||
|
||||
@Column(name="total_size")
|
||||
private Long totalSize;
|
||||
|
||||
public DataStoreRole getRole() {
|
||||
return role;
|
||||
|
|
@ -173,6 +171,13 @@ public class ImageStoreVO implements ImageStore {
|
|||
this.parent = parent;
|
||||
}
|
||||
|
||||
public Long getTotalSize() {
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
public void setTotalSize(Long totalSize) {
|
||||
this.totalSize = totalSize;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,4 +100,10 @@ public class DataStoreManagerImpl implements DataStoreManager {
|
|||
public List<DataStore> getImageCacheStores(Scope scope) {
|
||||
return imageDataStoreMgr.listImageCacheStores(scope);
|
||||
}
|
||||
@Override
|
||||
public List<DataStore> listImageStores() {
|
||||
return imageDataStoreMgr.listImageStores();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
// 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,
|
||||
|
|
@ -61,6 +61,8 @@ import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
|
|||
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
|
||||
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
|
@ -220,7 +222,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
@Inject
|
||||
AlertManager _alertMgr;
|
||||
// @com.cloud.utils.component.Inject(adapter = SecurityChecker.class)
|
||||
@Inject
|
||||
@Inject
|
||||
List<SecurityChecker> _secChecker;
|
||||
|
||||
@Inject
|
||||
|
|
@ -232,6 +234,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
@Inject
|
||||
SecondaryStorageVmManager _ssvmMgr;
|
||||
@Inject
|
||||
DataStoreManager _dataStoreMgr;
|
||||
@Inject
|
||||
NetworkOfferingServiceMapDao _ntwkOffServiceMapDao;
|
||||
@Inject
|
||||
PhysicalNetworkDao _physicalNetworkDao;
|
||||
|
|
@ -258,11 +262,11 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
@Override
|
||||
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
|
||||
String maxVolumeSizeInGbString = _configDao.getValue(Config.MaxVolumeSize.key());
|
||||
_maxVolumeSizeInGb = NumbersUtil.parseInt(maxVolumeSizeInGbString,
|
||||
_maxVolumeSizeInGb = NumbersUtil.parseInt(maxVolumeSizeInGbString,
|
||||
Integer.parseInt(Config.MaxVolumeSize.getDefaultValue()));
|
||||
|
||||
String defaultPageSizeString = _configDao.getValue(Config.DefaultPageSize.key());
|
||||
_defaultPageSize = NumbersUtil.parseLong(defaultPageSizeString,
|
||||
_defaultPageSize = NumbersUtil.parseLong(defaultPageSizeString,
|
||||
Long.parseLong(Config.DefaultPageSize.getDefaultValue()));
|
||||
|
||||
populateConfigValuesForValidationSet();
|
||||
|
|
@ -488,8 +492,8 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
return "Please enter either 'true' or 'false'.";
|
||||
}
|
||||
if (Config.SwiftEnable.key().equals(name)) {
|
||||
List<HostVO> hosts = _ssvmMgr.listSecondaryStorageHostsInAllZones();
|
||||
if (hosts != null && hosts.size() > 0) {
|
||||
List<DataStore> stores = this._dataStoreMgr.listImageStores();
|
||||
if (stores != null && stores.size() > 0) {
|
||||
return " can not change " + Config.SwiftEnable.key() + " after you have added secondary storage";
|
||||
}
|
||||
SwiftVO swift = _swiftDao.findById(1L);
|
||||
|
|
@ -708,7 +712,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
checkPodCidrSubnets(zoneId, podId, cidr);
|
||||
/*
|
||||
* Commenting out due to Bug 11593 - CIDR conflicts with zone when extending pod but not when creating it
|
||||
*
|
||||
*
|
||||
* checkCidrVlanOverlap(zoneId, cidr);
|
||||
*/
|
||||
}
|
||||
|
|
@ -1501,7 +1505,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (internalDns2 == null) {
|
||||
internalDns2 = zone.getInternalDns2();
|
||||
}
|
||||
|
||||
|
||||
if (guestCidr == null) {
|
||||
guestCidr = zone.getGuestNetworkCidr();
|
||||
}
|
||||
|
|
@ -1686,7 +1690,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
userNetwork.setBroadcastDomainType(broadcastDomainType);
|
||||
userNetwork.setNetworkDomain(networkDomain);
|
||||
_networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, false,
|
||||
_networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, false,
|
||||
Domain.ROOT_DOMAIN, null, null, null);
|
||||
}
|
||||
}
|
||||
|
|
@ -2112,9 +2116,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
String endIPv6 = cmd.getEndIpv6();
|
||||
String ip6Gateway = cmd.getIp6Gateway();
|
||||
String ip6Cidr = cmd.getIp6Cidr();
|
||||
|
||||
|
||||
Account vlanOwner = null;
|
||||
|
||||
|
||||
boolean ipv4 = (startIP != null);
|
||||
boolean ipv6 = (startIPv6 != null);
|
||||
|
||||
|
|
@ -2168,7 +2172,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
} else if (ipv6) {
|
||||
throw new InvalidParameterValueException("Only support IPv6 on extending existed network");
|
||||
}
|
||||
|
||||
|
||||
// Verify that zone exists
|
||||
DataCenterVO zone = _zoneDao.findById(zoneId);
|
||||
if (zone == null) {
|
||||
|
|
@ -2215,18 +2219,18 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Check if zone is enabled
|
||||
Account caller = UserContext.current().getCaller();
|
||||
if (Grouping.AllocationState.Disabled == zone.getAllocationState() && !_accountMgr.isRootAdmin(caller.getType())) {
|
||||
throw new PermissionDeniedException("Cannot perform this operation, Zone is currently disabled: " + zoneId);
|
||||
}
|
||||
}
|
||||
|
||||
if (zone.isSecurityGroupEnabled() && zone.getNetworkType() != DataCenter.NetworkType.Basic && forVirtualNetwork) {
|
||||
throw new InvalidParameterValueException("Can't add virtual ip range into a zone with security group enabled");
|
||||
}
|
||||
|
||||
|
||||
// If networkId is not specified, and vlan is Virtual or Direct Untagged, try to locate default networks
|
||||
if (forVirtualNetwork) {
|
||||
if (network == null) {
|
||||
|
|
@ -2316,7 +2320,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
//check resource limits
|
||||
_resourceLimitMgr.checkResourceLimit(vlanOwner, ResourceType.public_ip, accountIpRange);
|
||||
|
||||
|
||||
associateIpRangeToAccount = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -2328,7 +2332,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, podId, startIP,
|
||||
Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, podId, startIP,
|
||||
endIP, vlanGateway, vlanNetmask, vlanId, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
|
||||
|
||||
txn.commit();
|
||||
|
|
@ -2353,39 +2357,39 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
@Override
|
||||
@DB
|
||||
public Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, Long podId,
|
||||
public Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, Long podId,
|
||||
String startIP, String endIP, String vlanGateway, String vlanNetmask,
|
||||
String vlanId, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr) {
|
||||
Network network = _networkModel.getNetwork(networkId);
|
||||
|
||||
|
||||
boolean ipv4 = false, ipv6 = false;
|
||||
|
||||
|
||||
if (startIP != null) {
|
||||
ipv4 = true;
|
||||
}
|
||||
|
||||
|
||||
if (startIPv6 != null) {
|
||||
ipv6 = true;
|
||||
}
|
||||
|
||||
|
||||
if (!ipv4 && !ipv6) {
|
||||
throw new InvalidParameterValueException("Please specify IPv4 or IPv6 address.");
|
||||
}
|
||||
|
||||
|
||||
//Validate the zone
|
||||
DataCenterVO zone = _zoneDao.findById(zoneId);
|
||||
if (zone == null) {
|
||||
throw new InvalidParameterValueException("Please specify a valid zone.");
|
||||
}
|
||||
|
||||
|
||||
// ACL check
|
||||
checkZoneAccess(UserContext.current().getCaller(), zone);
|
||||
|
||||
|
||||
//Validate the physical network
|
||||
if (_physicalNetworkDao.findById(physicalNetworkId) == null) {
|
||||
throw new InvalidParameterValueException("Please specify a valid physical network id");
|
||||
}
|
||||
|
||||
|
||||
//Validate the pod
|
||||
if (podId != null) {
|
||||
Pod pod = _podDao.findById(podId);
|
||||
|
|
@ -2397,11 +2401,11 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
//pod vlans can be created in basic zone only
|
||||
if (zone.getNetworkType() != NetworkType.Basic || network.getTrafficType() != TrafficType.Guest) {
|
||||
throw new InvalidParameterValueException("Pod id can be specified only for the networks of type "
|
||||
+ TrafficType.Guest + " in zone of type " + NetworkType.Basic);
|
||||
throw new InvalidParameterValueException("Pod id can be specified only for the networks of type "
|
||||
+ TrafficType.Guest + " in zone of type " + NetworkType.Basic);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//1) if vlan is specified for the guest network range, it should be the same as network's vlan
|
||||
//2) if vlan is missing, default it to the guest network's vlan
|
||||
if (network.getTrafficType() == TrafficType.Guest) {
|
||||
|
|
@ -2411,7 +2415,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
String[] vlan = uri.toString().split("vlan:\\/\\/");
|
||||
networkVlanId = vlan[1];
|
||||
}
|
||||
|
||||
|
||||
if (vlanId != null) {
|
||||
// if vlan is specified, throw an error if it's not equal to network's vlanId
|
||||
if (networkVlanId != null && !networkVlanId.equalsIgnoreCase(vlanId)) {
|
||||
|
|
@ -2424,14 +2428,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
//vlan id is required for public network
|
||||
throw new InvalidParameterValueException("Vlan id is required when add ip range to the public network");
|
||||
}
|
||||
|
||||
|
||||
if (vlanId == null) {
|
||||
vlanId = Vlan.UNTAGGED;
|
||||
}
|
||||
|
||||
VlanType vlanType = forVirtualNetwork ? VlanType.VirtualNetwork : VlanType.DirectAttached;
|
||||
|
||||
|
||||
|
||||
|
||||
if (vlanOwner != null && zone.getNetworkType() != NetworkType.Advanced) {
|
||||
throw new InvalidParameterValueException("Vlan owner can be defined only in the zone of type " + NetworkType.Advanced);
|
||||
}
|
||||
|
|
@ -2447,7 +2451,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
throw new InvalidParameterValueException("Please specify a valid netmask");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ipv6) {
|
||||
if (!NetUtils.isValidIpv6(vlanIp6Gateway)) {
|
||||
throw new InvalidParameterValueException("Please specify a valid IPv6 gateway");
|
||||
|
|
@ -2502,7 +2506,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
List<VlanVO> vlans = _vlanDao.listByZone(zone.getId());
|
||||
for (VlanVO vlan : vlans) {
|
||||
String otherVlanGateway = vlan.getVlanGateway();
|
||||
// Continue if it's not IPv4
|
||||
// Continue if it's not IPv4
|
||||
if (otherVlanGateway == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -2538,14 +2542,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String ipv6Range = null;
|
||||
if (ipv6) {
|
||||
ipv6Range = startIPv6;
|
||||
if (endIPv6 != null) {
|
||||
ipv6Range += "-" + endIPv6;
|
||||
}
|
||||
|
||||
|
||||
List<VlanVO> vlans = _vlanDao.listByZone(zone.getId());
|
||||
for (VlanVO vlan : vlans) {
|
||||
if (vlan.getIp6Gateway() == null) {
|
||||
|
|
@ -2585,14 +2589,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
|
||||
String ipRange = null;
|
||||
|
||||
|
||||
if (ipv4) {
|
||||
ipRange = startIP;
|
||||
if (endIP != null) {
|
||||
ipRange += "-" + endIP;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Everything was fine, so persist the VLAN
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
|
@ -2604,7 +2608,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
// IPv6 use a used ip map, is different from ipv4, no need to save public ip range
|
||||
if (ipv4) {
|
||||
if (!savePublicIPRange(startIP, endIP, zoneId, vlan.getId(), networkId, physicalNetworkId)) {
|
||||
throw new CloudRuntimeException("Failed to save IPv4 range. Please contact Cloud Support.");
|
||||
throw new CloudRuntimeException("Failed to save IPv4 range. Please contact Cloud Support.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2630,7 +2634,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (vlan == null) {
|
||||
throw new InvalidParameterValueException("Please specify a valid IP range id.");
|
||||
}
|
||||
|
||||
|
||||
boolean isAccountSpecific = false;
|
||||
List<AccountVlanMapVO> acctVln = _accountVlanMapDao.listAccountVlanMapsByVlan(vlan.getId());
|
||||
// Check for account wide pool. It will have an entry for account_vlan_map.
|
||||
|
|
@ -2642,33 +2646,33 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
long allocIpCount = _publicIpAddressDao.countIPs(vlan.getDataCenterId(), vlanDbId, true);
|
||||
boolean success = true;
|
||||
if (allocIpCount > 0) {
|
||||
if (isAccountSpecific) {
|
||||
if (isAccountSpecific) {
|
||||
try {
|
||||
vlan = _vlanDao.acquireInLockTable(vlanDbId, 30);
|
||||
if (vlan == null) {
|
||||
throw new CloudRuntimeException("Unable to acquire vlan configuration: " + vlanDbId);
|
||||
}
|
||||
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("lock vlan " + vlanDbId + " is acquired");
|
||||
}
|
||||
|
||||
|
||||
List<IPAddressVO> ips = _publicIpAddressDao.listByVlanId(vlanDbId);
|
||||
|
||||
|
||||
for (IPAddressVO ip : ips) {
|
||||
if (ip.isOneToOneNat()) {
|
||||
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
|
||||
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
|
||||
" as ip " + ip + " belonging to the range is used for static nat purposes. Cleanup the rules first");
|
||||
}
|
||||
|
||||
|
||||
if (ip.isSourceNat() && _networkModel.getNetwork(ip.getAssociatedWithNetworkId()) != null) {
|
||||
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
|
||||
" as ip " + ip + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() +
|
||||
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
|
||||
" as ip " + ip + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() +
|
||||
". IP range with the source nat ip address can be removed either as a part of Network, or account removal");
|
||||
}
|
||||
|
||||
|
||||
if (_firewallDao.countRulesByIpId(ip.getId()) > 0) {
|
||||
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
|
||||
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
|
||||
" as ip " + ip + " belonging to the range has firewall rules applied. Cleanup the rules first");
|
||||
}
|
||||
//release public ip address here
|
||||
|
|
@ -2679,7 +2683,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
} finally {
|
||||
_vlanDao.releaseFromLockTable(vlanDbId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new InvalidParameterValueException("The IP range can't be deleted because it has allocated public IP addresses.");
|
||||
}
|
||||
|
|
@ -2759,7 +2763,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@DB
|
||||
protected boolean savePublicIPRange(String startIP, String endIP, long zoneId, long vlanDbId, long sourceNetworkid, long physicalNetworkId) {
|
||||
|
|
@ -2962,7 +2966,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private boolean validPod(long podId) {
|
||||
return (_podDao.findById(podId) != null);
|
||||
}
|
||||
|
|
@ -3180,7 +3184,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (provider == Provider.JuniperSRX) {
|
||||
firewallProvider = Provider.JuniperSRX;
|
||||
}
|
||||
|
||||
|
||||
if ((service == Service.PortForwarding || service == Service.StaticNat) && provider == Provider.VirtualRouter){
|
||||
firewallProvider = Provider.VirtualRouter;
|
||||
}
|
||||
|
|
@ -3341,7 +3345,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (!specifyVlan && type == GuestType.Shared) {
|
||||
throw new InvalidParameterValueException("SpecifyVlan should be true if network offering's type is " + type);
|
||||
}
|
||||
|
||||
|
||||
//specifyIpRanges should always be true for Shared networks
|
||||
//specifyIpRanges can only be true for Isolated networks with no Source Nat service
|
||||
if (specifyIpRanges) {
|
||||
|
|
@ -3365,7 +3369,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (availability == NetworkOffering.Availability.Required) {
|
||||
boolean canOffBeRequired = (type == GuestType.Isolated && serviceProviderMap.containsKey(Service.SourceNat));
|
||||
if (!canOffBeRequired) {
|
||||
throw new InvalidParameterValueException("Availability can be " + NetworkOffering.Availability.Required
|
||||
throw new InvalidParameterValueException("Availability can be " + NetworkOffering.Availability.Required
|
||||
+ " only for networkOfferings of type " + GuestType.Isolated + " and with "
|
||||
+ Service.SourceNat.getName() + " enabled");
|
||||
}
|
||||
|
|
@ -3373,11 +3377,11 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
// only one network offering in the system can be Required
|
||||
List<NetworkOfferingVO> offerings = _networkOfferingDao.listByAvailability(Availability.Required, false);
|
||||
if (!offerings.isEmpty()) {
|
||||
throw new InvalidParameterValueException("System already has network offering id=" + offerings.get(0).getId()
|
||||
throw new InvalidParameterValueException("System already has network offering id=" + offerings.get(0).getId()
|
||||
+ " with availability " + Availability.Required);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
boolean dedicatedLb = false;
|
||||
boolean elasticLb = false;
|
||||
boolean sharedSourceNat = false;
|
||||
|
|
@ -3386,7 +3390,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
boolean inline = false;
|
||||
if (serviceCapabilityMap != null && !serviceCapabilityMap.isEmpty()) {
|
||||
Map<Capability, String> lbServiceCapabilityMap = serviceCapabilityMap.get(Service.Lb);
|
||||
|
||||
|
||||
if ((lbServiceCapabilityMap != null) && (!lbServiceCapabilityMap.isEmpty())) {
|
||||
String isolationCapability = lbServiceCapabilityMap.get(Capability.SupportedLBIsolation);
|
||||
if (isolationCapability != null) {
|
||||
|
|
@ -3400,7 +3404,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (param != null) {
|
||||
elasticLb = param.contains("true");
|
||||
}
|
||||
|
||||
|
||||
String inlineMode = lbServiceCapabilityMap.get(Capability.InlineMode);
|
||||
if (inlineMode != null) {
|
||||
_networkModel.checkCapabilityForProvider(serviceProviderMap.get(Service.Lb), Service.Lb, Capability.InlineMode, inlineMode);
|
||||
|
|
@ -3414,14 +3418,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if ((sourceNatServiceCapabilityMap != null) && (!sourceNatServiceCapabilityMap.isEmpty())) {
|
||||
String sourceNatType = sourceNatServiceCapabilityMap.get(Capability.SupportedSourceNatTypes);
|
||||
if (sourceNatType != null) {
|
||||
_networkModel.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat,
|
||||
_networkModel.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat,
|
||||
Capability.SupportedSourceNatTypes, sourceNatType);
|
||||
sharedSourceNat = sourceNatType.contains("perzone");
|
||||
}
|
||||
|
||||
String param = sourceNatServiceCapabilityMap.get(Capability.RedundantRouter);
|
||||
if (param != null) {
|
||||
_networkModel.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat,
|
||||
_networkModel.checkCapabilityForProvider(serviceProviderMap.get(Service.SourceNat), Service.SourceNat,
|
||||
Capability.RedundantRouter, param);
|
||||
redundantRouter = param.contains("true");
|
||||
}
|
||||
|
|
@ -3436,7 +3440,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
}
|
||||
|
||||
NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan,
|
||||
NetworkOfferingVO offering = new NetworkOfferingVO(name, displayText, trafficType, systemOnly, specifyVlan,
|
||||
networkRate, multicastRate, isDefault, availability, tags, type, conserveMode, dedicatedLb,
|
||||
sharedSourceNat, redundantRouter, elasticIp, elasticLb, specifyIpRanges, inline, isPersistent);
|
||||
|
||||
|
|
@ -3463,7 +3467,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
_ntwkOffServiceMapDao.persist(offService);
|
||||
s_logger.trace("Added service for the network offering: " + offService + " with provider " + provider.getName());
|
||||
}
|
||||
|
||||
|
||||
if (vpcOff) {
|
||||
List<Service> supportedSvcs = new ArrayList<Service>();
|
||||
supportedSvcs.addAll(serviceProviderMap.keySet());
|
||||
|
|
@ -3637,7 +3641,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
// filter by supported services
|
||||
boolean listBySupportedServices = (supportedServicesStr != null && !supportedServicesStr.isEmpty() && !offerings.isEmpty());
|
||||
boolean checkIfProvidersAreEnabled = (zoneId != null);
|
||||
boolean parseOfferings = (listBySupportedServices || sourceNatSupported != null || checkIfProvidersAreEnabled
|
||||
boolean parseOfferings = (listBySupportedServices || sourceNatSupported != null || checkIfProvidersAreEnabled
|
||||
|| forVpc != null || network != null);
|
||||
|
||||
if (parseOfferings) {
|
||||
|
|
@ -3685,7 +3689,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (sourceNatSupported != null) {
|
||||
addOffering = addOffering && (_networkModel.areServicesSupportedByNetworkOffering(offering.getId(), Network.Service.SourceNat) == sourceNatSupported);
|
||||
}
|
||||
|
||||
|
||||
if (forVpc != null) {
|
||||
addOffering = addOffering && (isOfferingForVpc(offering) == forVpc.booleanValue());
|
||||
} else if (network != null){
|
||||
|
|
@ -3803,14 +3807,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
}
|
||||
if (availability == null) {
|
||||
throw new InvalidParameterValueException("Invalid value for Availability. Supported types: "
|
||||
throw new InvalidParameterValueException("Invalid value for Availability. Supported types: "
|
||||
+ Availability.Required + ", " + Availability.Optional);
|
||||
} else {
|
||||
if (availability == NetworkOffering.Availability.Required) {
|
||||
boolean canOffBeRequired = (offeringToUpdate.getGuestType() == GuestType.Isolated
|
||||
boolean canOffBeRequired = (offeringToUpdate.getGuestType() == GuestType.Isolated
|
||||
&& _networkModel.areServicesSupportedByNetworkOffering(offeringToUpdate.getId(), Service.SourceNat));
|
||||
if (!canOffBeRequired) {
|
||||
throw new InvalidParameterValueException("Availability can be " +
|
||||
throw new InvalidParameterValueException("Availability can be " +
|
||||
NetworkOffering.Availability.Required + " only for networkOfferings of type " + GuestType.Isolated + " and with "
|
||||
+ Service.SourceNat.getName() + " enabled");
|
||||
}
|
||||
|
|
@ -3818,7 +3822,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
// only one network offering in the system can be Required
|
||||
List<NetworkOfferingVO> offerings = _networkOfferingDao.listByAvailability(Availability.Required, false);
|
||||
if (!offerings.isEmpty() && offerings.get(0).getId() != offeringToUpdate.getId()) {
|
||||
throw new InvalidParameterValueException("System already has network offering id=" +
|
||||
throw new InvalidParameterValueException("System already has network offering id=" +
|
||||
offerings.get(0).getId() + " with availability " + Availability.Required);
|
||||
}
|
||||
}
|
||||
|
|
@ -3837,7 +3841,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
@ActionEvent(eventType = EventTypes.EVENT_ACCOUNT_MARK_DEFAULT_ZONE, eventDescription = "Marking account with the " +
|
||||
"default zone", async=true)
|
||||
public AccountVO markDefaultZone(String accountName, long domainId, long defaultZoneId) {
|
||||
|
||||
|
||||
// Check if the account exists
|
||||
Account account = _accountDao.findEnabledAccount(accountName, domainId);
|
||||
if (account == null) {
|
||||
|
|
@ -3851,9 +3855,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
|
||||
AccountVO acctForUpdate = _accountDao.findById(account.getId());
|
||||
|
||||
|
||||
acctForUpdate.setDefaultZoneId(defaultZoneId);
|
||||
|
||||
|
||||
if (_accountDao.update(account.getId(), acctForUpdate)) {
|
||||
UserContext.current().setEventDetails("Default zone id= " + defaultZoneId);
|
||||
return _accountDao.findById(account.getId());
|
||||
|
|
@ -3861,7 +3865,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Note: This method will be used for entity name validations in the coming
|
||||
// releases (place holder for now)
|
||||
private void validateEntityName(String str) {
|
||||
|
|
@ -3964,7 +3968,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
for (AccountVlanMapVO map : maps) {
|
||||
if (!deleteVlanAndPublicIpRange(_accountMgr.getSystemUser().getId(), map.getVlanDbId(),
|
||||
if (!deleteVlanAndPublicIpRange(_accountMgr.getSystemUser().getId(), map.getVlanDbId(),
|
||||
_accountMgr.getAccount(Account.ACCOUNT_ID_SYSTEM))) {
|
||||
result = false;
|
||||
}
|
||||
|
|
@ -3989,10 +3993,10 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
public ClusterVO getCluster(long id) {
|
||||
return _clusterDao.findById(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AllocationState findClusterAllocationState(ClusterVO cluster){
|
||||
|
||||
|
||||
if(cluster.getAllocationState() == AllocationState.Disabled){
|
||||
return AllocationState.Disabled;
|
||||
}else if(ApiDBUtils.findPodById(cluster.getPodId()).getAllocationState() == AllocationState.Disabled){
|
||||
|
|
@ -4000,20 +4004,20 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}else {
|
||||
DataCenterVO zone = ApiDBUtils.findZoneById(cluster.getDataCenterId());
|
||||
return zone.getAllocationState();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AllocationState findPodAllocationState(HostPodVO pod){
|
||||
|
||||
|
||||
if(pod.getAllocationState() == AllocationState.Disabled){
|
||||
return AllocationState.Disabled;
|
||||
}else {
|
||||
DataCenterVO zone = ApiDBUtils.findZoneById(pod.getDataCenterId());
|
||||
return zone.getAllocationState();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean allowIpRangeOverlap(VlanVO vlan, boolean forVirtualNetwork, long networkId) {
|
||||
// FIXME - delete restriction for virtual network in the future
|
||||
if (vlan.getVlanType() == VlanType.DirectAttached && !forVirtualNetwork) {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,12 @@ import java.util.concurrent.TimeUnit;
|
|||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
|
||||
|
|
@ -91,18 +97,21 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
@Inject private UserVmDao _userVmDao;
|
||||
@Inject private VolumeDao _volsDao;
|
||||
@Inject private PrimaryDataStoreDao _storagePoolDao;
|
||||
@Inject private ImageStoreDao _imageStoreDao;
|
||||
@Inject private StorageManager _storageManager;
|
||||
@Inject private StoragePoolHostDao _storagePoolHostDao;
|
||||
@Inject private SecondaryStorageVmManager _ssvmMgr;
|
||||
@Inject private DataStoreManager _dataStoreMgr;
|
||||
@Inject private ResourceManager _resourceMgr;
|
||||
@Inject private ConfigurationDao _configDao;
|
||||
@Inject private EndPointSelector _epSelector;
|
||||
|
||||
private ConcurrentHashMap<Long, HostStats> _hostStats = new ConcurrentHashMap<Long, HostStats>();
|
||||
private final ConcurrentHashMap<Long, VmStats> _VmStats = new ConcurrentHashMap<Long, VmStats>();
|
||||
private ConcurrentHashMap<Long, VolumeStats> _volumeStats = new ConcurrentHashMap<Long, VolumeStats>();
|
||||
private ConcurrentHashMap<Long, StorageStats> _storageStats = new ConcurrentHashMap<Long, StorageStats>();
|
||||
private ConcurrentHashMap<Long, StorageStats> _storagePoolStats = new ConcurrentHashMap<Long, StorageStats>();
|
||||
|
||||
|
||||
long hostStatsInterval = -1L;
|
||||
long hostAndVmStatsInterval = -1L;
|
||||
long storageStatsInterval = -1L;
|
||||
|
|
@ -113,12 +122,12 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
public static StatsCollector getInstance() {
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
public static StatsCollector getInstance(Map<String, String> configs) {
|
||||
s_instance.init(configs);
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
|
||||
public StatsCollector() {
|
||||
s_instance = this;
|
||||
}
|
||||
|
|
@ -140,15 +149,15 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
if (hostStatsInterval > 0) {
|
||||
_executor.scheduleWithFixedDelay(new HostCollector(), 15000L, hostStatsInterval, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
|
||||
if (hostAndVmStatsInterval > 0) {
|
||||
_executor.scheduleWithFixedDelay(new VmStatsCollector(), 15000L, hostAndVmStatsInterval, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
|
||||
if (storageStatsInterval > 0) {
|
||||
_executor.scheduleWithFixedDelay(new StorageCollector(), 15000L, storageStatsInterval, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
|
||||
// -1 means we don't even start this thread to pick up any data.
|
||||
if (volumeStatsInterval > 0) {
|
||||
_executor.scheduleWithFixedDelay(new VolumeCollector(), 15000L, volumeStatsInterval, TimeUnit.MILLISECONDS);
|
||||
|
|
@ -162,7 +171,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
public void run() {
|
||||
try {
|
||||
s_logger.debug("HostStatsCollector is running...");
|
||||
|
||||
|
||||
SearchCriteria<HostVO> sc = _hostDao.createSearchCriteria();
|
||||
sc.addAnd("status", SearchCriteria.Op.EQ, Status.Up.toString());
|
||||
sc.addAnd("resourceState", SearchCriteria.Op.NIN, ResourceState.Maintenance, ResourceState.PrepareForMaintenance, ResourceState.ErrorInMaintenance);
|
||||
|
|
@ -197,13 +206,13 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class VmStatsCollector implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
s_logger.debug("VmStatsCollector is running...");
|
||||
|
||||
|
||||
SearchCriteria<HostVO> sc = _hostDao.createSearchCriteria();
|
||||
sc.addAnd("status", SearchCriteria.Op.EQ, Status.Up.toString());
|
||||
sc.addAnd("resourceState", SearchCriteria.Op.NIN, ResourceState.Maintenance, ResourceState.PrepareForMaintenance, ResourceState.ErrorInMaintenance);
|
||||
|
|
@ -214,29 +223,29 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
sc.addAnd("type", SearchCriteria.Op.NEQ, Host.Type.TrafficMonitor.toString());
|
||||
sc.addAnd("type", SearchCriteria.Op.NEQ, Host.Type.SecondaryStorageVM.toString());
|
||||
List<HostVO> hosts = _hostDao.search(sc, null);
|
||||
|
||||
|
||||
for (HostVO host : hosts) {
|
||||
List<UserVmVO> vms = _userVmDao.listRunningByHostId(host.getId());
|
||||
List<Long> vmIds = new ArrayList<Long>();
|
||||
|
||||
|
||||
for (UserVmVO vm : vms) {
|
||||
vmIds.add(vm.getId());
|
||||
}
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
HashMap<Long, VmStatsEntry> vmStatsById = _userVmMgr.getVirtualMachineStatistics(host.getId(), host.getName(), vmIds);
|
||||
|
||||
|
||||
if(vmStatsById != null)
|
||||
{
|
||||
VmStatsEntry statsInMemory = null;
|
||||
|
||||
|
||||
Set<Long> vmIdSet = vmStatsById.keySet();
|
||||
for(Long vmId : vmIdSet)
|
||||
{
|
||||
VmStatsEntry statsForCurrentIteration = vmStatsById.get(vmId);
|
||||
statsInMemory = (VmStatsEntry) _VmStats.get(vmId);
|
||||
|
||||
|
||||
if(statsInMemory == null)
|
||||
{
|
||||
//no stats exist for this vm, directly persist
|
||||
|
|
@ -249,18 +258,18 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
statsInMemory.setNumCPUs(statsForCurrentIteration.getNumCPUs());
|
||||
statsInMemory.setNetworkReadKBs(statsInMemory.getNetworkReadKBs() + statsForCurrentIteration.getNetworkReadKBs());
|
||||
statsInMemory.setNetworkWriteKBs(statsInMemory.getNetworkWriteKBs() + statsForCurrentIteration.getNetworkWriteKBs());
|
||||
|
||||
|
||||
_VmStats.put(vmId, statsInMemory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
s_logger.debug("Failed to get VM stats for host with ID: " + host.getId());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Throwable t) {
|
||||
s_logger.error("Error trying to retrieve VM stats", t);
|
||||
}
|
||||
|
|
@ -278,29 +287,30 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("StorageCollector is running...");
|
||||
}
|
||||
|
||||
List<HostVO> hosts = _ssvmMgr.listSecondaryStorageHostsInAllZones();
|
||||
|
||||
List<DataStore> stores = _dataStoreMgr.listImageStores();
|
||||
ConcurrentHashMap<Long, StorageStats> storageStats = new ConcurrentHashMap<Long, StorageStats>();
|
||||
for (HostVO host : hosts) {
|
||||
if ( host.getStorageUrl() == null ) {
|
||||
for (DataStore store : stores) {
|
||||
if ( store.getUri() == null ) {
|
||||
continue;
|
||||
}
|
||||
GetStorageStatsCommand command = new GetStorageStatsCommand(host.getStorageUrl());
|
||||
HostVO ssAhost = _ssvmMgr.pickSsvmHost(host);
|
||||
GetStorageStatsCommand command = new GetStorageStatsCommand(store.getUri());
|
||||
EndPoint ssAhost = _epSelector.select(store);
|
||||
if (ssAhost == null) {
|
||||
s_logger.debug("There is no secondary storage VM for secondary storage host " + host.getName());
|
||||
s_logger.debug("There is no secondary storage VM for secondary storage host " + store.getName());
|
||||
continue;
|
||||
}
|
||||
long hostId = host.getId();
|
||||
Answer answer = _agentMgr.easySend(ssAhost.getId(), command);
|
||||
long storeId = store.getId();
|
||||
Answer answer = ssAhost.sendMessage(command);
|
||||
if (answer != null && answer.getResult()) {
|
||||
storageStats.put(hostId, (StorageStats)answer);
|
||||
s_logger.trace("HostId: "+hostId+ " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " + ((StorageStats)answer).getCapacityBytes());
|
||||
storageStats.put(storeId, (StorageStats)answer);
|
||||
s_logger.trace("HostId: "+storeId+ " Used: " + ((StorageStats)answer).getByteUsed() + " Total Available: " + ((StorageStats)answer).getCapacityBytes());
|
||||
//Seems like we have dynamically updated the sec. storage as prev. size and the current do not match
|
||||
if (_storageStats.get(hostId)!=null &&
|
||||
_storageStats.get(hostId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()){
|
||||
host.setTotalSize(((StorageStats)answer).getCapacityBytes());
|
||||
_hostDao.update(hostId, host);
|
||||
if (_storageStats.get(storeId)!=null &&
|
||||
_storageStats.get(storeId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()){
|
||||
ImageStoreVO imgStore = _imageStoreDao.findById(storeId);
|
||||
imgStore.setTotalSize(((StorageStats)answer).getCapacityBytes());
|
||||
_imageStoreDao.update(storeId, imgStore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -318,7 +328,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
Answer answer = _storageManager.sendToPool(pool.getId(), command);
|
||||
if (answer != null && answer.getResult()) {
|
||||
storagePoolStats.put(pool.getId(), (StorageStats)answer);
|
||||
|
||||
|
||||
// Seems like we have dynamically updated the pool size since the prev. size and the current do not match
|
||||
if (_storagePoolStats.get(poolId)!= null &&
|
||||
_storagePoolStats.get(poolId).getCapacityBytes() != ((StorageStats)answer).getCapacityBytes()){
|
||||
|
|
@ -342,11 +352,11 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
public StorageStats getStorageStats(long id) {
|
||||
return _storageStats.get(id);
|
||||
}
|
||||
|
||||
|
||||
public HostStats getHostStats(long hostId){
|
||||
return _hostStats.get(hostId);
|
||||
}
|
||||
|
||||
|
||||
public StorageStats getStoragePoolStats(long id) {
|
||||
return _storagePoolStats.get(id);
|
||||
}
|
||||
|
|
@ -357,7 +367,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
try {
|
||||
List<VolumeVO> volumes = _volsDao.listAll();
|
||||
Map<Long, List<VolumeCommand>> commandsByPool = new HashMap<Long, List<VolumeCommand>>();
|
||||
|
||||
|
||||
for (VolumeVO volume : volumes) {
|
||||
List<VolumeCommand> commands = commandsByPool.get(volume.getPoolId());
|
||||
if (commands == null) {
|
||||
|
|
@ -374,7 +384,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
Long poolId = iter.next();
|
||||
if(poolId != null) {
|
||||
List<VolumeCommand> commandsList = commandsByPool.get(poolId);
|
||||
|
||||
|
||||
long[] volumeIdArray = new long[commandsList.size()];
|
||||
Commands commands = new Commands(OnError.Continue);
|
||||
for (int i = 0; i < commandsList.size(); i++) {
|
||||
|
|
@ -382,7 +392,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
volumeIdArray[i] = vCommand.volumeId;
|
||||
commands.addCommand(vCommand.command);
|
||||
}
|
||||
|
||||
|
||||
List<StoragePoolHostVO> poolhosts = _storagePoolHostDao.listByPoolId(poolId);
|
||||
for(StoragePoolHostVO poolhost : poolhosts) {
|
||||
Answer[] answers = _agentMgr.send(poolhost.getHostId(), commands);
|
||||
|
|
@ -415,7 +425,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
|
|||
public long volumeId;
|
||||
public GetFileStatsCommand command;
|
||||
}
|
||||
|
||||
|
||||
public VolumeStats[] getVolumeStats(long[] ids) {
|
||||
VolumeStats[] stats = new VolumeStats[ids.length];
|
||||
if (volumeStatsInterval > 0) {
|
||||
|
|
|
|||
|
|
@ -1357,14 +1357,6 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<HostVO> listSecondaryStorageHostsInAllZones() {
|
||||
SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
|
||||
sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.SecondaryStorage);
|
||||
return sc.list();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<HostVO> listUpAndConnectingSecondaryStorageVmHost(Long dcId) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@ public interface SecondaryStorageVmManager extends Manager {
|
|||
|
||||
public Pair<HostVO, SecondaryStorageVmVO> assignSecStorageVm(long zoneId, Command cmd);
|
||||
boolean generateSetupCommand(Long hostId);
|
||||
public List<HostVO> listSecondaryStorageHostsInAllZones();
|
||||
public List<HostVO> listUpAndConnectingSecondaryStorageVmHost(Long dcId);
|
||||
public HostVO pickSsvmHost(HostVO ssHost);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ CREATE TABLE `cloud`.`image_store` (
|
|||
`parent` varchar(255) COMMENT 'parent path for the storage server',
|
||||
`created` datetime COMMENT 'date the image store first signed on',
|
||||
`removed` datetime COMMENT 'date removed if not null',
|
||||
`total_size` bigint unsigned COMMENT 'storage statistics',
|
||||
PRIMARY KEY(`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue