Skip to content

Commit 8bc0294

Browse files
committed
Revert "Merge pull request #714 from rafaelweingartner/master-lrg-cs-hackday-003"
This reverts commit cd7218e, reversing changes made to f5a7395. Reason for Revert: noredist build failed with the below error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project cloud-plugin-hypervisor-vmware: Compilation failure [ERROR] /home/jenkins/acs/workspace/build-master-noredist/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java:[484,12] error: non-static variable logger cannot be referenced from a static context [ERROR] -> [Help 1] even the normal build is broken as reported by @koushik-das on dev list http://markmail.org/message/nngimssuzkj5gpbz
1 parent cd7218e commit 8bc0294

361 files changed

Lines changed: 6550 additions & 5859 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/src/com/cloud/storage/template/IsoProcessor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,29 @@
2525
import javax.ejb.Local;
2626
import javax.naming.ConfigurationException;
2727

28+
import org.apache.log4j.Logger;
2829

2930
import com.cloud.storage.Storage.ImageFormat;
3031
import com.cloud.storage.StorageLayer;
3132
import com.cloud.utils.component.AdapterBase;
3233

3334
@Local(value = Processor.class)
3435
public class IsoProcessor extends AdapterBase implements Processor {
36+
private static final Logger s_logger = Logger.getLogger(IsoProcessor.class);
3537

3638
StorageLayer _storage;
3739

3840
@Override
3941
public FormatInfo process(String templatePath, ImageFormat format, String templateName) {
4042
if (format != null) {
41-
logger.debug("We don't handle conversion from " + format + " to ISO.");
43+
s_logger.debug("We don't handle conversion from " + format + " to ISO.");
4244
return null;
4345
}
4446

4547
String isoPath = templatePath + File.separator + templateName + "." + ImageFormat.ISO.getFileExtension();
4648

4749
if (!_storage.exists(isoPath)) {
48-
logger.debug("Unable to find the iso file: " + isoPath);
50+
s_logger.debug("Unable to find the iso file: " + isoPath);
4951
return null;
5052
}
5153

core/src/com/cloud/storage/template/OVAProcessor.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import javax.naming.ConfigurationException;
2727
import javax.xml.parsers.DocumentBuilderFactory;
2828

29+
import org.apache.log4j.Logger;
2930
import org.w3c.dom.Document;
3031
import org.w3c.dom.Element;
3132

@@ -37,38 +38,39 @@
3738

3839
@Local(value = Processor.class)
3940
public class OVAProcessor extends AdapterBase implements Processor {
41+
private static final Logger s_logger = Logger.getLogger(OVAProcessor.class);
4042

4143
StorageLayer _storage;
4244

4345
@Override
4446
public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException {
4547
if (format != null) {
46-
if (logger.isInfoEnabled()) {
47-
logger.info("We currently don't handle conversion from " + format + " to OVA.");
48+
if (s_logger.isInfoEnabled()) {
49+
s_logger.info("We currently don't handle conversion from " + format + " to OVA.");
4850
}
4951
return null;
5052
}
5153

52-
logger.info("Template processing. templatePath: " + templatePath + ", templateName: " + templateName);
54+
s_logger.info("Template processing. templatePath: " + templatePath + ", templateName: " + templateName);
5355
String templateFilePath = templatePath + File.separator + templateName + "." + ImageFormat.OVA.getFileExtension();
5456
if (!_storage.exists(templateFilePath)) {
55-
if (logger.isInfoEnabled()) {
56-
logger.info("Unable to find the vmware template file: " + templateFilePath);
57+
if (s_logger.isInfoEnabled()) {
58+
s_logger.info("Unable to find the vmware template file: " + templateFilePath);
5759
}
5860
return null;
5961
}
6062

61-
logger.info("Template processing - untar OVA package. templatePath: " + templatePath + ", templateName: " + templateName);
63+
s_logger.info("Template processing - untar OVA package. templatePath: " + templatePath + ", templateName: " + templateName);
6264
String templateFileFullPath = templatePath + File.separator + templateName + "." + ImageFormat.OVA.getFileExtension();
6365
File templateFile = new File(templateFileFullPath);
6466

65-
Script command = new Script("tar", 0, logger);
67+
Script command = new Script("tar", 0, s_logger);
6668
command.add("--no-same-owner");
6769
command.add("-xf", templateFileFullPath);
6870
command.setWorkDir(templateFile.getParent());
6971
String result = command.execute();
7072
if (result != null) {
71-
logger.info("failed to untar OVA package due to " + result + ". templatePath: " + templatePath + ", templateName: " + templateName);
73+
s_logger.info("failed to untar OVA package due to " + result + ". templatePath: " + templatePath + ", templateName: " + templateName);
7274
return null;
7375
}
7476

@@ -89,7 +91,7 @@ public long getVirtualSize(File file) {
8991
long size = getTemplateVirtualSize(file.getParent(), file.getName());
9092
return size;
9193
} catch (Exception e) {
92-
logger.info("[ignored]"
94+
s_logger.info("[ignored]"
9395
+ "failed to get virtual template size for ova: " + e.getLocalizedMessage());
9496
}
9597
return file.length();
@@ -103,7 +105,7 @@ public long getTemplateVirtualSize(String templatePath, String templateName) thr
103105
String ovfFileName = getOVFFilePath(templateFileFullPath);
104106
if (ovfFileName == null) {
105107
String msg = "Unable to locate OVF file in template package directory: " + templatePath;
106-
logger.error(msg);
108+
s_logger.error(msg);
107109
throw new InternalErrorException(msg);
108110
}
109111
try {
@@ -128,7 +130,7 @@ public long getTemplateVirtualSize(String templatePath, String templateName) thr
128130
return virtualSize;
129131
} catch (Exception e) {
130132
String msg = "Unable to parse OVF XML document to get the virtual disk size due to" + e;
131-
logger.error(msg);
133+
s_logger.error(msg);
132134
throw new InternalErrorException(msg);
133135
}
134136
}

core/src/com/cloud/storage/template/QCOW2Processor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import javax.ejb.Local;
2828
import javax.naming.ConfigurationException;
2929

30+
import org.apache.log4j.Logger;
3031

3132
import com.cloud.storage.Storage.ImageFormat;
3233
import com.cloud.storage.StorageLayer;
@@ -35,21 +36,22 @@
3536

3637
@Local(value = Processor.class)
3738
public class QCOW2Processor extends AdapterBase implements Processor {
39+
private static final Logger s_logger = Logger.getLogger(QCOW2Processor.class);
3840
private static final int VIRTUALSIZE_HEADER_LOCATION = 24;
3941

4042
private StorageLayer _storage;
4143

4244
@Override
4345
public FormatInfo process(String templatePath, ImageFormat format, String templateName) {
4446
if (format != null) {
45-
logger.debug("We currently don't handle conversion from " + format + " to QCOW2.");
47+
s_logger.debug("We currently don't handle conversion from " + format + " to QCOW2.");
4648
return null;
4749
}
4850

4951
String qcow2Path = templatePath + File.separator + templateName + "." + ImageFormat.QCOW2.getFileExtension();
5052

5153
if (!_storage.exists(qcow2Path)) {
52-
logger.debug("Unable to find the qcow2 file: " + qcow2Path);
54+
s_logger.debug("Unable to find the qcow2 file: " + qcow2Path);
5355
return null;
5456
}
5557

@@ -64,7 +66,7 @@ public FormatInfo process(String templatePath, ImageFormat format, String templa
6466
try {
6567
info.virtualSize = getVirtualSize(qcow2File);
6668
} catch (IOException e) {
67-
logger.error("Unable to get virtual size from " + qcow2File.getName());
69+
s_logger.error("Unable to get virtual size from " + qcow2File.getName());
6870
return null;
6971
}
7072

core/src/com/cloud/storage/template/RawImageProcessor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import javax.ejb.Local;
2626
import javax.naming.ConfigurationException;
2727

28+
import org.apache.log4j.Logger;
2829

2930
import com.cloud.exception.InternalErrorException;
3031
import com.cloud.storage.Storage.ImageFormat;
@@ -33,6 +34,7 @@
3334

3435
@Local(value = Processor.class)
3536
public class RawImageProcessor extends AdapterBase implements Processor {
37+
private static final Logger s_logger = Logger.getLogger(RawImageProcessor.class);
3638
StorageLayer _storage;
3739

3840
@Override
@@ -48,21 +50,21 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
4850
@Override
4951
public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException {
5052
if (format != null) {
51-
logger.debug("We currently don't handle conversion from " + format + " to raw image.");
53+
s_logger.debug("We currently don't handle conversion from " + format + " to raw image.");
5254
return null;
5355
}
5456

5557
String imgPath = templatePath + File.separator + templateName + "." + ImageFormat.RAW.getFileExtension();
5658
if (!_storage.exists(imgPath)) {
57-
logger.debug("Unable to find raw image:" + imgPath);
59+
s_logger.debug("Unable to find raw image:" + imgPath);
5860
return null;
5961
}
6062
FormatInfo info = new FormatInfo();
6163
info.format = ImageFormat.RAW;
6264
info.filename = templateName + "." + ImageFormat.RAW.getFileExtension();
6365
info.size = _storage.getSize(imgPath);
6466
info.virtualSize = info.size;
65-
logger.debug("Process raw image " + info.filename + " successfully");
67+
s_logger.debug("Process raw image " + info.filename + " successfully");
6668
return info;
6769
}
6870

core/src/com/cloud/storage/template/TARProcessor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.cloud.storage.Storage.ImageFormat;
2323
import com.cloud.storage.StorageLayer;
2424
import com.cloud.utils.component.AdapterBase;
25+
import org.apache.log4j.Logger;
2526

2627
import javax.ejb.Local;
2728
import javax.naming.ConfigurationException;
@@ -30,20 +31,21 @@
3031

3132
@Local(value = Processor.class)
3233
public class TARProcessor extends AdapterBase implements Processor {
34+
private static final Logger s_logger = Logger.getLogger(TARProcessor.class);
3335

3436
private StorageLayer _storage;
3537

3638
@Override
3739
public FormatInfo process(String templatePath, ImageFormat format, String templateName) {
3840
if (format != null) {
39-
logger.debug("We currently don't handle conversion from " + format + " to TAR.");
41+
s_logger.debug("We currently don't handle conversion from " + format + " to TAR.");
4042
return null;
4143
}
4244

4345
String tarPath = templatePath + File.separator + templateName + "." + ImageFormat.TAR.getFileExtension();
4446

4547
if (!_storage.exists(tarPath)) {
46-
logger.debug("Unable to find the tar file: " + tarPath);
48+
s_logger.debug("Unable to find the tar file: " + tarPath);
4749
return null;
4850
}
4951

core/src/com/cloud/storage/template/VhdProcessor.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import javax.ejb.Local;
2828
import javax.naming.ConfigurationException;
2929

30+
import org.apache.log4j.Logger;
3031

3132
import com.cloud.storage.Storage.ImageFormat;
3233
import com.cloud.storage.StorageLayer;
@@ -42,6 +43,7 @@
4243
@Local(value = Processor.class)
4344
public class VhdProcessor extends AdapterBase implements Processor {
4445

46+
private static final Logger s_logger = Logger.getLogger(VhdProcessor.class);
4547
StorageLayer _storage;
4648
private int vhdFooterSize = 512;
4749
private int vhdFooterCreatorAppOffset = 28;
@@ -52,13 +54,13 @@ public class VhdProcessor extends AdapterBase implements Processor {
5254
@Override
5355
public FormatInfo process(String templatePath, ImageFormat format, String templateName) {
5456
if (format != null) {
55-
logger.debug("We currently don't handle conversion from " + format + " to VHD.");
57+
s_logger.debug("We currently don't handle conversion from " + format + " to VHD.");
5658
return null;
5759
}
5860

5961
String vhdPath = templatePath + File.separator + templateName + "." + ImageFormat.VHD.getFileExtension();
6062
if (!_storage.exists(vhdPath)) {
61-
logger.debug("Unable to find the vhd file: " + vhdPath);
63+
s_logger.debug("Unable to find the vhd file: " + vhdPath);
6264
return null;
6365
}
6466

@@ -72,7 +74,7 @@ public FormatInfo process(String templatePath, ImageFormat format, String templa
7274
try {
7375
info.virtualSize = getVirtualSize(vhdFile);
7476
} catch (IOException e) {
75-
logger.error("Unable to get the virtual size for " + vhdPath);
77+
s_logger.error("Unable to get the virtual size for " + vhdPath);
7678
return null;
7779
}
7880

core/src/com/cloud/storage/template/VmdkProcessor.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import javax.ejb.Local;
3232
import javax.naming.ConfigurationException;
3333

34+
import org.apache.log4j.Logger;
3435

3536
import com.cloud.exception.InternalErrorException;
3637
import com.cloud.storage.Storage.ImageFormat;
@@ -39,23 +40,24 @@
3940

4041
@Local(value = Processor.class)
4142
public class VmdkProcessor extends AdapterBase implements Processor {
43+
private static final Logger s_logger = Logger.getLogger(VmdkProcessor.class);
4244

4345
StorageLayer _storage;
4446

4547
@Override
4648
public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException {
4749
if (format != null) {
48-
if (logger.isInfoEnabled()) {
49-
logger.info("We currently don't handle conversion from " + format + " to VMDK.");
50+
if (s_logger.isInfoEnabled()) {
51+
s_logger.info("We currently don't handle conversion from " + format + " to VMDK.");
5052
}
5153
return null;
5254
}
5355

54-
logger.info("Template processing. templatePath: " + templatePath + ", templateName: " + templateName);
56+
s_logger.info("Template processing. templatePath: " + templatePath + ", templateName: " + templateName);
5557
String templateFilePath = templatePath + File.separator + templateName + "." + ImageFormat.VMDK.getFileExtension();
5658
if (!_storage.exists(templateFilePath)) {
57-
if (logger.isInfoEnabled()) {
58-
logger.info("Unable to find the vmware template file: " + templateFilePath);
59+
if (s_logger.isInfoEnabled()) {
60+
s_logger.info("Unable to find the vmware template file: " + templateFilePath);
5961
}
6062
return null;
6163
}
@@ -75,7 +77,7 @@ public long getVirtualSize(File file) {
7577
long size = getTemplateVirtualSize(file.getParent(), file.getName());
7678
return size;
7779
} catch (Exception e) {
78-
logger.info("[ignored]"
80+
s_logger.info("[ignored]"
7981
+ "failed to get template virtual size for vmdk: " + e.getLocalizedMessage());
8082
}
8183
return file.length();
@@ -101,15 +103,15 @@ public long getTemplateVirtualSize(String templatePath, String templateName) thr
101103
}
102104
} catch(FileNotFoundException ex) {
103105
String msg = "Unable to open file '" + templateFileFullPath + "' " + ex.toString();
104-
logger.error(msg);
106+
s_logger.error(msg);
105107
throw new InternalErrorException(msg);
106108
} catch(IOException ex) {
107109
String msg = "Unable read open file '" + templateFileFullPath + "' " + ex.toString();
108-
logger.error(msg);
110+
s_logger.error(msg);
109111
throw new InternalErrorException(msg);
110112
}
111113

112-
logger.debug("vmdk file had size="+virtualSize);
114+
s_logger.debug("vmdk file had size="+virtualSize);
113115
return virtualSize;
114116
}
115117

0 commit comments

Comments
 (0)