You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/06/11 14:06:29 UTC

[1/3] git commit: updated refs/heads/master to 9855a84

Repository: cloudstack
Updated Branches:
  refs/heads/master 522208dec -> 9855a84a1


Move the maven wiz stuff to the tools directory and make sure it gets build with the correct version when needed


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9855a84a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9855a84a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9855a84a

Branch: refs/heads/master
Commit: 9855a84a18ef3828a4e6f0a95bfa8287eec2bb76
Parents: 8e704f5
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Wed Jun 11 14:05:13 2014 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Wed Jun 11 14:06:16 2014 +0200

----------------------------------------------------------------------
 Wix-cloudstack-maven-plugin/pom.xml             |  77 ----------
 .../src/org/apache/cloudstack/wix/HeatMojo.java | 144 -------------------
 client/pom.xml                                  |   2 +-
 pom.xml                                         |  11 ++
 tools/wix-cloudstack-maven-plugin/pom.xml       |  78 ++++++++++
 .../src/org/apache/cloudstack/wix/HeatMojo.java | 144 +++++++++++++++++++
 6 files changed, 234 insertions(+), 222 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9855a84a/Wix-cloudstack-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/Wix-cloudstack-maven-plugin/pom.xml b/Wix-cloudstack-maven-plugin/pom.xml
