diff --git a/api/src/com/cloud/gpu/GPU.java b/api/src/com/cloud/gpu/GPU.java index 9177edbf9c1..8aa54c0c0f8 100644 --- a/api/src/com/cloud/gpu/GPU.java +++ b/api/src/com/cloud/gpu/GPU.java @@ -24,7 +24,7 @@ public class GPU { vgpuType } - public enum vGPUType { + public enum GPUType { GRID_K100("GRID K100"), GRID_K120Q("GRID K120Q"), GRID_K140Q("GRID K140Q"), @@ -36,7 +36,7 @@ public class GPU { private String type; - vGPUType(String type) { + GPUType(String type) { this.type = type; } diff --git a/api/src/com/cloud/vm/NicIpAlias.java b/api/src/com/cloud/vm/NicIpAlias.java index d7431ba31e0..964a90fff54 100644 --- a/api/src/com/cloud/vm/NicIpAlias.java +++ b/api/src/com/cloud/vm/NicIpAlias.java @@ -27,7 +27,7 @@ public interface NicIpAlias extends ControlledEntity, Identity, InternalIdentity /** * @return id in the CloudStack database */ - enum state { + enum State { active, revoked, } diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java index 3e7749b5321..080075190ed 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java @@ -96,7 +96,6 @@ import com.cloud.host.Status; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.IpAddress; -import com.cloud.network.IpAddress.State; import com.cloud.network.IpAddressManager; import com.cloud.network.Network; import com.cloud.network.Network.Capability; @@ -1755,9 +1754,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra Network network = _networksDao.findById(nic.getNetworkId()); DhcpServiceProvider dhcpServiceProvider = getDhcpServiceProvider(network); try { - final NicIpAliasVO ipAlias = _nicIpAliasDao.findByGatewayAndNetworkIdAndState(nic.getIPv4Gateway(), network.getId(), NicIpAlias.state.active); + final NicIpAliasVO ipAlias = _nicIpAliasDao.findByGatewayAndNetworkIdAndState(nic.getIPv4Gateway(), network.getId(), NicIpAlias.State.active); if (ipAlias != null) { - ipAlias.setState(NicIpAlias.state.revoked); + ipAlias.setState(NicIpAlias.State.revoked); Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) { @@ -2919,7 +2918,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra List publicIpsToRelease = new ArrayList(); if (userIps != null && !userIps.isEmpty()) { for (IPAddressVO userIp : userIps) { - userIp.setState(State.Releasing); + userIp.setState(IpAddress.State.Releasing); PublicIp publicIp = PublicIp.createFromAddrAndVlan(userIp, _vlanDao.findById(userIp.getVlanId())); publicIpsToRelease.add(publicIp); } diff --git a/engine/schema/src/com/cloud/vm/dao/NicIpAliasDao.java b/engine/schema/src/com/cloud/vm/dao/NicIpAliasDao.java index b1cd02b5e76..b79c101b828 100644 --- a/engine/schema/src/com/cloud/vm/dao/NicIpAliasDao.java +++ b/engine/schema/src/com/cloud/vm/dao/NicIpAliasDao.java @@ -54,8 +54,8 @@ public interface NicIpAliasDao extends GenericDao { public NicIpAliasVO findByIp4AddressAndVmId(String ip4Address, long vmId); - NicIpAliasVO findByGatewayAndNetworkIdAndState(String gateway, long networkId, NicIpAlias.state state); + NicIpAliasVO findByGatewayAndNetworkIdAndState(String gateway, long networkId, NicIpAlias.State state); - List listByNetworkIdAndState(long networkId, NicIpAlias.state state); + List listByNetworkIdAndState(long networkId, NicIpAlias.State state); } \ No newline at end of file diff --git a/engine/schema/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java b/engine/schema/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java index 780bcdda311..48cc6621b44 100644 --- a/engine/schema/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java +++ b/engine/schema/src/com/cloud/vm/dao/NicIpAliasDaoImpl.java @@ -82,7 +82,7 @@ public class NicIpAliasDaoImpl extends GenericDaoBase implem } @Override - public List listByNetworkIdAndState(long networkId, NicIpAlias.state state) { + public List listByNetworkIdAndState(long networkId, NicIpAlias.State state) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("network", networkId); sc.setParameters("state", state); @@ -101,7 +101,7 @@ public class NicIpAliasDaoImpl extends GenericDaoBase implem public List getAliasIpForVm(long vmId) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("instanceId", vmId); - sc.setParameters("state", NicIpAlias.state.active); + sc.setParameters("state", NicIpAlias.State.active); return listBy(sc); } @@ -122,7 +122,7 @@ public class NicIpAliasDaoImpl extends GenericDaoBase implem SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("network", networkId); sc.setParameters("instanceId", instanceId); - sc.setParameters("state", NicIpAlias.state.active); + sc.setParameters("state", NicIpAlias.State.active); return findOneBy(sc); } @@ -132,7 +132,7 @@ public class NicIpAliasDaoImpl extends GenericDaoBase implem } @Override - public NicIpAliasVO findByGatewayAndNetworkIdAndState(String gateway, long networkId, NicIpAlias.state state) { + public NicIpAliasVO findByGatewayAndNetworkIdAndState(String gateway, long networkId, NicIpAlias.State state) { SearchCriteria sc = AllFieldsSearch.create(); sc.setParameters("gateway", gateway); sc.setParameters("network", networkId); diff --git a/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java b/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java index 2f000fde8a4..7e81495faeb 100644 --- a/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java +++ b/engine/schema/src/com/cloud/vm/dao/NicIpAliasVO.java @@ -45,7 +45,7 @@ public class NicIpAliasVO implements NicIpAlias { this.networkId = networkId; this.netmask = netmask; this.gateway = gateway; - state = NicIpAlias.state.active; + state = NicIpAlias.State.active; String cidr = NetUtils.getCidrFromGatewayAndNetmask(gateway, netmask); String[] cidrPair = cidr.split("\\/"); String cidrAddress = cidrPair[0]; @@ -99,7 +99,7 @@ public class NicIpAliasVO implements NicIpAlias { @Column(name = "state") @Enumerated(value = EnumType.STRING) - NicIpAlias.state state; + NicIpAlias.State state; @Column(name = "start_ip_of_subnet") String startIpOfSubnet; @@ -220,11 +220,11 @@ public class NicIpAliasVO implements NicIpAlias { this.gateway = gateway; } - public NicIpAlias.state getState() { + public NicIpAlias.State getState() { return state; } - public void setState(NicIpAlias.state state) { + public void setState(NicIpAlias.State state) { this.state = state; } diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtNetworkDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtNetworkDef.java index f20bec418d4..77dfd0049e3 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtNetworkDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtNetworkDef.java @@ -20,13 +20,13 @@ import java.util.ArrayList; import java.util.List; public class LibvirtNetworkDef { - enum netType { + enum NetworkType { BRIDGE, NAT, LOCAL } private final String _networkName; private final String _uuid; - private netType _networkType; + private NetworkType _networkType; private String _brName; private boolean _stp; private int _delay; @@ -66,7 +66,7 @@ public class LibvirtNetworkDef { } public void defNATNetwork(String brName, boolean stp, int delay, String fwNic, String ipAddr, String netMask) { - _networkType = netType.NAT; + _networkType = NetworkType.NAT; _brName = brName; _stp = stp; _delay = delay; @@ -76,7 +76,7 @@ public class LibvirtNetworkDef { } public void defBrNetwork(String brName, boolean stp, int delay, String fwNic, String ipAddr, String netMask) { - _networkType = netType.BRIDGE; + _networkType = NetworkType.BRIDGE; _brName = brName; _stp = stp; _delay = delay; @@ -86,7 +86,7 @@ public class LibvirtNetworkDef { } public void defLocalNetwork(String brName, boolean stp, int delay, String ipAddr, String netMask) { - _networkType = netType.LOCAL; + _networkType = NetworkType.LOCAL; _brName = brName; _stp = stp; _delay = delay; @@ -126,13 +126,13 @@ public class LibvirtNetworkDef { if (_domainName != null) { netBuilder.append("\n"); } - if (_networkType == netType.BRIDGE) { + if (_networkType == NetworkType.BRIDGE) { netBuilder.append("\n"); - } else if (_networkType == netType.NAT) { + } else if (_networkType == NetworkType.NAT) { netBuilder.append("" + _description + "\n"); } secretBuilder.append("\n"); - if (_usage == usage.VOLUME) { + if (_usage == Usage.VOLUME) { secretBuilder.append("" + _volumeVolume + "\n"); } - if (_usage == usage.CEPH) { + if (_usage == Usage.CEPH) { secretBuilder.append("" + _cephName + "\n"); } secretBuilder.append("\n"); diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java index 7631169f2b5..31fe88f36ab 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java @@ -17,11 +17,11 @@ package com.cloud.hypervisor.kvm.resource; public class LibvirtStoragePoolDef { - public enum poolType { + public enum PoolType { ISCSI("iscsi"), NETFS("netfs"), LOGICAL("logical"), DIR("dir"), RBD("rbd"), GLUSTERFS("glusterfs"); String _poolType; - poolType(String poolType) { + PoolType(String poolType) { _poolType = poolType; } @@ -31,11 +31,11 @@ public class LibvirtStoragePoolDef { } } - public enum authType { + public enum AuthenticationType { CHAP("chap"), CEPH("ceph"); String _authType; - authType(String authType) { + AuthenticationType(String authType) { _authType = authType; } @@ -45,7 +45,7 @@ public class LibvirtStoragePoolDef { } } - private poolType _poolType; + private PoolType _poolType; private String _poolName; private String _uuid; private String _sourceHost; @@ -53,10 +53,10 @@ public class LibvirtStoragePoolDef { private String _sourceDir; private String _targetPath; private String _authUsername; - private authType _authType; + private AuthenticationType _authType; private String _secretUuid; - public LibvirtStoragePoolDef(poolType type, String poolName, String uuid, String host, int port, String dir, String targetPath) { + public LibvirtStoragePoolDef(PoolType type, String poolName, String uuid, String host, int port, String dir, String targetPath) { _poolType = type; _poolName = poolName; _uuid = uuid; @@ -66,7 +66,7 @@ public class LibvirtStoragePoolDef { _targetPath = targetPath; } - public LibvirtStoragePoolDef(poolType type, String poolName, String uuid, String host, String dir, String targetPath) { + public LibvirtStoragePoolDef(PoolType type, String poolName, String uuid, String host, String dir, String targetPath) { _poolType = type; _poolName = poolName; _uuid = uuid; @@ -75,7 +75,7 @@ public class LibvirtStoragePoolDef { _targetPath = targetPath; } - public LibvirtStoragePoolDef(poolType type, String poolName, String uuid, String sourceHost, int sourcePort, String dir, String authUsername, authType authType, + public LibvirtStoragePoolDef(PoolType type, String poolName, String uuid, String sourceHost, int sourcePort, String dir, String authUsername, AuthenticationType authType, String secretUuid) { _poolType = type; _poolName = poolName; @@ -92,7 +92,7 @@ public class LibvirtStoragePoolDef { return _poolName; } - public poolType getPoolType() { + public PoolType getPoolType() { return _poolType; } @@ -120,14 +120,14 @@ public class LibvirtStoragePoolDef { return _secretUuid; } - public authType getAuthType() { + public AuthenticationType getAuthType() { return _authType; } @Override public String toString() { StringBuilder storagePoolBuilder = new StringBuilder(); - if (_poolType == poolType.GLUSTERFS) { + if (_poolType == PoolType.GLUSTERFS) { /* libvirt mounts a Gluster volume, similar to NFS */ storagePoolBuilder.append("\n"); } else { @@ -139,13 +139,13 @@ public class LibvirtStoragePoolDef { storagePoolBuilder.append("" + _poolName + "\n"); if (_uuid != null) storagePoolBuilder.append("" + _uuid + "\n"); - if (_poolType == poolType.NETFS) { + if (_poolType == PoolType.NETFS) { storagePoolBuilder.append("\n"); storagePoolBuilder.append("\n"); storagePoolBuilder.append("\n"); storagePoolBuilder.append("\n"); } - if (_poolType == poolType.RBD) { + if (_poolType == PoolType.RBD) { storagePoolBuilder.append("\n"); storagePoolBuilder.append("\n"); storagePoolBuilder.append("" + _sourceDir + "\n"); @@ -156,7 +156,7 @@ public class LibvirtStoragePoolDef { } storagePoolBuilder.append("\n"); } - if (_poolType == poolType.GLUSTERFS) { + if (_poolType == PoolType.GLUSTERFS) { storagePoolBuilder.append("\n"); storagePoolBuilder.append("\n"); storagePoolBuilder.append("\n"); } - if (_poolType != poolType.RBD) { + if (_poolType != PoolType.RBD) { storagePoolBuilder.append("\n"); storagePoolBuilder.append("" + _targetPath + "\n"); storagePoolBuilder.append("\n"); diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java index 6199e5da2c8..239cc3dca47 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java @@ -63,10 +63,10 @@ public class LibvirtStoragePoolXMLParser { if (auth != null) { String authUsername = auth.getAttribute("username"); String authType = auth.getAttribute("type"); - return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.poolType.valueOf(type.toUpperCase()), poolName, uuid, host, port, pool, authUsername, - LibvirtStoragePoolDef.authType.valueOf(authType.toUpperCase()), uuid); + return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.PoolType.valueOf(type.toUpperCase()), poolName, uuid, host, port, pool, authUsername, + LibvirtStoragePoolDef.AuthenticationType.valueOf(authType.toUpperCase()), uuid); } else { - return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.poolType.valueOf(type.toUpperCase()), poolName, uuid, host, port, pool, ""); + return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.PoolType.valueOf(type.toUpperCase()), poolName, uuid, host, port, pool, ""); } /* Gluster is a sub-type of LibvirtStoragePoolDef.poolType.NETFS, need to check format */ } else if (format != null && format.equalsIgnoreCase("glusterfs")) { @@ -83,7 +83,7 @@ public class LibvirtStoragePoolXMLParser { if (portValue != null && !portValue.isEmpty()) port = Integer.parseInt(portValue); - return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.poolType.valueOf(format.toUpperCase()), + return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.PoolType.valueOf(format.toUpperCase()), poolName, uuid, host, port, path, targetPath); } else { String path = getAttrValue("dir", "path", source); @@ -91,7 +91,7 @@ public class LibvirtStoragePoolXMLParser { Element target = (Element)rootElement.getElementsByTagName("target").item(0); String targetPath = getTagValue("path", target); - return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.poolType.valueOf(type.toUpperCase()), poolName, uuid, host, path, targetPath); + return new LibvirtStoragePoolDef(LibvirtStoragePoolDef.PoolType.valueOf(type.toUpperCase()), poolName, uuid, host, path, targetPath); } } catch (ParserConfigurationException e) { s_logger.debug(e.toString()); diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeDef.java index 61123110275..de65caeee59 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeDef.java @@ -20,11 +20,11 @@ import org.apache.cloudstack.utils.qemu.QemuImg; import org.apache.commons.lang.NotImplementedException; public class LibvirtStorageVolumeDef { - public enum volFormat { + public enum VolumeFormat { RAW("raw"), QCOW2("qcow2"), DIR("dir"), TAR("tar"); private String _format; - volFormat(String format) { + VolumeFormat(String format) { _format = format; } @@ -33,7 +33,7 @@ public class LibvirtStorageVolumeDef { return _format; } - public static volFormat getFormat(String format) { + public static VolumeFormat getFormat(String format) { if (format == null) { return null; } @@ -49,7 +49,7 @@ public class LibvirtStorageVolumeDef { return null; } - public static volFormat getFormat(QemuImg.PhysicalDiskFormat format){ + public static VolumeFormat getFormat(QemuImg.PhysicalDiskFormat format){ switch (format){ case RAW: return RAW; @@ -67,11 +67,11 @@ public class LibvirtStorageVolumeDef { private String _volName; private Long _volSize; - private volFormat _volFormat; + private VolumeFormat _volFormat; private String _backingPath; - private volFormat _backingFormat; + private VolumeFormat _backingFormat; - public LibvirtStorageVolumeDef(String volName, Long size, volFormat format, String tmplPath, volFormat tmplFormat) { + public LibvirtStorageVolumeDef(String volName, Long size, VolumeFormat format, String tmplPath, VolumeFormat tmplFormat) { _volName = volName; _volSize = size; _volFormat = format; @@ -79,7 +79,7 @@ public class LibvirtStorageVolumeDef { _backingFormat = tmplFormat; } - public volFormat getFormat() { + public VolumeFormat getFormat() { return this._volFormat; } diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java index 79957b2aec1..1c89f81327c 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java @@ -49,7 +49,7 @@ public class LibvirtStorageVolumeXMLParser { Element target = (Element)rootElement.getElementsByTagName("target").item(0); String format = getAttrValue("type", "format", target); Long capacity = Long.parseLong(getTagValue("capacity", rootElement)); - return new LibvirtStorageVolumeDef(VolName, capacity, LibvirtStorageVolumeDef.volFormat.getFormat(format), null, null); + return new LibvirtStorageVolumeDef(VolName, capacity, LibvirtStorageVolumeDef.VolumeFormat.getFormat(format), null, null); } catch (ParserConfigurationException e) { s_logger.debug(e.toString()); } catch (SAXException e) { diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java index 65c4c538bcd..d7bdab2532d 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java @@ -50,13 +50,13 @@ import org.apache.cloudstack.utils.qemu.QemuImgFile; import com.cloud.exception.InternalErrorException; import com.cloud.hypervisor.kvm.resource.LibvirtConnection; import com.cloud.hypervisor.kvm.resource.LibvirtSecretDef; -import com.cloud.hypervisor.kvm.resource.LibvirtSecretDef.usage; +import com.cloud.hypervisor.kvm.resource.LibvirtSecretDef.Usage; import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef; -import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.authType; -import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.poolType; +import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.AuthenticationType; +import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.PoolType; import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolXMLParser; import com.cloud.hypervisor.kvm.resource.LibvirtStorageVolumeDef; -import com.cloud.hypervisor.kvm.resource.LibvirtStorageVolumeDef.volFormat; +import com.cloud.hypervisor.kvm.resource.LibvirtStorageVolumeDef.VolumeFormat; import com.cloud.hypervisor.kvm.resource.LibvirtStorageVolumeXMLParser; import com.cloud.storage.Storage; import com.cloud.storage.Storage.StoragePoolType; @@ -122,7 +122,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { return vol; } - public StorageVol createVolume(Connect conn, StoragePool pool, String uuid, long size, volFormat format) throws LibvirtException { + public StorageVol createVolume(Connect conn, StoragePool pool, String uuid, long size, VolumeFormat format) throws LibvirtException { LibvirtStorageVolumeDef volDef = new LibvirtStorageVolumeDef(UUID.randomUUID().toString(), size, format, null, null); s_logger.debug(volDef.toString()); @@ -139,7 +139,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } } - private StoragePool createNetfsStoragePool(poolType fsType, Connect conn, String uuid, String host, String path) throws LibvirtException { + private StoragePool createNetfsStoragePool(PoolType fsType, Connect conn, String uuid, String host, String path) throws LibvirtException { String targetPath = _mountPoint + File.separator + uuid; LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(fsType, uuid, uuid, host, path, targetPath); _storageLayer.mkdir(targetPath); @@ -193,7 +193,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { s_logger.error(mountPoint + " does not exists. Check local.storage.path in agent.properties."); return null; } - LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(poolType.DIR, uuid, uuid, host, path, path); + LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(PoolType.DIR, uuid, uuid, host, path, path); StoragePool sp = null; try { s_logger.debug(spd.toString()); @@ -224,7 +224,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { String volgroupName = path; volgroupName = volgroupName.replaceFirst("/", ""); - LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(poolType.LOGICAL, volgroupName, uuid, host, volgroupPath, volgroupPath); + LibvirtStoragePoolDef spd = new LibvirtStoragePoolDef(PoolType.LOGICAL, volgroupName, uuid, host, volgroupPath, volgroupPath); StoragePool sp = null; try { s_logger.debug(spd.toString()); @@ -258,7 +258,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { String[] userInfoTemp = userInfo.split(":"); if (userInfoTemp.length == 2) { - LibvirtSecretDef sd = new LibvirtSecretDef(usage.CEPH, uuid); + LibvirtSecretDef sd = new LibvirtSecretDef(Usage.CEPH, uuid); sd.setCephName(userInfoTemp[0] + "@" + host + ":" + port + "/" + path); @@ -278,9 +278,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } return null; } - spd = new LibvirtStoragePoolDef(poolType.RBD, uuid, uuid, host, port, path, userInfoTemp[0], authType.CEPH, uuid); + spd = new LibvirtStoragePoolDef(PoolType.RBD, uuid, uuid, host, port, path, userInfoTemp[0], AuthenticationType.CEPH, uuid); } else { - spd = new LibvirtStoragePoolDef(poolType.RBD, uuid, uuid, host, port, path, ""); + spd = new LibvirtStoragePoolDef(PoolType.RBD, uuid, uuid, host, port, path, ""); } try { @@ -368,15 +368,15 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { throw new CloudRuntimeException("Unable to parse the storage pool definition for storage pool " + uuid); } StoragePoolType type = null; - if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.NETFS) { + if (spd.getPoolType() == LibvirtStoragePoolDef.PoolType.NETFS) { type = StoragePoolType.NetworkFilesystem; - } else if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.DIR) { + } else if (spd.getPoolType() == LibvirtStoragePoolDef.PoolType.DIR) { type = StoragePoolType.Filesystem; - } else if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.RBD) { + } else if (spd.getPoolType() == LibvirtStoragePoolDef.PoolType.RBD) { type = StoragePoolType.RBD; - } else if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.LOGICAL) { + } else if (spd.getPoolType() == LibvirtStoragePoolDef.PoolType.LOGICAL) { type = StoragePoolType.CLVM; - } else if (spd.getPoolType() == LibvirtStoragePoolDef.poolType.GLUSTERFS) { + } else if (spd.getPoolType() == LibvirtStoragePoolDef.PoolType.GLUSTERFS) { type = StoragePoolType.Gluster; } @@ -462,9 +462,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } else { disk.setFormat(pool.getDefaultFormat()); } - } else if (voldef.getFormat() == LibvirtStorageVolumeDef.volFormat.QCOW2) { + } else if (voldef.getFormat() == LibvirtStorageVolumeDef.VolumeFormat.QCOW2) { disk.setFormat(PhysicalDiskFormat.QCOW2); - } else if (voldef.getFormat() == LibvirtStorageVolumeDef.volFormat.RAW) { + } else if (voldef.getFormat() == LibvirtStorageVolumeDef.VolumeFormat.RAW) { disk.setFormat(PhysicalDiskFormat.RAW); } return disk; @@ -542,7 +542,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { if (type == StoragePoolType.NetworkFilesystem) { try { - sp = createNetfsStoragePool(poolType.NETFS, conn, name, host, path); + sp = createNetfsStoragePool(PoolType.NETFS, conn, name, host, path); } catch (LibvirtException e) { s_logger.error("Failed to create netfs mount: " + host + ":" + path , e); s_logger.error(e.getStackTrace()); @@ -550,7 +550,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { } } else if (type == StoragePoolType.Gluster) { try { - sp = createNetfsStoragePool(poolType.GLUSTERFS, conn, name, host, path); + sp = createNetfsStoragePool(PoolType.GLUSTERFS, conn, name, host, path); } catch (LibvirtException e) { s_logger.error("Failed to create glusterfs mount: " + host + ":" + path , e); s_logger.error(e.getStackTrace()); @@ -684,7 +684,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor { PhysicalDiskFormat format, Storage.ProvisioningType provisioningType, long size) { LibvirtStoragePool libvirtPool = (LibvirtStoragePool) pool; StoragePool virtPool = libvirtPool.getPool(); - LibvirtStorageVolumeDef.volFormat libvirtformat = LibvirtStorageVolumeDef.volFormat.getFormat(format); + LibvirtStorageVolumeDef.VolumeFormat libvirtformat = LibvirtStorageVolumeDef.VolumeFormat.getFormat(format); String volPath = null; String volName = null; diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/ManagedNfsStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/ManagedNfsStorageAdaptor.java index bcf00d3bb0b..72edb134608 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/ManagedNfsStorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/ManagedNfsStorageAdaptor.java @@ -32,7 +32,7 @@ import org.libvirt.StorageVol; import com.cloud.agent.api.to.DiskTO; import com.cloud.hypervisor.kvm.resource.LibvirtConnection; import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef; -import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.poolType; +import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.PoolType; import com.cloud.hypervisor.kvm.resource.LibvirtStorageVolumeDef; import com.cloud.hypervisor.kvm.resource.LibvirtStorageVolumeXMLParser; import com.cloud.storage.Storage.ImageFormat; @@ -105,7 +105,7 @@ public class ManagedNfsStorageAdaptor implements StorageAdaptor { } targetPath = "/mnt" + volumeUuid; - spd = new LibvirtStoragePoolDef(poolType.NETFS, volumeUuid, details.get(DiskTO.UUID), pool.getSourceHost(), details.get(DiskTO.MOUNT_POINT), targetPath); + spd = new LibvirtStoragePoolDef(PoolType.NETFS, volumeUuid, details.get(DiskTO.UUID), pool.getSourceHost(), details.get(DiskTO.MOUNT_POINT), targetPath); _storageLayer.mkdir(targetPath); s_logger.debug(spd.toString()); @@ -178,14 +178,14 @@ public class ManagedNfsStorageAdaptor implements StorageAdaptor { throw new CloudRuntimeException(e1.toString()); } - LibvirtStorageVolumeDef.volFormat libvirtformat = null; + LibvirtStorageVolumeDef.VolumeFormat libvirtformat = null; long volCapacity = 0; // check whether the volume is present on the given pool StorageVol vol = getVolume(virtPool, volumeUuid); try { if (vol == null) { - libvirtformat = LibvirtStorageVolumeDef.volFormat.QCOW2; + libvirtformat = LibvirtStorageVolumeDef.VolumeFormat.QCOW2; StoragePoolInfo poolinfo = virtPool.getInfo(); volCapacity = poolinfo.available; diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtSecretDefTest.java b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtSecretDefTest.java index 54036b3c848..6fb4137b127 100644 --- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtSecretDefTest.java +++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtSecretDefTest.java @@ -20,14 +20,14 @@ package com.cloud.hypervisor.kvm.resource; import junit.framework.TestCase; -import com.cloud.hypervisor.kvm.resource.LibvirtSecretDef.usage; +import com.cloud.hypervisor.kvm.resource.LibvirtSecretDef.Usage; public class LibvirtSecretDefTest extends TestCase { public void testVolumeSecretDef() { String uuid = "db66f42b-a79e-4666-9910-9dfc8a024427"; String name = "myEncryptedQCOW2"; - usage use = usage.VOLUME; + Usage use = Usage.VOLUME; LibvirtSecretDef def = new LibvirtSecretDef(use, uuid); def.setVolumeVolume(name); @@ -41,7 +41,7 @@ public class LibvirtSecretDefTest extends TestCase { public void testCephSecretDef() { String uuid = "a9febe83-ac5c-467a-bf19-eb75325ec23c"; String name = "admin"; - usage use = usage.CEPH; + Usage use = Usage.CEPH; LibvirtSecretDef def = new LibvirtSecretDef(use, uuid); def.setCephName(name); diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDefTest.java b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDefTest.java index 687432b3d71..ec22e3fed4f 100644 --- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDefTest.java +++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDefTest.java @@ -20,13 +20,13 @@ package com.cloud.hypervisor.kvm.resource; import junit.framework.TestCase; -import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.poolType; -import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.authType; +import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.PoolType; +import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.AuthenticationType; public class LibvirtStoragePoolDefTest extends TestCase { public void testSetGetStoragePool() { - poolType type = poolType.NETFS; + PoolType type = PoolType.NETFS; String name = "myNFSPool"; String uuid = "d7846cb0-f610-4a5b-8d38-ee6e8d63f37b"; String host = "127.0.0.1"; @@ -45,7 +45,7 @@ public class LibvirtStoragePoolDefTest extends TestCase { } public void testNfsStoragePool() { - poolType type = poolType.NETFS; + PoolType type = PoolType.NETFS; String name = "myNFSPool"; String uuid = "89a605bc-d470-4637-b3df-27388be452f5"; String host = "127.0.0.1"; @@ -62,14 +62,14 @@ public class LibvirtStoragePoolDefTest extends TestCase { } public void testRbdStoragePool() { - poolType type = poolType.RBD; + PoolType type = PoolType.RBD; String name = "myRBDPool"; String uuid = "921ef8b2-955a-4c18-a697-66bb9adf6131"; String host = "127.0.0.1"; String dir = "cloudstackrbdpool"; String authUsername = "admin"; String secretUuid = "08c2fa02-50d0-4a78-8903-b742d3f34934"; - authType auth = authType.CEPH; + AuthenticationType auth = AuthenticationType.CEPH; int port = 6789; LibvirtStoragePoolDef pool = new LibvirtStoragePoolDef(type, name, uuid, host, port, dir, authUsername, auth, secretUuid); diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 1b72919d809..5d691c634fc 100644 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -1591,7 +1591,7 @@ public class ApiResponseHelper implements ResponseGenerator { if (vgpuVMs.containsKey(capacity.getGroupName().concat(capacity.getModelName()))) { capacityUsed += (float)vgpuVMs.get(capacity.getGroupName().concat(capacity.getModelName())) / capacity.getMaxVpuPerGpu(); } - if (capacity.getModelName().equals(GPU.vGPUType.passthrough.toString())) { + if (capacity.getModelName().equals(GPU.GPUType.passthrough.toString())) { capacityMax += capacity.getMaxCapacity(); } } diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 1c74f824841..f8a1fac90fd 100644 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -3296,7 +3296,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } } } else { // !isAccountSpecific - final NicIpAliasVO ipAlias = _nicIpAliasDao.findByGatewayAndNetworkIdAndState(vlanRange.getVlanGateway(), vlanRange.getNetworkId(), NicIpAlias.state.active); + final NicIpAliasVO ipAlias = _nicIpAliasDao.findByGatewayAndNetworkIdAndState(vlanRange.getVlanGateway(), vlanRange.getNetworkId(), NicIpAlias.State.active); //check if the ipalias belongs to the vlan range being deleted. if (ipAlias != null && vlanDbId == _publicIpAddressDao.findByIpAndSourceNetworkId(vlanRange.getNetworkId(), ipAlias.getIp4Address()).getVlanId()) { throw new InvalidParameterValueException("Cannot delete vlan range " + vlanDbId + " as " + ipAlias.getIp4Address() diff --git a/server/src/com/cloud/network/router/CommandSetupHelper.java b/server/src/com/cloud/network/router/CommandSetupHelper.java index 1818dbd0650..925961d3fb7 100644 --- a/server/src/com/cloud/network/router/CommandSetupHelper.java +++ b/server/src/com/cloud/network/router/CommandSetupHelper.java @@ -122,7 +122,6 @@ import com.cloud.vm.NicProfile; import com.cloud.vm.NicVO; import com.cloud.vm.UserVmVO; import com.cloud.vm.VirtualMachine; -import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.VirtualMachineManager; import com.cloud.vm.VirtualMachineProfile; import com.cloud.vm.dao.DomainRouterDao; @@ -264,7 +263,7 @@ public class CommandSetupHelper { public void configDnsMasq(final VirtualRouter router, final Network network, final Commands cmds) { final DataCenterVO dcVo = _dcDao.findById(router.getDataCenterId()); - final List ipAliasVOList = _nicIpAliasDao.listByNetworkIdAndState(network.getId(), NicIpAlias.state.active); + final List ipAliasVOList = _nicIpAliasDao.listByNetworkIdAndState(network.getId(), NicIpAlias.State.active); final List ipList = new ArrayList(); final NicVO router_guest_nic = _nicDao.findByNtwkIdAndInstanceId(network.getId(), router.getId()); @@ -598,7 +597,7 @@ public class CommandSetupHelper { } public void createVmDataCommandForVMs(final DomainRouterVO router, final Commands cmds, final long guestNetworkId) { - final List vms = _userVmDao.listByNetworkIdAndStates(guestNetworkId, State.Running, State.Migrating, State.Stopping); + final List vms = _userVmDao.listByNetworkIdAndStates(guestNetworkId, VirtualMachine.State.Running, VirtualMachine.State.Migrating, VirtualMachine.State.Stopping); final DataCenterVO dc = _dcDao.findById(router.getDataCenterId()); for (final UserVmVO vm : vms) { boolean createVmData = true; @@ -617,7 +616,7 @@ public class CommandSetupHelper { } public void createDhcpEntryCommandsForVMs(final DomainRouterVO router, final Commands cmds, final long guestNetworkId) { - final List vms = _userVmDao.listByNetworkIdAndStates(guestNetworkId, State.Running, State.Migrating, State.Stopping); + final List vms = _userVmDao.listByNetworkIdAndStates(guestNetworkId, VirtualMachine.State.Running, VirtualMachine.State.Migrating, VirtualMachine.State.Stopping); final DataCenterVO dc = _dcDao.findById(router.getDataCenterId()); for (final UserVmVO vm : vms) { boolean createDhcp = true; diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java index 419537fbdbe..41cc5586115 100644 --- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java +++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java @@ -231,7 +231,6 @@ import com.cloud.vm.NicVO; import com.cloud.vm.ReservationContext; import com.cloud.vm.ReservationContextImpl; import com.cloud.vm.VirtualMachine; -import com.cloud.vm.VirtualMachine.State; import com.cloud.vm.VirtualMachineGuru; import com.cloud.vm.VirtualMachineManager; import com.cloud.vm.VirtualMachineProfile; @@ -249,7 +248,7 @@ import com.cloud.vm.dao.VMInstanceDao; * network appliances available in the Cloud Stack. */ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements VirtualNetworkApplianceManager, VirtualNetworkApplianceService, VirtualMachineGuru, Listener, -Configurable, StateListener { +Configurable, StateListener { private static final Logger s_logger = Logger.getLogger(VirtualNetworkApplianceManagerImpl.class); @Inject @@ -442,7 +441,7 @@ Configurable, StateListener { } // Check that the router is stopped - if (!router.getState().equals(State.Stopped)) { + if (!router.getState().equals(VirtualMachine.State.Stopped)) { s_logger.warn("Unable to upgrade router " + router.toString() + " in state " + router.getState()); throw new InvalidParameterValueException("Unable to upgrade router " + router.toString() + " in state " + router.getState() + "; make sure the router is stopped and not in an error state before upgrading."); @@ -542,7 +541,7 @@ Configurable, StateListener { _accountMgr.checkAccess(caller, null, true, router); // Can reboot domain router only in Running state - if (router == null || router.getState() != State.Running) { + if (router == null || router.getState() != VirtualMachine.State.Running) { s_logger.warn("Unable to reboot, virtual router is not in the right state " + router.getState()); throw new ResourceUnavailableException("Unable to reboot domR, it is not in right state " + router.getState(), DataCenter.class, router.getDataCenterId()); } @@ -744,7 +743,7 @@ Configurable, StateListener { @Override protected void runInContext() { try { - final List routers = _routerDao.listByStateAndNetworkType(State.Running, GuestType.Isolated, mgmtSrvrId); + final List routers = _routerDao.listByStateAndNetworkType(VirtualMachine.State.Running, GuestType.Isolated, mgmtSrvrId); s_logger.debug("Found " + routers.size() + " running routers. "); for (final DomainRouterVO router : routers) { @@ -908,7 +907,7 @@ Configurable, StateListener { if (conns == null || conns.isEmpty()) { continue; } - if (router.getState() != State.Running) { + if (router.getState() != VirtualMachine.State.Running) { for (final Site2SiteVpnConnectionVO conn : conns) { if (conn.getState() != Site2SiteVpnConnection.State.Error) { conn.setState(Site2SiteVpnConnection.State.Disconnected); @@ -989,7 +988,7 @@ Configurable, StateListener { continue; } final RedundantState prevState = router.getRedundantState(); - if (router.getState() != State.Running) { + if (router.getState() != VirtualMachine.State.Running) { router.setRedundantState(RedundantState.UNKNOWN); updated = true; } else { @@ -1041,7 +1040,7 @@ Configurable, StateListener { // Ensure router status is update to date before execute this function. The // function would try best to recover all routers except MASTER protected void recoverRedundantNetwork(final DomainRouterVO masterRouter, final DomainRouterVO backupRouter) { - if (masterRouter.getState() == State.Running && backupRouter.getState() == State.Running) { + if (masterRouter.getState() == VirtualMachine.State.Running && backupRouter.getState() == VirtualMachine.State.Running) { final HostVO masterHost = _hostDao.findById(masterRouter.getHostId()); final HostVO backupHost = _hostDao.findById(backupRouter.getHostId()); if (masterHost.getState() == Status.Up && backupHost.getState() == Status.Up) { @@ -1174,7 +1173,7 @@ Configurable, StateListener { final DomainRouterVO router0 = routers.get(0); final DomainRouterVO router1 = routers.get(1); - if (router0.getState() != State.Running || router1.getState() != State.Running) { + if (router0.getState() != VirtualMachine.State.Running || router1.getState() != VirtualMachine.State.Running) { updateRoutersRedundantState(routers); // Wilder Rodrigues (wrodrigues@schubergphilis.com) - One of the routers is not running, // so we don't have to continue here since the host will be null any way. Also, there is no need @@ -1188,8 +1187,8 @@ Configurable, StateListener { } else { router = router1; } - // && router.getState() == State.Stopped - if (router.getHostId() == null && router.getState() == State.Running) { + // && router.getState() == VirtualMachine.State.Stopped + if (router.getHostId() == null && router.getState() == VirtualMachine.State.Running) { s_logger.debug("Skip router pair (" + router0.getInstanceName() + "," + router1.getInstanceName() + ") due to can't find host"); continue; } @@ -1259,7 +1258,7 @@ Configurable, StateListener { protected void getRouterAlerts() { try { - final List routers = _routerDao.listByStateAndManagementServer(State.Running, mgmtSrvrId); + final List routers = _routerDao.listByStateAndManagementServer(VirtualMachine.State.Running, mgmtSrvrId); s_logger.debug("Found " + routers.size() + " running routers. "); @@ -1952,11 +1951,11 @@ Configurable, StateListener { _networkOfferingDao.findById(_networkDao.findById(guestNetworkId).getNetworkOfferingId()), Service.Dhcp); final String supportsMultipleSubnets = dhcpCapabilities.get(Network.Capability.DhcpAccrossMultipleSubnets); if (supportsMultipleSubnets != null && Boolean.valueOf(supportsMultipleSubnets)) { - final List revokedIpAliasVOs = _nicIpAliasDao.listByNetworkIdAndState(guestNetworkId, NicIpAlias.state.revoked); + final List revokedIpAliasVOs = _nicIpAliasDao.listByNetworkIdAndState(guestNetworkId, NicIpAlias.State.revoked); s_logger.debug("Found" + revokedIpAliasVOs.size() + "ip Aliases to revoke on the router as a part of dhcp configuration"); removeRevokedIpAliasFromDb(revokedIpAliasVOs); - final List aliasVOs = _nicIpAliasDao.listByNetworkIdAndState(guestNetworkId, NicIpAlias.state.active); + final List aliasVOs = _nicIpAliasDao.listByNetworkIdAndState(guestNetworkId, NicIpAlias.State.active); s_logger.debug("Found" + aliasVOs.size() + "ip Aliases to apply on the router as a part of dhcp configuration"); final List activeIpAliasTOs = new ArrayList(); for (final NicIpAliasVO aliasVO : aliasVOs) { @@ -2148,7 +2147,7 @@ Configurable, StateListener { } for (final VirtualRouter router : routers) { - if (router.getState() != State.Running) { + if (router.getState() != VirtualMachine.State.Running) { s_logger.warn("Failed to start remote access VPN: router not in right state " + router.getState()); throw new ResourceUnavailableException("Failed to start remote access VPN: router not in right state " + router.getState(), DataCenter.class, network.getDataCenterId()); @@ -2189,11 +2188,11 @@ Configurable, StateListener { boolean result = true; for (final VirtualRouter router : routers) { - if (router.getState() == State.Running) { + if (router.getState() == VirtualMachine.State.Running) { final Commands cmds = new Commands(Command.OnError.Continue); _commandSetupHelper.createApplyVpnCommands(false, vpn, router, cmds); result = result && _nwHelper.sendCommandsToRouter(router, cmds); - } else if (router.getState() == State.Stopped) { + } else if (router.getState() == VirtualMachine.State.Stopped) { s_logger.debug("Router " + router + " is in Stopped state, not sending deleteRemoteAccessVpn command to it"); continue; } else { @@ -2226,20 +2225,20 @@ Configurable, StateListener { } for (final DomainRouterVO router : routers) { - if (router.getState() != State.Running) { + if (router.getState() != VirtualMachine.State.Running) { s_logger.warn("Failed to add/remove VPN users: router not in running state"); throw new ResourceUnavailableException("Unable to assign ip addresses, domR is not in right state " + router.getState(), DataCenter.class, network.getDataCenterId()); } final Commands cmds = new Commands(Command.OnError.Continue); - final List revokedIpAliasVOs = _nicIpAliasDao.listByNetworkIdAndState(network.getId(), NicIpAlias.state.revoked); + final List revokedIpAliasVOs = _nicIpAliasDao.listByNetworkIdAndState(network.getId(), NicIpAlias.State.revoked); s_logger.debug("Found" + revokedIpAliasVOs.size() + "ip Aliases to revoke on the router as a part of dhcp configuration"); final List revokedIpAliasTOs = new ArrayList(); for (final NicIpAliasVO revokedAliasVO : revokedIpAliasVOs) { revokedIpAliasTOs.add(new IpAliasTO(revokedAliasVO.getIp4Address(), revokedAliasVO.getNetmask(), revokedAliasVO.getAliasCount().toString())); } - final List aliasVOs = _nicIpAliasDao.listByNetworkIdAndState(network.getId(), NicIpAlias.state.active); + final List aliasVOs = _nicIpAliasDao.listByNetworkIdAndState(network.getId(), NicIpAlias.State.active); s_logger.debug("Found" + aliasVOs.size() + "ip Aliases to apply on the router as a part of dhcp configuration"); final List activeIpAliasTOs = new ArrayList(); for (final NicIpAliasVO aliasVO : aliasVOs) { @@ -2306,7 +2305,7 @@ Configurable, StateListener { // After start network, check if it's already running router = _routerDao.findById(routerId); - if (router.getState() == State.Running) { + if (router.getState() == VirtualMachine.State.Running) { return router; } @@ -2365,8 +2364,8 @@ Configurable, StateListener { for (DomainRouterVO router : routers) { if (router.isStopPending()) { s_logger.info("Stopping router " + router.getInstanceName() + " due to stop pending flag found!"); - final State state = router.getState(); - if (state != State.Stopped && state != State.Destroyed) { + final VirtualMachine.State state = router.getState(); + if (state != VirtualMachine.State.Stopped && state != VirtualMachine.State.Destroyed) { try { stopRouter(router.getId(), false); } catch (final ResourceUnavailableException e) { @@ -2598,18 +2597,18 @@ Configurable, StateListener { } @Override - public boolean preStateTransitionEvent(final State oldState, final VirtualMachine.Event event, final State newState, final VirtualMachine vo, final boolean status, + public boolean preStateTransitionEvent(final VirtualMachine.State oldState, final VirtualMachine.Event event, final VirtualMachine.State newState, final VirtualMachine vo, final boolean status, final Object opaque) { return true; } @Override - public boolean postStateTransitionEvent(final StateMachine2.Transition transition, final VirtualMachine vo, final boolean status, final Object opaque) { - final State newState = transition.getToState(); + public boolean postStateTransitionEvent(final StateMachine2.Transition transition, final VirtualMachine vo, final boolean status, final Object opaque) { + final VirtualMachine.State newState = transition.getToState(); final VirtualMachine.Event event = transition.getEvent(); if (vo.getType() == VirtualMachine.Type.DomainRouter && event == VirtualMachine.Event.FollowAgentPowerOnReport && - newState == State.Running && + newState == VirtualMachine.State.Running && isOutOfBandMigrated(opaque)) { s_logger.debug("Virtual router " + vo.getInstanceName() + " is powered-on out-of-band"); } diff --git a/server/src/com/cloud/network/rules/DhcpSubNetRules.java b/server/src/com/cloud/network/rules/DhcpSubNetRules.java index a70aa810887..ed5513795a3 100644 --- a/server/src/com/cloud/network/rules/DhcpSubNetRules.java +++ b/server/src/com/cloud/network/rules/DhcpSubNetRules.java @@ -94,7 +94,7 @@ public class DhcpSubNetRules extends RuleApplier { // networks. if (!NetUtils.sameSubnet(domrGuestNic.getIPv4Address(), _nic.getIPv4Address(), _nic.getIPv4Netmask())) { final NicIpAliasDao nicIpAliasDao = visitor.getVirtualNetworkApplianceFactory().getNicIpAliasDao(); - final List aliasIps = nicIpAliasDao.listByNetworkIdAndState(domrGuestNic.getNetworkId(), NicIpAlias.state.active); + final List aliasIps = nicIpAliasDao.listByNetworkIdAndState(domrGuestNic.getNetworkId(), NicIpAlias.State.active); boolean ipInVmsubnet = false; for (final NicIpAliasVO alias : aliasIps) { // check if any of the alias ips belongs to the Vm's subnet. diff --git a/server/src/com/cloud/server/StatsCollector.java b/server/src/com/cloud/server/StatsCollector.java index 9f3c8cb89ab..ca86cfd0804 100644 --- a/server/src/com/cloud/server/StatsCollector.java +++ b/server/src/com/cloud/server/StatsCollector.java @@ -125,11 +125,11 @@ import com.cloud.vm.dao.VMInstanceDao; @Component public class StatsCollector extends ManagerBase implements ComponentMethodInterceptable { - public static enum externalStatsProtocol { + public static enum ExternalStatsProtocol { NONE("none"), GRAPHITE("graphite"); String _type; - externalStatsProtocol(String type) { + ExternalStatsProtocol(String type) { _type = type; } @@ -218,7 +218,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc String externalStatsHost = null; int externalStatsPort = -1; boolean externalStatsEnabled = false; - externalStatsProtocol externalStatsType = externalStatsProtocol.NONE; + ExternalStatsProtocol externalStatsType = ExternalStatsProtocol.NONE; private ScheduledExecutorService _diskStatsUpdateExecutor; private int _usageAggregationRange = 1440; @@ -266,7 +266,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc String scheme = uri.getScheme(); try { - externalStatsType = externalStatsProtocol.valueOf(scheme.toUpperCase()); + externalStatsType = ExternalStatsProtocol.valueOf(scheme.toUpperCase()); } catch (IllegalArgumentException e) { s_logger.info(scheme + " is not a valid protocol for external statistics. No statistics will be send."); } @@ -492,7 +492,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc * Currently only Graphite is supported */ if (!metrics.isEmpty()) { - if (externalStatsType != null && externalStatsType == externalStatsProtocol.GRAPHITE) { + if (externalStatsType != null && externalStatsType == ExternalStatsProtocol.GRAPHITE) { if (externalStatsPort == -1) { externalStatsPort = 2003;