You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2015/12/06 20:17:24 UTC
[2/4] git commit: updated refs/heads/master to 638f1cf
CLOUDSTACK-9046 renamed enums in kvm plugin
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/962d4b4a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/962d4b4a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/962d4b4a
Branch: refs/heads/master
Commit: 962d4b4afee6fb55aca09862b42c0f7c33f25a5f
Parents: 586c325
Author: Daan Hoogland <da...@onecht.net>
Authored: Mon Nov 9 10:52:30 2015 +0100
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Nov 16 13:41:14 2015 +0000
----------------------------------------------------------------------
.../kvm/resource/LibvirtNetworkDef.java | 14 +++----
.../kvm/resource/LibvirtSecretDef.java | 14 +++----
.../kvm/resource/LibvirtStoragePoolDef.java | 32 +++++++--------
.../resource/LibvirtStoragePoolXMLParser.java | 10 ++---
.../kvm/resource/LibvirtStorageVolumeDef.java | 16 ++++----
.../resource/LibvirtStorageVolumeXMLParser.java | 2 +-
.../kvm/storage/LibvirtStorageAdaptor.java | 42 ++++++++++----------
.../kvm/storage/ManagedNfsStorageAdaptor.java | 8 ++--
.../kvm/resource/LibvirtSecretDefTest.java | 6 +--
.../kvm/resource/LibvirtStoragePoolDefTest.java | 12 +++---
10 files changed, 78 insertions(+), 78 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtNetworkDef.java
----------------------------------------------------------------------
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 f20bec4..77dfd00 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("<domain name='" + _domainName + "'/>\n");
}
- if (_networkType == netType.BRIDGE) {
+ if (_networkType == NetworkType.BRIDGE) {
netBuilder.append("<forward mode='route'");
if (_fwDev != null) {
netBuilder.append(" dev='" + _fwDev + "'");
}
netBuilder.append("/>\n");
- } else if (_networkType == netType.NAT) {
+ } else if (_networkType == NetworkType.NAT) {
netBuilder.append("<forward mode='nat'");
if (_fwDev != null) {
netBuilder.append(" dev='" + _fwDev + "'");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtSecretDef.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtSecretDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtSecretDef.java
index d68f3a8..80c08e9 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtSecretDef.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtSecretDef.java
@@ -18,11 +18,11 @@ package com.cloud.hypervisor.kvm.resource;
public class LibvirtSecretDef {
- public enum usage {
+ public enum Usage {
VOLUME("volume"), CEPH("ceph");
String _usage;
- usage(String usage) {
+ Usage(String usage) {
_usage = usage;
}
@@ -32,7 +32,7 @@ public class LibvirtSecretDef {
}
}
- private usage _usage;
+ private Usage _usage;
private boolean _ephemeral;
private boolean _private;
private String _uuid;
@@ -40,12 +40,12 @@ public class LibvirtSecretDef {
private String _cephName;
private String _volumeVolume;
- public LibvirtSecretDef(usage usage, String uuid) {
+ public LibvirtSecretDef(Usage usage, String uuid) {
_usage = usage;
_uuid = uuid;
}
- public LibvirtSecretDef(usage usage, String uuid, String description) {
+ public LibvirtSecretDef(Usage usage, String uuid, String description) {
_usage = usage;
_uuid = uuid;
_description = description;
@@ -92,10 +92,10 @@ public class LibvirtSecretDef {
secretBuilder.append("<description>" + _description + "</description>\n");
}
secretBuilder.append("<usage type='" + _usage + "'>\n");
- if (_usage == usage.VOLUME) {
+ if (_usage == Usage.VOLUME) {
secretBuilder.append("<volume>" + _volumeVolume + "</volume>\n");
}
- if (_usage == usage.CEPH) {
+ if (_usage == Usage.CEPH) {
secretBuilder.append("<name>" + _cephName + "</name>\n");
}
secretBuilder.append("</usage>\n");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java
----------------------------------------------------------------------
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 7631169..31fe88f 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("<pool type='netfs'>\n");
} else {
@@ -139,13 +139,13 @@ public class LibvirtStoragePoolDef {
storagePoolBuilder.append("<name>" + _poolName + "</name>\n");
if (_uuid != null)
storagePoolBuilder.append("<uuid>" + _uuid + "</uuid>\n");
- if (_poolType == poolType.NETFS) {
+ if (_poolType == PoolType.NETFS) {
storagePoolBuilder.append("<source>\n");
storagePoolBuilder.append("<host name='" + _sourceHost + "'/>\n");
storagePoolBuilder.append("<dir path='" + _sourceDir + "'/>\n");
storagePoolBuilder.append("</source>\n");
}
- if (_poolType == poolType.RBD) {
+ if (_poolType == PoolType.RBD) {
storagePoolBuilder.append("<source>\n");
storagePoolBuilder.append("<host name='" + _sourceHost + "' port='" + _sourcePort + "'/>\n");
storagePoolBuilder.append("<name>" + _sourceDir + "</name>\n");
@@ -156,7 +156,7 @@ public class LibvirtStoragePoolDef {
}
storagePoolBuilder.append("</source>\n");
}
- if (_poolType == poolType.GLUSTERFS) {
+ if (_poolType == PoolType.GLUSTERFS) {
storagePoolBuilder.append("<source>\n");
storagePoolBuilder.append("<host name='");
storagePoolBuilder.append(_sourceHost);
@@ -173,7 +173,7 @@ public class LibvirtStoragePoolDef {
storagePoolBuilder.append("'/>\n");
storagePoolBuilder.append("</source>\n");
}
- if (_poolType != poolType.RBD) {
+ if (_poolType != PoolType.RBD) {
storagePoolBuilder.append("<target>\n");
storagePoolBuilder.append("<path>" + _targetPath + "</path>\n");
storagePoolBuilder.append("</target>\n");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java
----------------------------------------------------------------------
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 6199e5d..239cc3d 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());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeDef.java
----------------------------------------------------------------------
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 6112311..de65cae 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;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java
----------------------------------------------------------------------
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 79957b2..1c89f81 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) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
----------------------------------------------------------------------
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 65c4c53..d7bdab2 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;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/ManagedNfsStorageAdaptor.java
----------------------------------------------------------------------
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 bcf00d3..72edb13 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;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtSecretDefTest.java
----------------------------------------------------------------------
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 54036b3..6fb4137 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);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/962d4b4a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDefTest.java
----------------------------------------------------------------------
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 687432b..ec22e3f 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);