deleted file mode 100644
index 0ce356c..0000000
--- a/Wix-cloudstack-maven-plugin/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
-  license agreements. See the NOTICE file distributed with this work for additional
-  information regarding copyright ownership. The ASF licenses this file to you under
-  the Apache License, Version 2.0 (the "License"); you may not use this file except
-  in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
-  Unless required by applicable law or agreed to in writing, software distributed under
-  the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
-  OF ANY KIND, either express or implied. See the License for the specific language
-  governing permissions and limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <artifactId>Wix-cloudstack-maven-plugin</artifactId>
-  <name>Wix-cloudstack-maven-plugin</name>
-  <packaging>maven-plugin</packaging>
-  <parent>
-    <groupId>org.apache.cloudstack</groupId>
-    <artifactId>cloudstack</artifactId>
-    <version>4.5.0-SNAPSHOT</version>
-  </parent>
-
-  <dependencies>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
-      <version>${maven-plugin-api.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-exec</artifactId>
-      <version>${commons-exec.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.bitbucket.joxley</groupId>
-      <artifactId>wix-maven-plugin</artifactId>
-      <version>${wix-maven-plugin.version}</version>
-    </dependency>
-  </dependencies>
-
-  <properties>
-    <maven-plugin-api.version>2.0</maven-plugin-api.version>
-    <commons-exec.version>1.1</commons-exec.version>
-    <wix-maven-plugin.version>1.1.1</wix-maven-plugin.version>
-  </properties>
-
-  <build>
-    <pluginManagement>
-      <plugins>
-        <!-- Ignore/Execute plugin execution -->
-        <plugin>
-          <groupId>org.eclipse.m2e</groupId>
-          <artifactId>lifecycle-mapping</artifactId>
-          <version>1.0.0</version>
-          <configuration>
-            <lifecycleMappingMetadata>
-              <pluginExecutions>
-                <pluginExecution>
-                  <pluginExecutionFilter>
-                    <groupId>org.apache.maven.plugins</groupId>
-                    <artifactId>maven-enforcer-plugin</artifactId>
-                    <versionRange>[1.0.0,)</versionRange>
-                    <goals>
-                      <goal>enforce</goal>
-                    </goals>
-                  </pluginExecutionFilter>
-                  <action>
-                    <ignore />
-                  </action>
-                </pluginExecution>
-              </pluginExecutions>
-            </lifecycleMappingMetadata>
-          </configuration>
-        </plugin>
-      </plugins>
-    </pluginManagement>
-  </build>
-</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9855a84a/Wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java
----------------------------------------------------------------------
diff --git a/Wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java b/Wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java
deleted file mode 100644
index 075908e..0000000
--- a/Wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java
+++ /dev/null
@@ -1,144 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package org.apache.cloudstack.wix;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.commons.exec.CommandLine;
-import org.apache.commons.exec.DefaultExecutor;
-import org.apache.commons.exec.ExecuteException;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.bitbucket.joxley.wix.AbstractWixMojo;
-
-/**
- *
- * @goal heat
- *
- * @phase package
- *
- */
-public class HeatMojo extends AbstractWixMojo {
-
-  /**
-   * Directory name to be harvested
-   *
-   * @parameter expression="${dir}"
-   * @required
-   *
-   */
-  private String dir;
-
-  /**
-   * use template, one of: fragment,module,product
-   * @parameter expression="${template}" defaults to fragment
-   *
-   */
-  private String template;
-
-  /**
-   * Output file
-   *
-   * @parameter expression="${outputFile}"
-   */
-  private File outputFile;
-
-  /**
-  *
-  * variable names to be passed to heat command
-  * @parameter expression="${vars}"
-  */
-  private String vars;
-
-  /**
-  *
-  * variable names to be passed to heat command
-  * @parameter expression="${workingDirectory}"
-  */
-  private File workingDirectory;
-
-  /**
-  *
-  * variable names to be passed to heat command
-  * @parameter expression="${componentGroup}"
-  */
-  private String componentGroup;
-
-  /**
-   *
-   * <DirectoryName>  directory reference to root directories
-   * @parameter expression="${directoryName}"
-   */
-  private String directoryName;
-
-  @Override
-  public void execute() throws MojoExecutionException, MojoFailureException {
-    try {
-      CommandLine commandLine = new CommandLine("heat");
-
-      if(dir != null && !dir.trim().isEmpty()) {
-        commandLine.addArgument("dir");
-        commandLine.addArgument(dir);
-      }
-
-      commandLine.addArgument("-gg");
-      commandLine.addArgument("-cg");
-      commandLine.addArgument(componentGroup);
-      commandLine.addArgument("-ke");
-      commandLine.addArgument("-sfrag");
-
-      if(template == null || template.trim().isEmpty()) {
-        commandLine.addArgument("-template");
-        commandLine.addArgument("fragment");
-      } else {
-        commandLine.addArgument("-template");
-        commandLine.addArgument(template);
-      }
-
-      if (outputFile != null) {
-        commandLine.addArgument("-out");
-        commandLine.addArgument(outputFile.getAbsolutePath());
-      }
-
-      if (directoryName != null) {
-        commandLine.addArgument("-dr");
-        commandLine.addArgument(directoryName);
-      }
-
-      if (vars != null) {
-        commandLine.addArguments(vars, false);
-      }
-
-      DefaultExecutor executor = new DefaultExecutor();
-      getLog().debug("working directory " + commandLine.toString());
-      executor.setWorkingDirectory(getWorkingDirectory(workingDirectory));
-      int exitValue = executor.execute(commandLine);
-
-      if (exitValue != 0) {
-        throw new MojoExecutionException(
-            "Problem executing heat, return code " + exitValue);
-      }
-
-    } catch (ExecuteException e) {
-      throw new MojoExecutionException("Problem executing heat", e);
-    } catch (IOException e) {
-      throw new MojoExecutionException("Problem executing heat", e);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9855a84a/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index 4d1c118..29fef4f 100644
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -749,7 +749,7 @@
           <plugin>
             <groupId>org.apache.cloudstack</groupId>
             <artifactId>Wix-cloudstack-maven-plugin</artifactId>
-            <version>4.5.0-SNAPSHOT</version>
+            <version>${project.version}</version>
             <executions>
               <execution>
                 <id>wix-cs</id>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9855a84a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e7f56f9..0b3b56e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1059,5 +1059,16 @@
         </plugins>
       </build>
     </profile>  
+    <profile>
+      <id>buildw</id>
+      <activation>
+        <property>
+          <name>buildw</name>
+        </property>
+      </activation>
+      <modules>
+        <module>tools/wix-cloudstack-maven-plugin</module>
+      </modules>
+    </profile>
   </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9855a84a/tools/wix-cloudstack-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/tools/wix-cloudstack-maven-plugin/pom.xml b/tools/wix-cloudstack-maven-plugin/pom.xml
new file mode 100644
index 0000000..7b89b07
--- /dev/null
+++ b/tools/wix-cloudstack-maven-plugin/pom.xml
@@ -0,0 +1,78 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+  license agreements. See the NOTICE file distributed with this work for additional
+  information regarding copyright ownership. The ASF licenses this file to you under
+  the Apache License, Version 2.0 (the "License"); you may not use this file except
+  in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+  Unless required by applicable law or agreed to in writing, software distributed under
+  the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+  OF ANY KIND, either express or implied. See the License for the specific language
+  governing permissions and limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>Wix-cloudstack-maven-plugin</artifactId>
+  <name>Apache CloudStack - Wix Maven Plugin</name>
+  <packaging>maven-plugin</packaging>
+  <parent>
+    <groupId>org.apache.cloudstack</groupId>
+    <artifactId>cloudstack</artifactId>
+    <version>4.5.0-SNAPSHOT</version>
+    <relativePath>../../pom.xml</relativePath>
+  </parent>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>${maven-plugin-api.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-exec</artifactId>
+      <version>${commons-exec.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.bitbucket.joxley</groupId>
+      <artifactId>wix-maven-plugin</artifactId>
+      <version>${wix-maven-plugin.version}</version>
+    </dependency>
+  </dependencies>
+
+  <properties>
+    <maven-plugin-api.version>2.0</maven-plugin-api.version>
+    <commons-exec.version>1.1</commons-exec.version>
+    <wix-maven-plugin.version>1.1.1</wix-maven-plugin.version>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <!-- Ignore/Execute plugin execution -->
+        <plugin>
+          <groupId>org.eclipse.m2e</groupId>
+          <artifactId>lifecycle-mapping</artifactId>
+          <version>1.0.0</version>
+          <configuration>
+            <lifecycleMappingMetadata>
+              <pluginExecutions>
+                <pluginExecution>
+                  <pluginExecutionFilter>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-enforcer-plugin</artifactId>
+                    <versionRange>[1.0.0,)</versionRange>
+                    <goals>
+                      <goal>enforce</goal>
+                    </goals>
+                  </pluginExecutionFilter>
+                  <action>
+                    <ignore />
+                  </action>
+                </pluginExecution>
+              </pluginExecutions>
+            </lifecycleMappingMetadata>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9855a84a/tools/wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java
----------------------------------------------------------------------
diff --git a/tools/wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java b/tools/wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java
new file mode 100644
index 0000000..075908e
--- /dev/null
+++ b/tools/wix-cloudstack-maven-plugin/src/org/apache/cloudstack/wix/HeatMojo.java
@@ -0,0 +1,144 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.wix;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.exec.CommandLine;
+import org.apache.commons.exec.DefaultExecutor;
+import org.apache.commons.exec.ExecuteException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.bitbucket.joxley.wix.AbstractWixMojo;
+
+/**
+ *
+ * @goal heat
+ *
+ * @phase package
+ *
+ */
+public class HeatMojo extends AbstractWixMojo {
+
+  /**
+   * Directory name to be harvested
+   *
+   * @parameter expression="${dir}"
+   * @required
+   *
+   */
+  private String dir;
+
+  /**
+   * use template, one of: fragment,module,product
+   * @parameter expression="${template}" defaults to fragment
+   *
+   */
+  private String template;
+
+  /**
+   * Output file
+   *
+   * @parameter expression="${outputFile}"
+   */
+  private File outputFile;
+
+  /**
+  *
+  * variable names to be passed to heat command
+  * @parameter expression="${vars}"
+  */
+  private String vars;
+
+  /**
+  *
+  * variable names to be passed to heat command
+  * @parameter expression="${workingDirectory}"
+  */
+  private File workingDirectory;
+
+  /**
+  *
+  * variable names to be passed to heat command
+  * @parameter expression="${componentGroup}"
+  */
+  private String componentGroup;
+
+  /**
+   *
+   * <DirectoryName>  directory reference to root directories
+   * @parameter expression="${directoryName}"
+   */
+  private String directoryName;
+
+  @Override
+  public void execute() throws MojoExecutionException, MojoFailureException {
+    try {
+      CommandLine commandLine = new CommandLine("heat");
+
+      if(dir != null && !dir.trim().isEmpty()) {
+        commandLine.addArgument("dir");
+        commandLine.addArgument(dir);
+      }
+
+      commandLine.addArgument("-gg");
+      commandLine.addArgument("-cg");
+      commandLine.addArgument(componentGroup);
+      commandLine.addArgument("-ke");
+      commandLine.addArgument("-sfrag");
+
+      if(template == null || template.trim().isEmpty()) {
+        commandLine.addArgument("-template");
+        commandLine.addArgument("fragment");
+      } else {
+        commandLine.addArgument("-template");
+        commandLine.addArgument(template);
+      }
+
+      if (outputFile != null) {
+        commandLine.addArgument("-out");
+        commandLine.addArgument(outputFile.getAbsolutePath());
+      }
+
+      if (directoryName != null) {
+        commandLine.addArgument("-dr");
+        commandLine.addArgument(directoryName);
+      }
+
+      if (vars != null) {
+        commandLine.addArguments(vars, false);
+      }
+
+      DefaultExecutor executor = new DefaultExecutor();
+      getLog().debug("working directory " + commandLine.toString());
+      executor.setWorkingDirectory(getWorkingDirectory(workingDirectory));
+      int exitValue = executor.execute(commandLine);
+
+      if (exitValue != 0) {
+        throw new MojoExecutionException(
+            "Problem executing heat, return code " + exitValue);
+      }
+
+    } catch (ExecuteException e) {
+      throw new MojoExecutionException("Problem executing heat", e);
+    } catch (IOException e) {
+      throw new MojoExecutionException("Problem executing heat", e);
+    }
+  }
+
+}


[3/3] git commit: updated refs/heads/master to 9855a84

Posted by hu...@apache.org.
Fix a few coverity findings


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cd472379
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cd472379
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cd472379

Branch: refs/heads/master
Commit: cd4723794e8a607d78b659f2abe83a5f84d1dae2
Parents: 522208d
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Wed Jun 11 12:03:17 2014 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Wed Jun 11 14:06:16 2014 +0200

----------------------------------------------------------------------
 .../xenserver/resource/CitrixResourceBase.java  | 162 ++++++++++---------
 1 file changed, 83 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cd472379/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
index 1af4579..97915fa 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java
@@ -16,6 +16,77 @@
 // under the License.
 package com.cloud.hypervisor.xenserver.resource;
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Queue;
+import java.util.Random;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.TimeoutException;
+
+import javax.ejb.Local;
+import javax.naming.ConfigurationException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import com.trilead.ssh2.SCPClient;
+import com.xensource.xenapi.Bond;
+import com.xensource.xenapi.Connection;
+import com.xensource.xenapi.Console;
+import com.xensource.xenapi.Host;
+import com.xensource.xenapi.HostCpu;
+import com.xensource.xenapi.HostMetrics;
+import com.xensource.xenapi.Network;
+import com.xensource.xenapi.PBD;
+import com.xensource.xenapi.PIF;
+import com.xensource.xenapi.Pool;
+import com.xensource.xenapi.SR;
+import com.xensource.xenapi.Session;
+import com.xensource.xenapi.Task;
+import com.xensource.xenapi.Types;
+import com.xensource.xenapi.Types.BadServerResponse;
+import com.xensource.xenapi.Types.VmPowerState;
+import com.xensource.xenapi.Types.XenAPIException;
+import com.xensource.xenapi.VBD;
+import com.xensource.xenapi.VBDMetrics;
+import com.xensource.xenapi.VDI;
+import com.xensource.xenapi.VGPU;
+import com.xensource.xenapi.VIF;
+import com.xensource.xenapi.VLAN;
+import com.xensource.xenapi.VM;
+import com.xensource.xenapi.VMGuestMetrics;
+import com.xensource.xenapi.XenAPIObject;
+
+import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
+
 import com.cloud.agent.IAgentControl;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.AttachIsoCommand;
@@ -175,73 +246,6 @@ import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.PowerState;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.snapshot.VMSnapshot;
-import com.trilead.ssh2.SCPClient;
-import com.xensource.xenapi.Bond;
-import com.xensource.xenapi.Connection;
-import com.xensource.xenapi.Console;
-import com.xensource.xenapi.Host;
-import com.xensource.xenapi.HostCpu;
-import com.xensource.xenapi.HostMetrics;
-import com.xensource.xenapi.Network;
-import com.xensource.xenapi.PBD;
-import com.xensource.xenapi.PIF;
-import com.xensource.xenapi.Pool;
-import com.xensource.xenapi.SR;
-import com.xensource.xenapi.Session;
-import com.xensource.xenapi.Task;
-import com.xensource.xenapi.Types;
-import com.xensource.xenapi.Types.BadServerResponse;
-import com.xensource.xenapi.Types.VmPowerState;
-import com.xensource.xenapi.Types.XenAPIException;
-import com.xensource.xenapi.VBD;
-import com.xensource.xenapi.VBDMetrics;
-import com.xensource.xenapi.VDI;
-import com.xensource.xenapi.VGPU;
-import com.xensource.xenapi.VIF;
-import com.xensource.xenapi.VLAN;
-import com.xensource.xenapi.VM;
-import com.xensource.xenapi.VMGuestMetrics;
-import com.xensource.xenapi.XenAPIObject;
-import org.apache.cloudstack.storage.command.StorageSubSystemCommand;
-import org.apache.cloudstack.storage.to.TemplateObjectTO;
-import org.apache.cloudstack.storage.to.VolumeObjectTO;
-import org.apache.log4j.Logger;
-import org.apache.xmlrpc.XmlRpcException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import java.util.concurrent.TimeoutException;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Queue;
-import java.util.Random;
-import java.util.Set;
-import java.util.UUID;
 
 /**
  * CitrixResourceBase encapsulates the calls to the XenServer Xapi process
@@ -1067,7 +1071,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
                 //TODO: Should make this error not fatal?
                 //Can Concurrent VM shutdown/migration/reboot events can cause this method
                 //to be executed on a bridge which has already been removed?
-                throw new CloudRuntimeException("Unable to remove OVS bridge " + bridge + ":" + res);
+                throw new CloudRuntimeException("Unable to remove OVS bridge " + bridge + ":" + result);
             }
             return;
         } catch (Exception e) {
@@ -1087,13 +1091,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         BroadcastDomainType type = nic.getBroadcastType();
         if (uri != null && uri.toString().contains("untagged")) {
             return network.getNetwork();
-        } else if (type == BroadcastDomainType.Vlan) {
+        } else if (uri != null && type == BroadcastDomainType.Vlan) {
             assert (BroadcastDomainType.getSchemeValue(uri) == BroadcastDomainType.Vlan);
             long vlan = Long.parseLong(BroadcastDomainType.getValue(uri));
             return enableVlanNetwork(conn, vlan, network);
         } else if (type == BroadcastDomainType.Native || type == BroadcastDomainType.LinkLocal) {
             return network.getNetwork();
-        } else if (type == BroadcastDomainType.Vswitch) {
+        } else if (uri != null && type == BroadcastDomainType.Vswitch) {
             String header = uri.toString().substring(Networks.BroadcastDomainType.Vswitch.scheme().length() + "://".length());
             if (header.startsWith("vlan")) {
                 _isOvs = true;
@@ -1111,7 +1115,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         } else if (type == BroadcastDomainType.Lswitch) {
             // Nicira Logical Switch
             return network.getNetwork();
-        } else if (type == BroadcastDomainType.Pvlan) {
+        } else if (uri != null && type == BroadcastDomainType.Pvlan) {
             assert BroadcastDomainType.getSchemeValue(uri) == BroadcastDomainType.Pvlan;
             // should we consider moving this NetUtils method to BroadcastDomainType?
             long vlan = Long.parseLong(NetUtils.getPrimaryPvlanFromUri(uri));
@@ -1125,13 +1129,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
         if (broadcastUri.contains(".")) {
             String[] parts = broadcastUri.split("\\.");
             return "OVS-DR-VPC-Bridge"+parts[0];
-         } else {
+        } else {
             try {
                 return "OVSTunnel" + broadcastUri;
             } catch (Exception e) {
                 return null;
             }
-         }
+        }
     }
 
     protected VIF createVif(Connection conn, String vmName, VM vm, VirtualMachineTO vmSpec, NicTO nic) throws XmlRpcException, XenAPIException {
@@ -5063,11 +5067,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             }
             if (srr.shared) {
                 if (SRType.NFS.equals(srr.type) ){
-                       Map<String, String> smConfig = srr.smConfig;
-                       if( !smConfig.containsKey("nosubdir")) {
-                           smConfig.put("nosubdir", "true");
-                           sr.setSmConfig(conn,smConfig);
-                       }
+                    Map<String, String> smConfig = srr.smConfig;
+                    if( !smConfig.containsKey("nosubdir")) {
+                        smConfig.put("nosubdir", "true");
+                        sr.setSmConfig(conn,smConfig);
+                    }
                 }
 
                 Host host = Host.getByUuid(conn, _host.uuid);
@@ -5310,7 +5314,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
             String result = callHostPlugin(conn, "ovstunnel", "configure_ovs_bridge_for_network_topology", "bridge",
                     bridgeName, "config", cmd.getVpcConfigInJson(), "host-id", ((Long)cmd.getHostId()).toString(),
                     "seq-no", Long.toString(sequenceNo));
-                if (result.startsWith("SUCCESS")) {
+            if (result.startsWith("SUCCESS")) {
                 return new Answer(cmd, true, result);
             } else {
                 return new Answer(cmd, false, result);


[2/3] git commit: updated refs/heads/master to 9855a84

Posted by hu...@apache.org.
Add a first version of a PMD ruleset to our check project


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8e704f5e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8e704f5e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8e704f5e

Branch: refs/heads/master
Commit: 8e704f5eee07a2a52632a886b606633d6c3dbf6a
Parents: cd47237
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Wed Jun 11 12:06:32 2014 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Wed Jun 11 14:06:16 2014 +0200

----------------------------------------------------------------------
 plugins/network-elements/nicira-nvp/pom.xml     |  4 +
 pom.xml                                         | 10 +++
 .../checkstyle/src/main/resources/cloud-pmd.xml | 84 ++++++++++++++++++++
 3 files changed, 98 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e704f5e/plugins/network-elements/nicira-nvp/pom.xml
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/pom.xml b/plugins/network-elements/nicira-nvp/pom.xml
index b046610..86a1699 100644
--- a/plugins/network-elements/nicira-nvp/pom.xml
+++ b/plugins/network-elements/nicira-nvp/pom.xml
@@ -50,6 +50,10 @@
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-pmd-plugin</artifactId>
+      </plugin>
     </plugins>
   </build>
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e704f5e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1763d68..e7f56f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -904,8 +904,18 @@
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-pmd-plugin</artifactId>
           <version>3.1</version>
+          <dependencies>
+            <dependency>
+              <groupId>org.apache.cloudstack</groupId>
+              <artifactId>checkstyle</artifactId>
+              <version>${project.version}</version>
+            </dependency>
+          </dependencies>
           <configuration>
             <failOnViolation>false</failOnViolation>
+           <rulesets>
+             <ruleset>cloud-pmd.xml</ruleset>
+           </rulesets>
           </configuration>
           <executions>
             <execution>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e704f5e/tools/checkstyle/src/main/resources/cloud-pmd.xml
----------------------------------------------------------------------
diff --git a/tools/checkstyle/src/main/resources/cloud-pmd.xml b/tools/checkstyle/src/main/resources/cloud-pmd.xml
new file mode 100644
index 0000000..ec2914f
--- /dev/null
+++ b/tools/checkstyle/src/main/resources/cloud-pmd.xml
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+-->
+<ruleset name="Maven Ruleset"
+  xmlns="http://pmd.sf.net/ruleset/1.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
+  xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
+  
+  <description>
+    Ruleset that brings all the rulesets we want from the pmd jar, because
+    the maven-pmd-plugin doesn't find them otherwise. This is also the place
+    to add our own future rulesets, if any.
+  </description>
+  
+  <rule ref="rulesets/java/basic.xml"/>
+  <rule ref="rulesets/java/braces.xml"/>
+  <rule ref="rulesets/java/clone.xml"/>
+  <rule ref="rulesets/java/codesize.xml"/>
+  <rule ref="rulesets/java/comments.xml">
+    <!-- We shouldn't limit the number of lines in the header of a class -->
+    <exclude name="CommentSize"/>
+    <exclude name="CommentRequired" />
+  </rule>
+  <rule ref="rulesets/java/controversial.xml">
+    <!-- The rule is good, but is not properly applied. It forces you to statically declare it as ConcurrentHashMap -->
+    <exclude name="UseConcurrentHashMap"/>
+    <exclude name="CallSuperInConstructor"/>
+    <exclude name="AtLeastOneConstructor"/>
+    <exclude name="AssignmentInOperand"/>
+    <exclude name="NullAssignment"/>
+    <exclude name="DataflowAnomalyAnalysis" />
+    <exclude name="UseObjectForClearerAPI" />
+  </rule>
+  <rule ref="rulesets/java/coupling.xml">
+    <exclude name="ExcessiveImports" />
+    <exclude name="LawOfDemeter"/>
+  </rule>
+  <rule ref="rulesets/java/design.xml">
+    <exclude name="ConstructorCallsOverridableMethod"/>
+    <exclude name="AbstractClassWithoutAbstractMethod"/>
+    <exclude name="AvoidSynchronizedAtMethodLevel"/>
+  </rule>
+  <rule ref="rulesets/java/empty.xml"/>
+  <rule ref="rulesets/java/finalizers.xml"/>
+  <rule ref="rulesets/java/imports.xml"/>
+  <rule ref="rulesets/java/j2ee.xml"/>
+  <rule ref="rulesets/java/junit.xml"/>
+  <rule ref="rulesets/java/logging-java.xml"/>
+  <rule ref="rulesets/java/naming.xml">
+    <exclude name="ShortVariable"/>
+    <exclude name="AbstractNaming"/>
+  </rule>
+  <rule ref="rulesets/java/naming.xml/LongVariable">
+    <properties>
+      <property name="minimum" value="32"/>
+    </properties>
+  </rule>
+  <rule ref="rulesets/java/optimizations.xml"/>
+  <rule ref="rulesets/java/strictexception.xml"/>
+  <rule ref="rulesets/java/strings.xml"/>
+  <rule ref="rulesets/java/sunsecure.xml"/>
+  <rule ref="rulesets/java/typeresolution.xml"/>
+  <rule ref="rulesets/java/unnecessary.xml"/>
+  <rule ref="rulesets/java/unusedcode.xml"/>
+</ruleset>