You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/05/24 03:01:07 UTC
[01/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Updated Branches:
refs/heads/object_store 913e2b38b -> 98af42405
PVLAN: Fix NPE when VM are in allocated state
If vlan is not assigned for VM, nic.getBroadcastUri() would be null. Then just
ignore it.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/92ad6aba
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/92ad6aba
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/92ad6aba
Branch: refs/heads/object_store
Commit: 92ad6abab0063771dffaabb7c9d6d8256083c5be
Parents: a75cf9a
Author: Sheng Yang <sh...@citrix.com>
Authored: Tue May 21 14:46:31 2013 -0700
Committer: Sheng Yang <sh...@citrix.com>
Committed: Tue May 21 14:51:35 2013 -0700
----------------------------------------------------------------------
.../router/VirtualNetworkApplianceManagerImpl.java | 2 +-
server/src/com/cloud/vm/UserVmManagerImpl.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92ad6aba/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index 64e412a..b969be2 100755
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@ -2609,7 +2609,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
List<? extends Nic> routerNics = _nicDao.listByVmId(profile.getId());
for (Nic nic : routerNics) {
Network network = _networkModel.getNetwork(nic.getNetworkId());
- if (network.getTrafficType() == TrafficType.Guest && nic.getBroadcastUri().getScheme().equals("pvlan")) {
+ if (network.getTrafficType() == TrafficType.Guest && nic.getBroadcastUri() != null && nic.getBroadcastUri().getScheme().equals("pvlan")) {
NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
setupDhcpForPvlan(false, domR, domR.getHostId(), nicProfile);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92ad6aba/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 71b4e3f..5e20656 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -3059,7 +3059,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
for (NicVO nic : nics) {
NetworkVO network = _networkDao.findById(nic.getNetworkId());
if (network.getTrafficType() == TrafficType.Guest) {
- if (nic.getBroadcastUri().getScheme().equals("pvlan")) {
+ if (nic.getBroadcastUri() != null && nic.getBroadcastUri().getScheme().equals("pvlan")) {
NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
setupVmForPvlan(false, vm.getHostId(), nicProfile);
}
[39/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-862 Updated documentation with the new features available in
the Nicira NVP plugin.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1201d623
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1201d623
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1201d623
Branch: refs/heads/object_store
Commit: 1201d623a7091517a1e26bc4b82c5daeea3c155f
Parents: 623a26e
Author: Hugo Trippaers <tr...@gmail.com>
Authored: Thu May 23 16:58:12 2013 +0200
Committer: Hugo Trippaers <tr...@gmail.com>
Committed: Thu May 23 22:48:40 2013 +0200
----------------------------------------------------------------------
docs/en-US/CloudStack_Nicira_NVP_Guide.xml | 1 +
docs/en-US/images/nvp-add-controller.png | Bin 0 -> 35928 bytes
docs/en-US/images/nvp-enable-provider.png | Bin 0 -> 32158 bytes
docs/en-US/images/nvp-network-offering.png | Bin 0 -> 104060 bytes
docs/en-US/images/nvp-physical-network-stt.png | Bin 0 -> 27317 bytes
docs/en-US/images/nvp-vpc-offering-edit.png | Bin 0 -> 29279 bytes
docs/en-US/plugin-niciranvp-about.xml | 2 +-
docs/en-US/plugin-niciranvp-devicemanagement.xml | 32 +---
docs/en-US/plugin-niciranvp-features.xml | 67 +++++++-
docs/en-US/plugin-niciranvp-guide.xml | 31 ----
docs/en-US/plugin-niciranvp-introduction.xml | 5 +-
docs/en-US/plugin-niciranvp-networkofferings.xml | 131 +++++++++++++++
docs/en-US/plugin-niciranvp-physicalnet.xml | 37 ++++
docs/en-US/plugin-niciranvp-preparations.xml | 11 +-
docs/en-US/plugin-niciranvp-provider.xml | 28 ++--
docs/en-US/plugin-niciranvp-revisions.xml | 14 ++
docs/en-US/plugin-niciranvp-tables.xml | 105 +++++++++---
docs/en-US/plugin-niciranvp-usage.xml | 11 +-
docs/en-US/plugin-niciranvp-vpc.xml | 30 ++++
docs/en-US/plugin-niciranvp-vpcfeatures.xml | 28 +++
docs/en-US/plugin-niciranvp-vpcnetworkoffering.xml | 81 +++++++++
docs/en-US/plugin-niciranvp-vpcoffering.xml | 38 ++++
22 files changed, 537 insertions(+), 115 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/CloudStack_Nicira_NVP_Guide.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/CloudStack_Nicira_NVP_Guide.xml b/docs/en-US/CloudStack_Nicira_NVP_Guide.xml
index 7f156d5..5431fc1 100644
--- a/docs/en-US/CloudStack_Nicira_NVP_Guide.xml
+++ b/docs/en-US/CloudStack_Nicira_NVP_Guide.xml
@@ -48,6 +48,7 @@
</bookinfo>
<xi:include href="plugin-niciranvp-about.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="plugin-niciranvp-usage.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="plugin-niciranvp-vpc.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
<xi:include href="plugin-niciranvp-troubleshooting.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="plugin-niciranvp-revisions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</book>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/images/nvp-add-controller.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/nvp-add-controller.png b/docs/en-US/images/nvp-add-controller.png
new file mode 100644
index 0000000..e02d31f
Binary files /dev/null and b/docs/en-US/images/nvp-add-controller.png differ
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/images/nvp-enable-provider.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/nvp-enable-provider.png b/docs/en-US/images/nvp-enable-provider.png
new file mode 100644
index 0000000..0f2d02d
Binary files /dev/null and b/docs/en-US/images/nvp-enable-provider.png differ
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/images/nvp-network-offering.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/nvp-network-offering.png b/docs/en-US/images/nvp-network-offering.png
new file mode 100644
index 0000000..c2d25c4
Binary files /dev/null and b/docs/en-US/images/nvp-network-offering.png differ
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/images/nvp-physical-network-stt.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/nvp-physical-network-stt.png b/docs/en-US/images/nvp-physical-network-stt.png
new file mode 100644
index 0000000..2ce7853
Binary files /dev/null and b/docs/en-US/images/nvp-physical-network-stt.png differ
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/images/nvp-vpc-offering-edit.png
----------------------------------------------------------------------
diff --git a/docs/en-US/images/nvp-vpc-offering-edit.png b/docs/en-US/images/nvp-vpc-offering-edit.png
new file mode 100644
index 0000000..ff235e2
Binary files /dev/null and b/docs/en-US/images/nvp-vpc-offering-edit.png differ
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-about.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-about.xml b/docs/en-US/plugin-niciranvp-about.xml
index 8d2e20e..cfab83c 100644
--- a/docs/en-US/plugin-niciranvp-about.xml
+++ b/docs/en-US/plugin-niciranvp-about.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
%BOOK_ENTITIES;
<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-devicemanagement.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-devicemanagement.xml b/docs/en-US/plugin-niciranvp-devicemanagement.xml
index 57b8eee..761c39f 100644
--- a/docs/en-US/plugin-niciranvp-devicemanagement.xml
+++ b/docs/en-US/plugin-niciranvp-devicemanagement.xml
@@ -21,27 +21,15 @@
under the License.
-->
<section id="Device-management">
- <title>Device-management</title>
- <para>In &PRODUCT; 4.0.x each Nicira NVP setup is considered a "device" that can be added and removed from a physical network. To complete the configuration of the Nicira NVP plugin a device needs to be added to the physical network using the "addNiciraNVPDevice" API call. The plugin is now enabled on the physical network and any guest networks created on that network will be provisioned using the Nicira NVP Controller.</para>
- <para>The plugin introduces a set of new API calls to manage the devices, see below or refer to the API reference.</para>
- <itemizedlist>
- <listitem><para>addNiciraNvpDevice</para></listitem>
- <listitem>
- <itemizedlist>
- <listitem><para>physicalnetworkid: the UUID of the physical network on which the device is configured</para></listitem>
- <listitem><para>hostname: the IP address of the NVP controller</para></listitem>
- <listitem><para>username: the username for access to the NVP API</para></listitem>
- <listitem><para>password: the password for access to the NVP API</para></listitem>
- <listitem><para>transportzoneuuid: the UUID of the transportzone</para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para>deleteNiciraNVPDevice</para></listitem>
- <listitem>
- <itemizedlist>
- <listitem><para>nvpdeviceid: the UUID of the device</para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para>listNiciraNVPDevices</para></listitem>
- </itemizedlist>
+ <title>Device Management</title>
+ <para>In &PRODUCT; a Nicira NVP setup is considered a "device" that can be added and removed from a physical network. To complete the configuration of the Nicira NVP plugin a device needs to be added to the physical network. Press the "Add NVP Controller" button on the provider panel and enter the configuration details.</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="./images/nvp-add-controller.png" />
+ </imageobject>
+ <textobject>
+ <phrase>nvp-physical-network-stt.png: a screenshot of the device configuration popup.</phrase>
+ </textobject>
+ </mediaobject>
</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-features.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-features.xml b/docs/en-US/plugin-niciranvp-features.xml
index c346bfb..e439f1b 100644
--- a/docs/en-US/plugin-niciranvp-features.xml
+++ b/docs/en-US/plugin-niciranvp-features.xml
@@ -22,12 +22,63 @@
-->
<section id="Features-of-the-Nicira-NVP-Plugin">
<title>Features of the Nicira NVP Plugin</title>
- <para>In &PRODUCT; release 4.0.0-incubating this plugin supports the Connectivity service. This service is responsible for creating Layer 2 networks supporting the networks created by Guests. In other words when an tenant creates a new network, instead of the traditional VLAN a logical network will be created by sending the appropriate calls to the Nicira NVP Controller.</para>
- <para>The plugin has been tested with Nicira NVP versions 2.1.0, 2.2.0 and 2.2.1</para>
- <note><para>In &PRODUCT; 4.0.0-incubating only the XenServer hypervisor is supported for use in
- combination with Nicira NVP.</para>
- <para>In &PRODUCT; 4.1.0-incubating both KVM and XenServer hypervisors are
- supported.</para></note>
- <note><para>In &PRODUCT; 4.0.0-incubating the UI components for this plugin are not complete,
- configuration is done by sending commands to the API.</para></note>
+ <para>The following table lists the CloudStack network services provided by the Nicira NVP Plugin.</para>
+ <table>
+ <title>Supported Services</title>
+ <tgroup cols="3">
+ <thead>
+ <row>
+ <entry>Network Service</entry>
+ <entry>CloudStack version</entry>
+ <entry>NVP version</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>Virtual Networking</entry>
+ <entry>>= 4.0</entry>
+ <entry>>= 2.2.1</entry>
+ </row>
+ <row>
+ <entry>Source NAT</entry>
+ <entry>>= 4.1</entry>
+ <entry>>= 3.0.1</entry>
+ </row>
+ <row>
+ <entry>Static NAT</entry>
+ <entry>>= 4.1</entry>
+ <entry>>= 3.0.1</entry>
+ </row>
+ <row>
+ <entry>Port Forwarding</entry>
+ <entry>>= 4.1</entry>
+ <entry>>= 3.0.1</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <note><para>The Virtual Networking service was originally called 'Connectivity' in CloudStack 4.0</para></note>
+ <para>The following hypervisors are supported by the Nicira NVP Plugin.</para>
+ <table>
+ <title>Supported Hypervisors</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Hypervisor</entry>
+ <entry>CloudStack version</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>XenServer</entry>
+ <entry>>= 4.0</entry>
+ </row>
+ <row>
+ <entry>KVM</entry>
+ <entry>>= 4.1</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <note><para>Please refer to the Nicira NVP configuration guide on how to prepare the hypervisors for Nicira NVP integration.</para></note>
</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-guide.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-guide.xml b/docs/en-US/plugin-niciranvp-guide.xml
deleted file mode 100644
index 89c9871..0000000
--- a/docs/en-US/plugin-niciranvp-guide.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
-<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
-%BOOK_ENTITIES;
-<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
-%xinclude;
-]>
-
-<!-- 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.
--->
-<chapter id="niciranvp-plugin-guide">
- <title>Plugin Guide for the Nicira NVP Plugin</title>
- <xi:include href="plugin-niciranvp-about.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="plugin-niciranvp-usage.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
- <xi:include href="plugin-niciranvp-troubleshooting.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
-</chapter>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-introduction.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-introduction.xml b/docs/en-US/plugin-niciranvp-introduction.xml
index 9c1d42d..a06f123 100644
--- a/docs/en-US/plugin-niciranvp-introduction.xml
+++ b/docs/en-US/plugin-niciranvp-introduction.xml
@@ -22,5 +22,8 @@
-->
<section id="Introduction-to-the-Nicira-NVP-Plugin">
<title>Introduction to the Nicira NVP Plugin</title>
- <para>The Nicira NVP plugin allows CloudStack to use the Nicira solution for virtualized network as a provider for CloudStack networks and services.</para>
+ <para>The Nicira NVP plugin adds Nicira NVP as one of the available SDN implementations in
+ CloudStack. With the plugin an exisiting Nicira NVP setup can be used by CloudStack to
+ implement isolated guest networks and to provide additional services like routing and
+ NAT.</para>
</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-networkofferings.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-networkofferings.xml b/docs/en-US/plugin-niciranvp-networkofferings.xml
new file mode 100644
index 0000000..b30437e
--- /dev/null
+++ b/docs/en-US/plugin-niciranvp-networkofferings.xml
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="network-offerings">
+ <title>Network Offerings</title>
+ <para>Using the Nicira NVP plugin requires a network offering with Virtual Networking enabled and configured to use the NiciraNvp element. Typical use cases combine services from the Virtual Router appliance and the Nicira NVP plugin.</para>
+ <table>
+ <title>Isolated network offering with regular services from the Virtual Router.</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Service</entry>
+ <entry>Provider</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>VPN</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>DHCP</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>DNS</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Firewall</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Load Balancer</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>User Data</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Source NAT</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Static NAT</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Post Forwarding</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Virtual Networking</entry>
+ <entry>NiciraNVP</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="./images/nvp-network-offering.png" />
+ </imageobject>
+ <textobject>
+ <phrase>nvp-physical-network-stt.png: a screenshot of a network offering.</phrase>
+ </textobject>
+ </mediaobject>
+ <note><para>The tag in the network offering should be set to the name of the physical network with the NVP provider.</para></note>
+ <para>Isolated network with network services. The virtual router is still required to provide network services like dns and dhcp.</para>
+ <table>
+ <title>Isolated network offering with network services</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Service</entry>
+ <entry>Provider</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>DHCP</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>DNS</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>User Data</entry>
+ <entry>VirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Source NAT</entry>
+ <entry>NiciraNVP</entry>
+ </row>
+ <row>
+ <entry>Static NAT</entry>
+ <entry>NiciraNVP</entry>
+ </row>
+ <row>
+ <entry>Post Forwarding</entry>
+ <entry>NiciraNVP</entry>
+ </row>
+ <row>
+ <entry>Virtual Networking</entry>
+ <entry>NiciraNVP</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-physicalnet.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-physicalnet.xml b/docs/en-US/plugin-niciranvp-physicalnet.xml
new file mode 100644
index 0000000..d320290
--- /dev/null
+++ b/docs/en-US/plugin-niciranvp-physicalnet.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="zone-configuration">
+ <title>Zone Configuration</title>
+ <para>&PRODUCT; needs to have at least one physical network with the isolation method set to "STT". This network should be enabled for the Guest traffic type.</para>
+ <note><para>The Guest traffic type should be configured with the traffic label that matches the name of
+ the Integration Bridge on the hypervisor. See the Nicira NVP User Guide for more details
+ on how to set this up in XenServer or KVM.</para></note>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="./images/nvp-physical-network-stt.png" />
+ </imageobject>
+ <textobject>
+ <phrase>nvp-physical-network-stt.png: a screenshot of a physical network with the STT isolation type</phrase>
+ </textobject>
+ </mediaobject>
+ </section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-preparations.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-preparations.xml b/docs/en-US/plugin-niciranvp-preparations.xml
index 762c941..6072559 100644
--- a/docs/en-US/plugin-niciranvp-preparations.xml
+++ b/docs/en-US/plugin-niciranvp-preparations.xml
@@ -22,17 +22,16 @@
-->
<section id="Prerequisites">
<title>Prerequisites</title>
- <para>Before enabling the Nicira NVP plugin the NVP Controller needs to be configured. Please review the NVP User Guide on how to do that. </para>
- <para>&PRODUCT; needs to have at least one physical network with the isolation method set to "STT". This network should be enabled for the Guest traffic type.</para>
- <note><para>The Guest traffic type should be configured with the traffic label that matches the name of
- the Integration Bridge on the hypervisor. See the Nicira NVP User Guide for more details
- on how to set this up in XenServer or KVM.</para></note>
+ <para>Before enabling the Nicira NVP plugin the NVP Controller needs to be configured. Please review the NVP User Guide on how to do that.</para>
<para>Make sure you have the following information ready:</para>
<itemizedlist>
<listitem><para>The IP address of the NVP Controller</para></listitem>
<listitem><para>The username to access the API</para></listitem>
<listitem><para>The password to access the API</para></listitem>
<listitem><para>The UUID of the Transport Zone that contains the hypervisors in this Zone</para></listitem>
- <listitem><para>The UUID of the Physical Network that will be used for the Guest networks</para></listitem>
+ <listitem>
+ <para>The UUID of the Gateway Service used to provide router and NAT services.</para>
+ </listitem>
</itemizedlist>
+ <note><para>The gateway service uuid is optional and is used for Layer 3 services only (SourceNat, StaticNat and PortForwarding)</para></note>
</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-provider.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-provider.xml b/docs/en-US/plugin-niciranvp-provider.xml
index 80fb227..8694478 100644
--- a/docs/en-US/plugin-niciranvp-provider.xml
+++ b/docs/en-US/plugin-niciranvp-provider.xml
@@ -22,21 +22,15 @@
-->
<section id="Enabling-the-service-provider">
<title>Enabling the service provider</title>
- <para>To allow CloudStack to use the Nicira NVP Plugin the network service provider needs to be enabled on the physical network. The following sequence of API calls will enable the network service provider</para>
- <itemizedlist>
- <listitem><para>addNetworkServiceProvider</para></listitem>
- <listitem>
- <itemizedlist>
- <listitem><para>name = "NiciraNvp"</para></listitem>
- <listitem><para>physicalnetworkid = <the uuid of the physical network></para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para>updateNetworkServiceProvider</para></listitem>
- <listitem>
- <itemizedlist>
- <listitem><para>id = <the provider uuid returned by the previous call></para></listitem>
- <listitem><para>state = "Enabled"</para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
+ <para>The Nicira NVP provider is disabled by default. Navigate to the "Network Service Providers" configuration of the physical network with the STT isolation type. Navigate to the Nicira NVP provider and press the "Enable Provider" button.</para>
+ <note><para>CloudStack 4.0 does not have the UI interface to configure the Nicira NVP plugin. Configuration needs to be done using the API directly.</para></note>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="./images/nvp-enable-provider.png" />
+ </imageobject>
+ <textobject>
+ <phrase>nvp-physical-network-stt.png: a screenshot of an enabled Nicira NVP provider</phrase>
+ </textobject>
+ </mediaobject>
+
</section>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-revisions.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-revisions.xml b/docs/en-US/plugin-niciranvp-revisions.xml
index b8e6935..b58d333 100644
--- a/docs/en-US/plugin-niciranvp-revisions.xml
+++ b/docs/en-US/plugin-niciranvp-revisions.xml
@@ -40,6 +40,20 @@
</simplelist>
</revdescription>
</revision>
+ <revision>
+ <revnumber>1-0</revnumber>
+ <date>Wed May 22 2013</date>
+ <author>
+ <firstname>Hugo</firstname>
+ <surname>Trippaers</surname>
+ <email>hugo@apache.org</email>
+ </author>
+ <revdescription>
+ <simplelist>
+ <member>Documentation updated for &PRODUCT; 4.1.0</member>
+ </simplelist>
+ </revdescription>
+ </revision>
</revhistory>
</simpara>
</appendix>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-tables.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-tables.xml b/docs/en-US/plugin-niciranvp-tables.xml
index 4f81655..615f349 100644
--- a/docs/en-US/plugin-niciranvp-tables.xml
+++ b/docs/en-US/plugin-niciranvp-tables.xml
@@ -23,29 +23,84 @@
<section id="Database-tables">
<title>Database tables</title>
<para>The following tables are added to the cloud database for the Nicira NVP Plugin</para>
- <itemizedlist>
- <listitem><para>nicira_nvp_nic_map, contains a mapping from nic to logical switch port</para></listitem>
- <listitem>
- <itemizedlist>
- <listitem><para>id</para></listitem>
- <listitem><para>logicalswitch, uuid of the logical switch this port is connected to</para></listitem>
- <listitem><para>logicalswitchport, uuid of the logical switch port for this nic</para></listitem>
- <listitem><para>nic, the CloudStack uuid for this nic, reference to the nics table</para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- <itemizedlist>
- <listitem><para>external_nicira_nvp_devices, contains all configured devices</para></listitem>
- <listitem>
- <itemizedlist>
- <listitem><para>id</para></listitem>
- <listitem><para>uuid</para></listitem>
- <listitem><para>physical_network_id, the physical network this device is configured on</para></listitem>
- <listitem><para>provider_name, set to "NiciraNvp"</para></listitem>
- <listitem><para>device_name, display name for this device</para></listitem>
- <listitem><para>host_id, reference to the host table with the device configuration</para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
-
+ <table>
+ <title>nicira_nvp_nic_map</title>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>id</entry>
+ <entry>auto incrementing id</entry>
+ </row>
+ <row>
+ <entry>logicalswitch</entry>
+ <entry>uuid of the logical switch this port is connected to</entry>
+ </row>
+ <row>
+ <entry>logicalswitchport</entry>
+ <entry>uuid of the logical switch port for this nic</entry>
+ </row>
+ <row>
+ <entry>nic</entry>
+ <entry>the &PRODUCT; uuid for this nic, reference to the nics table</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>external_nicira_nvp_devices</title>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>id</entry>
+ <entry>auto incrementing id</entry>
+ </row>
+ <row>
+ <entry>uuid</entry>
+ <entry>UUID identifying this device</entry>
+ </row>
+ <row>
+ <entry>physical_network_id</entry>
+ <entry>the physical network this device is configured on</entry>
+ </row>
+ <row>
+ <entry>provider_name</entry>
+ <entry>NiciraNVP</entry>
+ </row>
+ <row>
+ <entry>device_name</entry>
+ <entry>display name for this device</entry>
+ </row>
+ <row>
+ <entry>host_id</entry>
+ <entry>reference to the host table with the device configuration</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <table>
+ <title>nicira_nvp_router_map</title>
+ <tgroup cols="2">
+ <tbody>
+ <row>
+ <entry>id</entry>
+ <entry>auto incrementing id</entry>
+ </row>
+ <row>
+ <entry>logicalrouter_uuid</entry>
+ <entry>uuid of the logical router</entry>
+ </row>
+ <row>
+ <entry>network_id</entry>
+ <entry>id of the network this router is linked to</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <note>
+ <para>nicira_nvp_router_map is only available in &PRODUCT; 4.1 and above</para>
+ </note>
+
</section>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-usage.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-usage.xml b/docs/en-US/plugin-niciranvp-usage.xml
index 76f9a0b..9f04c38 100644
--- a/docs/en-US/plugin-niciranvp-usage.xml
+++ b/docs/en-US/plugin-niciranvp-usage.xml
@@ -21,10 +21,13 @@
under the License.
-->
<chapter id="Using-the-Nicira-NVP-Plugin" >
- <title>Using the Nicira NVP Plugin</title>
+ <title>Configuring the Nicira NVP Plugin</title>
<xi:include href="plugin-niciranvp-preparations.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="plugin-niciranvp-ui.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="plugin-niciranvp-provider.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
- <xi:include href="plugin-niciranvp-devicemanagement.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="plugin-niciranvp-physicalnet.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="plugin-niciranvp-provider.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+ <xi:include href="plugin-niciranvp-devicemanagement.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"/>
+ <xi:include href="plugin-niciranvp-networkofferings.xml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"/>
</chapter>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-vpc.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-vpc.xml b/docs/en-US/plugin-niciranvp-vpc.xml
new file mode 100644
index 0000000..a43c5fa
--- /dev/null
+++ b/docs/en-US/plugin-niciranvp-vpc.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<chapter id="Using-the-Nicira-NVP-Plugin-With_VPC" >
+ <title>Using the Nicira NVP plugin with VPC</title>
+
+ <xi:include href="plugin-niciranvp-vpcfeatures.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="plugin-niciranvp-vpcoffering.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+ <xi:include href="plugin-niciranvp-vpcnetworkoffering.xml" xmlns:xi="http://www.w3.org/2001/XInclude"></xi:include>
+
+</chapter>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-vpcfeatures.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-vpcfeatures.xml b/docs/en-US/plugin-niciranvp-vpcfeatures.xml
new file mode 100644
index 0000000..a8d8194
--- /dev/null
+++ b/docs/en-US/plugin-niciranvp-vpcfeatures.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="vpc-features">
+ <title>Supported VPC features</title>
+ <para>The Nicira NVP plugin supports &PRODUCT; VPC to a certain extent. Starting with &PRODUCT; version 4.1 VPCs can be deployed using NVP isolated networks.</para>
+ <para>It is not possible to use a Nicira NVP Logical Router for as a VPC Router</para>
+ <para>It is not possible to connect a private gateway using a Nicira NVP Logical Switch</para>
+</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-vpcnetworkoffering.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-vpcnetworkoffering.xml b/docs/en-US/plugin-niciranvp-vpcnetworkoffering.xml
new file mode 100644
index 0000000..141006e
--- /dev/null
+++ b/docs/en-US/plugin-niciranvp-vpcnetworkoffering.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="nvp-vpc-network-offering">
+ <title>VPC Network Offerings</title>
+ <para>The VPC needs specific network offerings with the VPC flag enabled. Otherwise these network offerings are identical to regular network offerings. To allow VPC networks with a Nicira NVP isolated network the offerings need to support the Virtual Networking service with the NiciraNVP provider.</para>
+ <para>In a typical configuration two network offerings need to be created. One with the loadbalancing service enabled and one without loadbalancing.</para>
+ <table>
+ <title>VPC Network Offering with Loadbalancing</title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>Service</entry>
+ <entry>Provider</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>VPN</entry>
+ <entry>VpcVirtualRouter</entry>
+ </row>
+ <row>
+ <entry>DHCP</entry>
+ <entry>VpcVirtualRouter</entry>
+ </row>
+ <row>
+ <entry>DNS</entry>
+ <entry>VpcVirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Load Balancer</entry>
+ <entry>VpcVirtualRouter</entry>
+ </row>
+ <row>
+ <entry>User Data</entry>
+ <entry>VpcVirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Source NAT</entry>
+ <entry>VpcVirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Static NAT</entry>
+ <entry>VpcVirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Post Forwarding</entry>
+ <entry>VpcVirtualRouter</entry>
+ </row>
+ <row>
+ <entry>NetworkACL</entry>
+ <entry>VpcVirtualRouter</entry>
+ </row>
+ <row>
+ <entry>Virtual Networking</entry>
+ <entry>NiciraNVP</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1201d623/docs/en-US/plugin-niciranvp-vpcoffering.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/plugin-niciranvp-vpcoffering.xml b/docs/en-US/plugin-niciranvp-vpcoffering.xml
new file mode 100644
index 0000000..292621e
--- /dev/null
+++ b/docs/en-US/plugin-niciranvp-vpcoffering.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+<!ENTITY % xinclude SYSTEM "http://www.docbook.org/xml/4.4/xinclude.mod">
+%xinclude;
+]>
+<!-- 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.
+-->
+<section id="nvp-vpc-offering">
+ <title>VPC Offering with Nicira NVP</title>
+ <para>To allow a VPC to use the Nicira NVP plugin to provision networks, a new VPC offering needs to be created which allows the Virtual Networking service to be implemented by NiciraNVP.</para>
+ <para>This is not currently possible with the UI. The API does provide the proper calls to create a VPC offering with Virtual Networking enabled. However due to a limitation in the 4.1 API it is not possible to select the provider for this network service. To configure the VPC offering with the NiciraNVP provider edit the database table 'vpc_offering_service_map' and change the provider to NiciraNvp for the service 'Connectivity'</para>
+ <para>It is also possible to update the default VPC offering by adding a row to the
+ 'vpc_offering_service_map' with service 'Connectivity' and provider 'NiciraNvp'</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="./images/nvp-vpc-offering-edit.png" />
+ </imageobject>
+ <textobject>
+ <phrase>nvp-physical-network-stt.png: a screenshot of the mysql table.</phrase>
+ </textobject>
+ </mediaobject>
+ <note><para>When creating a new VPC offering please note that the UI does not allow you to select a VPC offering yet. The VPC needs to be created using the API with the offering UUID.</para></note>
+</section>
[49/50] [abbrv] Merge branch 'master' into object_store.
Posted by mc...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/vm/VirtualMachineProfileImpl.java
index c4e8822,e777d5e..033daf3
--- a/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineProfileImpl.java
@@@ -16,14 -16,7 +16,14 @@@
// under the License.
package com.cloud.vm;
-import com.cloud.agent.api.to.VolumeTO;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+import com.cloud.agent.api.to.DiskTO;
- import com.cloud.agent.api.to.VolumeTO;
++
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.offering.ServiceOffering;
import com.cloud.service.ServiceOfferingVO;
@@@ -40,7 -38,7 +40,7 @@@ import com.cloud.user.dao.AccountDao
*
*/
public class VirtualMachineProfileImpl<T extends VMInstanceVO> implements VirtualMachineProfile<T> {
--
++
T _vm;
ServiceOfferingVO _offering;
VMTemplateVO _template;
@@@ -55,7 -53,7 +55,7 @@@
Float memoryOvercommitRatio = 1.0f;
VirtualMachine.Type _type;
--
++
public VirtualMachineProfileImpl(T vm, VMTemplateVO template, ServiceOfferingVO offering, Account owner, Map<Param, Object> params) {
_vm = vm;
_template = template;
@@@ -68,25 -66,25 +68,25 @@@
if (vm != null)
_type = vm.getType();
}
--
++
public VirtualMachineProfileImpl(T vm) {
this(vm, null, null, null, null);
}
--
++
public VirtualMachineProfileImpl(VirtualMachine.Type type) {
_type = type;
}
--
++
@Override
public String toString() {
return _vm.toString();
}
--
++
@Override
public T getVirtualMachine() {
return _vm;
}
--
++
@Override
public ServiceOffering getServiceOffering() {
if (_offering == null) {
@@@ -94,17 -92,17 +94,17 @@@
}
return _offering;
}
--
++
@Override
public void setParameter(Param name, Object value) {
_params.put(name, value);
}
--
-- @Override
++
++ @Override
public void setBootLoaderType(BootloaderType bootLoader) {
this._bootloader = bootLoader;
}
--
++
@Override
public VirtualMachineTemplate getTemplate() {
if (_template == null && _vm != null) {
@@@ -112,7 -110,7 +112,7 @@@
}
return _template;
}
--
++
@Override
public HypervisorType getHypervisorType() {
return _vm.getHypervisorType();
@@@ -132,7 -130,7 +132,7 @@@
public long getId() {
return _vm.getId();
}
--
++
@Override
public String getUuid() {
return _vm.getUuid();
@@@ -141,48 -139,48 +141,48 @@@
public void setNics(List<NicProfile> nics) {
_nics = nics;
}
--
- public void setDisks(List<VolumeTO> disks) {
++
+ public void setDisks(List<DiskTO> disks) {
_disks = disks;
}
--
++
@Override
public List<NicProfile> getNics() {
return _nics;
}
--
++
@Override
- public List<VolumeTO> getDisks() {
+ public List<DiskTO> getDisks() {
return _disks;
}
--
++
@Override
public void addNic(int index, NicProfile nic) {
_nics.add(index, nic);
}
--
++
@Override
- public void addDisk(int index, VolumeTO disk) {
+ public void addDisk(int index, DiskTO disk) {
_disks.add(index, disk);
}
--
++
@Override
public StringBuilder getBootArgsBuilder() {
return _bootArgs;
}
--
++
@Override
public void addBootArgs(String... args) {
for (String arg : args) {
_bootArgs.append(arg).append(" ");
}
}
--
++
@Override
public VirtualMachine.Type getType() {
return _type;
}
--
++
@Override
public Account getOwner() {
if (_owner == null) {
@@@ -190,12 -188,12 +190,12 @@@
}
return _owner;
}
--
++
@Override
public String getBootArgs() {
return _bootArgs.toString();
}
--
++
static ServiceOfferingDao s_offeringDao;
static VMTemplateDao s_templateDao;
static AccountDao s_accountDao;
@@@ -219,12 -217,12 +219,12 @@@
public Object getParameter(Param name) {
return _params.get(name);
}
--
++
@Override
public String getHostName() {
return _vm.getHostName();
}
--
++
@Override
public String getInstanceName() {
return _vm.getInstanceName();
@@@ -234,28 -232,29 +234,29 @@@
public BootloaderType getBootLoaderType() {
return this._bootloader;
}
--
++
@Override
public Map<Param, Object> getParameters() {
return _params;
}
- public void setServiceOffering(ServiceOfferingVO offering) {
- _offering = offering;
- }
+ public void setServiceOffering(ServiceOfferingVO offering) {
+ _offering = offering;
+ }
- public void setcpuOvercommitRatio(Float cpuOvercommitRatio){
- this.cpuOvercommitRatio= cpuOvercommitRatio;
+ public void setCpuOvercommitRatio(Float cpuOvercommitRatio) {
+ this.cpuOvercommitRatio = cpuOvercommitRatio;
}
- public void setramOvercommitRatio(Float memoryOvercommitRatio){
- this.memoryOvercommitRatio= memoryOvercommitRatio;
+ public void setMemoryOvercommitRatio(Float memoryOvercommitRatio) {
+ this.memoryOvercommitRatio = memoryOvercommitRatio;
}
+
@Override
- public Float getCpuOvercommitRatio(){
+ public Float getCpuOvercommitRatio() {
- return this.cpuOvercommitRatio;
+ return this.cpuOvercommitRatio;
}
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
----------------------------------------------------------------------
diff --cc server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
index f5cf442,f862a2a..df15ceb
--- a/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
+++ b/server/test/org/apache/cloudstack/networkoffering/ChildTestConfiguration.java
@@@ -19,6 -19,12 +19,12 @@@ package org.apache.cloudstack.networkof
import java.io.IOException;
++
+ import org.apache.cloudstack.acl.SecurityChecker;
+ import org.apache.cloudstack.region.PortableIpDaoImpl;
+ import org.apache.cloudstack.region.dao.RegionDaoImpl;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
+ import org.apache.cloudstack.test.utils.SpringUtils;
import org.mockito.Mockito;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@@ -29,11 -35,6 +35,7 @@@ import org.springframework.core.type.cl
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.TypeFilter;
- import org.apache.cloudstack.acl.SecurityChecker;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
- import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl;
- import org.apache.cloudstack.test.utils.SpringUtils;
-
import com.cloud.agent.AgentManager;
import com.cloud.alert.AlertManager;
import com.cloud.api.query.dao.UserAccountJoinDaoImpl;
@@@ -350,11 -357,7 +358,11 @@@ public class ChildTestConfiguration
return Mockito.mock(AccountDetailsDao.class);
}
-
+ @Bean
+ public DataStoreManager dataStoreManager() {
+ return Mockito.mock(DataStoreManager.class);
+ }
-
++
public static class Library implements TypeFilter {
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --cc setup/db/db/schema-410to420.sql
index 5ddf3b6,885eff4..fd2ac56
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@@ -526,7 -393,16 +526,16 @@@ CREATE TABLE `cloud`.`vm_snapshots`
ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `vm_snapshot_enabled` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Whether VM snapshot is supported by hypervisor';
UPDATE `cloud`.`hypervisor_capabilities` SET `vm_snapshot_enabled`=1 WHERE `hypervisor_type` in ('VMware', 'XenServer');
+ CREATE TABLE `cloud`.`service_offering_details` (
+ `id` bigint unsigned NOT NULL auto_increment,
+ `service_offering_id` bigint unsigned NOT NULL COMMENT 'service offering id',
+ `name` varchar(255) NOT NULL,
+ `value` varchar(255) NOT NULL,
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_service_offering_details__service_offering_id` FOREIGN KEY (`service_offering_id`) REFERENCES `service_offering`(`id`) ON DELETE CASCADE,
+ CONSTRAINT UNIQUE KEY `uk_service_offering_id_name` (`service_offering_id`, `name`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
+
DROP VIEW IF EXISTS `cloud`.`user_vm_view`;
CREATE VIEW `cloud`.`user_vm_view` AS
select
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/test/integration/smoke/test_volumes.py
----------------------------------------------------------------------
diff --cc test/integration/smoke/test_volumes.py
index f29410d,89b013a..60fbb80
--- a/test/integration/smoke/test_volumes.py
+++ b/test/integration/smoke/test_volumes.py
@@@ -347,8 -344,9 +345,9 @@@ class TestVolumes(cloudstackTestCase)
cls.custom_resized_disk_offering,
cls.service_offering,
cls.disk_offering,
+ cls.volume,
cls.account
- ]
+ ]
@classmethod
def tearDownClass(cls):
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/tools/apidoc/gen_toc.py
----------------------------------------------------------------------
diff --cc tools/apidoc/gen_toc.py
index c01bf47,793f720..5d7e3be
--- a/tools/apidoc/gen_toc.py
+++ b/tools/apidoc/gen_toc.py
@@@ -141,12 -141,9 +141,13 @@@ known_categories =
'removeIpFromNic': 'Nic',
'listNics':'Nic',
'AffinityGroup': 'Affinity Group',
+ 'addImageStore': 'Image Store',
+ 'listImageStore': 'Image Store',
+ 'deleteImageStore': 'Image Store',
+ 'createCacheStore': 'Image Store',
'InternalLoadBalancer': 'Internal LB',
'DeploymentPlanners': 'Configuration',
+ 'PortableIp': 'Portable IP'
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/ui/scripts/system.js
----------------------------------------------------------------------
diff --cc ui/scripts/system.js
index 76f797c,2e23fc4..c62229c
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@@ -2708,7 -2708,363 +2708,363 @@@
}
}
},
-
+
+ InternalLbVm: {
+ id: 'InternalLbVm',
+ label: 'InternalLbVm',
+ isMaximized: true,
+ type: 'detailView',
+ fields: {
+ name: { label: 'label.name' },
+ ipaddress: { label: 'label.ip.address' },
+ state: { label: 'label.status', indicator: { 'Enabled': 'on' } }
+ },
+ tabs: {
+ network: {
+ title: 'label.network',
+ fields: [
+ {
+ name: { label: 'label.name' }
+ },
+ {
+ id: { label: 'label.id' },
+ state: { label: 'label.state' },
+ physicalnetworkid: { label: 'label.physical.network.ID' },
+ destinationphysicalnetworkid: { label: 'label.destination.physical.network.id' },
+ supportedServices: { label: 'label.supported.services' }
+ }
+ ],
+ dataProvider: function(args) {
+ refreshNspData("InternalLbVm");
+ args.response.success({
+ actionFilter: virtualRouterProviderActionFilter,
+ data: $.extend(nspMap["InternalLbVm"], {
+ supportedServices: nspMap["InternalLbVm"].servicelist.join(', ')
+ })
+ });
+ }
+ },
+
+ instances: {
+ title: 'label.instances',
+ listView: {
+ label: 'label.virtual.appliances',
+ id: 'internallbinstances',
+ fields: {
+ name: { label: 'label.name' },
+ zonename: { label: 'label.zone' },
+ routerType: {
+ label: 'label.type'
+ },
+ state: {
+ converter: function(str) {
+ // For localization
+ return str;
+ },
+ label: 'label.status',
+ indicator: {
+ 'Running': 'on',
+ 'Stopped': 'off',
+ 'Error': 'off'
+ }
+ }
+ },
+ dataProvider: function(args) {
+ var array1 = [];
+ if(args.filterBy != null) {
+ if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
+ switch(args.filterBy.search.by) {
+ case "name":
+ if(args.filterBy.search.value.length > 0)
+ array1.push("&keyword=" + args.filterBy.search.value);
+ break;
+ }
+ }
+ }
+
+ var routers = [];
+ $.ajax({
+ url: createURL("listInternalLoadBalancerVMs&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
+ success: function(json) {
+ var items = json.listinternallbvmssresponse.internalloadbalancervm ?
+ json.listinternallbvmssresponse.internalloadbalancervm : [];
+
+ $(items).map(function(index, item) {
+ routers.push(item);
+ });
+
+ // Get project routers
+ $.ajax({
+ url: createURL("listInternalLoadBalancerVMs&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"),
+ success: function(json) {
+ var items = json.listinternallbvmssresponse.internalloadbalancervm ?
+ json.listinternallbvmssresponse.internalloadbalancervm : [];
+
+ $(items).map(function(index, item) {
+ routers.push(item);
+ });
+ args.response.success({
+ actionFilter: internallbinstanceActionfilter,
+ data: $(routers).map(mapRouterType)
+ });
+ }
+ });
+ }
+ });
+ },
+ detailView: {
+ name: 'Virtual applicance details',
+ actions: {
+ start: {
+ label: 'Start LB VM',
+ messages: {
+ confirm: function(args) {
+ return 'Please confirm you want to start LB VM';
+ },
+ notification: function(args) {
+ return 'Start LB VM';
+ }
+ },
+ action: function(args) {
+ $.ajax({
+ url: createURL('startInternalLoadBalancerVM&id=' + args.context.internallbinstances[0].id),
+ dataType: 'json',
+ async: true,
+ success: function(json) {
+ var jid = json.startinternallbvmresponse.jobid;
+ args.response.success({
+ _custom: {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ return json.queryasyncjobresultresponse.jobresult.internalloadbalancervm;
+ },
+ getActionFilter: function() {
+ return internallbinstanceActionfilter;
+ }
+ }
+ });
+ }
+ });
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ },
+
+ stop: {
+ label: 'Stop LB VM',
+ createForm: {
+ title: 'Please confirm you want to stop LB VM',
+ desc: 'Stop LB VM',
+ fields: {
+ forced: {
+ label: 'force.stop',
+ isBoolean: true,
+ isChecked: false
+ }
+ }
+ },
+ messages: {
+ notification: function(args) {
+ return 'Stop LB VM';
+ }
+ },
+ action: function(args) {
+ var array1 = [];
+ array1.push("&forced=" + (args.data.forced == "on"));
+ $.ajax({
+ url: createURL('stopInternalLoadBalancerVM&id=' + args.context.internallbinstances[0].id + array1.join("")),
+ dataType: 'json',
+ async: true,
+ success: function(json) {
+ var jid = json.stopinternallbvmresponse.jobid;
+ args.response.success({
+ _custom: {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ return json.queryasyncjobresultresponse.jobresult.internalloadbalancervm;
+ },
+ getActionFilter: function() {
+ return internallbinstanceActionfilter;
+ }
+ }
+ });
+ }
+ });
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ }
+ },
+ tabs: {
+ details: {
+ title: 'label.details',
+ preFilter: function(args) {
+ var hiddenFields = [];
+ if (!args.context.internallbinstances[0].project) {
+ hiddenFields.push('project');
+ hiddenFields.push('projectid');
+ }
+ if(selectedZoneObj.networktype == 'Basic') {
+ hiddenFields.push('publicip'); //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API.
+ }
+ return hiddenFields;
+ },
+ fields: [
+ {
+ name: { label: 'label.name' },
+ project: { label: 'label.project' }
+ },
+ {
+ id: { label: 'label.id' },
+ projectid: { label: 'label.project.id' },
+ state: { label: 'label.state' },
+ guestnetworkid: { label: 'label.network.id' },
+ publicip: { label: 'label.public.ip' },
+ guestipaddress: { label: 'label.guest.ip' },
+ linklocalip: { label: 'label.linklocal.ip' },
+ hostname: { label: 'label.host' },
+ serviceofferingname: { label: 'label.compute.offering' },
+ networkdomain: { label: 'label.network.domain' },
+ domain: { label: 'label.domain' },
+ account: { label: 'label.account' },
+ created: { label: 'label.created', converter: cloudStack.converters.toLocalDate },
+ isredundantrouter: {
+ label: 'label.redundant.router',
+ converter: cloudStack.converters.toBooleanText
+ },
+ redundantRouterState: { label: 'label.redundant.state' }
+ }
+ ],
+ dataProvider: function(args) {
+ $.ajax({
+ url: createURL("listInternalLoadBalancerVMs&id=" + args.context.internallbinstances[0].id),
+ dataType: 'json',
+ async: true,
+ success: function(json) {
+ var jsonObj = json.listinternallbvmssresponse.internalloadbalancervm[0];
+ addExtraPropertiesToRouterInstanceObject(jsonObj);
+ args.response.success({
+ actionFilter: internallbinstanceActionfilter,
+ data: jsonObj
+ });
+ }
+ });
+ }
+ },
+ nics: {
+ title: 'label.nics',
+ multiple: true,
+ fields: [
+ {
+ name: { label: 'label.name', header: true },
+ type: { label: 'label.type' },
+ traffictype: { label: 'label.traffic.type' },
+ networkname: { label: 'label.network.name' },
+ netmask: { label: 'label.netmask' },
+ ipaddress: { label: 'label.ip.address' },
+ id: { label: 'label.id' },
+ networkid: { label: 'label.network.id' },
+ isolationuri: { label: 'label.isolation.uri' },
+ broadcasturi: { label: 'label.broadcast.uri' }
+ }
+ ],
+ dataProvider: function(args) {
+ $.ajax({
+ url: createURL("listInternalLoadBalancerVMs&id=" + args.context.internallbinstances[0].id),
+ dataType: 'json',
+ async: true,
+ success: function(json) {
+ var jsonObj = json.listinternallbvmssresponse.internalloadbalancervm[0].nic;
+
+ args.response.success({
+ actionFilter: internallbinstanceActionfilter,
+ data: $.map(jsonObj, function(nic, index) {
+ var name = 'NIC ' + (index + 1);
+ if (nic.isdefault) {
+ name += ' (' + _l('label.default') + ')';
+ }
+ return $.extend(nic, {
+ name: name
+ });
+ })
+ });
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ actions: {
+ enable: {
+ label: 'label.enable.provider',
+ action: function(args) {
+ $.ajax({
+ url: createURL("updateNetworkServiceProvider&id=" + nspMap["InternalLbVm"].id + "&state=Enabled"),
+ dataType: "json",
+ success: function(json) {
+ var jid = json.updatenetworkserviceproviderresponse.jobid;
+ args.response.success(
+ {_custom:
+ {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ $(window).trigger('cloudStack.fullRefresh');
+ }
+ }
+ }
+ );
+ }
+ });
+ },
+ messages: {
+ confirm: function(args) {
+ return 'message.confirm.enable.provider';
+ },
+ notification: function() {
+ return 'label.enable.provider';
+ }
+ },
+ notification: { poll: pollAsyncJobResult }
+ },
+ disable: {
+ label: 'label.disable.provider',
+ action: function(args) {
+ $.ajax({
+ url: createURL("updateNetworkServiceProvider&id=" + nspMap["InternalLbVm"].id + "&state=Disabled"),
+ dataType: "json",
+ success: function(json) {
+ var jid = json.updatenetworkserviceproviderresponse.jobid;
+ args.response.success(
+ {_custom:
+ {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ $(window).trigger('cloudStack.fullRefresh');
+ }
+ }
+ }
+ );
+ }
+ });
+ },
+ messages: {
+ confirm: function(args) {
+ return 'message.confirm.disable.provider';
+ },
+ notification: function() {
+ return 'label.disable.provider';
+ }
+ },
+ notification: { poll: pollAsyncJobResult }
+ }
+ }
+ },
+
vpcVirtualRouter: {
id: 'vpcVirtualRouterProviders',
label: 'VPC Virtual Router',
@@@ -12355,7 -12376,20 +12711,20 @@@
}
return allowedActions;
}
-
+
+ var internallbinstanceActionfilter = function(args) {
+ var jsonObj = args.context.item;
+ var allowedActions = [];
+
+ if (jsonObj.state == 'Running') {
+ allowedActions.push("stop");
+ }
+ else if (jsonObj.state == 'Stopped') {
+ allowedActions.push("start");
+ }
+ return allowedActions;
+ }
+
var systemvmActionfilter = function(args) {
var jsonObj = args.context.item;
var allowedActions = [];
@@@ -12513,7 -12550,16 +12885,16 @@@
state: nspMap.midoNet? nspMap.midoNet.state : 'Disabled'
}
);
+
+ nspHardcodingArray.push(
+ {
+ id: 'InternalLbVm',
+ name: 'InternalLbVm',
+ state: nspMap.InternalLbVm ? nspMap.InternalLbVm.state : 'Disabled'
+ }
+ );
+
- nspHardcodingArray.push(
+ nspHardcodingArray.push(
{
id: 'vpcVirtualRouter',
name: 'VPC Virtual Router',
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
[04/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2308 fixed adding route in vware for mgmt subnet
Signed-off-by: Abhinandan Prateek <ap...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e31553af
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e31553af
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e31553af
Branch: refs/heads/object_store
Commit: e31553aff827abd88e3dfa9b65bfb335e09fbd22
Parents: dce4258
Author: Jayapal <ja...@citrix.com>
Authored: Thu May 16 19:01:17 2013 +0530
Committer: Abhinandan Prateek <ap...@apache.org>
Committed: Wed May 22 12:21:30 2013 +0530
----------------------------------------------------------------------
.../debian/config/etc/init.d/cloud-early-config | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e31553af/patches/systemvm/debian/config/etc/init.d/cloud-early-config
----------------------------------------------------------------------
diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
index 893a245..d918670 100755
--- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config
+++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config
@@ -757,7 +757,10 @@ EOF
fi
if [ -n "$MGMTNET" -a -n "$LOCAL_GW" ]
then
- ip route add $MGMTNET via $LOCAL_GW dev eth1
+ if [ "$hyp" == "vmware" ]
+ then
+ ip route add $MGMTNET via $LOCAL_GW dev eth0
+ fi
fi
ip route delete default
[41/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
firewall service is not supported in shared SG enabled network offering , remove it
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e8fbee0e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e8fbee0e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e8fbee0e
Branch: refs/heads/object_store
Commit: e8fbee0e18383a4ae07b62c4dafdadf742ec62bb
Parents: 2336d47
Author: Anthony Xu <an...@citrix.com>
Authored: Thu May 23 14:18:09 2013 -0700
Committer: Anthony Xu <an...@citrix.com>
Committed: Thu May 23 14:19:43 2013 -0700
----------------------------------------------------------------------
.../src/com/cloud/upgrade/dao/Upgrade410to420.java | 32 +++++++++++++++
setup/db/db/schema-410to420.sql | 2 +-
2 files changed, 33 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8fbee0e/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index c03d377..95abe5f 100644
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@ -75,6 +75,7 @@ public class Upgrade410to420 implements DbUpgrade {
updateNetworkACLs(conn);
addHostDetailsIndex(conn);
updateNetworksForPrivateGateways(conn);
+ removeFirewallServiceFromSharedNetworkOfferingWithSGService(conn);
}
private void updateSystemVmTemplates(Connection conn) {
@@ -747,4 +748,35 @@ public class Upgrade410to420 implements DbUpgrade {
throw new CloudRuntimeException("Failed to update private networks with VPC id.", e);
}
}
+
+ private void removeFirewallServiceFromSharedNetworkOfferingWithSGService(Connection conn) {
+ PreparedStatement pstmt = null;
+ ResultSet rs = null;
+
+ try {
+ pstmt = conn.prepareStatement("select id from `cloud`.`network_offerings` where unique_name='DefaultSharedNetworkOfferingWithSGService'");
+ rs = pstmt.executeQuery();
+ while (rs.next()) {
+ long id = rs.getLong(1);
+ // remove Firewall service for SG shared network offering
+ pstmt = conn.prepareStatement("DELETE `cloud`.`ntwk_offering_service_map` where network_offering_id=? and service='Firewall'");
+ pstmt.setLong(1, id);
+ pstmt.executeUpdate();
+ }
+ } catch (SQLException e) {
+ throw new CloudRuntimeException("Unable to remove Firewall service for SG shared network offering.", e);
+ } finally {
+ try {
+ if (rs != null) {
+ rs.close();
+ }
+
+ if (pstmt != null) {
+ pstmt.close();
+ }
+ } catch (SQLException e) {
+ }
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e8fbee0e/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index ea7a18d..b548035 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -1710,5 +1710,5 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'VpcMa
-- Re-enable foreign key checking, at the end of the upgrade path
SET foreign_key_checks = 1;
-
+UPDATE `cloud`.`snapshot_policy` set uuid=id WHERE uuid is NULL;
[14/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Bad indentation corrected
For some reason test got unindented wrongly by Eclipse.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b3096db6
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b3096db6
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b3096db6
Branch: refs/heads/object_store
Commit: b3096db600d433cf3ddbae83f8ad82ca4609cc6f
Parents: 44a81f0
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Wed May 22 16:22:26 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 22 16:22:26 2013 +0530
----------------------------------------------------------------------
...st_deploy_vms_with_varied_deploymentplanners.py | 360 +++++++-------
1 files changed, 180 insertions(+), 180 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b3096db6/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index c557682..67532c7 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -56,195 +56,195 @@ class TestDeployVmWithVariedPlanners(cloudstackTestCase):
@classmethod
def setUpClass(cls):
- cls.apiclient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
- # Get Zone, Domain and templates
- cls.domain = get_domain(cls.apiclient, cls.services)
- cls.zone = get_zone(cls.apiclient, cls.services)
- cls.template = get_template(
- cls.apiclient,
- cls.zone.id,
- cls.services["ostype"]
- )
- cls.services["virtual_machine"]["zoneid"] = cls.zone.id
- cls.services["template"] = cls.template.id
- cls.services["zoneid"] = cls.zone.id
-
- cls.account = Account.create(
- cls.apiclient,
- cls.services["account"],
- domainid=cls.domain.id
- )
- cls.services["account"] = cls.account.name
- cls.cleanup = [
- cls.account
- ]
+ cls.apiclient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ # Get Zone, Domain and templates
+ cls.domain = get_domain(cls.apiclient, cls.services)
+ cls.zone = get_zone(cls.apiclient, cls.services)
+ cls.template = get_template(
+ cls.apiclient,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
+ cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+ cls.services["template"] = cls.template.id
+ cls.services["zoneid"] = cls.zone.id
+
+ cls.account = Account.create(
+ cls.apiclient,
+ cls.services["account"],
+ domainid=cls.domain.id
+ )
+ cls.services["account"] = cls.account.name
+ cls.cleanup = [
+ cls.account
+ ]
@attr(tags=["simulator", "advanced", "basic", "sg"])
def test_deployvm_firstfit(self):
- """Test to deploy vm with a first fit offering
- """
- #FIXME: How do we know that first fit actually happened?
- self.service_offering_firstfit = ServiceOffering.create(
- self.apiclient,
- self.services["service_offering"],
- deploymentplanner='FirstFitPlanner'
- )
-
- self.virtual_machine = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering_firstfit.id,
- templateid=self.template.id
- )
-
- list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
- self.debug(
- "Verify listVirtualMachines response for virtual machine: %s"\
- % self.virtual_machine.id
- )
- self.assertEqual(
- isinstance(list_vms, list),
- True,
- "List VM response was not a valid list"
- )
- self.assertNotEqual(
- len(list_vms),
- 0,
- "List VM response was empty"
- )
-
- vm = list_vms[0]
- self.assertEqual(
- vm.state,
- "Running",
- msg="VM is not in Running state"
- )
+ """Test to deploy vm with a first fit offering
+ """
+ #FIXME: How do we know that first fit actually happened?
+ self.service_offering_firstfit = ServiceOffering.create(
+ self.apiclient,
+ self.services["service_offering"],
+ deploymentplanner='FirstFitPlanner'
+ )
+
+ self.virtual_machine = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_firstfit.id,
+ templateid=self.template.id
+ )
+
+ list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
+ self.debug(
+ "Verify listVirtualMachines response for virtual machine: %s"\
+ % self.virtual_machine.id
+ )
+ self.assertEqual(
+ isinstance(list_vms, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ self.assertNotEqual(
+ len(list_vms),
+ 0,
+ "List VM response was empty"
+ )
+
+ vm = list_vms[0]
+ self.assertEqual(
+ vm.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
@attr(tags=["simulator", "advanced", "basic", "sg"])
def test_deployvm_userdispersing(self):
- """Test deploy VMs using user dispersion planner
- """
- self.service_offering_userdispersing = ServiceOffering.create(
- self.apiclient,
- self.services["service_offering"],
- deploymentplanner='UserDispersingPlanner'
- )
-
- self.virtual_machine_1 = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering_userdispersing.id,
- templateid=self.template.id
- )
- self.virtual_machine_2 = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering_userdispersing.id,
- templateid=self.template.id
- )
-
- list_vm_1 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_1.id)
- list_vm_2 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_2.id)
- self.assertEqual(
- isinstance(list_vm_1, list),
- True,
- "List VM response was not a valid list"
- )
- self.assertEqual(
- isinstance(list_vm_2, list),
- True,
- "List VM response was not a valid list"
- )
- vm1 = list_vm_1[0]
- vm2 = list_vm_2[0]
- self.assertEqual(
- vm1.state,
- "Running",
- msg="VM is not in Running state"
- )
- self.assertEqual(
- vm2.state,
- "Running",
- msg="VM is not in Running state"
- )
- self.assertNotEqual(
- vm1.hostid,
- vm2.hostid,
- msg="VMs meant to be dispersed are deployed on the same host"
- )
+ """Test deploy VMs using user dispersion planner
+ """
+ self.service_offering_userdispersing = ServiceOffering.create(
+ self.apiclient,
+ self.services["service_offering"],
+ deploymentplanner='UserDispersingPlanner'
+ )
+
+ self.virtual_machine_1 = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_userdispersing.id,
+ templateid=self.template.id
+ )
+ self.virtual_machine_2 = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_userdispersing.id,
+ templateid=self.template.id
+ )
+
+ list_vm_1 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_1.id)
+ list_vm_2 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_2.id)
+ self.assertEqual(
+ isinstance(list_vm_1, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ self.assertEqual(
+ isinstance(list_vm_2, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ vm1 = list_vm_1[0]
+ vm2 = list_vm_2[0]
+ self.assertEqual(
+ vm1.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
+ self.assertEqual(
+ vm2.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
+ self.assertNotEqual(
+ vm1.hostid,
+ vm2.hostid,
+ msg="VMs meant to be dispersed are deployed on the same host"
+ )
@attr(tags=["simulator", "advanced", "basic", "sg"])
def test_deployvm_userconcentrated(self):
- """Test deploy VMs using user concentrated planner
- """
- self.service_offering_userconcentrated = ServiceOffering.create(
- self.apiclient,
- self.services["service_offering"],
- deploymentplanner='UserConcentratedPodPlanner'
- )
-
- self.virtual_machine_1 = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering_userconcentrated.id,
- templateid=self.template.id
- )
- self.virtual_machine_2 = VirtualMachine.create(
- self.apiclient,
- self.services["virtual_machine"],
- accountid=self.account.name,
- zoneid=self.zone.id,
- domainid=self.account.domainid,
- serviceofferingid=self.service_offering_userconcentrated.id,
- templateid=self.template.id
- )
-
- list_vm_1 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_1.id)
- list_vm_2 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_2.id)
- self.assertEqual(
- isinstance(list_vm_1, list),
- True,
- "List VM response was not a valid list"
- )
- self.assertEqual(
- isinstance(list_vm_2, list),
- True,
- "List VM response was not a valid list"
- )
- vm1 = list_vm_1[0]
- vm2 = list_vm_2[0]
- self.assertEqual(
- vm1.state,
- "Running",
- msg="VM is not in Running state"
- )
- self.assertEqual(
- vm2.state,
- "Running",
- msg="VM is not in Running state"
- )
- self.assertNotEqual(
- vm1.hostid,
- vm2.hostid,
- msg="VMs meant to be concentrated are deployed on the different hosts"
- )
+ """Test deploy VMs using user concentrated planner
+ """
+ self.service_offering_userconcentrated = ServiceOffering.create(
+ self.apiclient,
+ self.services["service_offering"],
+ deploymentplanner='UserConcentratedPodPlanner'
+ )
+
+ self.virtual_machine_1 = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_userconcentrated.id,
+ templateid=self.template.id
+ )
+ self.virtual_machine_2 = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_userconcentrated.id,
+ templateid=self.template.id
+ )
+
+ list_vm_1 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_1.id)
+ list_vm_2 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_2.id)
+ self.assertEqual(
+ isinstance(list_vm_1, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ self.assertEqual(
+ isinstance(list_vm_2, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ vm1 = list_vm_1[0]
+ vm2 = list_vm_2[0]
+ self.assertEqual(
+ vm1.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
+ self.assertEqual(
+ vm2.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
+ self.assertNotEqual(
+ vm1.hostid,
+ vm2.hostid,
+ msg="VMs meant to be concentrated are deployed on the different hosts"
+ )
@classmethod
def tearDownClass(cls):
- try:
- cleanup_resources(cls.apiclient, cls.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
+ try:
+ cleanup_resources(cls.apiclient, cls.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
[34/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
port forwarding issues with the listNics API response parameter
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4fdd0261
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4fdd0261
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4fdd0261
Branch: refs/heads/object_store
Commit: 4fdd0261fe82b3a3fa7c8360ebb49429f0c36d7c
Parents: fce59b8
Author: Pranav Saxena <pr...@citrix.com>
Authored: Thu May 23 14:56:32 2013 +0530
Committer: Pranav Saxena <pr...@citrix.com>
Committed: Thu May 23 14:56:32 2013 +0530
----------------------------------------------------------------------
ui/scripts/network.js | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4fdd0261/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 6b310ce..3eef136 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -50,7 +50,7 @@
nicId: nic.id
},
success: function(json) {
- var nic = json.listnics.nic[0];
+ var nic = json.listnicsresponse.nic[0];
var ips = nic.secondaryip ? nic.secondaryip : [];
var ipSelection = [];
[05/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-681:Implicit Dedication UI support
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/49e39e51
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/49e39e51
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/49e39e51
Branch: refs/heads/object_store
Commit: 49e39e51f2bd39c1e5cd60389f4433d58f9415bc
Parents: e31553a
Author: Pranav Saxena <pr...@citrix.com>
Authored: Wed May 22 12:31:48 2013 +0530
Committer: Pranav Saxena <pr...@citrix.com>
Committed: Wed May 22 12:31:48 2013 +0530
----------------------------------------------------------------------
ui/scripts/configuration.js | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/49e39e51/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 92c3d00..8856d4b 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -144,6 +144,27 @@
},
+ deploymentPlanner:{
+ label:'Deployment Planner',
+ select:function(args){
+ $.ajax({
+ url:createURL('listDeploymentPlanners'),
+ dataType:'json',
+ success:function(json){
+ var items=[];
+ var plannerObjs = json.listdeploymentplannersresponse.deploymentPlanner;
+ $(plannerObjs).each(function(){
+ items.push({id: this.name, description: this.name});
+ });
+ args.response.success({data: items});
+
+
+ }
+ });
+ }
+ },
+
+
domainId: {
label: 'label.domain',
docID: 'helpComputeOfferingDomain',
@@ -176,7 +197,9 @@
storageType: args.data.storageType,
cpuNumber: args.data.cpuNumber,
cpuSpeed: args.data.cpuSpeed,
- memory: args.data.memory
+ memory: args.data.memory,
+ deploymentplanner: args.data.deploymentPlanner
+
};
if(args.data.networkRate != null && args.data.networkRate.length > 0) {
@@ -362,6 +385,7 @@
converter: cloudStack.converters.toBooleanText
},
isvolatile:{ label:'Volatile' , converter: cloudStack.converters.toBooleanText },
+ deploymentplanner:{label:'Deployment Planner'},
tags: { label: 'label.storage.tags' },
hosttags: { label: 'label.host.tags' },
domain: { label: 'label.domain' },
[10/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2567 - check for ! dmcEnabled.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a67728b3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a67728b3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a67728b3
Branch: refs/heads/object_store
Commit: a67728b312fbf3a4e6e7f7fb3914a45d22997dbf
Parents: 4e09079
Author: Nitin Mehta <ni...@citrix.com>
Authored: Wed May 22 15:30:53 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Wed May 22 15:31:18 2013 +0530
----------------------------------------------------------------------
.../xen/resource/CitrixResourceBase.java | 4 ++--
.../xen/resource/XenServer56FP1Resource.java | 5 ++++-
2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a67728b3/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index d08aaec..4680fde 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -661,8 +661,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Set<VM> vms = VM.getByNameLabel(conn, vmName);
Host host = Host.getByUuid(conn, _host.uuid);
- // If DMC is not enable then dont execute this command.
- if (isDmcEnabled(conn, host)) {
+ // If DMC is not enable then don't execute this command.
+ if (!isDmcEnabled(conn, host)) {
String msg = "Unable to scale the vm: " + vmName + " as DMC - Dynamic memory control is not enabled for the XenServer:" + _host.uuid + " ,check your license and hypervisor version.";
s_logger.info(msg);
return new ScaleVmAnswer(cmd, false, msg);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a67728b3/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
index 78ad236..54aeef5 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
@@ -244,6 +244,9 @@ public class XenServer56FP1Resource extends XenServer56Resource {
protected boolean isDmcEnabled(Connection conn, Host host) throws XenAPIException, XmlRpcException {
Map<String, String> hostParams = new HashMap<String, String>();
hostParams = host.getLicenseParams(conn);
- return hostParams.get("restrict_dmc").equalsIgnoreCase("false");
+
+ Boolean isDmcEnabled = hostParams.get("restrict_dmc").equalsIgnoreCase("false");
+
+ return isDmcEnabled;
}
}
[31/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
[Automation] fix CLOUDSTACK-2546 Failed to add second NIC to vm in KVM environment
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/47864209
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/47864209
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/47864209
Branch: refs/heads/object_store
Commit: 4786420986b60955ca8f084f24b69f9d07153ab5
Parents: a69101d
Author: Mice Xia <mi...@tcloudcomputing.com>
Authored: Thu May 23 09:54:46 2013 +0800
Committer: Mice Xia <mi...@tcloudcomputing.com>
Committed: Thu May 23 09:55:30 2013 +0800
----------------------------------------------------------------------
test/integration/smoke/test_nic.py | 51 ++++++++++++++++++++++++++++---
1 files changed, 46 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/47864209/test/integration/smoke/test_nic.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_nic.py b/test/integration/smoke/test_nic.py
index bae6dfd..8e8d340 100644
--- a/test/integration/smoke/test_nic.py
+++ b/test/integration/smoke/test_nic.py
@@ -79,11 +79,35 @@ class Services:
"PortForwarding": 'VirtualRouter',
},
},
+ "network_offering_shared": {
+ "name": 'Test Network offering shared',
+ "displaytext": 'Test Network offering Shared',
+ "guestiptype": 'Shared',
+ "supportedservices": 'Dhcp,Dns,UserData',
+ "traffictype": 'GUEST',
+ "specifyVlan" : "True",
+ "specifyIpRanges" : "True",
+ "serviceProviderList" : {
+ "Dhcp": 'VirtualRouter',
+ "Dns": 'VirtualRouter',
+ "UserData": 'VirtualRouter',
+ },
+ },
"network": {
"name": "Test Network",
"displaytext": "Test Network",
"acltype": "Account",
},
+ "network2": {
+ "name": "Test Network Shared",
+ "displaytext": "Test Network Shared",
+ "vlan" :1201,
+ "gateway" :"172.16.15.1",
+ "netmask" :"255.255.255.0",
+ "startip" :"172.16.15.21",
+ "endip" :"172.16.15.41",
+ "acltype": "Account",
+ },
# ISO settings for Attach/Detach ISO tests
"iso": {
"displaytext": "Test ISO",
@@ -176,6 +200,14 @@ class TestDeployVM(cloudstackTestCase):
self.network_offering.update(self.apiclient, state='Enabled') # Enable Network offering
self.services["network"]["networkoffering"] = self.network_offering.id
+ self.network_offering_shared = NetworkOffering.create(
+ self.apiclient,
+ self.services["network_offering_shared"],
+ )
+ self.cleanup.insert(0, self.network_offering_shared)
+ self.network_offering_shared.update(self.apiclient, state='Enabled') # Enable Network offering
+ self.services["network2"]["networkoffering"] = self.network_offering_shared.id
+
################
### Test Network
self.test_network = Network.create(
@@ -185,6 +217,14 @@ class TestDeployVM(cloudstackTestCase):
self.account.domainid,
)
self.cleanup.insert(0, self.test_network)
+ self.test_network2 = Network.create(
+ self.apiclient,
+ self.services["network2"],
+ self.account.name,
+ self.account.domainid,
+ zoneid=self.services["network"]["zoneid"]
+ )
+ self.cleanup.insert(0, self.test_network2)
except Exception as ex:
self.debug("Exception during NIC test SETUP!: " + str(ex))
self.assertEqual(True, False, "Exception during NIC test SETUP!: " + str(ex))
@@ -201,10 +241,10 @@ class TestDeployVM(cloudstackTestCase):
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
- mode=self.services['mode']
+ mode=self.services['mode'],
+ networkids=[self.test_network.id]
)
self.cleanup.insert(0, self.virtual_machine)
-
list_vm_response = list_virtual_machines(
self.apiclient,
id=self.virtual_machine.id
@@ -256,7 +296,7 @@ class TestDeployVM(cloudstackTestCase):
existing_nic_id = vm_response.nic[0].id
# 1. add a nic
- add_response = self.virtual_machine.add_nic(self.apiclient, self.test_network.id)
+ add_response = self.virtual_machine.add_nic(self.apiclient, self.test_network2.id)
time.sleep(5)
# now go get the vm list?
@@ -308,8 +348,9 @@ class TestDeployVM(cloudstackTestCase):
sawException = True
self.assertEqual(sawException, True, "Make sure we cannot delete the default NIC")
-
- self.virtual_machine.remove_nic(self.apiclient, existing_nic_id)
+ self.virtual_machine.update_default_nic(self.apiclient, existing_nic_id)
+ time.sleep(5)
+ self.virtual_machine.remove_nic(self.apiclient, new_nic_id)
time.sleep(5)
list_vm_response = list_virtual_machines(
[40/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
debian: When building packages run a Maven clean first
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2336d478
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2336d478
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2336d478
Branch: refs/heads/object_store
Commit: 2336d478beca8c3d17fbf76bbf09f915906bdea8
Parents: 1201d62
Author: Wido den Hollander <wi...@42on.com>
Authored: Thu May 23 23:19:03 2013 +0200
Committer: Wido den Hollander <wi...@42on.com>
Committed: Thu May 23 23:19:03 2013 +0200
----------------------------------------------------------------------
debian/rules | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2336d478/debian/rules
----------------------------------------------------------------------
diff --git a/debian/rules b/debian/rules
index e381b1a..48485bb 100755
--- a/debian/rules
+++ b/debian/rules
@@ -34,7 +34,7 @@ build: build-indep
build-indep: build-indep-stamp
build-indep-stamp: configure
- mvn package -Pawsapi -DskipTests -Dsystemvm \
+ mvn clean package -Pawsapi -DskipTests -Dsystemvm \
-Dcs.replace.properties=replace.properties.tmp \
${ACS_BUILD_OPTS}
touch $@
[03/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2568: ACS41 regression in storage subsystem (seen with local storage and 2 or more hosts)
Changes:
- In VolumeReservationVO, the getter method of a column had a typo, causing us to create a wrong searchbuilder. It was searching over the 'id' column instead of 'vm_reservation_id' causing
- This bug was causing the vm deployment to choose a wrong pool during deployment since the search was choosing incorrectly
- This bug in the GenericSearchBuilder is also fixed - if the getter method does not use the standard 'get' or 'is' prefix, one should annotate that method using
@Column(name = "<column_name>") and indicate which column this method refers to. This will cause the GenericSearchBuilder to identify the field correctly.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dce42581
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dce42581
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dce42581
Branch: refs/heads/object_store
Commit: dce42581710ce3613f4bf765d713fab9552747ca
Parents: 0a44369
Author: Prachi Damle <pr...@cloud.com>
Authored: Tue May 21 16:05:07 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Tue May 21 16:06:29 2013 -0700
----------------------------------------------------------------------
.../cloud/entity/api/db/VolumeReservationVO.java | 22 ++-------------
.../api/db/dao/VolumeReservationDaoImpl.java | 2 +-
.../com/cloud/utils/db/GenericSearchBuilder.java | 18 +++++++-----
3 files changed, 15 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dce42581/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java
index f064623..e858f74 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java
@@ -16,22 +16,14 @@
// under the License.
package org.apache.cloudstack.engine.cloud.entity.api.db;
-import java.util.Date;
-import java.util.Map;
-
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
-import javax.persistence.Transient;
-
-import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-import com.cloud.utils.db.GenericDao;
-
@Entity
@Table(name = "volume_reservation")
public class VolumeReservationVO implements InternalIdentity{
@@ -42,7 +34,7 @@ public class VolumeReservationVO implements InternalIdentity{
private long id;
@Column(name = "vm_reservation_id")
- private Long vmReservationId;
+ private long vmReservationId;
@Column(name = "vm_id")
private long vmId;
@@ -53,10 +45,6 @@ public class VolumeReservationVO implements InternalIdentity{
@Column(name="pool_id")
private long poolId;
- // VolumeId -> poolId
- @Transient
- Map<String, String> volumeReservationMap;
-
/**
* There should never be a public constructor for this class. Since it's
* only here to define the table for the DAO class.
@@ -64,7 +52,7 @@ public class VolumeReservationVO implements InternalIdentity{
protected VolumeReservationVO() {
}
- public VolumeReservationVO(long vmId, long volumeId, long poolId, Long vmReservationId) {
+ public VolumeReservationVO(long vmId, long volumeId, long poolId, long vmReservationId) {
this.vmId = vmId;
this.volumeId = volumeId;
this.poolId = poolId;
@@ -80,7 +68,7 @@ public class VolumeReservationVO implements InternalIdentity{
return vmId;
}
- public Long geVmReservationId() {
+ public long getVmReservationId() {
return vmReservationId;
}
@@ -93,8 +81,4 @@ public class VolumeReservationVO implements InternalIdentity{
}
- public Map<String,String> getVolumeReservation(){
- return volumeReservationMap;
- }
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dce42581/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java
index 26bc65f..4f3761b 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java
@@ -49,7 +49,7 @@ public class VolumeReservationDaoImpl extends GenericDaoBase<VolumeReservationVO
VmIdSearch.done();
VmReservationIdSearch = createSearchBuilder();
- VmReservationIdSearch.and("vmReservationId", VmReservationIdSearch.entity().geVmReservationId(), SearchCriteria.Op.EQ);
+ VmReservationIdSearch.and("vmReservationId", VmReservationIdSearch.entity().getVmReservationId(), SearchCriteria.Op.EQ);
VmReservationIdSearch.done();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dce42581/utils/src/com/cloud/utils/db/GenericSearchBuilder.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/db/GenericSearchBuilder.java b/utils/src/com/cloud/utils/db/GenericSearchBuilder.java
index 8bbe07c..337d444 100755
--- a/utils/src/com/cloud/utils/db/GenericSearchBuilder.java
+++ b/utils/src/com/cloud/utils/db/GenericSearchBuilder.java
@@ -23,6 +23,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.persistence.Column;
import javax.persistence.Transient;
import net.sf.cglib.proxy.Factory;
@@ -163,13 +164,16 @@ public class GenericSearchBuilder<T, K> implements MethodInterceptor {
set(fieldName);
return null;
} else {
- name = name.toLowerCase();
- for (String fieldName : _attrs.keySet()) {
- if (name.endsWith(fieldName.toLowerCase())) {
- set(fieldName);
- return null;
- }
- }
+ Column ann = method.getAnnotation(Column.class);
+ if (ann != null) {
+ String colName = ann.name();
+ for (Map.Entry<String, Attribute> attr : _attrs.entrySet()) {
+ if (colName.equals(attr.getValue().columnName)) {
+ set(attr.getKey());
+ return null;
+ }
+ }
+ }
assert false : "Perhaps you need to make the method start with get or is?";
}
}
[06/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2398: ssvm-check.sh failed with permission error
RPCbind service is running in the 4.2 systemVMs resulting in ssvm-check
trying to write to the mountpoint. Avoid writing to the rpc_pipefs.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/11f85c9c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/11f85c9c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/11f85c9c
Branch: refs/heads/object_store
Commit: 11f85c9c9e5ab06e53ebdf8f42fca8054850b1c9
Parents: 49e39e5
Author: Rajesh Battala <ra...@citrix.com>
Authored: Wed May 15 17:21:46 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 22 13:58:36 2013 +0530
----------------------------------------------------------------------
services/secondary-storage/scripts/ssvm-check.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/11f85c9c/services/secondary-storage/scripts/ssvm-check.sh
----------------------------------------------------------------------
diff --git a/services/secondary-storage/scripts/ssvm-check.sh b/services/secondary-storage/scripts/ssvm-check.sh
index a401164..7b83c98 100644
--- a/services/secondary-storage/scripts/ssvm-check.sh
+++ b/services/secondary-storage/scripts/ssvm-check.sh
@@ -67,12 +67,12 @@ fi
# check to see if we have the NFS volume mounted
echo ================================================
-mount|grep -v sunrpc|grep nfs 1> /dev/null 2>&1
+mount|grep -v sunrpc|grep -v rpc_pipefs|grep nfs 1> /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "NFS is currently mounted"
# check for write access
- for MOUNTPT in `mount|grep -v sunrpc|grep nfs| awk '{print $3}'`
+ for MOUNTPT in `mount|grep -v sunrpc|grep -v rpc_pipefs|grep nfs| awk '{print $3}'`
do
if [ $MOUNTPT != "/proc/xen" ] # mounted by xen
then
[28/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Remote access vpn: method name change
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f41d398c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f41d398c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f41d398c
Branch: refs/heads/object_store
Commit: f41d398cf75cee5e700d668252b4d52d5fe4f1a7
Parents: 19321d4
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Wed May 22 16:05:03 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Wed May 22 16:05:03 2013 -0700
----------------------------------------------------------------------
.../cloud/network/vpn/RemoteAccessVpnService.java | 2 +-
.../command/user/vpn/DeleteRemoteAccessVpnCmd.java | 2 +-
.../src/com/cloud/network/NetworkManagerImpl.java | 2 +-
.../network/vpn/RemoteAccessVpnManagerImpl.java | 4 ++--
server/src/com/cloud/user/AccountManagerImpl.java | 2 +-
5 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f41d398c/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
index d637da6..b554719 100644
--- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
+++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java
@@ -32,7 +32,7 @@ public interface RemoteAccessVpnService {
RemoteAccessVpn createRemoteAccessVpn(long vpnServerAddressId, String ipRange, boolean openFirewall, long networkId)
throws NetworkRuleConflictException;
- void destroyRemoteAccessVpn(long vpnServerAddressId, Account caller) throws ResourceUnavailableException;
+ void destroyRemoteAccessVpnForIp(long vpnServerAddressId, Account caller) throws ResourceUnavailableException;
RemoteAccessVpn startRemoteAccessVpn(long vpnServerAddressId, boolean openFirewall) throws ResourceUnavailableException;
VpnUser addVpnUser(long vpnOwnerId, String userName, String password);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f41d398c/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
index 5b1c5c6..06c2530 100644
--- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java
@@ -84,7 +84,7 @@ public class DeleteRemoteAccessVpnCmd extends BaseAsyncCmd {
@Override
public void execute() throws ResourceUnavailableException {
- _ravService.destroyRemoteAccessVpn(publicIpId, UserContext.current().getCaller());
+ _ravService.destroyRemoteAccessVpnForIp(publicIpId, UserContext.current().getCaller());
}
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f41d398c/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java
index 0f43b87..254510b 100755
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@ -3273,7 +3273,7 @@ public class NetworkManagerImpl extends ManagerBase implements NetworkManager, L
// the code would be triggered
s_logger.debug("Cleaning up remote access vpns as a part of public IP id=" + ipId + " release...");
try {
- _vpnMgr.destroyRemoteAccessVpn(ipId, caller);
+ _vpnMgr.destroyRemoteAccessVpnForIp(ipId, caller);
} catch (ResourceUnavailableException e) {
s_logger.warn("Unable to destroy remote access vpn for ip id=" + ipId + " as a part of ip release", e);
success = false;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f41d398c/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
index 062743b..9e7bb13 100755
--- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
+++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java
@@ -226,10 +226,10 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc
}
@Override @DB
- public void destroyRemoteAccessVpn(long ipId, Account caller) throws ResourceUnavailableException {
+ public void destroyRemoteAccessVpnForIp(long ipId, Account caller) throws ResourceUnavailableException {
RemoteAccessVpnVO vpn = _remoteAccessVpnDao.findByPublicIpAddress(ipId);
if (vpn == null) {
- s_logger.debug("vpn id=" + ipId + " does not exists ");
+ s_logger.debug("there are no Remote access vpns for public ip address id=" + ipId);
return;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f41d398c/server/src/com/cloud/user/AccountManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/user/AccountManagerImpl.java b/server/src/com/cloud/user/AccountManagerImpl.java
index aac8d19..7421422 100755
--- a/server/src/com/cloud/user/AccountManagerImpl.java
+++ b/server/src/com/cloud/user/AccountManagerImpl.java
@@ -628,7 +628,7 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
try {
for (RemoteAccessVpnVO vpn : remoteAccessVpns) {
- _remoteAccessVpnMgr.destroyRemoteAccessVpn(vpn.getServerAddressId(), caller);
+ _remoteAccessVpnMgr.destroyRemoteAccessVpnForIp(vpn.getServerAddressId(), caller);
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Failed to cleanup remote access vpn resources as a part of account id=" + accountId + " cleanup due to Exception: ", ex);
[11/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Minor tagging and comments in tests
Adding tags to the deployvm test from the marvin tutorial
Adding docstrings to the vm snapshot tests
Add tag to the pvlan test
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/698da2a2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/698da2a2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/698da2a2
Branch: refs/heads/object_store
Commit: 698da2a279747f85ca6db5558677286c9dc5338b
Parents: a67728b
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Wed May 22 15:40:01 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 22 15:43:03 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_deploy_vm.py | 3 +
test/integration/smoke/test_pvlan.py | 1 +
test/integration/smoke/test_vm_snapshots.py | 618 +++++++++++-----------
3 files changed, 314 insertions(+), 308 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/698da2a2/test/integration/smoke/test_deploy_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vm.py b/test/integration/smoke/test_deploy_vm.py
index 5c8e063..425aeb7 100644
--- a/test/integration/smoke/test_deploy_vm.py
+++ b/test/integration/smoke/test_deploy_vm.py
@@ -31,6 +31,8 @@ from marvin.integration.lib.utils import cleanup_resources
#common - commonly used methods for all tests are listed here
from marvin.integration.lib.common import get_zone, get_domain, get_template
+from nose.plugins.attrib import attr
+
class TestData(object):
"""Test data object that is required to create resources
"""
@@ -94,6 +96,7 @@ class TestDeployVM(cloudstackTestCase):
self.account
]
+ @attr(tags = ['advanced', 'simulator', 'basic', 'sg'])
def test_deploy_vm(self):
"""Test Deploy Virtual Machine
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/698da2a2/test/integration/smoke/test_pvlan.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_pvlan.py b/test/integration/smoke/test_pvlan.py
index 4eb76e1..0a427ba 100644
--- a/test/integration/smoke/test_pvlan.py
+++ b/test/integration/smoke/test_pvlan.py
@@ -41,6 +41,7 @@ class TestPVLAN(cloudstackTestCase):
def setUp(self):
self.apiClient = self.testClient.getApiClient()
+ @attr(tags = ["advanced"])
def test_create_pvlan_network(self):
self.debug("Test create pvlan network")
createNetworkCmd = createNetwork.createNetworkCmd()
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/698da2a2/test/integration/smoke/test_vm_snapshots.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_vm_snapshots.py b/test/integration/smoke/test_vm_snapshots.py
index 353d499..cca4cfb 100644
--- a/test/integration/smoke/test_vm_snapshots.py
+++ b/test/integration/smoke/test_vm_snapshots.py
@@ -1,308 +1,310 @@
-# 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.
-
-# Import Local Modules
-import marvin
-from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.integration.lib.utils import *
-from marvin.integration.lib.base import *
-from marvin.integration.lib.common import *
-from marvin.remoteSSHClient import remoteSSHClient
-
-class Services:
- """Test Snapshots Services
- """
-
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 200, # in MHz
- "memory": 256, # In MBs
- },
- "server": {
- "displayname": "TestVM",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "mgmt_server": {
- "ipaddress": '1.2.2.152',
- "username": "root",
- "password": "password",
- "port": 22,
- },
- "templates": {
- "displaytext": 'Template',
- "name": 'Template',
- "ostype": "CentOS 5.3 (64-bit)",
- "templatefilter": 'self',
- },
- "test_dir": "/tmp",
- "random_data": "random.data",
- "snapshot_name":"TestSnapshot",
- "snapshot_displaytext":"Test",
- "ostype": "CentOS 5.3 (64-bit)",
- "sleep": 60,
- "timeout": 10,
- "mode": 'advanced', # Networking mode: Advanced, Basic
- }
-
-class TestVmSnapshot(cloudstackTestCase):
- @classmethod
- def setUpClass(cls):
- cls.api_client = super(TestVmSnapshot, cls).getClsTestClient().getApiClient()
- cls.services = Services().services
- # Get Zone, Domain and templates
- cls.domain = get_domain(cls.api_client, cls.services)
- cls.zone = get_zone(cls.api_client, cls.services)
-
- template = get_template(
- cls.api_client,
- cls.zone.id,
- cls.services["ostype"]
- )
- cls.services["domainid"] = cls.domain.id
- cls.services["server"]["zoneid"] = cls.zone.id
- cls.services["templates"]["ostypeid"] = template.ostypeid
- cls.services["zoneid"] = cls.zone.id
-
- # Create VMs, NAT Rules etc
- cls.account = Account.create(
- cls.api_client,
- cls.services["account"],
- domainid=cls.domain.id
- )
-
- cls.services["account"] = cls.account.name
-
- cls.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
- )
- cls.virtual_machine = VirtualMachine.create(
- cls.api_client,
- cls.services["server"],
- templateid=template.id,
- accountid=cls.account.name,
- domainid=cls.account.domainid,
- serviceofferingid=cls.service_offering.id,
- mode=cls.services["mode"]
- )
- cls.random_data_0 = random_gen(100)
- cls._cleanup = [
- cls.service_offering,
- cls.account,
- ]
- return
-
- @classmethod
- def tearDownClass(cls):
- try:
- # Cleanup resources used
- cleanup_resources(cls.api_client, cls._cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
-
- def setUp(self):
- self.apiclient = self.testClient.getApiClient()
- self.dbclient = self.testClient.getDbConnection()
- self.cleanup = []
- return
-
- def tearDown(self):
- try:
- # Clean up, terminate the created instance, volumes and snapshots
- cleanup_resources(self.apiclient, self.cleanup)
- except Exception as e:
- raise Exception("Warning: Exception during cleanup : %s" % e)
- return
-
- @attr(tags=["advanced", "advancedns", "smoke"])
- def test_01_create_vm_snapshots(self):
-
- try:
- # Login to VM and write data to file system
- ssh_client = self.virtual_machine.get_ssh_client()
-
- cmds = [
- "echo %s > %s/%s" % (self.random_data_0, self.services["test_dir"], self.services["random_data"]),
- "cat %s/%s" % (self.services["test_dir"], self.services["random_data"])
- ]
-
- for c in cmds:
- self.debug(c)
- result = ssh_client.execute(c)
- self.debug(result)
-
- except Exception:
- self.fail("SSH failed for Virtual machine: %s" %
- self.virtual_machine.ipaddress)
- self.assertEqual(
- self.random_data_0,
- result[0],
- "Check the random data has be write into temp file!"
- )
-
- time.sleep(self.services["sleep"])
-
- vm_snapshot = VmSnapshot.create(
- self.apiclient,
- self.virtual_machine.id,
- "false",
- self.services["snapshot_name"],
- self.services["snapshot_displaytext"]
- )
- self.assertEqual(
- vm_snapshot.state,
- "Ready",
- "Check the snapshot of vm is ready!"
- )
- return
-
- @attr(tags=["advanced", "advancedns", "smoke"])
- def test_02_revert_vm_snapshots(self):
- try:
- ssh_client = self.virtual_machine.get_ssh_client()
-
- cmds = [
- "rm -rf %s/%s" % (self.services["test_dir"], self.services["random_data"]),
- "ls %s/%s" % (self.services["test_dir"], self.services["random_data"])
- ]
-
- for c in cmds:
- self.debug(c)
- result = ssh_client.execute(c)
- self.debug(result)
-
- except Exception:
- self.fail("SSH failed for Virtual machine: %s" %
- self.virtual_machine.ipaddress)
-
- if str(result[0]).index("No such file or directory") == -1:
- self.fail("Check the random data has be delete from temp file!")
-
- time.sleep(self.services["sleep"])
-
- list_snapshot_response = VmSnapshot.list(self.apiclient,vmid=self.virtual_machine.id,listall=True)
-
- self.assertEqual(
- isinstance(list_snapshot_response, list),
- True,
- "Check list response returns a valid list"
- )
- self.assertNotEqual(
- list_snapshot_response,
- None,
- "Check if snapshot exists in ListSnapshot"
- )
-
- self.assertEqual(
- list_snapshot_response[0].state,
- "Ready",
- "Check the snapshot of vm is ready!"
- )
-
- VmSnapshot.revertToSnapshot(self.apiclient,list_snapshot_response[0].id)
-
- list_vm_response = list_virtual_machines(
- self.apiclient,
- id=self.virtual_machine.id
- )
-
- self.assertEqual(
- list_vm_response[0].state,
- "Stopped",
- "Check the state of vm is Stopped!"
- )
-
- cmd = startVirtualMachine.startVirtualMachineCmd()
- cmd.id = list_vm_response[0].id
- self.apiclient.startVirtualMachine(cmd)
-
- time.sleep(self.services["sleep"])
-
- try:
- ssh_client = self.virtual_machine.get_ssh_client(reconnect=True)
-
- cmds = [
- "cat %s/%s" % (self.services["test_dir"], self.services["random_data"])
- ]
-
- for c in cmds:
- self.debug(c)
- result = ssh_client.execute(c)
- self.debug(result)
-
- except Exception:
- self.fail("SSH failed for Virtual machine: %s" %
- self.virtual_machine.ipaddress)
-
- self.assertEqual(
- self.random_data_0,
- result[0],
- "Check the random data is equal with the ramdom file!"
- )
- @attr(tags=["advanced", "advancedns", "smoke"])
- def test_03_delete_vm_snapshots(self):
-
- list_snapshot_response = VmSnapshot.list(self.apiclient,vmid=self.virtual_machine.id,listall=True)
-
- self.assertEqual(
- isinstance(list_snapshot_response, list),
- True,
- "Check list response returns a valid list"
- )
- self.assertNotEqual(
- list_snapshot_response,
- None,
- "Check if snapshot exists in ListSnapshot"
- )
- """
- cmd = deleteVMSnapshot.deleteVMSnapshotCmd()
- cmd.vmsnapshotid = list_snapshot_response[0].id
- self.apiclient.deleteVMSnapshot(cmd)
- """
- VmSnapshot.deleteVMSnapshot(self.apiclient,list_snapshot_response[0].id)
-
- time.sleep(self.services["sleep"]*3)
-
- list_snapshot_response = VmSnapshot.list(self.apiclient,vmid=self.virtual_machine.id,listall=True)
-
- self.assertEqual(
- list_snapshot_response,
- None,
- "Check list vm snapshot has be deleted"
- )
+# 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.
+
+# Import Local Modules
+import marvin
+from nose.plugins.attrib import attr
+from marvin.cloudstackTestCase import *
+from marvin.cloudstackAPI import *
+from marvin.integration.lib.utils import *
+from marvin.integration.lib.base import *
+from marvin.integration.lib.common import *
+
+class Services:
+ """Test Snapshots Services
+ """
+
+ def __init__(self):
+ self.services = {
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test",
+ "lastname": "User",
+ "username": "test",
+ # Random characters are appended for unique
+ # username
+ "password": "password",
+ },
+ "service_offering": {
+ "name": "Tiny Instance",
+ "displaytext": "Tiny Instance",
+ "cpunumber": 1,
+ "cpuspeed": 200, # in MHz
+ "memory": 256, # In MBs
+ },
+ "server": {
+ "displayname": "TestVM",
+ "username": "root",
+ "password": "password",
+ "ssh_port": 22,
+ "hypervisor": 'XenServer',
+ "privateport": 22,
+ "publicport": 22,
+ "protocol": 'TCP',
+ },
+ "mgmt_server": {
+ "ipaddress": '1.2.2.152',
+ "username": "root",
+ "password": "password",
+ "port": 22,
+ },
+ "templates": {
+ "displaytext": 'Template',
+ "name": 'Template',
+ "ostype": "CentOS 5.3 (64-bit)",
+ "templatefilter": 'self',
+ },
+ "test_dir": "/tmp",
+ "random_data": "random.data",
+ "snapshot_name":"TestSnapshot",
+ "snapshot_displaytext":"Test",
+ "ostype": "CentOS 5.3 (64-bit)",
+ "sleep": 60,
+ "timeout": 10,
+ "mode": 'advanced', # Networking mode: Advanced, Basic
+ }
+
+class TestVmSnapshot(cloudstackTestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.api_client = super(TestVmSnapshot, cls).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ # Get Zone, Domain and templates
+ cls.domain = get_domain(cls.api_client, cls.services)
+ cls.zone = get_zone(cls.api_client, cls.services)
+
+ template = get_template(
+ cls.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
+ cls.services["domainid"] = cls.domain.id
+ cls.services["server"]["zoneid"] = cls.zone.id
+ cls.services["templates"]["ostypeid"] = template.ostypeid
+ cls.services["zoneid"] = cls.zone.id
+
+ # Create VMs, NAT Rules etc
+ cls.account = Account.create(
+ cls.api_client,
+ cls.services["account"],
+ domainid=cls.domain.id
+ )
+
+ cls.services["account"] = cls.account.name
+
+ cls.service_offering = ServiceOffering.create(
+ cls.api_client,
+ cls.services["service_offering"]
+ )
+ cls.virtual_machine = VirtualMachine.create(
+ cls.api_client,
+ cls.services["server"],
+ templateid=template.id,
+ accountid=cls.account.name,
+ domainid=cls.account.domainid,
+ serviceofferingid=cls.service_offering.id,
+ mode=cls.services["mode"]
+ )
+ cls.random_data_0 = random_gen(100)
+ cls._cleanup = [
+ cls.service_offering,
+ cls.account,
+ ]
+ return
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ # Cleanup resources used
+ cleanup_resources(cls.api_client, cls._cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ def setUp(self):
+ self.apiclient = self.testClient.getApiClient()
+ self.dbclient = self.testClient.getDbConnection()
+ self.cleanup = []
+ return
+
+ def tearDown(self):
+ try:
+ # Clean up, terminate the created instance, volumes and snapshots
+ cleanup_resources(self.apiclient, self.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
+ return
+
+ @attr(tags=["advanced", "advancedns", "smoke"])
+ def test_01_create_vm_snapshots(self):
+ """Test to create VM snapshots
+ """
+
+ try:
+ # Login to VM and write data to file system
+ ssh_client = self.virtual_machine.get_ssh_client()
+
+ cmds = [
+ "echo %s > %s/%s" % (self.random_data_0, self.services["test_dir"], self.services["random_data"]),
+ "cat %s/%s" % (self.services["test_dir"], self.services["random_data"])
+ ]
+
+ for c in cmds:
+ self.debug(c)
+ result = ssh_client.execute(c)
+ self.debug(result)
+
+ except Exception:
+ self.fail("SSH failed for Virtual machine: %s" %
+ self.virtual_machine.ipaddress)
+ self.assertEqual(
+ self.random_data_0,
+ result[0],
+ "Check the random data has be write into temp file!"
+ )
+
+ time.sleep(self.services["sleep"])
+
+ vm_snapshot = VmSnapshot.create(
+ self.apiclient,
+ self.virtual_machine.id,
+ "false",
+ self.services["snapshot_name"],
+ self.services["snapshot_displaytext"]
+ )
+ self.assertEqual(
+ vm_snapshot.state,
+ "Ready",
+ "Check the snapshot of vm is ready!"
+ )
+ return
+
+ @attr(tags=["advanced", "advancedns", "smoke"])
+ def test_02_revert_vm_snapshots(self):
+ """Test to revert VM snapshots
+ """
+
+ try:
+ ssh_client = self.virtual_machine.get_ssh_client()
+
+ cmds = [
+ "rm -rf %s/%s" % (self.services["test_dir"], self.services["random_data"]),
+ "ls %s/%s" % (self.services["test_dir"], self.services["random_data"])
+ ]
+
+ for c in cmds:
+ self.debug(c)
+ result = ssh_client.execute(c)
+ self.debug(result)
+
+ except Exception:
+ self.fail("SSH failed for Virtual machine: %s" %
+ self.virtual_machine.ipaddress)
+
+ if str(result[0]).index("No such file or directory") == -1:
+ self.fail("Check the random data has be delete from temp file!")
+
+ time.sleep(self.services["sleep"])
+
+ list_snapshot_response = VmSnapshot.list(self.apiclient,vmid=self.virtual_machine.id,listall=True)
+
+ self.assertEqual(
+ isinstance(list_snapshot_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
+ self.assertNotEqual(
+ list_snapshot_response,
+ None,
+ "Check if snapshot exists in ListSnapshot"
+ )
+
+ self.assertEqual(
+ list_snapshot_response[0].state,
+ "Ready",
+ "Check the snapshot of vm is ready!"
+ )
+
+ VmSnapshot.revertToSnapshot(self.apiclient,list_snapshot_response[0].id)
+
+ list_vm_response = list_virtual_machines(
+ self.apiclient,
+ id=self.virtual_machine.id
+ )
+
+ self.assertEqual(
+ list_vm_response[0].state,
+ "Stopped",
+ "Check the state of vm is Stopped!"
+ )
+
+ cmd = startVirtualMachine.startVirtualMachineCmd()
+ cmd.id = list_vm_response[0].id
+ self.apiclient.startVirtualMachine(cmd)
+
+ time.sleep(self.services["sleep"])
+
+ try:
+ ssh_client = self.virtual_machine.get_ssh_client(reconnect=True)
+
+ cmds = [
+ "cat %s/%s" % (self.services["test_dir"], self.services["random_data"])
+ ]
+
+ for c in cmds:
+ self.debug(c)
+ result = ssh_client.execute(c)
+ self.debug(result)
+
+ except Exception:
+ self.fail("SSH failed for Virtual machine: %s" %
+ self.virtual_machine.ipaddress)
+
+ self.assertEqual(
+ self.random_data_0,
+ result[0],
+ "Check the random data is equal with the ramdom file!"
+ )
+
+ @attr(tags=["advanced", "advancedns", "smoke"])
+ def test_03_delete_vm_snapshots(self):
+ """Test to delete vm snapshots
+ """
+
+ list_snapshot_response = VmSnapshot.list(self.apiclient,vmid=self.virtual_machine.id,listall=True)
+
+ self.assertEqual(
+ isinstance(list_snapshot_response, list),
+ True,
+ "Check list response returns a valid list"
+ )
+ self.assertNotEqual(
+ list_snapshot_response,
+ None,
+ "Check if snapshot exists in ListSnapshot"
+ )
+ VmSnapshot.deleteVMSnapshot(self.apiclient,list_snapshot_response[0].id)
+
+ time.sleep(self.services["sleep"]*3)
+
+ list_snapshot_response = VmSnapshot.list(self.apiclient,vmid=self.virtual_machine.id,listall=True)
+
+ self.assertEqual(
+ list_snapshot_response,
+ None,
+ "Check list vm snapshot has be deleted"
+ )
[44/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2656: UUID column for all 4.0 schema entities should be
populated when they are upgraded to 4.1
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a46b4d82
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a46b4d82
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a46b4d82
Branch: refs/heads/object_store
Commit: a46b4d8273e9033e55172bf2d00845820bc9511a
Parents: b1f4c8e
Author: Min Chen <mi...@citrix.com>
Authored: Thu May 23 15:14:43 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Thu May 23 15:15:13 2013 -0700
----------------------------------------------------------------------
setup/db/db/schema-40to410.sql | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a46b4d82/setup/db/db/schema-40to410.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql
index 381a4ce..acc29a2 100644
--- a/setup/db/db/schema-40to410.sql
+++ b/setup/db/db/schema-40to410.sql
@@ -184,6 +184,7 @@ UPDATE `cloud`.`alert` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`async_job` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`cluster` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`data_center` set uuid=id WHERE uuid is NULL;
+UPDATE `cloud`.`dc_storage_network_ip_range` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`disk_offering` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`domain` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`event` set uuid=id WHERE uuid is NULL;
@@ -217,6 +218,7 @@ UPDATE `cloud`.`security_group` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`security_group_rule` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`snapshot_schedule` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`snapshots` set uuid=id WHERE uuid is NULL;
+UPDATE `cloud`.`snapshot_policy` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`static_routes` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`storage_pool` set uuid=id WHERE uuid is NULL;
UPDATE `cloud`.`swift` set uuid=id WHERE uuid is NULL;
[18/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2602. XenServer storage motion strategy returns true for canHandle even though hosts are of different hypervisor type. Fixed the canHandle routine to return true only if source and destination hosts are of type XenServer.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/85ff5070
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/85ff5070
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/85ff5070
Branch: refs/heads/object_store
Commit: 85ff50709424dc726b934d2d29f046d47b610d75
Parents: f7eb139
Author: Devdeep Singh <de...@gmail.com>
Authored: Wed May 22 17:25:01 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Wed May 22 17:47:11 2013 +0530
----------------------------------------------------------------------
.../motion/XenServerStorageMotionStrategy.java | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/85ff5070/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java b/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
index 353f2b5..42cb68d 100644
--- a/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
+++ b/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
@@ -19,8 +19,8 @@
package org.apache.cloudstack.storage.motion;
import java.util.HashMap;
-import java.util.Map;
import java.util.List;
+import java.util.Map;
import javax.inject.Inject;
@@ -50,6 +50,7 @@ import com.cloud.agent.api.to.VolumeTO;
import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.OperationTimedoutException;
import com.cloud.host.Host;
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.storage.StoragePool;
import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.VolumeDao;
@@ -73,7 +74,12 @@ public class XenServerStorageMotionStrategy implements DataMotionStrategy {
@Override
public boolean canHandle(Map<VolumeInfo, DataStore> volumeMap, Host srcHost, Host destHost) {
- return true;
+ boolean canHandle = false;
+ if (srcHost.getHypervisorType() == HypervisorType.XenServer &&
+ destHost.getHypervisorType() == HypervisorType.XenServer) {
+ canHandle = true;
+ }
+ return canHandle;
}
@Override
[26/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-747: internal LB in VPC - remove module internalLbProvider since internalLbVm section has been added in system.js
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c7976b66
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c7976b66
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c7976b66
Branch: refs/heads/object_store
Commit: c7976b668586181267bf9d8ceba50d194fd96d1c
Parents: c7b9020
Author: Jessica Wang <je...@apache.org>
Authored: Wed May 22 11:03:56 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Wed May 22 11:03:56 2013 -0700
----------------------------------------------------------------------
.../internalLbProvider/internalLbProvider.js | 182 ---------------
ui/modules/modules.js | 3 +-
2 files changed, 1 insertions(+), 184 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7976b66/ui/modules/internalLbProvider/internalLbProvider.js
----------------------------------------------------------------------
diff --git a/ui/modules/internalLbProvider/internalLbProvider.js b/ui/modules/internalLbProvider/internalLbProvider.js
deleted file mode 100644
index aaa386e..0000000
--- a/ui/modules/internalLbProvider/internalLbProvider.js
+++ /dev/null
@@ -1,182 +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.
-(function($, cloudStack) {
- cloudStack.modules.internalLbProvider = function(module) {
- var internalLbDeviceViewAll = [
- {
- label: 'Devices',
- path: '_zone.internalLbDevices'
- }
- ];
-
- var internalLbListView = {
- id: 'internalLbDevices',
- fields: {
- resourcename: { label: 'Resource Name' },
- provider: { label: 'Provider' }
- },
- dataProvider: function(args) {
- args.response.success({ data: [] });
- },
- actions: {
- add: {
- label: 'Add internal LB device',
-
- messages: {
- notification: function(args) {
- return 'Add internal LB device';
- }
- },
-
- createForm: {
- title: 'Add internal LB device',
- fields: {
- hostname: {
- label: 'label.host',
- validation: { required: true }
- },
- username: {
- label: 'label.username',
- validation: { required: true }
- },
- password: {
- label: 'label.password',
- isPassword: true,
- validation: { required: true }
- }
- }
- },
-
- action: function(args) {
- args.response.success();
- },
-
- notification: {
- poll: function(args) {
- args.complete();
- }
- }
- }
- },
-
- detailView: {
- name: 'Internal LB resource details',
- actions: {
- remove: {
- label: 'delete Internal LB resource',
- messages: {
- confirm: function(args) {
- return 'Please confirm you want to delete Internal LB resource';
- },
- notification: function(args) {
- return 'delete Internal LB resource';
- }
- },
- action: function(args) {
- args.response.success();
- },
- notification: {
- poll: function(args) {
- args.complete();
- }
- }
- }
- },
-
- tabs: {
- details: {
- title: 'label.details',
- fields: [
- {
- resourcename: { label: 'Resource Name' }
- },
- {
- resourceid: { label: 'Resource ID'},
- provider: { label: 'Provider' },
- RESOURCE_NAME: { label: 'Resource Name'}
- }
- ],
- dataProvider: function(args) {
- args.response.success({ data: args.context.internalLbDevices[0] });
- }
- }
- }
- }
- };
-
- var internalLbProviderDetailView = {
- id: 'internalLbProvider',
- label: 'internal LB',
- viewAll: internalLbDeviceViewAll,
- tabs: {
- details: {
- title: 'label.details',
- fields: [
- {
- name: { label: 'label.name' }
- },
- {
- state: { label: 'label.state' },
- id: { label: 'label.id' },
- servicelist: {
- label: 'Services',
- converter: function(args){
- if(args)
- return args.join(', ');
- else
- return '';
- }
- }
- }
- ],
- dataProvider: function(args) {
- $.ajax({
- url: createURL('listNetworkServiceProviders'),
- data: {
- name: 'InternalLb',
- physicalnetworkid: args.context.physicalNetworks[0].id
- },
- success: function(json){
- var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
- if(items != null && items.length > 0) {
- args.response.success({ data: items[0] });
- }
- else {
- args.response.success({
- data: {
- name: 'InternalLb',
- state: 'Disabled'
- }
- })
- }
- }
- });
- }
- }
- }
- };
-
- module.infrastructure.networkServiceProvider({
- id: 'internalLb',
- name: 'Internal LB',
- //state: 'Disabled', //don't know state until log in and visit Infrastructure menu > zone detail > physical network > network service providers
- listView: internalLbListView,
-
- detailView: internalLbProviderDetailView
- });
- };
-}(jQuery, cloudStack));
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7976b66/ui/modules/modules.js
----------------------------------------------------------------------
diff --git a/ui/modules/modules.js b/ui/modules/modules.js
index 3170122..d4502a1 100644
--- a/ui/modules/modules.js
+++ b/ui/modules/modules.js
@@ -18,7 +18,6 @@
cloudStack.modules = [
'infrastructure',
'vnmcNetworkProvider',
- 'vnmcAsa1000v',
- 'internalLbProvider'
+ 'vnmcAsa1000v'
];
}(jQuery, cloudStack));
[42/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2504: UI - create network offering dialog - pass specifyIpRanges=false for Isolated Network.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/026c2cec
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/026c2cec
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/026c2cec
Branch: refs/heads/object_store
Commit: 026c2cec6d3cb42c32929c9ed3ee417b7771b667
Parents: e8fbee0
Author: Jessica Wang <je...@apache.org>
Authored: Thu May 23 14:34:26 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Thu May 23 14:35:40 2013 -0700
----------------------------------------------------------------------
ui/scripts/configuration.js | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/026c2cec/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 808b342..9932cdc 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -1919,26 +1919,22 @@
inputData['isPersistent'] = false;
}
else if (inputData['guestIpType'] == "Isolated") { //specifyVlan checkbox is shown
- if (inputData['specifyVlan'] == 'on') { //specifyVlan checkbox is checked
+ inputData['specifyIpRanges'] = false;
+
+ if (inputData['specifyVlan'] == 'on') { //specifyVlan checkbox is checked
inputData['specifyVlan'] = true;
- inputData['specifyIpRanges'] = true;
-
-
-
-
}
else { //specifyVlan checkbox is unchecked
inputData['specifyVlan'] = false;
- inputData['specifyIpRanges'] = false;
+
}
- if(inputData['isPersistent'] == 'on') { //It is a persistent network
- inputData['isPersistent'] = true;
- }
- else { //Isolated Network with Non-persistent network
- inputData['isPersistent'] = false;
- }
-
+ if(inputData['isPersistent'] == 'on') { //It is a persistent network
+ inputData['isPersistent'] = true;
+ }
+ else { //Isolated Network with Non-persistent network
+ inputData['isPersistent'] = false;
+ }
}
[08/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2585: Failed to apply new PF rules after deleting the existing PF Rule with Cisco VNMC Provider
Each rule created in VNMC under a policy object needs to have an unique order value. Rules are evaluated based on this value.
Eariler order was computed based on the rule count under a policy object. This resulted in duplicate order value when rules get
deleted and recreated. Changed the logic to compute order based on the CS db id of the rule which is unique.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/83f84add
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/83f84add
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/83f84add
Branch: refs/heads/object_store
Commit: 83f84adda2715eae60c47738eee886a48fbc5b03
Parents: 5d3e6bd
Author: Koushik Das <ko...@citrix.com>
Authored: Wed May 22 14:49:48 2013 +0530
Committer: Koushik Das <ko...@citrix.com>
Committed: Wed May 22 14:49:48 2013 +0530
----------------------------------------------------------------------
.../cloud/network/cisco/CiscoVnmcConnection.java | 22 ++--
.../network/cisco/CiscoVnmcConnectionImpl.java | 112 ++++++---------
.../cloud/network/resource/CiscoVnmcResource.java | 20 ++--
.../network/resource/CiscoVnmcResourceTest.java | 22 ++--
4 files changed, 77 insertions(+), 99 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83f84add/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java
index 28e2535..be4814a 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnection.java
@@ -74,16 +74,16 @@ public interface CiscoVnmcConnection {
String ipAddress) throws ExecutionException;
public boolean createTenantVDCDNatRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String publicIp)
throws ExecutionException;
public boolean deleteTenantVDCDNatRule(String tenantName,
- String identifier, String policyIdentifier)
+ long ruleId, String policyIdentifier)
throws ExecutionException;
public boolean createTenantVDCAclRuleForDNat(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String ipAddress)
throws ExecutionException;
@@ -104,17 +104,17 @@ public interface CiscoVnmcConnection {
String ipAddress) throws ExecutionException;
public boolean createTenantVDCPFRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String publicIp,
String startPort, String endPort)
throws ExecutionException;
public boolean deleteTenantVDCPFRule(String tenantName,
- String identifier, String policyIdentifier)
+ long ruleId, String policyIdentifier)
throws ExecutionException;
public boolean createTenantVDCAclRuleForPF(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String ipAddress,
String startPort, String endPort)
throws ExecutionException;
@@ -138,29 +138,29 @@ public interface CiscoVnmcConnection {
throws ExecutionException;
public boolean createTenantVDCIngressAclRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String sourceStartIp, String sourceEndIp,
String destStartPort, String destEndPort)
throws ExecutionException;
public boolean createTenantVDCIngressAclRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String sourceStartIp, String sourceEndIp)
throws ExecutionException;
public boolean createTenantVDCEgressAclRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String sourceStartIp, String sourceEndIp,
String destStartPort, String destEndPort)
throws ExecutionException;
public boolean createTenantVDCEgressAclRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String sourceStartIp, String sourceEndIp)
throws ExecutionException;
public boolean deleteTenantVDCAclRule(String tenantName,
- String identifier, String policyIdentifier) throws ExecutionException;
+ long ruleId, String policyIdentifier) throws ExecutionException;
public boolean createTenantVDCAclPolicy(String tenantName,
String identifier) throws ExecutionException;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83f84add/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
index a9e8cf6..72ecc67 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/cisco/CiscoVnmcConnectionImpl.java
@@ -490,12 +490,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
xml = replaceXmlValue(xml, "srcendip", endSourceIp);
xml = replaceXmlValue(xml, "ippoolname", getNameForSourceNatIpPool(tenantName));
- List<String> rules = listChildren(getDnForSourceNatPolicy(tenantName));
- int order = 100;
- if (rules != null) {
- order += rules.size();
- }
- xml = replaceXmlValue(xml, "order", Integer.toString(order));
+ long order = 100;
+ xml = replaceXmlValue(xml, "order", Long.toString(order));
String response = sendRequest(service, xml);
return verifySuccess(response);
@@ -671,12 +667,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
@Override
public boolean createTenantVDCIngressAclRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String sourceStartIp, String sourceEndIp,
String destStartPort, String destEndPort) throws ExecutionException {
String xml = VnmcXml.CREATE_INGRESS_ACL_RULE.getXml();
String service = VnmcXml.CREATE_INGRESS_ACL_RULE.getService();
+ String identifier = Long.toString(ruleId);
xml = replaceXmlValue(xml, "cookie", _cookie);
xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier));
xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier));
@@ -688,12 +685,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
xml = replaceXmlValue(xml, "deststartport", destStartPort);
xml = replaceXmlValue(xml, "destendport", destEndPort);
- List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier));
- int order = 100;
- if (rules != null) {
- order += rules.size();
- }
- xml = replaceXmlValue(xml, "order", Integer.toString(order));
+ long order = 100 + ruleId;
+ xml = replaceXmlValue(xml, "order", Long.toString(order));
String response = sendRequest(service, xml);
return verifySuccess(response);
@@ -701,11 +694,12 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
@Override
public boolean createTenantVDCIngressAclRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String sourceStartIp, String sourceEndIp) throws ExecutionException {
String xml = VnmcXml.CREATE_GENERIC_INGRESS_ACL_RULE.getXml();
String service = VnmcXml.CREATE_GENERIC_INGRESS_ACL_RULE.getService();
+ String identifier = Long.toString(ruleId);
xml = replaceXmlValue(xml, "cookie", _cookie);
xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier));
xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier));
@@ -715,12 +709,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
xml = replaceXmlValue(xml, "sourcestartip", sourceStartIp);
xml = replaceXmlValue(xml, "sourceendip", sourceEndIp);
- List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier));
- int order = 100;
- if (rules != null) {
- order += rules.size();
- }
- xml = replaceXmlValue(xml, "order", Integer.toString(order));
+ long order = 100 + ruleId;
+ xml = replaceXmlValue(xml, "order", Long.toString(order));
String response = sendRequest(service, xml);
return verifySuccess(response);
@@ -728,12 +718,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
@Override
public boolean createTenantVDCEgressAclRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String sourceStartIp, String sourceEndIp,
String destStartPort, String destEndPort) throws ExecutionException {
String xml = VnmcXml.CREATE_EGRESS_ACL_RULE.getXml();
String service = VnmcXml.CREATE_EGRESS_ACL_RULE.getService();
+ String identifier = Long.toString(ruleId);
xml = replaceXmlValue(xml, "cookie", _cookie);
xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier));
xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier));
@@ -745,12 +736,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
xml = replaceXmlValue(xml, "deststartport", destStartPort);
xml = replaceXmlValue(xml, "destendport", destEndPort);
- List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier));
- int order = 100;
- if (rules != null) {
- order += rules.size();
- }
- xml = replaceXmlValue(xml, "order", Integer.toString(order));
+ long order = 100 + ruleId;
+ xml = replaceXmlValue(xml, "order", Long.toString(order));
String response = sendRequest(service, xml);
return verifySuccess(response);
@@ -758,7 +745,7 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
@Override
public boolean createTenantVDCEgressAclRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String sourceStartIp, String sourceEndIp) throws ExecutionException {
String xml = VnmcXml.CREATE_GENERIC_EGRESS_ACL_RULE.getXml();
String service = VnmcXml.CREATE_GENERIC_EGRESS_ACL_RULE.getService();
@@ -768,6 +755,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
} else { // specific protocol
xml = replaceXmlValue(xml, "protocolvalue", protocol);
}
+
+ String identifier = Long.toString(ruleId);
xml = replaceXmlValue(xml, "cookie", _cookie);
xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier));
xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier));
@@ -776,19 +765,16 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
xml = replaceXmlValue(xml, "sourcestartip", sourceStartIp);
xml = replaceXmlValue(xml, "sourceendip", sourceEndIp);
- List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier));
- int order = 100;
- if (rules != null) {
- order += rules.size();
- }
- xml = replaceXmlValue(xml, "order", Integer.toString(order));
+ long order = 100 + ruleId;
+ xml = replaceXmlValue(xml, "order", Long.toString(order));
String response = sendRequest(service, xml);
return verifySuccess(response);
}
@Override
- public boolean deleteTenantVDCAclRule(String tenantName, String identifier, String policyIdentifier) throws ExecutionException {
+ public boolean deleteTenantVDCAclRule(String tenantName, long ruleId, String policyIdentifier) throws ExecutionException {
+ String identifier = Long.toString(ruleId);
return deleteTenantVDCRule(
getDnForAclRule(tenantName, identifier, policyIdentifier),
getNameForAclRule(tenantName, identifier));
@@ -1001,11 +987,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
@Override
public boolean createTenantVDCPFRule(String tenantName,
- String identifier, String policyIdentifier,
+ long ruleId, String policyIdentifier,
String protocol, String publicIp,
String startPort, String endPort) throws ExecutionException {
String xml = VnmcXml.CREATE_PF_RULE.getXml();
String service = VnmcXml.CREATE_PF_RULE.getService();
+
+ String identifier = Long.toString(ruleId);
xml = replaceXmlValue(xml, "cookie", _cookie);
xml = replaceXmlValue(xml, "natruledn", getDnForPFRule(tenantName, identifier, policyIdentifier));
xml = replaceXmlValue(xml, "natrulename", getNameForPFRule(tenantName, identifier));
@@ -1017,20 +1005,16 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
xml = replaceXmlValue(xml, "endport", endPort);
xml = replaceXmlValue(xml, "protocolvalue", protocol);
- List<String> rules = listChildren(getDnForPFPolicy(tenantName, policyIdentifier));
- int order = 100;
- if (rules != null) {
- order += rules.size();
- }
- xml = replaceXmlValue(xml, "order", Integer.toString(order));
+ long order = 100 + ruleId;
+ xml = replaceXmlValue(xml, "order", Long.toString(order));
String response = sendRequest(service, xml);
return verifySuccess(response);
}
@Override
- public boolean deleteTenantVDCPFRule(String tenantName, String identifier,
- String policyIdentifier) throws ExecutionException {
+ public boolean deleteTenantVDCPFRule(String tenantName, long ruleId, String policyIdentifier) throws ExecutionException {
+ String identifier = Long.toString(ruleId);
return deleteTenantVDCRule(
getDnForPFRule(tenantName, identifier, policyIdentifier),
getNameForPFRule(tenantName, identifier));
@@ -1038,11 +1022,13 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
@Override
public boolean createTenantVDCAclRuleForPF(String tenantName,
- String identifier, String policyIdentifier, String protocol,
+ long ruleId, String policyIdentifier, String protocol,
String ipAddress, String startPort, String endPort)
throws ExecutionException {
String xml = VnmcXml.CREATE_ACL_RULE_FOR_PF.getXml();
String service = VnmcXml.CREATE_ACL_RULE_FOR_PF.getService();
+
+ String identifier = Long.toString(ruleId);
xml = replaceXmlValue(xml, "cookie", _cookie);
xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier));
xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier));
@@ -1053,12 +1039,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
xml = replaceXmlValue(xml, "startport", startPort);
xml = replaceXmlValue(xml, "endport", endPort);
- List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier));
- int order = 100;
- if (rules != null) {
- order += rules.size();
- }
- xml = replaceXmlValue(xml, "order", Integer.toString(order));
+ long order = 100 + ruleId;
+ xml = replaceXmlValue(xml, "order", Long.toString(order));
String response = sendRequest(service, xml);
return verifySuccess(response);
@@ -1127,10 +1109,12 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
@Override
public boolean createTenantVDCDNatRule(String tenantName,
- String identifier, String policyIdentifier, String publicIp)
+ long ruleId, String policyIdentifier, String publicIp)
throws ExecutionException {
String xml = VnmcXml.CREATE_DNAT_RULE.getXml();
String service = VnmcXml.CREATE_DNAT_RULE.getService();
+
+ String identifier = Long.toString(ruleId);
xml = replaceXmlValue(xml, "cookie", _cookie);
xml = replaceXmlValue(xml, "natruledn", getDnForDNatRule(tenantName, identifier, policyIdentifier));
xml = replaceXmlValue(xml, "natrulename", getNameForDNatRule(tenantName, identifier));
@@ -1138,21 +1122,17 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
xml = replaceXmlValue(xml, "ippoolname", getNameForDNatIpPool(tenantName, identifier));
xml = replaceXmlValue(xml, "ip", publicIp);
- List<String> rules = listChildren(getDnForDNatPolicy(tenantName, policyIdentifier));
- int order = 100;
- if (rules != null) {
- order += rules.size();
- }
- xml = replaceXmlValue(xml, "order", Integer.toString(order));
+ long order = 100 + ruleId;
+ xml = replaceXmlValue(xml, "order", Long.toString(order));
String response = sendRequest(service, xml);
return verifySuccess(response);
}
@Override
- public boolean deleteTenantVDCDNatRule(String tenantName,
- String identifier, String policyIdentifier)
+ public boolean deleteTenantVDCDNatRule(String tenantName, long ruleId, String policyIdentifier)
throws ExecutionException {
+ String identifier = Long.toString(ruleId);
return deleteTenantVDCRule(
getDnForDNatRule(tenantName, identifier, policyIdentifier),
getNameForDNatRule(tenantName, identifier));
@@ -1160,10 +1140,12 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
@Override
public boolean createTenantVDCAclRuleForDNat(String tenantName,
- String identifier, String policyIdentifier, String ipAddress)
+ long ruleId, String policyIdentifier, String ipAddress)
throws ExecutionException {
String xml = VnmcXml.CREATE_ACL_RULE_FOR_DNAT.getXml();
String service = VnmcXml.CREATE_ACL_RULE_FOR_DNAT.getService();
+
+ String identifier = Long.toString(ruleId);
xml = replaceXmlValue(xml, "cookie", _cookie);
xml = replaceXmlValue(xml, "aclruledn", getDnForAclRule(tenantName, identifier, policyIdentifier));
xml = replaceXmlValue(xml, "aclrulename", getNameForAclRule(tenantName, identifier));
@@ -1171,12 +1153,8 @@ public class CiscoVnmcConnectionImpl implements CiscoVnmcConnection {
xml = replaceXmlValue(xml, "actiontype", "permit");
xml = replaceXmlValue(xml, "ip", ipAddress);
- List<String> rules = listChildren(getDnForAclPolicy(tenantName, policyIdentifier));
- int order = 100;
- if (rules != null) {
- order += rules.size();
- }
- xml = replaceXmlValue(xml, "order", Integer.toString(order));
+ long order = 100 + ruleId;
+ xml = replaceXmlValue(xml, "order", Long.toString(order));
String response = sendRequest(service, xml);
return verifySuccess(response);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83f84add/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java
index 29bbbe6..fc0c334 100644
--- a/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java
+++ b/plugins/network-elements/cisco-vnmc/src/com/cloud/network/resource/CiscoVnmcResource.java
@@ -174,7 +174,7 @@ public class CiscoVnmcResource implements ServerResource {
cmd.setPod("");
cmd.setPrivateIpAddress(_ip);
cmd.setStorageIpAddress("");
- cmd.setVersion("");
+ cmd.setVersion(CiscoVnmcResource.class.getPackage().getImplementationVersion());
cmd.setGuid(_guid);
return new StartupCommand[] { cmd };
}
@@ -359,7 +359,7 @@ public class CiscoVnmcResource implements ServerResource {
for (FirewallRuleTO rule : publicIpRulesMap.get(publicIp)) {
if (rule.revoked()) {
- if (!_connection.deleteTenantVDCAclRule(tenant, Long.toString(rule.getId()), policyIdentifier)) {
+ if (!_connection.deleteTenantVDCAclRule(tenant, rule.getId(), policyIdentifier)) {
throw new ExecutionException("Failed to delete ACL rule in VNMC for guest network with vlan " + vlanId);
}
} else {
@@ -368,14 +368,14 @@ public class CiscoVnmcResource implements ServerResource {
if (!rule.getProtocol().equalsIgnoreCase("icmp")
&& rule.getSrcPortRange() != null) {
if (!_connection.createTenantVDCIngressAclRule(tenant,
- Long.toString(rule.getId()), policyIdentifier,
+ rule.getId(), policyIdentifier,
rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1],
Integer.toString(rule.getSrcPortRange()[0]), Integer.toString(rule.getSrcPortRange()[1]))) {
throw new ExecutionException("Failed to create ACL ingress rule in VNMC for guest network with vlan " + vlanId);
}
} else {
if (!_connection.createTenantVDCIngressAclRule(tenant,
- Long.toString(rule.getId()), policyIdentifier,
+ rule.getId(), policyIdentifier,
rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1])) {
throw new ExecutionException("Failed to create ACL ingress rule in VNMC for guest network with vlan " + vlanId);
}
@@ -384,7 +384,7 @@ public class CiscoVnmcResource implements ServerResource {
if ((rule.getProtocol().equalsIgnoreCase("tcp") || rule.getProtocol().equalsIgnoreCase("udp"))
&& rule.getSrcPortRange() != null) {
if (!_connection.createTenantVDCEgressAclRule(tenant,
- Long.toString(rule.getId()), policyIdentifier,
+ rule.getId(), policyIdentifier,
rule.getProtocol().toUpperCase(),
externalIpRange[0], externalIpRange[1],
Integer.toString(rule.getSrcPortRange()[0]), Integer.toString(rule.getSrcPortRange()[1]))) {
@@ -392,7 +392,7 @@ public class CiscoVnmcResource implements ServerResource {
}
} else {
if (!_connection.createTenantVDCEgressAclRule(tenant,
- Long.toString(rule.getId()), policyIdentifier,
+ rule.getId(), policyIdentifier,
rule.getProtocol().toUpperCase(), externalIpRange[0], externalIpRange[1])) {
throw new ExecutionException("Failed to create ACL egress rule in VNMC for guest network with vlan " + vlanId);
}
@@ -472,7 +472,7 @@ public class CiscoVnmcResource implements ServerResource {
for (StaticNatRuleTO rule : publicIpRulesMap.get(publicIp)) {
if (rule.revoked()) {
- if (!_connection.deleteTenantVDCDNatRule(tenant, Long.toString(rule.getId()), policyIdentifier)) {
+ if (!_connection.deleteTenantVDCDNatRule(tenant, rule.getId(), policyIdentifier)) {
throw new ExecutionException("Failed to delete DNAT rule in VNMC for guest network with vlan " + vlanId);
}
} else {
@@ -481,7 +481,7 @@ public class CiscoVnmcResource implements ServerResource {
}
if (!_connection.createTenantVDCDNatRule(tenant,
- Long.toString(rule.getId()), policyIdentifier, rule.getSrcIp())) {
+ rule.getId(), policyIdentifier, rule.getSrcIp())) {
throw new ExecutionException("Failed to create DNAT rule in VNMC for guest network with vlan " + vlanId);
}
}
@@ -558,7 +558,7 @@ public class CiscoVnmcResource implements ServerResource {
for (PortForwardingRuleTO rule : publicIpRulesMap.get(publicIp)) {
if (rule.revoked()) {
- if (!_connection.deleteTenantVDCPFRule(tenant, Long.toString(rule.getId()), policyIdentifier)) {
+ if (!_connection.deleteTenantVDCPFRule(tenant, rule.getId(), policyIdentifier)) {
throw new ExecutionException("Failed to delete PF rule in VNMC for guest network with vlan " + vlanId);
}
} else {
@@ -571,7 +571,7 @@ public class CiscoVnmcResource implements ServerResource {
}
if (!_connection.createTenantVDCPFRule(tenant,
- Long.toString(rule.getId()), policyIdentifier,
+ rule.getId(), policyIdentifier,
rule.getProtocol().toUpperCase(), rule.getSrcIp(),
Integer.toString(rule.getSrcPortRange()[0]), Integer.toString(rule.getSrcPortRange()[1]))) {
throw new ExecutionException("Failed to create PF rule in VNMC for guest network with vlan " + vlanId);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/83f84add/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java
index f1942ea..b3821d7 100755
--- a/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java
+++ b/plugins/network-elements/cisco-vnmc/test/com/cloud/network/resource/CiscoVnmcResourceTest.java
@@ -163,13 +163,13 @@ public class CiscoVnmcResourceTest {
when(_connection.createTenantVDCAclPolicySet(anyString(), anyBoolean())).thenReturn(true);
when(_connection.createTenantVDCAclPolicy(anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCAclPolicyRef(anyString(), anyString(), anyBoolean())).thenReturn(true);
- when(_connection.deleteTenantVDCAclRule(anyString(), anyString(), anyString())).thenReturn(true);
+ when(_connection.deleteTenantVDCAclRule(anyString(), anyLong(), anyString())).thenReturn(true);
when(_connection.createTenantVDCIngressAclRule(
- anyString(), anyString(), anyString(),
+ anyString(), anyLong(), anyString(),
anyString(), anyString(), anyString(),
anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCEgressAclRule(
- anyString(), anyString(), anyString(),
+ anyString(), anyLong(), anyString(),
anyString(), anyString(), anyString(),
anyString(), anyString())).thenReturn(true);
when(_connection.associateAclPolicySet(anyString())).thenReturn(true);
@@ -201,13 +201,13 @@ public class CiscoVnmcResourceTest {
when(_connection.createTenantVDCDNatPolicyRef(anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCAclPolicy(anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCAclPolicyRef(anyString(), anyString(), anyBoolean())).thenReturn(true);
- when(_connection.deleteTenantVDCDNatRule(anyString(), anyString(), anyString())).thenReturn(true);
- when(_connection.deleteTenantVDCAclRule(anyString(), anyString(), anyString())).thenReturn(true);
+ when(_connection.deleteTenantVDCDNatRule(anyString(), anyLong(), anyString())).thenReturn(true);
+ when(_connection.deleteTenantVDCAclRule(anyString(), anyLong(), anyString())).thenReturn(true);
when(_connection.createTenantVDCDNatIpPool(anyString(), anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCDNatRule(anyString(),
- anyString(), anyString(), anyString())).thenReturn(true);
+ anyLong(), anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCAclRuleForDNat(anyString(),
- anyString(), anyString(), anyString())).thenReturn(true);
+ anyLong(), anyString(), anyString())).thenReturn(true);
when(_connection.associateAclPolicySet(anyString())).thenReturn(true);
Answer answer = _resource.executeRequest(cmd);
@@ -237,15 +237,15 @@ public class CiscoVnmcResourceTest {
when(_connection.createTenantVDCPFPolicyRef(anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCAclPolicy(anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCAclPolicyRef(anyString(), anyString(), anyBoolean())).thenReturn(true);
- when(_connection.deleteTenantVDCPFRule(anyString(), anyString(), anyString())).thenReturn(true);
- when(_connection.deleteTenantVDCAclRule(anyString(), anyString(), anyString())).thenReturn(true);
+ when(_connection.deleteTenantVDCPFRule(anyString(), anyLong(), anyString())).thenReturn(true);
+ when(_connection.deleteTenantVDCAclRule(anyString(), anyLong(), anyString())).thenReturn(true);
when(_connection.createTenantVDCPFIpPool(anyString(), anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCPFPortPool(anyString(), anyString(), anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCPFRule(anyString(),
- anyString(), anyString(), anyString(),
+ anyLong(), anyString(), anyString(),
anyString(), anyString(), anyString())).thenReturn(true);
when(_connection.createTenantVDCAclRuleForPF(anyString(),
- anyString(), anyString(), anyString(),
+ anyLong(), anyString(), anyString(),
anyString(), anyString(), anyString())).thenReturn(true);
when(_connection.associateAclPolicySet(anyString())).thenReturn(true);
[13/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2577: Fix exception handling for listPortForwarding API
listPortForwarding API returns an exception if the PF is deleted.
Changed testcases to handle this exception.
Signed-off-by: Girish Shilamkar <gi...@clogeny.com>
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/44a81f0b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/44a81f0b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/44a81f0b
Branch: refs/heads/object_store
Commit: 44a81f0b6f2d4305d8e92058abb88c1a6334d814
Parents: 6160110
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Wed May 22 15:53:27 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 22 15:52:31 2013 +0530
----------------------------------------------------------------------
test/integration/smoke/test_network.py | 69 +++++++++-----------------
1 files changed, 24 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/44a81f0b/test/integration/smoke/test_network.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_network.py b/test/integration/smoke/test_network.py
index 4a7bb44..61ddf46 100644
--- a/test/integration/smoke/test_network.py
+++ b/test/integration/smoke/test_network.py
@@ -18,6 +18,7 @@
"""
#Import Local Modules
import marvin
+from marvin.cloudstackException import cloudstackAPIException
from marvin.cloudstackTestCase import *
from marvin.cloudstackAPI import *
from marvin import remoteSSHClient
@@ -447,16 +448,14 @@ class TestPortForwarding(cloudstackTestCase):
nat_rule.delete(self.apiclient)
- list_nat_rule_response = list_nat_rules(
+ try:
+ list_nat_rule_response = list_nat_rules(
self.apiclient,
id=nat_rule.id
)
+ except cloudstackAPIException:
+ self.debug("Nat Rule is deleted")
- self.assertEqual(
- list_nat_rule_response,
- None,
- "Check Port Forwarding Rule is deleted"
- )
# Check if the Public SSH port is inaccessible
with self.assertRaises(Exception):
self.debug(
@@ -565,15 +564,14 @@ class TestPortForwarding(cloudstackTestCase):
nat_rule.delete(self.apiclient)
- list_nat_rule_response = list_nat_rules(
+ try:
+ list_nat_rule_response = list_nat_rules(
self.apiclient,
id=nat_rule.id
)
- self.assertEqual(
- list_nat_rule_response,
- None,
- "Check Port Forwarding Rule is deleted"
- )
+ except cloudstackAPIException:
+ self.debug("Nat Rule is deleted")
+
# Check if the Public SSH port is inaccessible
with self.assertRaises(Exception):
self.debug(
@@ -785,7 +783,6 @@ class TestLoadBalancingRule(cloudstackTestCase):
"SSH into VM (IPaddress: %s) & NAT Rule (Public IP: %s)" %
(self.vm_1.ipaddress, src_nat_ip_addr.ipaddress)
)
-
ssh_1 = remoteSSHClient(
src_nat_ip_addr.ipaddress,
self.services['lbrule']["publicport"],
@@ -1582,32 +1579,28 @@ class TestReleaseIP(cloudstackTestCase):
"Check if disassociated IP Address is no longer available"
)
+ self.debug("List NAT Rule response" + str(list_nat_rule))
# ListPortForwardingRules should not list
# associated rules with Public IP address
- list_nat_rule = list_nat_rules(
+ try:
+ list_nat_rule = list_nat_rules(
self.apiclient,
id=self.nat_rule.id
)
- self.debug("List NAT Rule response" + str(list_nat_rule))
- self.assertEqual(
- list_nat_rule,
- None,
- "Check if PF rules are no longer available for IP address"
- )
+ except cloudstackAPIException:
+ self.debug("Port Forwarding Rule is deleted")
# listLoadBalancerRules should not list
# associated rules with Public IP address
- list_lb_rule = list_lb_rules(
+ self.debug("List LB Rule response" + str(list_lb_rule))
+ try:
+ list_lb_rule = list_lb_rules(
self.apiclient,
id=self.lb_rule.id
)
- self.debug("List LB Rule response" + str(list_lb_rule))
- self.assertEqual(
- list_lb_rule,
- None,
- "Check if LB rules for IP Address are no longer available"
- )
+ except cloudstackAPIException:
+ self.debug("Port Forwarding Rule is deleted")
# SSH Attempt though public IP should fail
with self.assertRaises(Exception):
@@ -1720,16 +1713,9 @@ class TestDeleteAccount(cloudstackTestCase):
account=self.account.name,
domainid=self.account.domainid
)
- self.assertEqual(
- list_lb_reponse,
- None,
- "Check load balancing rule is properly deleted."
- )
- except Exception as e:
+ except cloudstackAPIException:
+ self.debug("Port Forwarding Rule is deleted")
- raise Exception(
- "Exception raised while fetching LB rules for account: %s" %
- self.account.name)
# ListPortForwardingRules should not
# list associated rules with deleted account
try:
@@ -1738,16 +1724,9 @@ class TestDeleteAccount(cloudstackTestCase):
account=self.account.name,
domainid=self.account.domainid
)
- self.assertEqual(
- list_nat_reponse,
- None,
- "Check load balancing rule is properly deleted."
- )
- except Exception as e:
+ except cloudstackAPIException:
+ self.debug("NATRule is deleted")
- raise Exception(
- "Exception raised while fetching NAT rules for account: %s" %
- self.account.name)
#Retrieve router for the user account
try:
routers = list_routers(
[48/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2657: listTemplatePermissions API should also include the owner of the template to the list of users having permission to launch
Changes:
- Add template owner to the list of users
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/780b45e2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/780b45e2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/780b45e2
Branch: refs/heads/object_store
Commit: 780b45e245aba1ca99d12fd4a8de88999642b4ae
Parents: 7e6f3f9
Author: Prachi Damle <pr...@cloud.com>
Authored: Thu May 23 16:32:34 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Thu May 23 16:33:07 2013 -0700
----------------------------------------------------------------------
.../com/cloud/template/TemplateManagerImpl.java | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/780b45e2/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index d4976cd..517d4ba 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1553,6 +1553,13 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
accountNames.add(acct.getAccountName());
}
}
+
+ // also add the owner if not public
+ if (!template.isPublicTemplate()) {
+ Account templateOwner = _accountDao.findById(template.getAccountId());
+ accountNames.add(templateOwner.getAccountName());
+ }
+
return accountNames;
}
[24/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-747: UI - create network offering - default sourceNat type as per account instead of per zone.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/29574267
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/29574267
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/29574267
Branch: refs/heads/object_store
Commit: 29574267c9776aed5d17d2495602f03bfb4c3487
Parents: e720e8a
Author: Jessica Wang <je...@apache.org>
Authored: Tue May 21 11:59:03 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Wed May 22 10:48:44 2013 -0700
----------------------------------------------------------------------
ui/scripts/configuration.js | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/29574267/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index fdeaba0..808b342 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -1741,9 +1741,9 @@
dependsOn: 'service.SourceNat.isEnabled',
select: function(args) {
args.response.success({
- data: [
- { id: 'perzone', description: 'Per zone'},
- { id: 'peraccount', description: 'Per account'}
+ data: [
+ { id: 'peraccount', description: 'Per account'},
+ { id: 'perzone', description: 'Per zone'}
]
});
}
[02/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Add base internal LB provider module
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0a443697
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0a443697
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0a443697
Branch: refs/heads/object_store
Commit: 0a443697ea48d48310a24c5e25a2298522183901
Parents: 92ad6ab
Author: Brian Federle <bf...@gmail.com>
Authored: Tue May 21 15:26:55 2013 -0700
Committer: Brian Federle <bf...@gmail.com>
Committed: Tue May 21 15:26:59 2013 -0700
----------------------------------------------------------------------
.../internalLbProvider/internalLbProvider.js | 182 +++++++++++++++
ui/modules/modules.js | 3 +-
2 files changed, 184 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a443697/ui/modules/internalLbProvider/internalLbProvider.js
----------------------------------------------------------------------
diff --git a/ui/modules/internalLbProvider/internalLbProvider.js b/ui/modules/internalLbProvider/internalLbProvider.js
new file mode 100644
index 0000000..aaa386e
--- /dev/null
+++ b/ui/modules/internalLbProvider/internalLbProvider.js
@@ -0,0 +1,182 @@
+// 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.
+(function($, cloudStack) {
+ cloudStack.modules.internalLbProvider = function(module) {
+ var internalLbDeviceViewAll = [
+ {
+ label: 'Devices',
+ path: '_zone.internalLbDevices'
+ }
+ ];
+
+ var internalLbListView = {
+ id: 'internalLbDevices',
+ fields: {
+ resourcename: { label: 'Resource Name' },
+ provider: { label: 'Provider' }
+ },
+ dataProvider: function(args) {
+ args.response.success({ data: [] });
+ },
+ actions: {
+ add: {
+ label: 'Add internal LB device',
+
+ messages: {
+ notification: function(args) {
+ return 'Add internal LB device';
+ }
+ },
+
+ createForm: {
+ title: 'Add internal LB device',
+ fields: {
+ hostname: {
+ label: 'label.host',
+ validation: { required: true }
+ },
+ username: {
+ label: 'label.username',
+ validation: { required: true }
+ },
+ password: {
+ label: 'label.password',
+ isPassword: true,
+ validation: { required: true }
+ }
+ }
+ },
+
+ action: function(args) {
+ args.response.success();
+ },
+
+ notification: {
+ poll: function(args) {
+ args.complete();
+ }
+ }
+ }
+ },
+
+ detailView: {
+ name: 'Internal LB resource details',
+ actions: {
+ remove: {
+ label: 'delete Internal LB resource',
+ messages: {
+ confirm: function(args) {
+ return 'Please confirm you want to delete Internal LB resource';
+ },
+ notification: function(args) {
+ return 'delete Internal LB resource';
+ }
+ },
+ action: function(args) {
+ args.response.success();
+ },
+ notification: {
+ poll: function(args) {
+ args.complete();
+ }
+ }
+ }
+ },
+
+ tabs: {
+ details: {
+ title: 'label.details',
+ fields: [
+ {
+ resourcename: { label: 'Resource Name' }
+ },
+ {
+ resourceid: { label: 'Resource ID'},
+ provider: { label: 'Provider' },
+ RESOURCE_NAME: { label: 'Resource Name'}
+ }
+ ],
+ dataProvider: function(args) {
+ args.response.success({ data: args.context.internalLbDevices[0] });
+ }
+ }
+ }
+ }
+ };
+
+ var internalLbProviderDetailView = {
+ id: 'internalLbProvider',
+ label: 'internal LB',
+ viewAll: internalLbDeviceViewAll,
+ tabs: {
+ details: {
+ title: 'label.details',
+ fields: [
+ {
+ name: { label: 'label.name' }
+ },
+ {
+ state: { label: 'label.state' },
+ id: { label: 'label.id' },
+ servicelist: {
+ label: 'Services',
+ converter: function(args){
+ if(args)
+ return args.join(', ');
+ else
+ return '';
+ }
+ }
+ }
+ ],
+ dataProvider: function(args) {
+ $.ajax({
+ url: createURL('listNetworkServiceProviders'),
+ data: {
+ name: 'InternalLb',
+ physicalnetworkid: args.context.physicalNetworks[0].id
+ },
+ success: function(json){
+ var items = json.listnetworkserviceprovidersresponse.networkserviceprovider;
+ if(items != null && items.length > 0) {
+ args.response.success({ data: items[0] });
+ }
+ else {
+ args.response.success({
+ data: {
+ name: 'InternalLb',
+ state: 'Disabled'
+ }
+ })
+ }
+ }
+ });
+ }
+ }
+ }
+ };
+
+ module.infrastructure.networkServiceProvider({
+ id: 'internalLb',
+ name: 'Internal LB',
+ //state: 'Disabled', //don't know state until log in and visit Infrastructure menu > zone detail > physical network > network service providers
+ listView: internalLbListView,
+
+ detailView: internalLbProviderDetailView
+ });
+ };
+}(jQuery, cloudStack));
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0a443697/ui/modules/modules.js
----------------------------------------------------------------------
diff --git a/ui/modules/modules.js b/ui/modules/modules.js
index d4502a1..3170122 100644
--- a/ui/modules/modules.js
+++ b/ui/modules/modules.js
@@ -18,6 +18,7 @@
cloudStack.modules = [
'infrastructure',
'vnmcNetworkProvider',
- 'vnmcAsa1000v'
+ 'vnmcAsa1000v',
+ 'internalLbProvider'
];
}(jQuery, cloudStack));
[29/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2627: disassociate ip address - assign return value of releaseIpAddress backend call to the result returned to the API caller
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c52879b8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c52879b8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c52879b8
Branch: refs/heads/object_store
Commit: c52879b88c4cc418289e87927f5c10ddbfe62f82
Parents: f41d398
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Wed May 22 16:14:47 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Wed May 22 16:14:47 2013 -0700
----------------------------------------------------------------------
.../user/address/DisassociateIPAddrCmd.java | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c52879b8/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
index 8f78fe3..41691ea 100644
--- a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java
@@ -76,9 +76,9 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd {
UserContext.current().setEventDetails("Ip Id: " + getIpAddressId());
boolean result = false;
if (!isPortable(id)) {
- _networkService.releaseIpAddress(getIpAddressId());
+ result = _networkService.releaseIpAddress(getIpAddressId());
} else {
- _networkService.releaseIpAddress(getIpAddressId());
+ result = _networkService.releaseIpAddress(getIpAddressId());
}
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
[21/50] [abbrv] CLOUDSTACK-2623. Provide appropriate AWS EC2 error
codes in error thrown by CS AWSAPI. Since CS has very few generic errorcode
groups,
in AWSAPI parse the response message and translate the CS error to AWS EC2
error code. Provide support
Posted by mc...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
index 9ac2bc6..1859bb8 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
@@ -25,12 +25,11 @@ import java.security.SignatureException;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import java.util.UUID;
import javax.inject.Inject;
@@ -67,7 +66,6 @@ import com.cloud.stack.models.CloudStackPasswordData;
import com.cloud.stack.models.CloudStackResourceLimit;
import com.cloud.stack.models.CloudStackResourceTag;
import com.cloud.stack.models.CloudStackSecurityGroup;
-import com.cloud.stack.models.CloudStackSecurityGroupIngress;
import com.cloud.stack.models.CloudStackSnapshot;
import com.cloud.stack.models.CloudStackTemplate;
import com.cloud.stack.models.CloudStackTemplatePermission;
@@ -227,7 +225,7 @@ public class EC2Engine extends ManagerBase {
return true;
} catch(Exception e) {
logger.error("Validate account failed!");
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ throw new EC2ServiceException(ClientError.AuthFailure, "User not authorised");
}
}
@@ -247,8 +245,9 @@ public class EC2Engine extends ManagerBase {
return false;
} catch( Exception e ) {
logger.error( "EC2 CreateSecurityGroup - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return false;
}
/**
@@ -266,8 +265,9 @@ public class EC2Engine extends ManagerBase {
return false;
} catch( Exception e ) {
logger.error( "EC2 DeleteSecurityGroup - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return false;
}
/**
@@ -276,19 +276,19 @@ public class EC2Engine extends ManagerBase {
* @param request
* @return
*/
- public EC2DescribeSecurityGroupsResponse describeSecurityGroups(EC2DescribeSecurityGroups request)
- {
+ public EC2DescribeSecurityGroupsResponse describeSecurityGroups(EC2DescribeSecurityGroups request) {
+ EC2DescribeSecurityGroupsResponse response = new EC2DescribeSecurityGroupsResponse();
try {
- EC2DescribeSecurityGroupsResponse response = listSecurityGroups( request.getGroupSet());
+ response = listSecurityGroups( request.getGroupSet());
EC2GroupFilterSet gfs = request.getFilterSet();
-
- if ( null == gfs )
- return response;
- else return gfs.evaluate( response );
+ if ( gfs != null ) {
+ response = gfs.evaluate( response );
+ }
} catch( Exception e ) {
logger.error( "EC2 DescribeSecurityGroups - ", e);
- throw new EC2ServiceException(ServerError.InternalError, "An unexpected error occurred.");
+ handleException(e);
}
+ return response;
}
/**
@@ -300,7 +300,6 @@ public class EC2Engine extends ManagerBase {
*/
public boolean revokeSecurityGroup( EC2AuthorizeRevokeSecurityGroup request )
{
- if (null == request.getName()) throw new EC2ServiceException(ServerError.InternalError, "Name is a required parameter");
try {
String[] groupSet = new String[1];
groupSet[0] = request.getName();
@@ -310,6 +309,9 @@ public class EC2Engine extends ManagerBase {
EC2DescribeSecurityGroupsResponse response = listSecurityGroups( groupSet );
EC2SecurityGroup[] groups = response.getGroupSet();
+ if ( groups.length == 0 ) {
+ throw new Exception("Unable to find security group name");
+ }
for (EC2SecurityGroup group : groups) {
EC2IpPermission[] perms = group.getIpPermissionSet();
@@ -320,17 +322,16 @@ public class EC2Engine extends ManagerBase {
}
if (null == ruleId)
- throw new EC2ServiceException(ClientError.InvalidGroup_NotFound, "Cannot find matching ruleid.");
-
+ throw new Exception("Specified Ip permission is invalid");
CloudStackInfoResponse resp = getApi().revokeSecurityGroupIngress(ruleId);
if (resp != null) {
return resp.getSuccess();
}
- return false;
} catch( Exception e ) {
logger.error( "EC2 revokeSecurityGroupIngress" + " - " + e.getMessage());
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
- }
+ handleException(e);
+ }
+ return false;
}
/**
@@ -338,10 +339,7 @@ public class EC2Engine extends ManagerBase {
*
* @param request - ip permission parameters
*/
- public boolean authorizeSecurityGroup(EC2AuthorizeRevokeSecurityGroup request )
- {
- if (null == request.getName()) throw new EC2ServiceException(ServerError.InternalError, "Name is a required parameter");
-
+ public boolean authorizeSecurityGroup(EC2AuthorizeRevokeSecurityGroup request ) {
EC2IpPermission[] items = request.getIpPermissionSet();
try {
@@ -374,7 +372,7 @@ public class EC2Engine extends ManagerBase {
}
} catch(Exception e) {
logger.error( "EC2 AuthorizeSecurityGroupIngress - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
return true;
}
@@ -444,13 +442,14 @@ public class EC2Engine extends ManagerBase {
* @param request
* @return
*/
- public EC2DescribeSnapshotsResponse handleRequest( EC2DescribeSnapshots request )
+ public EC2DescribeSnapshotsResponse describeSnapshots( EC2DescribeSnapshots request )
{
+ EC2DescribeSnapshotsResponse response = new EC2DescribeSnapshotsResponse();
EC2SnapshotFilterSet sfs = request.getFilterSet();
EC2TagKeyValue[] tagKeyValueSet = request.getResourceTagSet();
try {
- EC2DescribeSnapshotsResponse response = listSnapshots( request.getSnapshotSet(),
+ response = listSnapshots( request.getSnapshotSet(),
getResourceTags(tagKeyValueSet));
if (response == null) {
return new EC2DescribeSnapshotsResponse();
@@ -475,17 +474,14 @@ public class EC2Engine extends ManagerBase {
}
snap.setVolumeSize(size);
}
- if ( null == sfs )
- return response;
- else return sfs.evaluate( response );
- } catch( EC2ServiceException error ) {
- logger.error( "EC2 DescribeSnapshots - ", error);
- throw error;
-
+ if (sfs != null) {
+ response = sfs.evaluate( response );
+ }
} catch( Exception e ) {
logger.error( "EC2 DescribeSnapshots - ", e);
- throw new EC2ServiceException(ServerError.InternalError, "An unexpected error occurred.");
+ handleException(e);
}
+ return response;
}
/**
@@ -495,14 +491,12 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2Snapshot createSnapshot( String volumeId ) {
+ EC2Snapshot ec2Snapshot = new EC2Snapshot();
try {
-
CloudStackSnapshot snap = getApi().createSnapshot(volumeId, null, null, null);
if (snap == null) {
- throw new EC2ServiceException(ServerError.InternalError, "Unable to create snapshot!");
+ throw new Exception("Unable to create snapshot");
}
- EC2Snapshot ec2Snapshot = new EC2Snapshot();
-
ec2Snapshot.setId(snap.getId());
ec2Snapshot.setName(snap.getName());
ec2Snapshot.setType(snap.getSnapshotType());
@@ -518,12 +512,11 @@ public class EC2Engine extends ManagerBase {
Long sizeInGB = vols.get(0).getSize().longValue()/1073741824;
ec2Snapshot.setVolumeSize(sizeInGB);
}
-
- return ec2Snapshot;
} catch( Exception e ) {
logger.error( "EC2 CreateSnapshot - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return ec2Snapshot;
}
/**
@@ -543,8 +536,9 @@ public class EC2Engine extends ManagerBase {
return false;
} catch(Exception e) {
logger.error( "EC2 DeleteSnapshot - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return false;
}
@@ -595,15 +589,11 @@ public class EC2Engine extends ManagerBase {
}
return false;
}
-
} catch (Exception e) {
logger.error( "EC2 modifyImageAttribute - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
-
return false;
-
-
}
public EC2ImageAttributes describeImageAttribute(EC2DescribeImageAttribute request) {
@@ -632,7 +622,7 @@ public class EC2Engine extends ManagerBase {
} catch (Exception e) {
logger.error( "EC2 describeImageAttribute - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
return imageAtts;
@@ -646,18 +636,18 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2PasswordData getPasswordData(String instanceId) {
+ EC2PasswordData passwdData = new EC2PasswordData();
try {
CloudStackPasswordData resp = getApi().getVMPassword(instanceId);
- EC2PasswordData passwdData = new EC2PasswordData();
if (resp != null) {
passwdData.setInstanceId(instanceId);
passwdData.setEncryptedPassword(resp.getEncryptedpassword());
}
- return passwdData;
} catch(Exception e) {
logger.error("EC2 GetPasswordData - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return passwdData;
}
/**
@@ -667,18 +657,17 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2DescribeKeyPairsResponse describeKeyPairs( EC2DescribeKeyPairs request ) {
+ EC2DescribeKeyPairsResponse response = new EC2DescribeKeyPairsResponse();
try {
- EC2DescribeKeyPairsResponse response = listKeyPairs(request.getKeyNames());
+ response = listKeyPairs(request.getKeyNames());
EC2KeyPairFilterSet kfs = request.getKeyFilterSet();
-
- if (kfs == null)
- return response;
- else
- return kfs.evaluate(response);
+ if (kfs != null)
+ response = kfs.evaluate(response);
} catch(Exception e) {
logger.error("EC2 DescribeKeyPairs - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return response;
}
/**
@@ -688,17 +677,18 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public boolean deleteKeyPair( EC2DeleteKeyPair request ) {
+ CloudStackInfoResponse resp = new CloudStackInfoResponse();
+ String keyPairName = request.getKeyName();
try {
- CloudStackInfoResponse resp = getApi().deleteSSHKeyPair(request.getKeyName(), null, null);
+ resp = getApi().deleteSSHKeyPair(keyPairName, null, null);
if (resp == null) {
throw new Exception("Ivalid CloudStack API response");
}
-
- return resp.getSuccess();
} catch(Exception e) {
logger.error("EC2 DeleteKeyPair - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return resp.getSuccess();
}
/**
@@ -708,22 +698,21 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2SSHKeyPair createKeyPair(EC2CreateKeyPair request) {
+ String keyPairName = request.getKeyName();
+ EC2SSHKeyPair response = new EC2SSHKeyPair();
try {
- CloudStackKeyPair resp = getApi().createSSHKeyPair(request.getKeyName(), null, null);
+ CloudStackKeyPair resp = getApi().createSSHKeyPair(keyPairName, null, null);
if (resp == null) {
throw new Exception("Ivalid CloudStack API response");
}
-
- EC2SSHKeyPair response = new EC2SSHKeyPair();
response.setFingerprint(resp.getFingerprint());
response.setKeyName(resp.getName());
response.setPrivateKey(resp.getPrivatekey());
-
- return response;
} catch (Exception e) {
logger.error("EC2 CreateKeyPair - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return response;
}
/**
@@ -733,22 +722,20 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2SSHKeyPair importKeyPair( EC2ImportKeyPair request ) {
+ EC2SSHKeyPair response = new EC2SSHKeyPair();
try {
CloudStackKeyPair resp = getApi().registerSSHKeyPair(request.getKeyName(), request.getPublicKeyMaterial());
if (resp == null) {
throw new Exception("Ivalid CloudStack API response");
}
-
- EC2SSHKeyPair response = new EC2SSHKeyPair();
response.setFingerprint(resp.getFingerprint());
response.setKeyName(resp.getName());
response.setPrivateKey(resp.getPrivatekey());
-
- return response;
} catch (Exception e) {
logger.error("EC2 ImportKeyPair - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return response;
}
/**
@@ -758,18 +745,17 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2DescribeAddressesResponse describeAddresses( EC2DescribeAddresses request ) {
+ EC2DescribeAddressesResponse response = new EC2DescribeAddressesResponse();
try {
- EC2DescribeAddressesResponse response = listAddresses(request.getPublicIpsSet());
+ response = listAddresses(request.getPublicIpsSet());
EC2AddressFilterSet afs = request.getFilterSet();
-
- if (afs ==null)
- return response;
- else
- return afs.evaluate(response);
+ if (afs != null)
+ response = afs.evaluate(response);
} catch(Exception e) {
logger.error("EC2 DescribeAddresses - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return response;
}
/**
@@ -782,7 +768,7 @@ public class EC2Engine extends ManagerBase {
try {
List<CloudStackIpAddress> cloudIps = getApi().listPublicIpAddresses(null, null, null, null, null, request.getPublicIp(), null, null, null);
if (cloudIps == null)
- throw new EC2ServiceException(ServerError.InternalError, "Specified ipAddress doesn't exist");
+ throw new Exception("Specified ipAddress doesn't exist");
CloudStackIpAddress cloudIp = cloudIps.get(0);
CloudStackInfoResponse resp = getApi().disassociateIpAddress(cloudIp.getId());
if (resp != null) {
@@ -790,7 +776,7 @@ public class EC2Engine extends ManagerBase {
}
} catch(Exception e) {
logger.error("EC2 ReleaseAddress - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
return false;
}
@@ -805,13 +791,13 @@ public class EC2Engine extends ManagerBase {
try {
List<CloudStackIpAddress> cloudIps = getApi().listPublicIpAddresses(null, null, null, null, null, request.getPublicIp(), null, null, null);
if (cloudIps == null)
- throw new EC2ServiceException(ServerError.InternalError, "Specified ipAddress doesn't exist");
+ throw new Exception("Specified ipAddress doesn't exist");
CloudStackIpAddress cloudIp = cloudIps.get(0);
List<CloudStackUserVm> vmList = getApi().listVirtualMachines(null, null, true, null, null, null, null,
request.getInstanceId(), null, null, null, null, null, null, null, null, null);
if (vmList == null || vmList.size() == 0) {
- throw new EC2ServiceException(ServerError.InternalError, "Specified instance-id doesn't exist");
+ throw new Exception("Instance not found");
}
CloudStackUserVm cloudVm = vmList.get(0);
@@ -821,7 +807,7 @@ public class EC2Engine extends ManagerBase {
}
} catch(Exception e) {
logger.error( "EC2 AssociateAddress - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
return false;
}
@@ -836,7 +822,7 @@ public class EC2Engine extends ManagerBase {
try {
List<CloudStackIpAddress> cloudIps = getApi().listPublicIpAddresses(null, null, null, null, null, request.getPublicIp(), null, null, null);
if (cloudIps == null)
- throw new EC2ServiceException(ServerError.InternalError, "Specified ipAddress doesn't exist");
+ throw new Exception("Specified ipAddress doesn't exist");
CloudStackIpAddress cloudIp = cloudIps.get(0);
CloudStackInfoResponse resp = getApi().disableStaticNat(cloudIp.getId());
@@ -845,7 +831,7 @@ public class EC2Engine extends ManagerBase {
}
} catch(Exception e) {
logger.error( "EC2 DisassociateAddress - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
return false;
}
@@ -856,10 +842,9 @@ public class EC2Engine extends ManagerBase {
* @param request
* @return
*/
- public EC2Address allocateAddress()
- {
+ public EC2Address allocateAddress() {
+ EC2Address ec2Address = new EC2Address();
try {
- EC2Address ec2Address = new EC2Address();
// this gets our networkId
CloudStackAccount caller = getCurrentAccount();
@@ -881,12 +866,11 @@ public class EC2Engine extends ManagerBase {
} else {
ec2Address.setIpAddress(resp.getIpAddress());
}
-
- return ec2Address;
} catch(Exception e) {
logger.error( "EC2 AllocateAddress - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return ec2Address;
}
/**
@@ -896,10 +880,8 @@ public class EC2Engine extends ManagerBase {
* @param request
* @return
*/
- public EC2DescribeImagesResponse describeImages(EC2DescribeImages request)
- {
+ public EC2DescribeImagesResponse describeImages(EC2DescribeImages request) {
EC2DescribeImagesResponse images = new EC2DescribeImagesResponse();
-
try {
String[] templateIds = request.getImageSet();
EC2ImageFilterSet ifs = request.getFilterSet();
@@ -911,14 +893,13 @@ public class EC2Engine extends ManagerBase {
images = listTemplates(s, images);
}
}
- if (ifs == null)
- return images;
- else
+ if (ifs != null)
return ifs.evaluate(images);
} catch( Exception e ) {
logger.error( "EC2 DescribeImages - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return images;
}
/**
@@ -938,10 +919,9 @@ public class EC2Engine extends ManagerBase {
*/
public EC2CreateImageResponse createImage(EC2CreateImage request)
{
- EC2CreateImageResponse response = null;
+ EC2CreateImageResponse response = new EC2CreateImageResponse();
boolean needsRestart = false;
String volumeId = null;
-
try {
// [A] Creating a template from a VM volume should be from the ROOT volume
// Also for this to work the VM must be in a Stopped state so we 'reboot' it if its not
@@ -954,7 +934,7 @@ public class EC2Engine extends ManagerBase {
if (vmState.equalsIgnoreCase( "running" ) || vmState.equalsIgnoreCase( "starting" )) {
needsRestart = true;
if (!stopVirtualMachine( request.getInstanceId() ))
- throw new EC2ServiceException(ClientError.IncorrectState, "CreateImage - instance must be in a stopped state");
+ throw new Exception("Instance must be in a stopped state");
}
volumeId = vol.getId();
break;
@@ -975,25 +955,22 @@ public class EC2Engine extends ManagerBase {
CloudStackTemplate resp = getApi().createTemplate((request.getDescription() == null ? "" : request.getDescription()), request.getName(),
osTypeId, null, null, null, null, null, null, volumeId);
if (resp == null || resp.getId() == null) {
- throw new EC2ServiceException(ServerError.InternalError, "An upexpected error occurred.");
+ throw new Exception("Image couldn't be created");
}
//if template was created succesfully, create the new image response
- response = new EC2CreateImageResponse();
response.setId(resp.getId());
// [C] If we stopped the virtual machine now we need to restart it
if (needsRestart) {
- if (!startVirtualMachine( request.getInstanceId() ))
- throw new EC2ServiceException(ServerError.InternalError,
- "CreateImage - restarting instance " + request.getInstanceId() + " failed");
+ if (!startVirtualMachine( request.getInstanceId() ))
+ throw new Exception("Failed to start the stopped instance");
}
- return response;
-
} catch( Exception e ) {
logger.error( "EC2 CreateImage - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return response;
}
/**
@@ -1002,13 +979,9 @@ public class EC2Engine extends ManagerBase {
* @param request
* @return
*/
- public EC2CreateImageResponse registerImage(EC2RegisterImage request)
- {
+ public EC2CreateImageResponse registerImage(EC2RegisterImage request) {
+ EC2CreateImageResponse image = new EC2CreateImageResponse();
try {
- CloudStackAccount caller = getCurrentAccount();
- if (null == request.getName())
- throw new EC2ServiceException(ClientError.Unsupported, "Missing parameter - name");
-
List<CloudStackTemplate> templates = getApi().registerTemplate((request.getDescription() == null ? request.getName() : request.getDescription()),
request.getFormat(), request.getHypervisor(), request.getName(), toOSTypeId(request.getOsTypeName()), request.getLocation(),
toZoneId(request.getZoneName(), null), null, null, null, null, null, null, null, null, null);
@@ -1016,17 +989,16 @@ public class EC2Engine extends ManagerBase {
// technically we will only ever register a single template...
for (CloudStackTemplate template : templates) {
if (template != null && template.getId() != null) {
- EC2CreateImageResponse image = new EC2CreateImageResponse();
image.setId(template.getId().toString());
return image;
}
}
}
- return null;
} catch( Exception e ) {
logger.error( "EC2 RegisterImage - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return image;
}
/**
@@ -1044,8 +1016,9 @@ public class EC2Engine extends ManagerBase {
return resp.getSuccess();
} catch( Exception e ) {
logger.error( "EC2 DeregisterImage - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return false;
}
/**
@@ -1055,14 +1028,16 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2DescribeInstancesResponse describeInstances(EC2DescribeInstances request ) {
+ EC2DescribeInstancesResponse response = new EC2DescribeInstancesResponse();
try {
EC2TagKeyValue[] tagKeyValueSet = request.getResourceTagSet();
- return listVirtualMachines( request.getInstancesSet(), request.getFilterSet(),
+ response = listVirtualMachines( request.getInstancesSet(), request.getFilterSet(),
getResourceTags(tagKeyValueSet));
} catch( Exception e ) {
logger.error( "EC2 DescribeInstances - " ,e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return response;
}
/**
@@ -1071,22 +1046,18 @@ public class EC2Engine extends ManagerBase {
* @param request
* @return
*/
- public EC2DescribeAvailabilityZonesResponse handleRequest(EC2DescribeAvailabilityZones request) {
+ public EC2DescribeAvailabilityZonesResponse describeAvailabilityZones(EC2DescribeAvailabilityZones request) {
+ EC2DescribeAvailabilityZonesResponse availableZones = new EC2DescribeAvailabilityZonesResponse();
try {
- EC2DescribeAvailabilityZonesResponse availableZones = listZones(request.getZoneSet(), null);
+ availableZones = listZones(request.getZoneSet(), null);
EC2AvailabilityZonesFilterSet azfs = request.getFilterSet();
- if ( null == azfs )
- return availableZones;
- else
- return azfs.evaluate(availableZones);
- } catch( EC2ServiceException error ) {
- logger.error( "EC2 DescribeAvailabilityZones - ", error);
- throw error;
-
+ if ( azfs != null )
+ availableZones = azfs.evaluate(availableZones);
} catch( Exception e ) {
logger.error( "EC2 DescribeAvailabilityZones - " ,e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return availableZones;
}
/**
@@ -1095,7 +1066,7 @@ public class EC2Engine extends ManagerBase {
* @param request
* @return
*/
- public EC2DescribeVolumesResponse handleRequest( EC2DescribeVolumes request ) {
+ public EC2DescribeVolumesResponse describeVolumes( EC2DescribeVolumes request ) {
EC2DescribeVolumesResponse volumes = new EC2DescribeVolumesResponse();
EC2VolumeFilterSet vfs = request.getFilterSet();
EC2TagKeyValue[] tagKeyValueSet = request.getResourceTagSet();
@@ -1107,14 +1078,13 @@ public class EC2Engine extends ManagerBase {
for (String s : volumeIds)
volumes = listVolumes(s, null, volumes, getResourceTags(tagKeyValueSet) );
}
-
- if ( null == vfs )
- return volumes;
- else return vfs.evaluate( volumes );
+ if ( vfs != null )
+ volumes = vfs.evaluate( volumes );
} catch( Exception e ) {
logger.error( "EC2 DescribeVolumes - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return volumes;
}
/**
@@ -1124,10 +1094,9 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2Volume attachVolume( EC2Volume request ) {
+ EC2Volume resp = new EC2Volume();
try {
request.setDeviceId(mapDeviceToCloudDeviceId(request.getDevice()));
- EC2Volume resp = new EC2Volume();
-
CloudStackVolume vol = getApi().attachVolume(request.getId(), request.getInstanceId(), request.getDeviceId());
if(vol != null) {
resp.setAttached(vol.getAttached());
@@ -1144,13 +1113,12 @@ public class EC2Engine extends ManagerBase {
resp.setVMState(vol.getVirtualMachineState());
resp.setAttachmentState(mapToAmazonVolumeAttachmentState(vol.getVirtualMachineState()));
resp.setZoneName(vol.getZoneName());
- return resp;
}
- throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occurred." );
} catch( Exception e ) {
- logger.error( "EC2 AttachVolume 2 - ", e);
- throw new EC2ServiceException( ServerError.InternalError, e.getMessage() != null ? e.getMessage() : e.toString());
- }
+ logger.error( "EC2 AttachVolume - ", e);
+ handleException(e);
+ }
+ return resp;
}
/**
@@ -1160,10 +1128,27 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2Volume detachVolume(EC2Volume request) {
+ EC2Volume resp = new EC2Volume();
try {
- CloudStackVolume vol = getApi().detachVolume(null, request.getId(), null);
- EC2Volume resp = new EC2Volume();
+ // verifying if instanceId and deviceId provided is valid
+ EC2DescribeVolumesResponse volumes = new EC2DescribeVolumesResponse();
+ volumes = listVolumes(request.getId(), null, volumes, null);
+ if (volumes != null) {
+ EC2Volume[] volumeSet = volumes.getVolumeSet();
+ if (request.getInstanceId() != null) {
+ if ( !request.getInstanceId().equalsIgnoreCase(volumeSet[0].getInstanceId()) )
+ throw new Exception("Volume is not attached to the Instance");
+ }
+ if (request.getDevice() != null) {
+ String devicePath = null;
+ if ( volumeSet[0].getDeviceId() != null )
+ devicePath = cloudDeviceIdToDevicePath( volumeSet[0].getHypervisor(), volumeSet[0].getDeviceId());
+ if ( !request.getDevice().equalsIgnoreCase(devicePath) )
+ throw new Exception("Volume is not attached to the Device");
+ }
+ }
+ CloudStackVolume vol = getApi().detachVolume(null , request.getId(), null);
if(vol != null) {
resp.setAttached(vol.getAttached());
resp.setCreated(vol.getCreated());
@@ -1178,14 +1163,12 @@ public class EC2Engine extends ManagerBase {
resp.setType(vol.getVolumeType());
resp.setVMState(vol.getVirtualMachineState());
resp.setZoneName(vol.getZoneName());
- return resp;
}
-
- throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occurred." );
} catch( Exception e ) {
logger.error( "EC2 DetachVolume - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
- }
+ handleException(e);
+ }
+ return resp;
}
/**
@@ -1195,9 +1178,8 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2Volume createVolume( EC2CreateVolume request ) {
+ EC2Volume resp = new EC2Volume();
try {
-
- CloudStackAccount caller = getCurrentAccount();
// -> put either snapshotid or diskofferingid on the request
String snapshotId = request.getSnapshotId();
Long size = request.getSize();
@@ -1216,7 +1198,6 @@ public class EC2Engine extends ManagerBase {
// // -> no volume name is given in the Amazon request but is required in the cloud API
CloudStackVolume vol = getApi().createVolume(UUID.randomUUID().toString(), null, diskOfferingId, null, size, snapshotId, toZoneId(request.getZoneName(), null));
if (vol != null) {
- EC2Volume resp = new EC2Volume();
resp.setAttached(vol.getAttached());
resp.setCreated(vol.getCreated());
// resp.setDevice();
@@ -1231,13 +1212,12 @@ public class EC2Engine extends ManagerBase {
resp.setVMState(vol.getVirtualMachineState());
resp.setAttachmentState("detached");
resp.setZoneName(vol.getZoneName());
- return resp;
}
- return null;
} catch( Exception e ) {
logger.error( "EC2 CreateVolume - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
- }
+ handleException(e);
+ }
+ return resp;
}
/**
@@ -1251,14 +1231,12 @@ public class EC2Engine extends ManagerBase {
CloudStackInfoResponse resp = getApi().deleteVolume(request.getId());
if(resp != null) {
request.setState("deleted");
- return request;
}
-
- throw new EC2ServiceException(ServerError.InternalError, "An unexpected error occurred.");
} catch( Exception e ) {
- logger.error( "EC2 DeleteVolume 2 - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
- }
+ logger.error( "EC2 DeleteVolume - ", e);
+ handleException(e);
+ }
+ return request;
}
/**
@@ -1295,9 +1273,9 @@ public class EC2Engine extends ManagerBase {
return true;
} catch (Exception e){
logger.error( "EC2 Create/Delete Tags - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ?
- e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return false;
}
/**
@@ -1307,11 +1285,11 @@ public class EC2Engine extends ManagerBase {
* @return
*/
public EC2DescribeTagsResponse describeTags (EC2DescribeTags request) {
+ EC2DescribeTagsResponse tagResponse = new EC2DescribeTagsResponse();
try {
- EC2DescribeTagsResponse tagResponse = new EC2DescribeTagsResponse();
+ tagResponse = new EC2DescribeTagsResponse();
List<CloudStackResourceTag> resourceTagList = getApi().listTags(null, null, null, true, null);
- List<EC2ResourceTag> tagList = new ArrayList<EC2ResourceTag>();
if (resourceTagList != null && resourceTagList.size() > 0) {
for (CloudStackResourceTag resourceTag: resourceTagList) {
EC2ResourceTag tag = new EC2ResourceTag();
@@ -1325,14 +1303,13 @@ public class EC2Engine extends ManagerBase {
}
EC2TagsFilterSet tfs = request.getFilterSet();
- if (tfs == null)
- return tagResponse;
- else
- return tfs.evaluate(tagResponse);
+ if (tfs != null)
+ tagResponse = tfs.evaluate(tagResponse);
} catch(Exception e) {
logger.error("EC2 DescribeTags - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ handleException(e);
}
+ return tagResponse;
}
/**
@@ -1362,13 +1339,14 @@ public class EC2Engine extends ManagerBase {
// -> if some specified VMs where not found we have to tell the caller
if (instanceSet.length != vms.length)
- throw new EC2ServiceException(ClientError.InvalidAMIID_NotFound, "One or more instanceIds do not exist, other instances rebooted.");
+ throw new Exception("One or more instanceIds do not exist, other instances rebooted.");
return true;
} catch( Exception e ) {
logger.error( "EC2 RebootInstances - ", e );
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return false;
}
/**
@@ -1384,15 +1362,13 @@ public class EC2Engine extends ManagerBase {
int countCreated = 0;
try {
- CloudStackAccount caller = getCurrentAccount();
-
// ugly...
canCreateInstances = calculateAllowedInstances();
if (-1 == canCreateInstances) canCreateInstances = request.getMaxCount();
if (canCreateInstances < request.getMinCount()) {
logger.info( "EC2 RunInstances - min count too big (" + request.getMinCount() + "), " + canCreateInstances + " left to allocate");
- throw new EC2ServiceException(ClientError.InstanceLimitExceeded ,"Only " + canCreateInstances + " instance(s) left to allocate");
+ throw new Exception("Min Count is greater than the number of instances left to allocate");
}
if ( canCreateInstances < request.getMaxCount())
@@ -1408,7 +1384,7 @@ public class EC2Engine extends ManagerBase {
CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType);
if(svcOffering == null){
logger.info("No ServiceOffering found to be defined by name, please contact the administrator "+instanceType );
- throw new EC2ServiceException(ClientError.Unsupported, "instanceType: [" + instanceType + "] not found!");
+ throw new Exception("instanceType not found");
}
// zone stuff
@@ -1417,7 +1393,7 @@ public class EC2Engine extends ManagerBase {
List<CloudStackZone> zones = getApi().listZones(null, null, zoneId, null);
if (zones == null || zones.size() == 0) {
logger.info("EC2 RunInstances - zone [" + request.getZoneName() + "] not found!");
- throw new EC2ServiceException(ClientError.InvalidZone_NotFound, "ZoneId [" + request.getZoneName() + "] not found!");
+ throw new Exception("zone not found");
}
// we choose first zone?
CloudStackZone zone = zones.get(0);
@@ -1467,19 +1443,17 @@ public class EC2Engine extends ManagerBase {
logger.error("Failed to deploy VM number: "+ (i+1) +" due to error: "+e.getMessage());
break;
}
- }
-
+ }
if (0 == countCreated) {
// TODO, we actually need to destroy left-over VMs when the exception is thrown
- throw new EC2ServiceException(ServerError.InternalError, "Failed to deploy instances" );
+ throw new Exception("Insufficient Instance Capacity");
}
logger.debug("Could deploy "+ countCreated + " VM's successfully");
-
- return instances;
} catch( Exception e ) {
logger.error( "EC2 RunInstances - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return instances;
}
/**
@@ -1515,11 +1489,11 @@ public class EC2Engine extends ManagerBase {
}
instances.addInstance(vm);
}
- return instances;
} catch( Exception e ) {
logger.error( "EC2 StartInstances - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ handleException(e);
}
+ return instances;
}
/**
@@ -1566,11 +1540,48 @@ public class EC2Engine extends ManagerBase {
instances.addInstance(vm);
}
}
- return instances;
} catch( Exception e ) {
logger.error( "EC2 StopInstances - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() + ", might already be destroyed" : "An unexpected error occurred.");
+ handleException(e);
}
+ return instances;
+ }
+
+ /**
+ * @param request
+ * @return
+ * @throws Exception
+ */
+ public boolean modifyInstanceAttribute(EC2ModifyInstanceAttribute request) {
+ boolean status = true;
+ String instanceId = request.getInstanceId();
+ try {
+ // AWS requires VM to be in stopped state to modify 'InstanceType' and 'UserData'
+ EC2DescribeInstancesResponse vmResponse = new EC2DescribeInstancesResponse();
+ vmResponse = lookupInstances(instanceId, vmResponse, null);
+ EC2Instance[] instances = vmResponse.getInstanceSet();
+ if ( !instances[0].getState().equalsIgnoreCase("stopped")) {
+ throw new Exception("Cannot modify, instance should be in stopped state");
+ }
+
+ if (request.getInstanceType() != null) {
+ String instanceType = request.getInstanceType();
+ CloudStackServiceOfferingVO svcOffering = getCSServiceOfferingId(instanceType);
+ if (svcOffering == null)
+ throw new Exception("instanceType not found");
+ CloudStackUserVm userVm = getApi().changeServiceForVirtualMachine(instanceId, svcOffering.getId());
+ status = (userVm != null);
+ }
+ if (status != false && request.getUserData() != null) {
+ CloudStackUserVm userVm = getApi().updateVirtualMachine(instanceId, null, null, null,
+ null, request.getUserData());
+ status = (userVm != null);
+ }
+ } catch (Exception e) {
+ logger.error("ModifyInstanceAttribute - ", e);
+ handleException(e);
+ }
+ return status;
}
/**
@@ -1719,7 +1730,7 @@ public class EC2Engine extends ManagerBase {
zones = listZones(interestedZones, domainId);
if (zones == null || zones.getAvailabilityZoneSet().length == 0)
- throw new EC2ServiceException(ClientError.InvalidParameterValue, "Unknown zoneName value - " + zoneName);
+ throw new Exception("Unknown zoneName value");
EC2AvailabilityZone[] zoneSet = zones.getAvailabilityZoneSet();
return zoneSet[0].getId();
@@ -1731,15 +1742,22 @@ public class EC2Engine extends ManagerBase {
*
*/
- private CloudStackServiceOfferingVO getCSServiceOfferingId(String instanceType){
+ private CloudStackServiceOfferingVO getCSServiceOfferingId(String instanceType) throws Exception {
try {
- if (null == instanceType) instanceType = "m1.small";
+ // list of valid values for AWS EC2 instanceType
+ String[] validInstanceTypes = {"t1.micro", "m1.small", "m1.medium", "m1.large", "m1.xlarge",
+ "c1.medium", "c1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge",
+ "m3.xlarge", "m3.2xlarge", "hi1.4xlarge", "cc1.4xlarge", "cg1.4xlarge", "cc2.8xlarge"};
+ if (instanceType == null)
+ instanceType = "m1.small"; // default value
+ else if ( !Arrays.asList(validInstanceTypes).contains(instanceType)) {
+ throw new Exception("Specified instance type is invalid");
+ }
return scvoDao.getSvcOfferingByName(instanceType);
-
} catch(Exception e) {
logger.error( "Error while retrieving ServiceOffering information by name - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ throw new Exception("No ServiceOffering found to be defined by name");
}
}
@@ -1751,7 +1769,7 @@ public class EC2Engine extends ManagerBase {
* @return A valid value for the Amazon defined instanceType
* @throws SQLException, ClassNotFoundException, IllegalAccessException, InstantiationException
*/
- private String serviceOfferingIdToInstanceType( String serviceOfferingId ){
+ private String serviceOfferingIdToInstanceType( String serviceOfferingId ) throws Exception {
try{
CloudStackServiceOfferingVO offering = scvoDao.getSvcOfferingById(serviceOfferingId); //dao.getSvcOfferingById(serviceOfferingId);
@@ -1762,8 +1780,8 @@ public class EC2Engine extends ManagerBase {
return offering.getName();
}
catch(Exception e) {
- logger.error( "sError while retrieving ServiceOffering information by id - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ logger.error( "Error while retrieving ServiceOffering information by id - ", e);
+ throw new Exception( e.getMessage() != null ? e.getMessage() : e.toString() );
}
}
@@ -1784,7 +1802,7 @@ public class EC2Engine extends ManagerBase {
return null;
} catch(Exception e) {
logger.error( "List OS Types - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ throw new Exception( e.getMessage() != null ? e.getMessage() : e.toString() );
}
}
@@ -1898,7 +1916,7 @@ public class EC2Engine extends ManagerBase {
}else{
if(instanceId != null){
//no such instance found
- throw new EC2ServiceException(ServerError.InternalError, "Instance:" + instanceId + " not found");
+ throw new Exception("Instance not found");
}
}
return instances;
@@ -1915,7 +1933,7 @@ public class EC2Engine extends ManagerBase {
* @return the same object passed in as the "images" parameter modified with one or more
* EC2Image objects loaded.
*/
- private EC2DescribeImagesResponse listTemplates( String templateId, EC2DescribeImagesResponse images ) throws EC2ServiceException {
+ private EC2DescribeImagesResponse listTemplates( String templateId, EC2DescribeImagesResponse images ) throws Exception {
try {
List<CloudStackTemplate> result = new ArrayList<CloudStackTemplate>();
@@ -1985,7 +2003,7 @@ public class EC2Engine extends ManagerBase {
return images;
} catch(Exception e) {
logger.error( "List Templates - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ throw new Exception( e.getMessage() != null ? e.getMessage() : e.toString() );
}
}
@@ -2036,7 +2054,7 @@ public class EC2Engine extends ManagerBase {
return groupSet;
} catch(Exception e) {
logger.error( "List Security Groups - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ throw new Exception( e.getMessage() != null ? e.getMessage() : e.toString() );
}
}
@@ -2068,7 +2086,7 @@ public class EC2Engine extends ManagerBase {
return keyPairSet;
} catch(Exception e) {
logger.error( "List Keypairs - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ throw new Exception( e.getMessage() != null ? e.getMessage() : e.toString() );
}
}
@@ -2101,7 +2119,7 @@ public class EC2Engine extends ManagerBase {
return addressSet;
} catch(Exception e) {
logger.error( "List Addresses - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ throw new Exception(e.getMessage() != null ? e.getMessage() : e.toString());
}
}
@@ -2148,7 +2166,7 @@ public class EC2Engine extends ManagerBase {
return snapshotSet;
} catch(Exception e) {
logger.error( "List Snapshots - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ throw new Exception(e.getMessage() != null ? e.getMessage() : e.toString());
}
}
@@ -2298,7 +2316,7 @@ public class EC2Engine extends ManagerBase {
}
// if we get this far and haven't returned already return an error
- throw new EC2ServiceException(ServerError.InternalError, "Unable to find an appropriate network for account " + caller.getName());
+ throw new Exception("Unable to find an appropriate network for account ");
}
/**
@@ -2344,12 +2362,12 @@ public class EC2Engine extends ManagerBase {
/**
* Finds the defaultZone marked for the account
*/
- private String getDefaultZoneId(String accountId) {
+ private String getDefaultZoneId(String accountId) throws Exception {
try {
return accDao.getDefaultZoneId(accountId);
} catch(Exception e) {
logger.error( "Error while retrieving Account information by id - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage());
+ throw new Exception("Unable to retrieve account account information");
}
}
@@ -2400,7 +2418,7 @@ public class EC2Engine extends ManagerBase {
* @param device string
* @return deviceId value
*/
- private String mapDeviceToCloudDeviceId( String device )
+ private String mapDeviceToCloudDeviceId( String device ) throws Exception
{
if (device.equalsIgnoreCase( "/dev/sdb" )) return "1";
else if (device.equalsIgnoreCase( "/dev/sdc" )) return "2";
@@ -2429,7 +2447,7 @@ public class EC2Engine extends ManagerBase {
else if (device.equalsIgnoreCase( "xvdi" )) return "8";
else if (device.equalsIgnoreCase( "xvdj" )) return "9";
- else throw new EC2ServiceException( ClientError.Unsupported, device + " is not supported" );
+ else throw new Exception("Device is not supported");
}
/**
@@ -2529,7 +2547,7 @@ public class EC2Engine extends ManagerBase {
return resp != null;
} catch(Exception e) {
logger.error( "StopVirtualMachine - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ throw new Exception( e.getMessage() != null ? e.getMessage() : e.toString() );
}
}
@@ -2548,7 +2566,7 @@ public class EC2Engine extends ManagerBase {
return resp != null;
} catch(Exception e) {
logger.error("StartVirtualMachine - ", e);
- throw new EC2ServiceException(ServerError.InternalError, e.getMessage() != null ? e.getMessage() : "An unexpected error occurred.");
+ throw new Exception( e.getMessage() != null ? e.getMessage() : e.toString() );
}
}
@@ -2577,4 +2595,269 @@ public class EC2Engine extends ManagerBase {
}
return resourceTags;
}
+
+ private void handleException( Exception e) {
+ String[] error = e.getMessage().split("Error Code - ");
+ String errorMessage = error[0];
+ if (error.length == 2) { // error code has been supplied
+ int errorCode = Integer.parseInt(error[1]);
+ if (errorCode == 431) {
+ if ( errorMessage.contains("Object vm_instance(uuid:") && errorMessage.contains(") does not exist") ) {
+ throw new EC2ServiceException( ClientError.InvalidInstanceID_NotFound,
+ "Specified Instance ID does not exist");
+ } else if ( errorMessage.contains("Unable to find security group by name") ||
+ errorMessage.contains("Unable to find security group") ||
+ ( errorMessage.contains("Object security_group(uuid:") && errorMessage.contains(") does not exist") ) ||
+ errorMessage.contains("Unable to find group by name ") ) {
+ throw new EC2ServiceException( ClientError.InvalidGroup_NotFound,
+ "Specified Security Group does not exist");
+ } else if ( errorMessage.contains("Invalid port numbers") ) {
+ throw new EC2ServiceException( ClientError.InvalidPermission_Malformed,
+ "Specified Port value is invalid");
+ } else if (errorMessage.contains("Nonexistent account") && errorMessage.contains("when trying to authorize security group rule for security group") ) {
+ throw new EC2ServiceException( ClientError.InvalidPermission_Malformed,
+ "Specified account doesn't exist");
+ } else if ( errorMessage.contains("Nonexistent group") && errorMessage.contains("unable to authorize security group rule") ) {
+ throw new EC2ServiceException( ClientError.InvalidPermission_Malformed,
+ "Specified source security group doesn't exist");
+ } else if ( errorMessage.contains("Invalid protocol") ) {
+ throw new EC2ServiceException( ClientError.InvalidPermission_Malformed,
+ "Specified protocol is invalid");
+ } else if ( errorMessage.contains("is an Invalid CIDR") ) {
+ throw new EC2ServiceException( ClientError.InvalidPermission_Malformed,
+ "Specified CIDR is invalid");
+ }else if ( errorMessage.contains("Nonexistent account") ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Specified Account name is invalid");
+ } else if ( errorMessage.contains("Object volumes(uuid:") && errorMessage.contains(") does not exist") ) {
+ throw new EC2ServiceException( ClientError.InvalidVolume_NotFound,
+ "Specified Volume ID doesn't exist");
+ } else if ( errorMessage.contains("Object snapshots(uuid:") && errorMessage.contains(") does not exist") ) {
+ throw new EC2ServiceException( ClientError.InvalidSnapshot_NotFound,
+ "Specified Snapshot ID doesn't exist");
+ } else if ( (errorMessage.contains("A key pair with name '") && errorMessage.contains("' does not exist")) ||
+ (errorMessage.contains("A key pair with name '") && errorMessage.contains("' was not found")) ) {
+ throw new EC2ServiceException( ClientError.InvalidKeyPair_NotFound,
+ "Specified Key pair name is invalid");
+ } else if ( errorMessage.contains("A key pair with name '") && errorMessage.contains("' already exists") ) {
+ throw new EC2ServiceException( ClientError.InvalidKeyPair_Duplicate,
+ "Specified Key pair already exists");
+ } else if ( errorMessage.contains("Unknown zoneName value") ) {
+ throw new EC2ServiceException( ClientError.InvalidZone_NotFound,
+ "Specified AvailabilityZone name is invalid");
+ } else if ( errorMessage.contains("specify a volume that is not attached to any VM") ) {
+ throw new EC2ServiceException( ClientError.DependencyViolation,
+ "Specified Volume is attached to a VM");
+ } else if ( errorMessage.contains("Object vm_template(uuid: ")&& errorMessage.contains(") does not exist") ) {
+ throw new EC2ServiceException( ClientError.InvalidAMIID_NotFound,
+ "Specified Image ID does not exist");
+ } else if ( errorMessage.contains("unable to find template by id") ) {
+ throw new EC2ServiceException( ClientError.InvalidAMIID_NotFound,
+ "Specified Image ID does not exist");
+ } else if ( errorMessage.contains("a group with name") && errorMessage.contains("already exists") ) {
+ throw new EC2ServiceException( ClientError.InvalidGroup_Duplicate,
+ "Specified Security Group already exists");
+ } else if ( errorMessage.contains("specified volume is not attached to a VM") ) {
+ throw new EC2ServiceException( ClientError.IncorrectState,
+ "Specified volume is not in the correct state 'attached' for detachment");
+ } else if ( errorMessage.contains("Snapshot with specified snapshotId is not in BackedUp state yet and can't be used for volume creation") ) {
+ throw new EC2ServiceException( ClientError.IncorrectState,
+ "Specified snapshot is not in the correct state 'completed' for volume creation");
+ } else if ( errorMessage.contains("Can't delete snapshotshot 4 due to it is not in BackedUp Status") ) {
+ throw new EC2ServiceException( ClientError.IncorrectState,
+ "Specified snapshot is not in the correct state 'completed' for deletion");
+ } else if ( errorMessage.contains("Public key is invalid") ) {
+ throw new EC2ServiceException( ClientError.InvalidKeyPair_Format,
+ "Format of the specified key is invalid");
+ } else if ( errorMessage.contains("Invalid resource type") ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Specified resourceId is invalid");
+ } else if ( errorMessage.contains("Unable to find tags by parameters specified") ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Specified resourceTag for the specified resourceId doesn't exist");
+ } else if ( errorMessage.contains("Failed to enable static nat for the ip address with specified ipId " +
+ "as vm with specified vmId is already associated with specified currentIp") ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Specified publicIp is already associated to the specified VM");
+ } else if ( errorMessage.contains("Specified IP address id is not associated with any vm Id") ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Specified publicIp is not associated to any VM");
+ } else if ( errorMessage.contains("specify a VM that is either running or stopped") ) {
+ throw new EC2ServiceException( ClientError.IncorrectInstanceState,
+ "Unable to attach. Specified instances is in an incorrect state");
+ } else if ( errorMessage.contains("specify a valid data volume") ) {
+ throw new EC2ServiceException( ClientError.InvalidVolume_NotFound,
+ "Specified volume doen't exist");
+ } else if ( errorMessage.contains("VolumeId is not in Ready state, but in state Allocated. Cannot take snapshot") ) {
+ throw new EC2ServiceException( ClientError.IncorrectState,
+ "Cannot take snapshot. Specified volume is not in the correct state");
+ } else if ( errorMessage.contains("Can't delete snapshot") && errorMessage.contains("it is not in BackedUp Status") ) {
+ throw new EC2ServiceException( ClientError.IncorrectState,
+ "Cannot delete snapshot. Specified snapshot is not in the correct state");
+ } else if ( errorMessage.contains("Invalid port range") ) {
+ throw new EC2ServiceException( ClientError.InvalidPermission_Malformed,
+ "The specified port range is invalid");
+ } else if ( errorMessage.contains("specify a valid User VM") ) {
+ throw new EC2ServiceException( ClientError.InvalidInstanceID_NotFound,
+ "Specified instance is invalid");
+ } else if ( errorMessage.contains("No password for VM with specified id found") ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "No password for VM with the specified id found");
+ } else if ( errorMessage.contains("make sure the virtual machine is stopped and not in an error state before upgrading") ) {
+ throw new EC2ServiceException( ClientError.IncorrectInstanceState,
+ "Unable to modify. Specified instances is not in the correct state 'Stopped'");
+ } else if ( errorMessage.contains("Not upgrading vm") && errorMessage.contains("it already has the" +
+ " requested service offering") ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Unable to modify. Specified instance already has the requested instanceType");
+ }
+ // Can't enable static, ip address with specified id is a sourceNat ip address ?
+ else {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "The value supplied for a parameter is invalid");
+ }
+ }
+ else if (errorCode == 536) {
+ if ( errorMessage.contains("Cannot delete group when it's in use by virtual machines") ) {
+ throw new EC2ServiceException( ClientError.InvalidGroup_InUse,
+ "Group is in use by a virtual machine");
+ } else {
+ throw new EC2ServiceException( ClientError.DependencyViolation,
+ "Specified resource is in use");
+ }
+ }
+ else if (errorCode == 531) {
+ if ( errorMessage.contains("Acct") && errorMessage.contains("does not have permission to launch" +
+ " instances from Tmpl") ) {
+ throw new EC2ServiceException( ClientError.AuthFailure,
+ "User not authorized to operate on the specified AMI");
+ } else {
+ throw new EC2ServiceException( ClientError.AuthFailure, "User not authorized");
+ }
+ }
+ else if (errorCode == 530) {
+ if ( errorMessage.contains("deviceId") && errorMessage.contains("is used by VM") ) {
+ throw new EC2ServiceException( ClientError.InvalidDevice_InUse,
+ "Specified Device is already being used by the VM");
+ } else if (errorMessage.contains("Entity already exists") ){
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Specified resource tag already exists");
+ } else if ( errorMessage.contains("Template") && errorMessage.contains("has not been completely downloaded") ){
+ throw new EC2ServiceException( ClientError.InvalidAMIID_NotFound,
+ "Specified ImageId is unavailable");
+ } else if ( errorMessage.contains("cannot stop VM") && errorMessage.contains("when it is in state Starting") ){
+ throw new EC2ServiceException( ClientError.IncorrectInstanceState,
+ "Unable to stop. One or more of the specified instances is in an incorrect state 'pending'");
+ } else if ( errorMessage.contains("Failed to authorize security group ingress rule(s)") ) {
+ throw new EC2ServiceException(ClientError.InvalidParameterValue, "Specified Ip-permission is invalid" +
+ " or the Ip-permission already exists");
+ } else if ( errorMessage.contains("Failed to reboot vm instance") ) {
+ throw new EC2ServiceException(ClientError.IncorrectInstanceState,
+ "Unable to reboot. One or more of the specified instances is in an incorrect state");
+ } else if ( errorMessage.contains("specify a template that is not currently being downloaded") ) {
+ throw new EC2ServiceException(ClientError.IncorrectState,
+ "Unable to deregister. Image is not in the correct state 'available'");
+ } else {
+ throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occured");
+ }
+ }
+ else if (errorCode == 534) {
+ if ( errorMessage.contains("Maximum number of resources of type 'volume' for account")
+ && errorMessage.contains("has been exceeded") ) {
+ throw new EC2ServiceException( ClientError.VolumeLimitExceeded,
+ "You have reached the limit on the number of volumes that can be created");
+ } else if ( errorMessage.contains("Maximum number of resources of type 'public_ip' for account")
+ && errorMessage.contains("has been exceeded") ) {
+ throw new EC2ServiceException( ClientError.AddressLimitExceeded,
+ "You have reached the limit on the number of elastic ip addresses your account can have");
+ } else if ( errorMessage.contains("Unable to apply save userdata entry on router") ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "The value supplied for parameter UserData is invalid");
+ } else {
+ throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occured");
+ }
+ }
+ else if (errorCode == 533) {
+ if ( errorMessage.contains("Unable to create a deployment for VM") ) {
+ throw new EC2ServiceException( ClientError.InsufficientInstanceCapacity,
+ "There is insufficient capacity available to deploy a VM");
+ } else if ( errorMessage.contains("Insufficient address capacity") ) {
+ throw new EC2ServiceException( ServerError.InsufficientAddressCapacity,
+ "Not enough available addresses to satisfy your minimum request");
+ } else {
+ throw new EC2ServiceException( ServerError.InternalError, "There is insufficient capacity");
+ }
+ } else if (errorCode == 401) {
+ if ( errorMessage.contains("Unauthorized") ) {
+ throw new EC2ServiceException(ClientError.AuthFailure, "User not authorised");
+ } else {
+ throw new EC2ServiceException(ClientError.AuthFailure, "User not authorised");
+ }
+ } else {
+ throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occured");
+ }
+ } else {
+ if ( errorMessage.contains("Unknown zoneName value") ) {
+ throw new EC2ServiceException( ClientError.InvalidZone_NotFound,
+ "AvailabilityZone name is invalid");
+ } else if ( errorMessage.contains("No ServiceOffering found to be defined by name") ) {
+ throw new EC2ServiceException(ClientError.InvalidParameterValue, "Specified InstanceType is invalid");
+ } else if ( errorMessage.contains("Specified Ip permission is invalid") ) {
+ throw new EC2ServiceException(ClientError.InvalidPermission_Malformed, "Specified Ip permission is invalid");
+ } else if ( errorMessage.contains("One or more instanceIds do not exist, other instances rebooted") ) {
+ throw new EC2ServiceException(ClientError.InvalidInstanceID_NotFound,
+ "One or more InstanceId doesn't exist, other instances rebooted");
+ } else if ( errorMessage.contains("Device is not supported") ) {
+ throw new EC2ServiceException(ClientError.InvalidParameterValue,
+ "Value specified for parameter Device is invalid");
+ } else if ( errorMessage.contains("Volume is not attached to the Instance") ) {
+ throw new EC2ServiceException(ClientError.InvalidAttachment_NotFound,
+ "Specified Volume is not attached to the specified Instance");
+ } else if ( errorMessage.contains("Volume is not attached to the Device") ) {
+ throw new EC2ServiceException(ClientError.InvalidAttachment_NotFound,
+ "Specified Volume is not attached to the specified device");
+ } else if ( errorMessage.contains("Unable to create snapshot") ) {
+ throw new EC2ServiceException(ServerError.InternalError,
+ "Unable to create snapshot");
+ } else if ( errorMessage.contains("Instance must be in stopped state") ) {
+ throw new EC2ServiceException(ClientError.IncorrectInstanceState,
+ "Specified instance is not in the correct state 'stopped'");
+ } else if ( errorMessage.contains("Image couldn't be created") ) {
+ throw new EC2ServiceException(ServerError.InternalError,
+ "Unable to create image");
+ } else if ( errorMessage.contains("Failed to start the stopped instance") ) {
+ throw new EC2ServiceException(ServerError.InternalError,
+ "Unable to start the instance that was stopped during image creation");
+ } else if ( errorMessage.contains("One or more of instanceIds specified is in stopped state") ) {
+ throw new EC2ServiceException(ClientError.IncorrectInstanceState,
+ "Unable to reboot. One or more of the specified instances is in an incorrect state 'stopped'");
+ } else if ( errorMessage.contains("Specified ipAddress doesn't exist") ) {
+ throw new EC2ServiceException(ClientError.InvalidParameterValue, "Specified publicIp doesn't exist");
+ } else if ( errorMessage.contains("Min Count is greater than the number of instances left to allocate") ) {
+ throw new EC2ServiceException(ClientError.InstanceLimitExceeded,
+ "Specified MinCount parameter is greater than the number of instances you can create");
+ } else if ( errorMessage.contains("instanceType not found") ) {
+ throw new EC2ServiceException(ClientError.InvalidParameterValue,
+ "Specified instanceType not found");
+ } else if ( errorMessage.contains("zone not found") ) {
+ throw new EC2ServiceException(ClientError.InvalidZone_NotFound,
+ "Specified zone doesn't exist");
+ } else if ( errorMessage.contains("Both groupId and groupName has been specified") ) {
+ throw new EC2ServiceException(ClientError.InvalidParameterCombination,
+ " for EC2 groups either a group ID or a group name is accepted");
+ } else if ( errorMessage.contains("Insufficient Instance Capacity") ) {
+ throw new EC2ServiceException(ServerError.InsufficientInstanceCapacity, "Insufficient Instance Capacity" );
+ } else if ( errorMessage.contains("Unable to find security group name") ) {
+ throw new EC2ServiceException(ClientError.InvalidGroup_NotFound, "Specified Security Group does not exist" );
+ } else if ( errorMessage.contains("Instance not found") ) {
+ throw new EC2ServiceException(ClientError.InvalidInstanceID_NotFound,
+ "One or more of the specified instanceId not found");
+ } else if ( errorMessage.contains("Cannot modify, instance should be in stopped state") ) {
+ throw new EC2ServiceException(ClientError.IncorrectInstanceState,
+ "Unable to modify instance attribute. Specified instance is not in the correct state 'stopped'");
+ } else {
+ throw new EC2ServiceException( ServerError.InternalError, "An unexpected error occured");
+ }
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2GroupFilterSet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2GroupFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2GroupFilterSet.java
index dbc367c..bd79041 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2GroupFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2GroupFilterSet.java
@@ -23,6 +23,7 @@ import java.util.List;
import java.util.Map;
import com.cloud.bridge.service.exception.EC2ServiceException;
+import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
public class EC2GroupFilterSet {
@@ -52,11 +53,9 @@ public class EC2GroupFilterSet {
String filterName = param.getName();
String value = (String) filterTypes.get( filterName );
- if (null == value)
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 1", 501 );
-
- if (null != value && value.equalsIgnoreCase( "null" ))
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 2", 501 );
+ if ( value == null || value.equalsIgnoreCase("null")) {
+ throw new EC2ServiceException( ClientError.InvalidFilter, "Filter '" + filterName + "' is invalid");
+ }
// ToDo we could add checks to make sure the type of a filters value is correct (e.g., an integer)
filterSet.add( param );
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2ImageFilterSet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2ImageFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2ImageFilterSet.java
index aea3df0..646d20f 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2ImageFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2ImageFilterSet.java
@@ -25,6 +25,7 @@ import java.util.Map;
import org.apache.log4j.Logger;
import com.cloud.bridge.service.exception.EC2ServiceException;
+import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
public class EC2ImageFilterSet {
protected final static Logger logger = Logger.getLogger(EC2ImageFilterSet.class);
@@ -51,10 +52,9 @@ public class EC2ImageFilterSet {
String filterName = param.getName();
if ( !filterName.startsWith("tag:") ) {
String value = (String) filterTypes.get( filterName );
- if (null == value)
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 1", 501 );
- if (null != value && value.equalsIgnoreCase( "null" ))
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 2", 501 );
+ if ( value == null || value.equalsIgnoreCase("null")) {
+ throw new EC2ServiceException( ClientError.InvalidFilter, "Filter '" + filterName + "' is invalid");
+ }
}
filterSet.add( param );
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java
index b5b7c78..a71d476 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java
@@ -24,6 +24,7 @@ import java.util.Map;
import com.cloud.bridge.service.EC2SoapServiceImpl;
import com.cloud.bridge.service.exception.EC2ServiceException;
+import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
public class EC2InstanceFilterSet {
@@ -59,11 +60,10 @@ public class EC2InstanceFilterSet {
String filterName = param.getName();
String value = (String) filterTypes.get( filterName );
- if (null == value)
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "]", 501 );
+ if ( value == null || value.equalsIgnoreCase("null") ) {
+ throw new EC2ServiceException( ClientError.InvalidFilter, "Filter '" + filterName + "' is invalid");
+ }
- if (null != value && value.equalsIgnoreCase( "null" ))
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "]", 501 );
// ToDo we could add checks to make sure the type of a filters value is correct (e.g., an integer)
filterSet.add( param );
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2KeyPairFilterSet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2KeyPairFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2KeyPairFilterSet.java
index 2ad005b..d27972d 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2KeyPairFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2KeyPairFilterSet.java
@@ -25,6 +25,9 @@ import java.util.Map;
import org.apache.log4j.Logger;
+import com.cloud.bridge.service.exception.EC2ServiceException;
+import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
+
public class EC2KeyPairFilterSet {
protected final static Logger logger = Logger.getLogger(EC2KeyPairFilterSet.class);
@@ -42,16 +45,9 @@ public class EC2KeyPairFilterSet {
String filterName = param.getName();
String value = (String) filterTypes.get( filterName );
- if (null == value) {
- // Changing this to silently ignore
- logger.error("Unsupported filter [" + filterName + "] - 1");
- return;
- }
-
- if (null != value && value.equalsIgnoreCase( "null" )) {
- logger.error("Unsupported filter [" + filterName + "] - 2");
- return;
- }
+ if ( value == null || value.equalsIgnoreCase("null") ) {
+ throw new EC2ServiceException( ClientError.InvalidFilter, "Filter '" + filterName + "' is invalid");
+ }
// ToDo we could add checks to make sure the type of a filters value is correct (e.g., an integer)
filterSet.add( param );
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2ModifyInstanceAttribute.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2ModifyInstanceAttribute.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2ModifyInstanceAttribute.java
new file mode 100644
index 0000000..8394e33
--- /dev/null
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2ModifyInstanceAttribute.java
@@ -0,0 +1,64 @@
+// 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 com.cloud.bridge.service.core.ec2;
+
+
+public class EC2ModifyInstanceAttribute {
+ private String instanceId;
+ private String instanceType;
+ private String userData;
+
+ /**
+ * @return instanceId
+ */
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ /**
+ * @param instanceId to set
+ */
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ /**
+ * @return instanceType
+ */
+ public String getInstanceType() {
+ return instanceType;
+ }
+
+ /**
+ * @param instanceType to set
+ */
+ public void setInstanceType(String instanceType) {
+ this.instanceType = instanceType;
+ }
+
+ /**
+ * @return userData
+ */
+ public String getUserData() {
+ return userData;
+ }
+
+ public void setUserData(String userData) {
+ this.userData = userData;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2RegisterImage.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2RegisterImage.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2RegisterImage.java
index d713297..43b27df 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2RegisterImage.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2RegisterImage.java
@@ -72,7 +72,7 @@ public class EC2RegisterImage {
if (null != param) {
if (!param.contains(":") || param.split(":").length < 4) {
throw new EC2ServiceException( ClientError.InvalidParameterValue, "Supported format for " +
- "'architecture' is format:zonename:ostypename:hypervisor" );
+ "parameter 'architecture' is format:zonename:ostypename:hypervisor" );
}
String parts[] = param.split( ":" );
format = parts[0];
@@ -80,9 +80,6 @@ public class EC2RegisterImage {
osTypeName = parts[2];
hypervisor = parts[3];
}
- else {
- throw new EC2ServiceException(ClientError.Unsupported, "Missing Parameter -" + " architecture");
- }
}
public String getFormat() {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2SnapshotFilterSet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2SnapshotFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2SnapshotFilterSet.java
index c2bed3c..ef395d9 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2SnapshotFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2SnapshotFilterSet.java
@@ -27,6 +27,7 @@ import java.util.TimeZone;
import com.cloud.bridge.service.UserContext;
import com.cloud.bridge.service.exception.EC2ServiceException;
+import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
import com.cloud.bridge.util.DateHelper;
import com.cloud.bridge.util.EC2RestAuth;
@@ -56,12 +57,9 @@ public class EC2SnapshotFilterSet {
String filterName = param.getName();
if (!filterName.startsWith("tag:")) {
String value = (String) filterTypes.get( filterName );
-
- if (null == value)
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 1", 501 );
-
- if (null != value && value.equalsIgnoreCase( "null" ))
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 2", 501 );
+ if ( value == null || value.equalsIgnoreCase("null") ) {
+ throw new EC2ServiceException( ClientError.InvalidFilter, "Filter '" + filterName + "' is invalid");
+ }
}
// ToDo we could add checks to make sure the type of a filters value is correct (e.g., an integer)
filterSet.add( param );
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2TagsFilterSet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2TagsFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2TagsFilterSet.java
index c2d33c3..06edc38 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2TagsFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2TagsFilterSet.java
@@ -26,6 +26,7 @@ import java.util.Map;
import org.apache.log4j.Logger;
import com.cloud.bridge.service.exception.EC2ServiceException;
+import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
public class EC2TagsFilterSet {
protected final static Logger logger = Logger.getLogger(EC2TagsFilterSet.class);
@@ -45,11 +46,9 @@ public class EC2TagsFilterSet {
String filterName = param.getName();
String value = (String) filterTypes.get( filterName );
- if (null == value)
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 1", 501 );
-
- if (null != value && value.equalsIgnoreCase( "null" ))
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 2", 501 );
+ if ( value == null || value.equalsIgnoreCase("null") ) {
+ throw new EC2ServiceException( ClientError.InvalidFilter, "Filter '" + filterName + "' is invalid");
+ }
filterSet.add( param );
}
[12/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Refactoring the planner tests
1. Planner tests rewritten to use marvin integration libraries
2. Included verification of multi VM deployment for user dispersion
3. Included a test for user concentrated planner
TODO: firstfit planner test doesn't actually test the planner strategy.
It only deploys a VM using the offering.
Signed-off-by: Prasanna Santhanam <ts...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/61601102
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/61601102
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/61601102
Branch: refs/heads/object_store
Commit: 616011020b0bfeaa0d54cee666cf486974246cf7
Parents: 698da2a
Author: Prasanna Santhanam <ts...@apache.org>
Authored: Wed May 22 15:41:35 2013 +0530
Committer: Prasanna Santhanam <ts...@apache.org>
Committed: Wed May 22 15:43:04 2013 +0530
----------------------------------------------------------------------
...st_deploy_vms_with_varied_deploymentplanners.py | 414 +++++++++------
1 files changed, 250 insertions(+), 164 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/61601102/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
index d904a4c..c557682 100644
--- a/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
+++ b/test/integration/smoke/test_deploy_vms_with_varied_deploymentplanners.py
@@ -1,164 +1,250 @@
-# 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.
-
-#!/usr/bin/env python
-
-import marvin
-from marvin import cloudstackTestCase
-from marvin.cloudstackTestCase import *
-
-import unittest
-import hashlib
-import random
-
-class TestDeployVmWithVariedPlanners(cloudstackTestCase):
- """
- This test tests that we can create serviceOfferings with different deployment Planners and deploy virtual machines into a user account
- using these service offerings and builtin template
- """
- def setUp(self):
- """
- CloudStack internally saves its passwords in md5 form and that is how we
- specify it in the API. Python's hashlib library helps us to quickly hash
- strings as follows
- """
- mdf = hashlib.md5()
- mdf.update('password')
- mdf_pass = mdf.hexdigest()
-
- self.apiClient = self.testClient.getApiClient() #Get ourselves an API client
-
- self.acct = createAccount.createAccountCmd() #The createAccount command
- self.acct.accounttype = 0 #We need a regular user. admins have accounttype=1
- self.acct.firstname = 'test'
- self.acct.lastname = 'user' #What's up doc?
- self.acct.username = 'testuser'
- self.acct.password = mdf_pass #The md5 hashed password string
- self.acct.email = 'test@domain.com'
- self.acct.account = 'testacct'
- self.acct.domainid = 1 #The default ROOT domain
- self.acctResponse = self.apiClient.createAccount(self.acct)
- # And upon successful creation we'll log a helpful message in our logs
- # using the default debug logger of the test framework
- self.debug("successfully created account: %s, id: \
- %s"%(self.acctResponse.name, \
- self.acctResponse.id))
-
- #Create service offerings with varied planners
- self.svcOfferingFirstFit = createServiceOffering.createServiceOfferingCmd()
- self.svcOfferingFirstFit.name = 'Tiny Instance FirstFit'
- self.svcOfferingFirstFit.displaytext = 'Tiny Instance with FirstFitPlanner'
- self.svcOfferingFirstFit.cpuspeed = 100
- self.svcOfferingFirstFit.cpunumber = 1
- self.svcOfferingFirstFit.memory = 256
- self.svcOfferingFirstFit.deploymentplanner = 'FirstFitPlanner'
- self.svcOfferingFirstFitResponse = self.apiClient.createServiceOffering(self.svcOfferingFirstFit)
-
- self.debug("successfully created serviceofferring name: %s, id: \
- %s, deploymentPlanner: %s"%(self.svcOfferingFirstFitResponse.name, \
- self.svcOfferingFirstFitResponse.id,self.svcOfferingFirstFitResponse.deploymentplanner))
-
- #Create service offerings with varied planners
- self.svcOfferingUserDispersing = createServiceOffering.createServiceOfferingCmd()
- self.svcOfferingUserDispersing.name = 'Tiny Instance UserDispersing'
- self.svcOfferingUserDispersing.displaytext = 'Tiny Instance with UserDispersingPlanner'
- self.svcOfferingUserDispersing.cpuspeed = 100
- self.svcOfferingUserDispersing.cpunumber = 1
- self.svcOfferingUserDispersing.memory = 256
- self.svcOfferingUserDispersing.deploymentplanner = 'FirstFitPlanner'
- self.svcOfferingUserDispersingResponse = self.apiClient.createServiceOffering(self.svcOfferingUserDispersing)
-
- self.debug("successfully created serviceofferring name: %s, id: \
- %s, deploymentPlanner: %s"%(self.svcOfferingUserDispersingResponse.name, \
- self.svcOfferingUserDispersingResponse.id,self.svcOfferingUserDispersingResponse.deploymentplanner))
-
- def test_DeployVm(self):
- """
- Let's start by defining the attributes of our VM that we will be
- deploying on CloudStack. We will be assuming a single zone is available
- and is configured and all templates are Ready
-
- The hardcoded values are used only for brevity.
- """
- deployVmCmd = deployVirtualMachine.deployVirtualMachineCmd()
- deployVmCmd.zoneid = 1
- deployVmCmd.account = self.acct.account
- deployVmCmd.domainid = self.acct.domainid
- deployVmCmd.templateid = 5 #For default template- CentOS 5.6(64 bit)
- deployVmCmd.serviceofferingid = self.svcOfferingFirstFitResponse.id
-
- deployVmResponse = self.apiClient.deployVirtualMachine(deployVmCmd)
- self.debug("VM %s was deployed in the job %s"%(deployVmResponse.id, deployVmResponse.jobid))
-
- # At this point our VM is expected to be Running. Let's find out what
- # listVirtualMachines tells us about VMs in this account
-
- listVmCmd = listVirtualMachines.listVirtualMachinesCmd()
- listVmCmd.id = deployVmResponse.id
- listVmResponse = self.apiClient.listVirtualMachines(listVmCmd)
-
- self.assertNotEqual(len(listVmResponse), 0, "Check if the list API \
- returns a non-empty response")
-
- vm1 = listVmResponse[0]
-
- self.assertEqual(vm1.id, deployVmResponse.id, "Check if the VM returned \
- is the same as the one we deployed")
- self.assertEqual(vm1.state, "Running", "Check if VM has reached \
- a state of running")
-
-
- deployVm2Cmd = deployVirtualMachine.deployVirtualMachineCmd()
- deployVm2Cmd.zoneid = 1
- deployVm2Cmd.account = self.acct.account
- deployVm2Cmd.domainid = self.acct.domainid
- deployVm2Cmd.templateid = 5 #For default template- CentOS 5.6(64 bit)
- deployVm2Cmd.serviceofferingid = self.svcOfferingFirstFitResponse.id
-
- deployVm2Response = self.apiClient.deployVirtualMachine(deployVm2Cmd)
- self.debug("VM %s was deployed in the job %s"%(deployVm2Response.id, deployVm2Response.jobid))
-
- # At this point our VM is expected to be Running. Let's find out what
- # listVirtualMachines tells us about VMs in this account
-
- listVm2Cmd = listVirtualMachines.listVirtualMachinesCmd()
- listVm2Cmd.id = deployVm2Response.id
- listVm2Response = self.apiClient.listVirtualMachines(listVm2Cmd)
- self.assertNotEqual(len(listVm2Response), 0, "Check if the list API \
- returns a non-empty response")
- vm2 = listVm2Response[0]
- self.assertEqual(vm2.id, deployVm2Response.id, "Check if the VM returned \
- is the same as the one we deployed")
- self.assertEqual(vm2.state, "Running", "Check if VM has reached \
- a state of running")
-
-
- def tearDown(self): # Teardown will delete the Account as well as the VM once the VM reaches "Running" state
- """
- And finally let us cleanup the resources we created by deleting the
- account. All good unittests are atomic and rerunnable this way
- """
- deleteAcct = deleteAccount.deleteAccountCmd()
- deleteAcct.id = self.acctResponse.id
- self.apiClient.deleteAccount(deleteAcct)
- deleteSvcOfferingFirstFit = deleteServiceOffering.deleteServiceOfferingCmd()
- deleteSvcOfferingFirstFit.id = self.svcOfferingFirstFitResponse.id
- self.apiClient.deleteServiceOffering(deleteSvcOfferingFirstFit);
- deleteSvcOfferingUserDispersing = deleteServiceOffering.deleteServiceOfferingCmd()
- deleteSvcOfferingUserDispersing.id = self.svcOfferingUserDispersingResponse.id
- self.apiClient.deleteServiceOffering(deleteSvcOfferingUserDispersing);
-
\ No newline at end of file
+# 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.
+
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.integration.lib.base import Account, VirtualMachine, ServiceOffering
+from marvin.integration.lib.common import get_zone, get_domain, get_template, cleanup_resources
+
+from nose.plugins.attrib import attr
+
+class Services:
+ def __init__(self):
+ self.services = {
+ "account": {
+ "email": "test@test.com",
+ "firstname": "Test",
+ "lastname": "User",
+ "username": "test",
+ # Random characters are appended for unique
+ # username
+ "password": "password",
+ },
+ "service_offering": {
+ "name": "Planner Service Offering",
+ "displaytext": "Planner Service Offering",
+ "cpunumber": 1,
+ "cpuspeed": 100,
+ # in MHz
+ "memory": 128,
+ # In MBs
+ },
+ "ostype": 'CentOS 5.3 (64-bit)',
+ "virtual_machine": {
+ "hypervisor": "XenServer",
+ }
+ }
+
+
+class TestDeployVmWithVariedPlanners(cloudstackTestCase):
+ """ Test to create services offerings for deployment planners
+ - firstfit, userdispersing
+ """
+
+ @classmethod
+ def setUpClass(cls):
+ cls.apiclient = super(TestDeployVmWithVariedPlanners, cls).getClsTestClient().getApiClient()
+ cls.services = Services().services
+ # Get Zone, Domain and templates
+ cls.domain = get_domain(cls.apiclient, cls.services)
+ cls.zone = get_zone(cls.apiclient, cls.services)
+ cls.template = get_template(
+ cls.apiclient,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
+ cls.services["virtual_machine"]["zoneid"] = cls.zone.id
+ cls.services["template"] = cls.template.id
+ cls.services["zoneid"] = cls.zone.id
+
+ cls.account = Account.create(
+ cls.apiclient,
+ cls.services["account"],
+ domainid=cls.domain.id
+ )
+ cls.services["account"] = cls.account.name
+ cls.cleanup = [
+ cls.account
+ ]
+
+ @attr(tags=["simulator", "advanced", "basic", "sg"])
+ def test_deployvm_firstfit(self):
+ """Test to deploy vm with a first fit offering
+ """
+ #FIXME: How do we know that first fit actually happened?
+ self.service_offering_firstfit = ServiceOffering.create(
+ self.apiclient,
+ self.services["service_offering"],
+ deploymentplanner='FirstFitPlanner'
+ )
+
+ self.virtual_machine = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_firstfit.id,
+ templateid=self.template.id
+ )
+
+ list_vms = VirtualMachine.list(self.apiclient, id=self.virtual_machine.id)
+ self.debug(
+ "Verify listVirtualMachines response for virtual machine: %s"\
+ % self.virtual_machine.id
+ )
+ self.assertEqual(
+ isinstance(list_vms, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ self.assertNotEqual(
+ len(list_vms),
+ 0,
+ "List VM response was empty"
+ )
+
+ vm = list_vms[0]
+ self.assertEqual(
+ vm.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
+
+ @attr(tags=["simulator", "advanced", "basic", "sg"])
+ def test_deployvm_userdispersing(self):
+ """Test deploy VMs using user dispersion planner
+ """
+ self.service_offering_userdispersing = ServiceOffering.create(
+ self.apiclient,
+ self.services["service_offering"],
+ deploymentplanner='UserDispersingPlanner'
+ )
+
+ self.virtual_machine_1 = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_userdispersing.id,
+ templateid=self.template.id
+ )
+ self.virtual_machine_2 = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_userdispersing.id,
+ templateid=self.template.id
+ )
+
+ list_vm_1 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_1.id)
+ list_vm_2 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_2.id)
+ self.assertEqual(
+ isinstance(list_vm_1, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ self.assertEqual(
+ isinstance(list_vm_2, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ vm1 = list_vm_1[0]
+ vm2 = list_vm_2[0]
+ self.assertEqual(
+ vm1.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
+ self.assertEqual(
+ vm2.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
+ self.assertNotEqual(
+ vm1.hostid,
+ vm2.hostid,
+ msg="VMs meant to be dispersed are deployed on the same host"
+ )
+
+ @attr(tags=["simulator", "advanced", "basic", "sg"])
+ def test_deployvm_userconcentrated(self):
+ """Test deploy VMs using user concentrated planner
+ """
+ self.service_offering_userconcentrated = ServiceOffering.create(
+ self.apiclient,
+ self.services["service_offering"],
+ deploymentplanner='UserConcentratedPodPlanner'
+ )
+
+ self.virtual_machine_1 = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_userconcentrated.id,
+ templateid=self.template.id
+ )
+ self.virtual_machine_2 = VirtualMachine.create(
+ self.apiclient,
+ self.services["virtual_machine"],
+ accountid=self.account.name,
+ zoneid=self.zone.id,
+ domainid=self.account.domainid,
+ serviceofferingid=self.service_offering_userconcentrated.id,
+ templateid=self.template.id
+ )
+
+ list_vm_1 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_1.id)
+ list_vm_2 = VirtualMachine.list(self.apiclient, id=self.virtual_machine_2.id)
+ self.assertEqual(
+ isinstance(list_vm_1, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ self.assertEqual(
+ isinstance(list_vm_2, list),
+ True,
+ "List VM response was not a valid list"
+ )
+ vm1 = list_vm_1[0]
+ vm2 = list_vm_2[0]
+ self.assertEqual(
+ vm1.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
+ self.assertEqual(
+ vm2.state,
+ "Running",
+ msg="VM is not in Running state"
+ )
+ self.assertNotEqual(
+ vm1.hostid,
+ vm2.hostid,
+ msg="VMs meant to be concentrated are deployed on the different hosts"
+ )
+
+ @classmethod
+ def tearDownClass(cls):
+ try:
+ cleanup_resources(cls.apiclient, cls.cleanup)
+ except Exception as e:
+ raise Exception("Warning: Exception during cleanup : %s" % e)
[50/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Merge branch 'master' into object_store.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/98af4240
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/98af4240
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/98af4240
Branch: refs/heads/object_store
Commit: 98af424053f341d80f5e3ef8f99951b9ecd654ae
Parents: 913e2b3 780b45e
Author: Min Chen <mi...@citrix.com>
Authored: Thu May 23 18:00:15 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Thu May 23 18:00:15 2013 -0700
----------------------------------------------------------------------
api/src/com/cloud/async/AsyncJob.java | 1 +
.../cloud/configuration/ConfigurationService.java | 13 +
api/src/com/cloud/deploy/DeploymentPlanner.java | 7 +
api/src/com/cloud/event/EventTypes.java | 8 +
.../InsufficientServerCapacityException.java | 11 +
api/src/com/cloud/network/IpAddress.java | 4 +-
.../cloud/network/NetworkMigrationResponder.java | 70 ++
api/src/com/cloud/network/NetworkService.java | 5 +
.../cloud/network/vpn/RemoteAccessVpnService.java | 2 +-
api/src/com/cloud/server/ManagementService.java | 12 +-
api/src/com/cloud/vm/UserVmService.java | 2 +-
.../org/apache/cloudstack/api/ApiConstants.java | 3 +
.../apache/cloudstack/api/ResponseGenerator.java | 7 +
.../api/command/admin/cluster/AddClusterCmd.java | 36 +-
.../command/admin/cluster/UpdateClusterCmd.java | 6 +-
.../admin/host/FindHostsForMigrationCmd.java | 2 +-
.../admin/offering/CreateServiceOfferingCmd.java | 16 +
.../admin/region/CreatePortableIpRangeCmd.java | 156 +++
.../admin/region/DeletePortableIpRangeCmd.java | 93 ++
.../admin/region/ListPortableIpRangesCmd.java | 109 ++
.../command/admin/systemvm/ScaleSystemVMCmd.java | 131 +++
.../command/user/address/AssociateIPAddrCmd.java | 28 +-
.../user/address/DisassociateIPAddrCmd.java | 12 +-
.../loadbalancer/ListLoadBalancerRulesCmd.java | 9 +
.../api/command/user/nat/EnableStaticNatCmd.java | 6 +
.../api/command/user/vm/DeployVMCmd.java | 11 +-
.../cloudstack/api/command/user/vm/ScaleVMCmd.java | 23 +-
.../cloudstack/api/command/user/vm/StartVMCmd.java | 14 +-
.../command/user/vpn/DeleteRemoteAccessVpnCmd.java | 2 +-
.../cloudstack/api/response/ClusterResponse.java | 27 +-
.../cloudstack/api/response/IPAddressResponse.java | 7 +
.../api/response/LoadBalancerResponse.java | 11 +-
.../api/response/PortableIpRangeResponse.java | 93 ++
.../api/response/PortableIpResponse.java | 106 ++
.../org/apache/cloudstack/region/PortableIp.java | 58 ++
.../apache/cloudstack/region/PortableIpRange.java | 38 +
.../api/command/test/ScaleVMCmdTest.java | 30 +-
.../bridge/persist/dao/CloudStackUserDaoImpl.java | 12 +-
.../com/cloud/bridge/service/EC2MainServlet.java | 2 +-
.../com/cloud/bridge/service/EC2RestServlet.java | 428 ++++++---
.../cloud/bridge/service/EC2SoapServiceImpl.java | 259 +++--
.../service/core/ec2/EC2AddressFilterSet.java | 16 +-
.../core/ec2/EC2AvailabilityZonesFilterSet.java | 9 +-
.../bridge/service/core/ec2/EC2DescribeImages.java | 10 +
.../cloud/bridge/service/core/ec2/EC2Engine.java | 764 ++++++++++-----
.../bridge/service/core/ec2/EC2GroupFilterSet.java | 9 +-
.../cloud/bridge/service/core/ec2/EC2Image.java | 63 +-
.../bridge/service/core/ec2/EC2ImageFilterSet.java | 168 ++++
.../service/core/ec2/EC2InstanceFilterSet.java | 8 +-
.../service/core/ec2/EC2KeyPairFilterSet.java | 16 +-
.../core/ec2/EC2ModifyInstanceAttribute.java | 64 ++
.../bridge/service/core/ec2/EC2RegisterImage.java | 5 +-
.../service/core/ec2/EC2SnapshotFilterSet.java | 10 +-
.../bridge/service/core/ec2/EC2TagsFilterSet.java | 9 +-
.../service/core/ec2/EC2VolumeFilterSet.java | 9 +-
.../service/exception/EC2ServiceException.java | 120 ++--
awsapi/src/com/cloud/stack/CloudStackClient.java | 5 +-
client/pom.xml | 5 +
client/tomcatconf/applicationContext.xml.in | 8 +-
client/tomcatconf/commands.properties.in | 7 +
client/tomcatconf/componentContext.xml.in | 1 +
client/tomcatconf/nonossComponentContext.xml.in | 2 +-
.../storage/CreateEntityDownloadURLCommand.java | 1 -
.../src/com/cloud/network/DnsMasqConfigurator.java | 2 +-
debian/rules | 4 +-
docs/en-US/CloudStack_Nicira_NVP_Guide.xml | 1 +
docs/en-US/Release_Notes.xml | 53 +-
docs/en-US/added-API-commands-4.2.xml | 16 +
docs/en-US/images/nvp-add-controller.png | Bin 0 -> 35928 bytes
docs/en-US/images/nvp-enable-provider.png | Bin 0 -> 32158 bytes
docs/en-US/images/nvp-network-offering.png | Bin 0 -> 104060 bytes
docs/en-US/images/nvp-physical-network-stt.png | Bin 0 -> 27317 bytes
docs/en-US/images/nvp-vpc-offering-edit.png | Bin 0 -> 29279 bytes
docs/en-US/plugin-niciranvp-about.xml | 2 +-
docs/en-US/plugin-niciranvp-devicemanagement.xml | 32 +-
docs/en-US/plugin-niciranvp-features.xml | 67 ++-
docs/en-US/plugin-niciranvp-guide.xml | 31 -
docs/en-US/plugin-niciranvp-introduction.xml | 5 +-
docs/en-US/plugin-niciranvp-networkofferings.xml | 131 +++
docs/en-US/plugin-niciranvp-physicalnet.xml | 37 +
docs/en-US/plugin-niciranvp-preparations.xml | 11 +-
docs/en-US/plugin-niciranvp-provider.xml | 28 +-
docs/en-US/plugin-niciranvp-revisions.xml | 14 +
docs/en-US/plugin-niciranvp-tables.xml | 105 ++-
docs/en-US/plugin-niciranvp-usage.xml | 11 +-
docs/en-US/plugin-niciranvp-vpc.xml | 30 +
docs/en-US/plugin-niciranvp-vpcfeatures.xml | 28 +
docs/en-US/plugin-niciranvp-vpcnetworkoffering.xml | 81 ++
docs/en-US/plugin-niciranvp-vpcoffering.xml | 38 +
docs/en-US/portable-ip.xml | 30 +
.../subsystem/api/storage/AbstractScope.java | 6 +-
.../cloud/entity/api/VMEntityManagerImpl.java | 18 +-
.../cloud/entity/api/db/VolumeReservationVO.java | 22 +-
.../api/db/dao/VolumeReservationDaoImpl.java | 2 +-
.../src/com/cloud/alert/dao/AlertDaoImpl.java | 8 +
.../cloud/configuration/dao/ResourceCountDao.java | 2 +
.../configuration/dao/ResourceCountDaoImpl.java | 16 +
.../cloud/configuration/dao/ResourceLimitDao.java | 2 +
.../configuration/dao/ResourceLimitDaoImpl.java | 14 +
.../src/com/cloud/event/dao/EventDaoImpl.java | 5 +
.../network/dao/ExternalLoadBalancerDeviceVO.java | 2 +-
.../src/com/cloud/network/dao/IPAddressVO.java | 24 +
.../cloud/service/ServiceOfferingDetailsVO.java | 73 ++
.../src/com/cloud/service/ServiceOfferingVO.java | 27 +
.../com/cloud/service/dao/ServiceOfferingDao.java | 2 +
.../cloud/service/dao/ServiceOfferingDaoImpl.java | 19 +-
.../service/dao/ServiceOfferingDetailsDao.java | 29 +
.../service/dao/ServiceOfferingDetailsDaoImpl.java | 98 ++
.../src/com/cloud/upgrade/dao/Upgrade410to420.java | 32 +
framework/jobs/pom.xml | 1 +
.../debian/config/etc/init.d/cloud-early-config | 5 +-
.../affinity/HostAntiAffinityProcessor.java | 31 +-
.../implicit-dedication/pom.xml | 29 +
.../cloud/deploy/ImplicitDedicationPlanner.java | 249 +++++
.../implicitplanner/ImplicitPlannerTest.java | 586 +++++++++++
.../kvm/resource/LibvirtComputingResource.java | 133 ++--
.../kvm/resource/LibvirtDomainXMLParser.java | 57 +-
.../kvm/resource/LibvirtComputingResourceTest.java | 4 +-
.../xen/discoverer/XcpServerDiscoverer.java | 88 +-
.../hypervisor/xen/resource/CitrixHelper.java | 4 +-
.../xen/resource/CitrixResourceBase.java | 40 +-
.../xen/resource/XcpServer16Resource.java | 32 +
.../hypervisor/xen/resource/XcpServerResource.java | 120 ++-
.../xen/resource/XenServer56FP1Resource.java | 91 ++-
.../motion/XenServerStorageMotionStrategy.java | 8 +-
.../xen/resource/CitrixResourceBaseTest.java | 5 +-
.../cloud/network/cisco/CiscoVnmcConnection.java | 22 +-
.../network/cisco/CiscoVnmcConnectionImpl.java | 112 +--
.../cloud/network/resource/CiscoVnmcResource.java | 20 +-
.../network/resource/CiscoVnmcResourceTest.java | 22 +-
.../cloud/network/element/MidoNetElementTest.java | 3 +-
.../response/NetscalerLoadBalancerResponse.java | 21 +
.../cloud/network/element/NetscalerElement.java | 4 +
.../cloud/network/nicira/DestinationNatRule.java | 105 ++
.../src/com/cloud/network/nicira/Match.java | 146 +---
.../src/com/cloud/network/nicira/NatRule.java | 363 ++-----
.../src/com/cloud/network/nicira/NiciraNvpApi.java | 67 +-
.../com/cloud/network/nicira/SourceNatRule.java | 123 +++
.../cloud/network/resource/NiciraNvpResource.java | 57 +-
.../test/com/cloud/network/nicira/NatRuleTest.java | 43 +-
.../network/resource/NiciraNvpResourceTest.java | 113 ++-
plugins/pom.xml | 1 +
scripts/vm/hypervisor/xenserver/xcposs/patch | 2 +
scripts/vm/hypervisor/xenserver/xcpserver/patch | 4 +-
scripts/vm/hypervisor/xenserver/xenserver56/patch | 4 +-
.../vm/hypervisor/xenserver/xenserver56fp1/patch | 4 +-
scripts/vm/hypervisor/xenserver/xenserver60/patch | 4 +-
server/src/com/cloud/api/ApiResponseHelper.java | 124 ++-
.../src/com/cloud/api/query/QueryManagerImpl.java | 2 +-
.../com/cloud/capacity/CapacityManagerImpl.java | 18 +-
.../cloud/configuration/ConfigurationManager.java | 3 +-
.../configuration/ConfigurationManagerImpl.java | 266 ++++--
.../deploy/DeploymentPlanningManagerImpl.java | 24 +-
.../com/cloud/hypervisor/HypervisorGuruBase.java | 4 +-
server/src/com/cloud/network/NetworkManager.java | 43 +-
.../src/com/cloud/network/NetworkManagerImpl.java | 326 ++++++-
server/src/com/cloud/network/NetworkModelImpl.java | 8 +-
.../src/com/cloud/network/NetworkServiceImpl.java | 105 ++-
server/src/com/cloud/network/addr/PublicIp.java | 9 +
.../network/element/VirtualRouterElement.java | 70 ++-
.../network/lb/LoadBalancingRulesManagerImpl.java | 6 +
.../router/VirtualNetworkApplianceManager.java | 2 +-
.../router/VirtualNetworkApplianceManagerImpl.java | 26 +-
.../com/cloud/network/rules/RulesManagerImpl.java | 43 +
.../cloud/network/vpc/NetworkACLServiceImpl.java | 4 +-
.../network/vpn/RemoteAccessVpnManagerImpl.java | 4 +-
server/src/com/cloud/resource/DiscovererBase.java | 1 +
.../com/cloud/resource/ResourceManagerImpl.java | 7 +-
server/src/com/cloud/server/ManagementServer.java | 6 +
.../src/com/cloud/server/ManagementServerImpl.java | 162 +---
.../src/com/cloud/storage/VolumeManagerImpl.java | 22 +-
.../com/cloud/template/TemplateManagerImpl.java | 7 +
server/src/com/cloud/user/AccountManagerImpl.java | 19 +-
server/src/com/cloud/user/DomainManagerImpl.java | 15 +-
server/src/com/cloud/vm/UserVmManager.java | 7 +-
server/src/com/cloud/vm/UserVmManagerImpl.java | 41 +-
.../com/cloud/vm/VirtualMachineManagerImpl.java | 33 +-
.../com/cloud/vm/VirtualMachineProfileImpl.java | 71 +-
.../affinity/AffinityGroupServiceImpl.java | 9 +
.../apache/cloudstack/region/PortableIpDao.java | 39 +
.../cloudstack/region/PortableIpDaoImpl.java | 131 +++
.../cloudstack/region/PortableIpRangeDao.java | 30 +
.../cloudstack/region/PortableIpRangeDaoImpl.java | 65 ++
.../cloudstack/region/PortableIpRangeVO.java | 119 +++
.../org/apache/cloudstack/region/PortableIpVO.java | 222 +++++
.../com/cloud/network/MockNetworkManagerImpl.java | 69 ++-
.../test/com/cloud/vm/MockUserVmManagerImpl.java | 15 +-
.../cloud/vpc/MockConfigurationManagerImpl.java | 60 ++-
.../test/com/cloud/vpc/MockNetworkManagerImpl.java | 89 ++-
.../vpc/MockVpcVirtualNetworkApplianceManager.java | 6 +
.../networkoffering/ChildTestConfiguration.java | 18 +-
services/secondary-storage/scripts/ssvm-check.sh | 4 +-
setup/db/db/schema-302to40.sql | 12 +-
setup/db/db/schema-40to410.sql | 14 +
setup/db/db/schema-410to420.sql | 62 ++-
test/integration/component/test_accounts.py | 2 +-
test/integration/component/test_custom_hostname.py | 369 +++++++
.../component/test_high_availability.py | 28 +-
.../component/test_host_high_availability.py | 14 +-
.../integration/component/test_implicit_planner.py | 232 +++++
test/integration/component/test_ldap.py | 365 +++++++
test/integration/component/test_project_limits.py | 5 +-
test/integration/component/test_projects.py | 34 +-
.../integration/component/test_redundant_router.py | 120 ++--
test/integration/component/test_stopped_vm.py | 70 +-
test/integration/component/test_tags.py | 110 +-
test/integration/component/test_vpc.py | 124 ++--
.../component/test_vpc_host_maintenance.py | 44 +-
test/integration/component/test_vpc_network.py | 108 +-
.../component/test_vpc_network_lbrules.py | 18 +-
.../component/test_vpc_network_pfrules.py | 18 +-
.../component/test_vpc_network_staticnatrule.py | 18 +-
test/integration/component/test_vpc_offerings.py | 52 +-
test/integration/component/test_vpc_routers.py | 93 +--
.../component/test_vpc_vm_life_cycle.py | 98 +-
.../component/test_vpc_vms_deployment.py | 154 ++--
test/integration/component/test_vpn_users.py | 4 +-
test/integration/smoke/test_deploy_vm.py | 3 +
.../smoke/test_deploy_vm_with_userdata.py | 8 +-
...st_deploy_vms_with_varied_deploymentplanners.py | 414 +++++---
test/integration/smoke/test_iso.py | 10 +-
test/integration/smoke/test_network.py | 69 +-
test/integration/smoke/test_nic.py | 51 +-
test/integration/smoke/test_portable_publicip.py | 236 +++++
test/integration/smoke/test_public_ip_range.py | 6 +-
test/integration/smoke/test_pvlan.py | 1 +
test/integration/smoke/test_routers.py | 16 +-
test/integration/smoke/test_templates.py | 11 +-
test/integration/smoke/test_vm_life_cycle.py | 145 ++--
test/integration/smoke/test_vm_snapshots.py | 618 ++++++------
test/integration/smoke/test_volumes.py | 76 +-
tools/apidoc/gen_toc.py | 1 +
tools/marvin/marvin/cloudstackConnection.py | 6 +-
tools/marvin/marvin/integration/lib/base.py | 41 +
ui/scripts/configuration.js | 223 ++++-
ui/scripts/docs.js | 9 +
ui/scripts/network.js | 2 +-
ui/scripts/system.js | 385 ++++++++-
ui/scripts/ui-custom/installWizard.js | 13 +-
ui/scripts/zoneWizard.js | 2 +-
.../com/cloud/utils/db/GenericSearchBuilder.java | 18 +-
utils/src/com/cloud/utils/net/NetUtils.java | 13 +
242 files changed, 10622 insertions(+), 3337 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/api/src/com/cloud/server/ManagementService.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/api/src/org/apache/cloudstack/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/ResponseGenerator.java
index dd2bd58,0732e77..8cc9eaf
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@@ -363,7 -443,12 +365,12 @@@ public interface ResponseGenerator
Long getAffinityGroupId(String name, long entityOwnerId);
+ PortableIpRangeResponse createPortableIPRangeResponse(PortableIpRange range);
+
+ PortableIpResponse createPortableIPResponse(PortableIp portableIp);
+
InternalLoadBalancerElementResponse createInternalLbElementResponse(VirtualRouterProvider result);
-
+
IsolationMethodResponse createIsolationMethodResponse(IsolationType method);
+
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/client/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
----------------------------------------------------------------------
diff --cc engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
index 5e108e0,95abe5f..2e9f47f
--- a/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
+++ b/engine/schema/src/com/cloud/upgrade/dao/Upgrade410to420.java
@@@ -75,10 -75,10 +75,11 @@@ public class Upgrade410to420 implement
updateNetworkACLs(conn);
addHostDetailsIndex(conn);
updateNetworksForPrivateGateways(conn);
+ removeFirewallServiceFromSharedNetworkOfferingWithSGService(conn);
}
- private void updateSystemVmTemplates(Connection conn) {
+ private void updateSystemVmTemplates(Connection conn) {
+ /* TODO: where should be system vm templates located?
PreparedStatement sql = null;
try {
sql = conn.prepareStatement("update vm_template set image_data_store_id = 1 where type = 'SYSTEM' or type = 'BUILTIN'");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 39375f8,1e20d75..ee8531b
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@@ -243,7 -234,7 +243,7 @@@ import com.cloud.vm.VirtualMachineName
/**
* LibvirtComputingResource execute requests on the computing/routing host using
* the libvirt API
-- *
++ *
* @config {@table || Param Name | Description | Values | Default || ||
* hypervisor.type | type of local hypervisor | string | kvm || ||
* hypervisor.uri | local hypervisor to connect to | URI |
@@@ -394,9 -386,7 +394,9 @@@ ServerResource
}
protected BridgeType _bridgeType;
-
+
+ protected StorageSubsystemCommandHandler storageHandler;
+
private String getEndIpFromStartIp(String startIp, int numIps) {
String[] tokens = startIp.split("[.]");
assert (tokens.length == 4);
@@@ -605,13 -595,13 +605,13 @@@
throw new ConfigurationException(
"Unable to find the ovs-pvlan-dhcp-host.sh");
}
--
++
_ovsPvlanVmPath = Script.findScript(networkScriptsDir, "ovs-pvlan-vm.sh");
if ( _ovsPvlanVmPath == null) {
throw new ConfigurationException(
"Unable to find the ovs-pvlan-vm.sh");
}
--
++
String value = (String) params.get("developer");
boolean isDeveloper = Boolean.parseBoolean(value);
@@@ -691,7 -681,7 +691,7 @@@
if (_localStoragePath == null) {
_localStoragePath = "/var/lib/libvirt/images/";
}
--
++
File storagePath = new File(_localStoragePath);
_localStoragePath = storagePath.getAbsolutePath();
@@@ -835,11 -825,7 +835,11 @@@
params.put("libvirt.computing.resource", this);
configureVifDrivers(params);
-
+
+ KVMStorageProcessor storageProcessor = new KVMStorageProcessor(this._storagePoolMgr, this);
+ storageProcessor.configure(name, params);
+ storageHandler = new StorageSubsystemCommandHandlerBase(storageProcessor);
+
return true;
}
@@@ -987,13 -973,18 +987,13 @@@
return pif;
}
-
+
- private String getOvsPif(String bridge) {
- String pif = Script.runSimpleBashScript("ovs-vsctl list-ports " + bridge);
- return pif;
- }
-
private String matchPifFileInDirectory(String bridgeName){
File f = new File("/sys/devices/virtual/net/" + bridgeName + "/brif");
if (! f.isDirectory()){
s_logger.debug("failing to get physical interface from bridge"
-- + bridgeName + ", does " + f.getAbsolutePath()
++ + bridgeName + ", does " + f.getAbsolutePath()
+ "exist?");
return "";
}
@@@ -1063,7 -1054,7 +1063,7 @@@
return vnetId;
}
-- private void passCmdLine(String vmName, String cmdLine)
++ private void passCmdLine(String vmName, String cmdLine)
throws InternalErrorException {
final Script command = new Script(_patchViaSocketPath, _timeout, s_logger);
String result;
@@@ -1373,7 -1362,7 +1373,7 @@@
disksize = dskch.getSize();
if (cmd.getTemplateUrl() != null) {
-- if(primaryPool.getType() == StoragePoolType.CLVM) {
++ if(primaryPool.getType() == StoragePoolType.CLVM) {
vol = templateToPrimaryDownload(cmd.getTemplateUrl(),primaryPool);
} else {
BaseVol = primaryPool.getPhysicalDisk(cmd.getTemplateUrl());
@@@ -1450,7 -1439,7 +1450,7 @@@
private String getResizeScriptType (KVMStoragePool pool, KVMPhysicalDisk vol) {
StoragePoolType poolType = pool.getType();
PhysicalDiskFormat volFormat = vol.getFormat();
--
++
if(pool.getType() == StoragePoolType.CLVM && volFormat == PhysicalDiskFormat.RAW) {
return "CLVM";
} else if ((poolType == StoragePoolType.NetworkFilesystem
@@@ -1462,7 -1451,7 +1462,7 @@@
return null;
}
-- /* uses a local script now, eventually support for virStorageVolResize() will maybe work on
++ /* uses a local script now, eventually support for virStorageVolResize() will maybe work on
qcow2 and lvm and we can do this in libvirt calls */
public Answer execute(ResizeVolumeCommand cmd) {
String volid = cmd.getPath();
@@@ -1479,16 -1468,16 +1479,16 @@@
String type = getResizeScriptType(pool, vol);
if (type == null) {
-- return new ResizeVolumeAnswer(cmd, false, "Unsupported volume format: pool type '"
++ return new ResizeVolumeAnswer(cmd, false, "Unsupported volume format: pool type '"
+ pool.getType() + "' and volume format '" + vol.getFormat() + "'");
} else if (type.equals("QCOW2") && shrinkOk) {
return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of type " + type);
}
-- s_logger.debug("got to the stage where we execute the volume resize, params:"
++ s_logger.debug("got to the stage where we execute the volume resize, params:"
+ path + "," + currentSize + "," + newSize + "," + type + "," + vmInstanceName + "," + shrinkOk);
final Script resizecmd = new Script(_resizeVolumePath,
-- _cmdsTimeout, s_logger);
++ _cmdsTimeout, s_logger);
resizecmd.add("-s",String.valueOf(newSize));
resizecmd.add("-c",String.valueOf(currentSize));
resizecmd.add("-p",path);
@@@ -1512,8 -1501,8 +1512,8 @@@
s_logger.debug(error);
return new ResizeVolumeAnswer(cmd, false, error);
}
--
-- }
++
++ }
public Answer execute(DestroyCommand cmd) {
VolumeTO vol = cmd.getVolume();
@@@ -1537,7 -1528,7 +1537,7 @@@
if(pifparts.length == 2) {
return pifparts[1];
} else {
-- s_logger.debug("failed to get vlan id from bridge " + brName
++ s_logger.debug("failed to get vlan id from bridge " + brName
+ "attached to physical interface" + pif);
return "";
}
@@@ -1552,13 -1543,13 +1552,13 @@@
String dhcpIp = cmd.getDhcpIp();
String vmMac = cmd.getVmMac();
boolean add = true;
--
++
String opr = "-A";
if (op.equals("delete")) {
opr = "-D";
add = false;
}
--
++
String result = null;
Connect conn;
try {
@@@ -1722,7 -1715,9 +1722,7 @@@
private SetNetworkACLAnswer execute(SetNetworkACLCommand cmd) {
String[] results = new String[cmd.getRules().length];
-
- String callResult;
- Connect conn;
- String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
++
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
String privateGw = cmd.getAccessDetail(NetworkElementCommand.VPC_PRIVATE_GATEWAY);
@@@ -1772,7 -1770,7 +1772,7 @@@
for (InterfaceDef pluggedNic : pluggedNics) {
String pluggedVlanBr = pluggedNic.getBrName();
String pluggedVlanId = getVlanIdFromBridge(pluggedVlanBr);
-- if (pubVlan.equalsIgnoreCase(Vlan.UNTAGGED)
++ if (pubVlan.equalsIgnoreCase(Vlan.UNTAGGED)
&& pluggedVlanBr.equalsIgnoreCase(_publicBridgeName)) {
break;
} else if (pluggedVlanBr.equalsIgnoreCase(_linkLocalBridgeName)){
@@@ -1818,7 -1817,7 +1818,7 @@@
for (InterfaceDef pluggedNic : pluggedNics) {
String pluggedVlan = pluggedNic.getBrName();
if (pluggedVlan.equalsIgnoreCase(_linkLocalBridgeName)) {
-- vlanToNicNum.put("LinkLocal",devNum);
++ vlanToNicNum.put("LinkLocal",devNum);
} else if (pluggedVlan.equalsIgnoreCase(_publicBridgeName)
|| pluggedVlan.equalsIgnoreCase(_privBridgeName)
|| pluggedVlan.equalsIgnoreCase(_guestBridgeName)) {
@@@ -1864,8 -1863,8 +1864,8 @@@
if (nic.getBrName().equalsIgnoreCase(_linkLocalBridgeName)) {
vlanAllocatedToVM.put("LinkLocal", nicPos);
} else {
-- if (nic.getBrName().equalsIgnoreCase(_publicBridgeName)
-- || nic.getBrName().equalsIgnoreCase(_privBridgeName)
++ if (nic.getBrName().equalsIgnoreCase(_publicBridgeName)
++ || nic.getBrName().equalsIgnoreCase(_privBridgeName)
|| nic.getBrName().equalsIgnoreCase(_guestBridgeName)) {
vlanAllocatedToVM.put(Vlan.UNTAGGED, nicPos);
} else {
@@@ -3351,14 -3357,10 +3351,14 @@@
}
}
- private String getVolumePath(Connect conn, VolumeTO volume)
+ private String getVolumePath(Connect conn, DiskTO volume)
throws LibvirtException, URISyntaxException {
- if (volume.getType() == Volume.Type.ISO && volume.getPath() != null) {
- String isoPath = volume.getPath();
+ DataTO data = volume.getData();
+ DataStoreTO store = data.getDataStore();
-
++
+ if (volume.getType() == Volume.Type.ISO && data.getPath() != null) {
+ NfsTO nfsStore = (NfsTO)store;
+ String isoPath = nfsStore.getUrl() + File.separator + data.getPath();
int index = isoPath.lastIndexOf("/");
String path = isoPath.substring(0, index);
String name = isoPath.substring(index + 1);
@@@ -4308,7 -4312,28 +4305,29 @@@
return parser.getEmulator();
}
+
+ private String getGuestType(Connect conn, String vmName) {
+ LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
+ Domain dm = null;
+ try {
+ dm = conn.domainLookupByName(vmName);
+ String xmlDesc = dm.getXMLDesc(0);
+ parser.parseDomainXML(xmlDesc);
+ return parser.getDescription();
+ } catch (LibvirtException e) {
+ s_logger.trace("Ignoring libvirt error.", e);
+ return null;
+ } finally {
+ try {
+ if (dm != null) {
+ dm.free();
+ }
+ } catch (LibvirtException l) {
+ s_logger.trace("Ignoring libvirt error.", l);
+ }
+ }
+ }
+
boolean isGuestPVEnabled(String guestOS) {
if (guestOS == null) {
return false;
@@@ -4378,10 -4411,10 +4397,10 @@@
}
}
- private Domain getDomain(Connect conn, String vmName)
+ public Domain getDomain(Connect conn, String vmName)
throws LibvirtException {
return conn
- .domainLookupByUUID(UUID.nameUUIDFromBytes(vmName.getBytes()));
+ .domainLookupByName(vmName);
}
protected List<InterfaceDef> getInterfaces(Connect conn, String vmName) {
@@@ -4786,13 -4848,13 +4803,13 @@@
@Override
public void setName(String name) {
// TODO Auto-generated method stub
--
++
}
@Override
public void setConfigParams(Map<String, Object> params) {
// TODO Auto-generated method stub
--
++
}
@Override
@@@ -4810,7 -4872,7 +4827,7 @@@
@Override
public void setRunLevel(int level) {
// TODO Auto-generated method stub
--
++
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
index 5698218,fd49836..6d9265d
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java
@@@ -79,10 -62,11 +62,10 @@@ import com.cloud.resource.ResourceManag
import com.cloud.resource.ResourceStateAdapter;
import com.cloud.resource.ServerResource;
import com.cloud.resource.UnableDeleteHostException;
- import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType;
+ import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.dao.VMTemplateDao;
-import com.cloud.storage.dao.VMTemplateHostDao;
import com.cloud.user.Account;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.SearchCriteria.Op;
@@@ -425,37 -428,36 +426,36 @@@ public class XcpServerDiscoverer extend
prodVersion = prodVersion.trim();
}
- if(prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0") || prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4"))) {
- return new XcpServerResource("1.1");
+ // Xen Cloud Platform group of hypervisors
+ if (prodBrand.equals("XCP") && (
+ prodVersion.equals("1.0.0")
+ || prodVersion.equals("1.1.0")
+ || prodVersion.equals("5.6.100")
+ || prodVersion.startsWith("1.4")
+ )) {
+ return new XcpServerResource();
} else if (prodBrand.equals("XCP") && prodVersion.startsWith("1.6")) {
- return new XcpServerResource("1.6");
- }
-
- if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
+ return new XcpServer16Resource();
+ } // Citrix Xenserver group of hypervisors
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
- return new XenServer56Resource();
+ return new XenServer56Resource();
-
- if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
- return new XenServer600Resource();
+ return new XenServer600Resource();
-
- if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2"))
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2"))
- return new XenServer602Resource();
+ return new XenServer602Resource();
-
- if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
return new XenServer610Resource();
-
- if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
+ else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
- String prodVersionTextShort = record.softwareVersion.get("product_version_text_short").trim();
+ String prodVersionTextShort = record.softwareVersion.get("product_version_text_short").trim();
- if("5.6 SP2".equals(prodVersionTextShort)) {
+ if ("5.6 SP2".equals(prodVersionTextShort)) {
- return new XenServer56SP2Resource();
+ return new XenServer56SP2Resource();
- } else if("5.6 FP1".equals(prodVersionTextShort)) {
+ } else if ("5.6 FP1".equals(prodVersionTextShort)) {
- return new XenServer56FP1Resource();
- }
+ return new XenServer56FP1Resource();
+ }
- }
-
- if (prodBrand.equals("XCP_Kronos")) {
+ } else if (prodBrand.equals("XCP_Kronos")) {
- return new XcpOssResource();
- }
-
+ return new XcpOssResource();
+ }
+
String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0 but this one is " + prodBrand + " " + prodVersion;
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
s_logger.debug(msg);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
----------------------------------------------------------------------
diff --cc plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
index d2b96e4,54aeef5..724c21b
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
@@@ -11,31 -11,16 +11,31 @@@
// 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
++// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.hypervisor.xen.resource;
++
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ejb.Local;
+
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.log4j.Logger;
+import org.apache.xmlrpc.XmlRpcException;
+
import com.cloud.agent.api.FenceAnswer;
import com.cloud.agent.api.FenceCommand;
+import com.cloud.agent.api.to.DiskTO;
import com.cloud.agent.api.to.VirtualMachineTO;
--import com.cloud.agent.api.to.VolumeTO;
import com.cloud.resource.ServerResource;
import com.cloud.storage.Volume;
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
@@@ -48,25 -33,36 +48,25 @@@ import com.xensource.xenapi.Types.XenAP
import com.xensource.xenapi.VBD;
import com.xensource.xenapi.VDI;
import com.xensource.xenapi.VM;
@Local(value=ServerResource.class)
public class XenServer56FP1Resource extends XenServer56Resource {
+ private static final long mem_128m = 134217728L;
private static final Logger s_logger = Logger.getLogger(XenServer56FP1Resource.class);
--
++
public XenServer56FP1Resource() {
super();
}
--
++
@Override
protected String getGuestOsType(String stdType, boolean bootFromCD) {
return CitrixHelper.getXenServer56FP1GuestOsType(stdType, bootFromCD);
}
--
++
@Override
-- protected List<File> getPatchFiles() {
++ protected List<File> getPatchFiles() {
List<File> files = new ArrayList<File>();
-- String patch = "scripts/vm/hypervisor/xenserver/xenserver56fp1/patch";
++ String patch = "scripts/vm/hypervisor/xenserver/xenserver56fp1/patch";
String patchfilePath = Script.findScript("" , patch);
if ( patchfilePath == null ) {
throw new CloudRuntimeException("Unable to find patch file " + patch);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/plugins/pom.xml
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/api/ApiResponseHelper.java
index ae666fe,540c8e9..1cb425a
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@@ -102,9 -90,10 +90,11 @@@ import org.apache.cloudstack.api.respon
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.NicResponse;
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
+import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.PodResponse;
+ import org.apache.cloudstack.api.response.PortableIpRangeResponse;
+ import org.apache.cloudstack.api.response.PortableIpResponse;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
@@@ -444,11 -437,11 +442,11 @@@ public class ApiResponseHelper implemen
snapshotResponse.setVolumeId(volume.getUuid());
snapshotResponse.setVolumeName(volume.getName());
snapshotResponse.setVolumeType(volume.getVolumeType().name());
--
++
DataCenter zone = ApiDBUtils.findZoneById(volume.getDataCenterId());
if (zone != null) {
snapshotResponse.setZoneName(zone.getName());
-- snapshotResponse.setZoneType(zone.getNetworkType().toString());
++ snapshotResponse.setZoneType(zone.getNetworkType().toString());
}
}
snapshotResponse.setCreated(snapshot.getCreated());
@@@ -733,7 -726,9 +731,10 @@@
}
}
- // set tag information
++
+ ipResponse.setPortable(ipAddr.isPortable());
+
+ //set tag information
List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.PublicIpAddress, ipAddr.getId());
List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
for (ResourceTag tag : tags) {
@@@ -781,7 -776,10 +782,10 @@@
tagResponses.add(tagResponse);
}
lbResponse.setTags(tagResponses);
-
+
+ Network ntwk = ApiDBUtils.findNetworkById(loadBalancer.getNetworkId());
+ lbResponse.setNetworkId(ntwk.getUuid());
+
lbResponse.setObjectName("loadbalancer");
return lbResponse;
}
@@@ -954,15 -948,6 +958,15 @@@
}
@Override
+ public ImageStoreResponse createImageStoreResponse(ImageStore os) {
+ List<ImageStoreJoinVO> viewStores = ApiDBUtils.newImageStoreView(os);
+ List<ImageStoreResponse> listStores = ViewResponseHelper
+ .createImageStoreResponse(viewStores.toArray(new ImageStoreJoinVO[viewStores.size()]));
+ assert listStores != null && listStores.size() == 1 : "There should be one image data store returned";
+ return listStores.get(0);
+ }
-
++
+ @Override
public StoragePoolForMigrationResponse createStoragePoolForMigrationResponse(StoragePool pool) {
List<StoragePoolJoinVO> viewPools = ApiDBUtils.newStoragePoolView(pool);
List<StoragePoolForMigrationResponse> listPools = ViewResponseHelper.createStoragePoolForMigrationResponse(
@@@ -991,11 -976,12 +995,11 @@@
clusterResponse.setClusterType(cluster.getClusterType().toString());
clusterResponse.setAllocationState(cluster.getAllocationState().toString());
clusterResponse.setManagedState(cluster.getManagedState().toString());
- String cpuOvercommitRatio = ApiDBUtils.findClusterDetails(cluster.getId(), "cpuOvercommitRatio").getValue();
- String memoryOvercommitRatio = ApiDBUtils.findClusterDetails(cluster.getId(), "memoryOvercommitRatio").getValue();
- clusterResponse.setCpuovercommitratio(cpuOvercommitRatio);
- clusterResponse.setRamovercommitratio(memoryOvercommitRatio);
+ String cpuOvercommitRatio=ApiDBUtils.findClusterDetails(cluster.getId(),"cpuOvercommitRatio").getValue();
+ String memoryOvercommitRatio=ApiDBUtils.findClusterDetails(cluster.getId(),"memoryOvercommitRatio").getValue();
+ clusterResponse.setCpuOvercommitRatio(cpuOvercommitRatio);
+ clusterResponse.setMemoryOvercommitRatio(memoryOvercommitRatio);
-
if (showCapacities != null && showCapacities) {
List<SummedCapacity> capacities = ApiDBUtils.getCapacityByClusterPodZone(null, null, cluster.getId());
Set<CapacityResponse> capacityResponses = new HashSet<CapacityResponse>();
@@@ -1302,25 -1413,126 +1306,25 @@@
}
@Override
- public List<TemplateResponse> createTemplateResponses(long templateId, long zoneId, boolean readyOnly) {
+ public List<TemplateResponse> createTemplateResponses(long templateId, Long zoneId, boolean readyOnly) {
VirtualMachineTemplate template = findTemplateById(templateId);
- List<TemplateResponse> responses = new ArrayList<TemplateResponse>();
- VMTemplateHostVO templateHostRef = ApiDBUtils.findTemplateHostRef(templateId, zoneId, readyOnly);
- if (templateHostRef == null) {
- return responses;
- }
-
- HostVO host = ApiDBUtils.findHostById(templateHostRef.getHostId());
- if (host.getType() == Host.Type.LocalSecondaryStorage && host.getStatus() != com.cloud.host.Status.Up) {
- return responses;
- }
-
- TemplateResponse templateResponse = new TemplateResponse();
- templateResponse.setId(template.getUuid());
- templateResponse.setName(template.getName());
- templateResponse.setDisplayText(template.getDisplayText());
- templateResponse.setPublic(template.isPublicTemplate());
- templateResponse.setCreated(templateHostRef.getCreated());
-
- templateResponse.setReady(templateHostRef.getDownloadState() == Status.DOWNLOADED);
- templateResponse.setFeatured(template.isFeatured());
- templateResponse.setExtractable(template.isExtractable() && !(template.getTemplateType() == TemplateType.SYSTEM));
- templateResponse.setPasswordEnabled(template.getEnablePassword());
- templateResponse.setSshKeyEnabled(template.getEnableSshKey());
- templateResponse.setCrossZones(template.isCrossZones());
- templateResponse.setFormat(template.getFormat());
- if (template.getTemplateType() != null) {
- templateResponse.setTemplateType(template.getTemplateType().toString());
- }
-
- templateResponse.setHypervisor(template.getHypervisorType().toString());
- templateResponse.setDetails(template.getDetails());
-
- GuestOS os = ApiDBUtils.findGuestOSById(template.getGuestOSId());
- if (os != null) {
- templateResponse.setOsTypeId(os.getUuid());
- templateResponse.setOsTypeName(os.getDisplayName());
- } else {
- templateResponse.setOsTypeId("-1");
- templateResponse.setOsTypeName("");
- }
-
- Account account = ApiDBUtils.findAccountByIdIncludingRemoved(template.getAccountId());
- populateAccount(templateResponse, account.getId());
- populateDomain(templateResponse, account.getDomainId());
-
- DataCenter datacenter = ApiDBUtils.findZoneById(zoneId);
-
- if (datacenter != null) {
- // Add the zone ID
- templateResponse.setZoneId(datacenter.getUuid());
- templateResponse.setZoneName(datacenter.getName());
- templateResponse.setZoneType(datacenter.getNetworkType().toString());
- }
-
- boolean isAdmin = false;
- Account caller = UserContext.current().getCaller();
- if ((caller == null) || BaseCmd.isAdmin(caller.getType())) {
- isAdmin = true;
- }
-
- // If the user is an Admin, add the template download status
- if (isAdmin || caller.getId() == template.getAccountId()) {
- // add download status
- if (templateHostRef.getDownloadState() != Status.DOWNLOADED) {
- String templateStatus = "Processing";
- if (templateHostRef.getDownloadState() == VMTemplateHostVO.Status.DOWNLOAD_IN_PROGRESS) {
- if (templateHostRef.getDownloadPercent() == 100) {
- templateStatus = "Installing Template";
- } else {
- templateStatus = templateHostRef.getDownloadPercent() + "% Downloaded";
- }
- } else {
- templateStatus = templateHostRef.getErrorString();
- }
- templateResponse.setStatus(templateStatus);
- } else if (templateHostRef.getDownloadState() == VMTemplateHostVO.Status.DOWNLOADED) {
- templateResponse.setStatus("Download Complete");
- } else {
- templateResponse.setStatus("Successfully Installed");
- }
- }
-
- Long templateSize = templateHostRef.getSize();
- if (templateSize > 0) {
- templateResponse.setSize(templateSize);
- }
-
- templateResponse.setChecksum(template.getChecksum());
- if (template.getSourceTemplateId() != null) {
- VirtualMachineTemplate tmpl = ApiDBUtils.findTemplateById(template.getSourceTemplateId());
- if (tmpl != null) {
- templateResponse.setSourceTemplateId(tmpl.getUuid());
- }
- }
-
- templateResponse.setChecksum(template.getChecksum());
+ return createTemplateResponses(template, zoneId, readyOnly);
+ }
- templateResponse.setTemplateTag(template.getTemplateTag());
- //set tag information
- List<? extends ResourceTag> tags = null;
- if (template.getFormat() == ImageFormat.ISO) {
- tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.ISO, template.getId());
+ @Override
+ public List<TemplateResponse> createIsoResponses(VirtualMachineTemplate result, Long zoneId, boolean readyOnly) {
+ List<TemplateJoinVO> tvo = null;
+ if (zoneId == null || zoneId == -1) {
+ tvo = ApiDBUtils.newTemplateView(result);
} else {
- tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.Template, template.getId());
+ tvo = ApiDBUtils.newTemplateView(result, zoneId, readyOnly);
}
-
- List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();
- for (ResourceTag tag : tags) {
- ResourceTagResponse tagResponse = createResourceTagResponse(tag, true);
- tagResponses.add(tagResponse);
- }
- templateResponse.setTags(tagResponses);
+
- templateResponse.setObjectName("template");
- responses.add(templateResponse);
- return responses;
+ return ViewResponseHelper.createIsoResponse(tvo.toArray(new TemplateJoinVO[tvo.size()]));
}
+ /*
@Override
public List<TemplateResponse> createIsoResponses(long isoId, Long zoneId, boolean readyOnly) {
@@@ -2084,13 -2286,13 +2088,13 @@@
response.setForVpc(ApiDBUtils.isOfferingForVpc(offering));
response.setServices(serviceResponses);
--
++
//set network offering details
Map<Detail, String> details = _ntwkModel.getNtwkOffDetails(offering.getId());
if (details != null && !details.isEmpty()) {
response.setDetails(details);
}
--
++
response.setObjectName("networkoffering");
return response;
}
@@@ -3522,7 -3736,7 +3526,7 @@@
return response;
}
--
++
@Override
public ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(ApplicationLoadBalancerRule lb, Map<Ip, UserVm> lbInstances) {
@@@ -3534,7 -3748,7 +3538,7 @@@
Network nw = ApiDBUtils.findNetworkById(lb.getNetworkId());
lbResponse.setNetworkId(nw.getUuid());
populateOwner(lbResponse, lb);
--
++
if (lb.getScheme() == Scheme.Internal) {
lbResponse.setSourceIp(lb.getSourceIp().addr());
//TODO - create the view for the load balancer rule to reflect the network uuid
@@@ -3547,7 -3761,7 +3551,7 @@@
Network ntwk = ApiDBUtils.findNetworkById(publicIp.getNetworkId());
lbResponse.setSourceIpNetworkId(ntwk.getUuid());
}
--
++
//set load balancer rules information (only one rule per load balancer in this release)
List<ApplicationLoadBalancerRuleResponse> ruleResponses = new ArrayList<ApplicationLoadBalancerRuleResponse>();
ApplicationLoadBalancerRuleResponse ruleResponse = new ApplicationLoadBalancerRuleResponse();
@@@ -3561,7 -3775,7 +3565,7 @@@
ruleResponse.setObjectName("loadbalancerrule");
ruleResponses.add(ruleResponse);
lbResponse.setLbRules(ruleResponses);
--
++
//set Lb instances information
List<ApplicationLoadBalancerInstanceResponse> instanceResponses = new ArrayList<ApplicationLoadBalancerInstanceResponse>();
for (Ip ip : lbInstances.keySet()) {
@@@ -3573,7 -3787,7 +3577,7 @@@
instanceResponse.setObjectName("loadbalancerinstance");
instanceResponses.add(instanceResponse);
}
--
++
lbResponse.setLbInstances(instanceResponses);
//set tag information
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/capacity/CapacityManagerImpl.java
index a627719,e58ae40..7a94c78
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@@ -177,10 -177,10 +177,10 @@@ public class CapacityManagerImpl extend
ServiceOfferingVO svo = _offeringsDao.findById(vm.getServiceOfferingId());
CapacityVO capacityCpu = _capacityDao.findByHostIdType(hostId, CapacityVO.CAPACITY_TYPE_CPU);
CapacityVO capacityMemory = _capacityDao.findByHostIdType(hostId, CapacityVO.CAPACITY_TYPE_MEMORY);
- Long clusterId=null;
+ Long clusterId = null;
if (hostId != null) {
- HostVO host = _hostDao.findById(hostId);
+ HostVO host = _hostDao.findById(hostId);
- clusterId= host.getClusterId();
+ clusterId = host.getClusterId();
}
if (capacityCpu == null || capacityMemory == null || svo == null) {
return false;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 174a7ad,47c5482..f0b6899
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@@ -39,11 -39,11 +39,8 @@@ import javax.naming.NamingException
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
-
--import com.cloud.dc.*;
--import com.cloud.dc.dao.*;
--import com.cloud.user.*;
import com.cloud.event.UsageEventUtils;
+ import com.cloud.utils.db.*;
import org.apache.cloudstack.acl.SecurityChecker;
import org.apache.cloudstack.api.ApiConstants.LDAPParams;
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
@@@ -68,8 -71,8 +68,10 @@@ import org.apache.cloudstack.api.comman
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+ import org.apache.cloudstack.region.*;
+ import org.apache.cloudstack.region.dao.RegionDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
@@@ -113,7 -116,7 +115,6 @@@ import com.cloud.domain.DomainVO
import com.cloud.domain.dao.DomainDao;
import com.cloud.event.ActionEvent;
import com.cloud.event.EventTypes;
--import com.cloud.event.UsageEventUtils;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
@@@ -199,58 -201,58 +197,6 @@@ import com.cloud.vm.dao.NicIpAliasDao
import com.cloud.vm.dao.NicIpAliasVO;
import com.cloud.vm.dao.NicSecondaryIpDao;
import edu.emory.mathcs.backport.java.util.Arrays;
--import org.apache.cloudstack.acl.SecurityChecker;
--import org.apache.cloudstack.api.ApiConstants.LDAPParams;
--import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
--import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
--import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
--import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd;
--import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
--import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd;
--import org.apache.cloudstack.api.command.admin.offering.CreateDiskOfferingCmd;
--import org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd;
--import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd;
--import org.apache.cloudstack.api.command.admin.offering.DeleteServiceOfferingCmd;
--import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd;
--import org.apache.cloudstack.api.command.admin.offering.UpdateServiceOfferingCmd;
--import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
--import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
--import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
--import org.apache.cloudstack.api.command.admin.vlan.DedicatePublicIpRangeCmd;
--import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
--import org.apache.cloudstack.api.command.admin.vlan.ReleasePublicIpRangeCmd;
--import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
--import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
--import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
--import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
--import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
--import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
--import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
--import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
--import org.apache.log4j.Logger;
--import org.springframework.stereotype.Component;
--
--import javax.ejb.Local;
--import javax.inject.Inject;
--import javax.naming.ConfigurationException;
--import javax.naming.Context;
--import javax.naming.NamingException;
--import javax.naming.directory.DirContext;
--import javax.naming.directory.InitialDirContext;
--import java.net.URI;
--import java.sql.PreparedStatement;
--import java.sql.ResultSet;
--import java.sql.SQLException;
--import java.util.ArrayList;
--import java.util.Collection;
--import java.util.HashMap;
--import java.util.HashSet;
--import java.util.Hashtable;
--import java.util.Iterator;
--import java.util.List;
--import java.util.Map;
--import java.util.Set;
--import java.util.UUID;
@Component
@Local(value = { ConfigurationManager.class, ConfigurationService.class })
@@@ -1901,7 -1911,7 +1855,7 @@@ public class ConfigurationManagerImpl e
userNetwork.setBroadcastDomainType(broadcastDomainType);
userNetwork.setNetworkDomain(networkDomain);
-- _networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, false,
++ _networkMgr.setupNetwork(systemAccount, offering, userNetwork, plan, null, null, false,
Domain.ROOT_DOMAIN, null, null, null, true);
}
}
@@@ -2543,7 -2560,7 +2504,7 @@@
Transaction txn = Transaction.currentTxn();
txn.start();
-- Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, podId, startIP,
++ Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, podId, startIP,
endIP, newVlanGateway, newVlanNetmask, vlanId, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
//create an entry in the nic_secondary table. This will be the new gateway that will be configured on the corresponding routervm.
if (sameSubnet == false) {
@@@ -2918,7 -2936,7 +2879,7 @@@
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
" as ip " + ip + " belonging to the range is used for static nat purposes. Cleanup the rules first");
}
--
++
if (ip.isSourceNat()) {
throw new InvalidParameterValueException("Can't delete account specific vlan " + vlanDbId +
" as ip " + ip + " belonging to the range is a source nat ip for the network id=" + ip.getSourceNetworkId() +
@@@ -2937,7 -2955,7 +2898,7 @@@
}
} finally {
_vlanDao.releaseFromLockTable(vlanDbId);
-- }
++ }
}
}
@@@ -3765,7 -3783,7 +3726,7 @@@
firewallProviderSet.add(firewallProvider);
serviceProviderMap.put(Service.Firewall, firewallProviderSet);
}
--
++
Map<NetworkOffering.Detail, String> details = new HashMap<NetworkOffering.Detail, String>();
if (detailsStr != null) {
for (String detailStr : detailsStr.keySet()) {
@@@ -3820,7 -3838,7 +3781,7 @@@
throw new InvalidParameterValueException("Unknown specified value for " + Capability.LbSchemes.getName());
}
} else {
-- throw new InvalidParameterValueException("Only " + Capability.SupportedLBIsolation.getName() +
++ throw new InvalidParameterValueException("Only " + Capability.SupportedLBIsolation.getName() +
", " + Capability.ElasticLb.getName() + ", " + Capability.InlineMode.getName()
+ ", " + Capability.LbSchemes.getName() + " capabilities can be sepcified for LB service");
}
@@@ -3974,7 -3992,7 +3935,7 @@@
} else {
inline = false;
}
--
++
String publicLbStr = lbServiceCapabilityMap.get(Capability.LbSchemes);
if (serviceProviderMap.containsKey(Service.Lb)) {
if (publicLbStr != null) {
@@@ -3987,7 -4005,7 +3948,7 @@@
}
}
}
--
++
//in the current version of the code, publicLb and specificLb can't both be set to true for the same network offering
if (publicLb && internalLb) {
throw new InvalidParameterValueException("Public lb and internal lb can't be enabled at the same time on the offering");
@@@ -4030,7 -4048,7 +3991,7 @@@
if (serviceOfferingId != null) {
offering.setServiceOfferingId(serviceOfferingId);
}
--
++
//validate the details
if (details != null) {
validateNtwkOffDetails(details, serviceProviderMap);
@@@ -4077,7 -4095,7 +4038,7 @@@
protected void validateNtwkOffDetails(Map<Detail, String> details, Map<Service, Set<Provider>> serviceProviderMap) {
for (Detail detail : details.keySet()) {
--
++
Provider lbProvider = null;
if (detail == NetworkOffering.Detail.InternalLbProvider || detail == NetworkOffering.Detail.PublicLbProvider) {
//1) Vaidate the detail values - have to match the lb provider name
@@@ -4092,13 -4110,13 +4053,13 @@@
break;
}
}
-- }
--
++ }
++
if (lbProvider == null) {
throw new InvalidParameterValueException("Invalid value " + details.get(detail)
+ " for the detail " + detail + ". The provider is not supported by the network offering");
}
--
++
//2) validate if the provider supports the scheme
Set<Provider> lbProviders = new HashSet<Provider>();
lbProviders.add(lbProvider);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/hypervisor/HypervisorGuruBase.java
index 33e9d5d,ea4fcc1..befd8c1
--- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
@@@ -88,9 -86,9 +88,9 @@@ public abstract class HypervisorGuruBas
ServiceOffering offering = vmProfile.getServiceOffering();
VirtualMachine vm = vmProfile.getVirtualMachine();
- Long minMemory = (long) (offering.getRamSize()/vmProfile.getCpuOvercommitRatio());
- int minspeed= (int)(offering.getSpeed()/vmProfile.getMemoryOvercommitRatio());
+ Long minMemory = (long) (offering.getRamSize() / vmProfile.getMemoryOvercommitRatio());
+ int minspeed = (int) (offering.getSpeed() / vmProfile.getCpuOvercommitRatio());
- int maxspeed = (offering.getSpeed());
+ int maxspeed = (offering.getSpeed());
VirtualMachineTO to = new VirtualMachineTO(vm.getId(), vm.getInstanceName(), vm.getType(), offering.getCpu(), minspeed, maxspeed,
minMemory * 1024l * 1024l, offering.getRamSize() * 1024l * 1024l, null, null, vm.isHaEnabled(), vm.limitCpuUse(), vm.getVncPassword());
to.setBootArgs(vmProfile.getBootArgs());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/network/NetworkManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/NetworkManagerImpl.java
index bf79596,254510b..e880180
--- a/server/src/com/cloud/network/NetworkManagerImpl.java
+++ b/server/src/com/cloud/network/NetworkManagerImpl.java
@@@ -740,13 -803,15 +802,15 @@@ public class NetworkManagerImpl extend
}
DataCenter zone = _configMgr.getZone(network.getDataCenterId());
- if (network.getGuestType() == Network.GuestType.Shared && zone.getNetworkType() == NetworkType.Advanced) {
+ if (zone.getNetworkType() == NetworkType.Advanced) {
+ if (network.getGuestType() == Network.GuestType.Shared) {
- if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
- _accountMgr.checkAccess(UserContext.current().getCaller(), AccessType.UseNetwork, false, network);
- } else {
- throw new InvalidParameterValueException("IP can be associated with guest network of 'shared' type only if " +
- "network services Source Nat, Static Nat, Port Forwarding, Load balancing, firewall are enabled in the network");
- }
+ if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId())) {
+ _accountMgr.checkAccess(UserContext.current().getCaller(), AccessType.UseNetwork, false, network);
+ } else {
+ throw new InvalidParameterValueException("IP can be associated with guest network of 'shared' type only if " +
+ "network services Source Nat, Static Nat, Port Forwarding, Load balancing, firewall are enabled in the network");
+ }
+ }
} else {
_accountMgr.checkAccess(caller, null, true, ipToAssoc);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
index f5f99ed,b969be2..4e3b903
--- a/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
+++ b/server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java
@@@ -2234,15 -2234,22 +2235,22 @@@ public class VirtualNetworkApplianceMan
}
Network network = _networkDao.findById(nic.getNetworkId());
String networkTag = _networkModel.getNetworkTag(router.getHypervisorType(), network);
- PvlanSetupCommand cmd = PvlanSetupCommand.createDhcpSetup(op, nic.getBroadcastUri(), networkTag, router.getInstanceName(), nic.getMacAddress(), nic.getIp4Address());
- Commands cmds = new Commands(cmd);
+ PvlanSetupCommand cmd = PvlanSetupCommand.createDhcpSetup(op, nic.getBroadCastUri(), networkTag, router.getInstanceName(), nic.getMacAddress(), nic.getIp4Address());
// In fact we send command to the host of router, we're not programming router but the host
+ Answer answer = null;
- try {
+ try {
- sendCommandsToRouter(router, cmds);
+ answer = _agentMgr.send(hostId, cmd);
+ } catch (OperationTimedoutException e) {
+ s_logger.warn("Timed Out", e);
+ return false;
- } catch (AgentUnavailableException e) {
+ } catch (AgentUnavailableException e) {
s_logger.warn("Agent Unavailable ", e);
- return false;
- }
+ return false;
+ }
+
+ if (answer == null || !answer.getResult()) {
+ return false;
+ }
return true;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/server/ManagementServerImpl.java
index 17f87a5,8323af8..95ef6f4
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@@ -17,11 -17,11 +17,7 @@@
package com.cloud.server;
import java.lang.reflect.Field;
--import java.net.Inet6Address;
--import java.net.InetAddress;
--import java.net.URI;
import java.net.URISyntaxException;
--import java.net.UnknownHostException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.ArrayList;
@@@ -29,10 -29,10 +25,8 @@@ import java.util.Calendar
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
--import java.util.HashSet;
import java.util.List;
import java.util.Map;
--import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@@ -43,12 -43,22 +37,20 @@@ import javax.crypto.spec.SecretKeySpec
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+ import com.cloud.exception.*;
+ import com.cloud.vm.*;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
- import org.apache.cloudstack.affinity.AffinityGroupProcessor;
- import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.api.ApiConstants;
+
+ import com.cloud.event.ActionEventUtils;
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
+ import org.apache.cloudstack.api.command.admin.region.*;
+ import org.apache.cloudstack.api.response.ExtractResponse;
+ import org.apache.commons.codec.binary.Base64;
+ import org.apache.log4j.Logger;
+ import org.apache.cloudstack.affinity.AffinityGroupProcessor;
+ import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd;
import org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd;
import org.apache.cloudstack.api.command.admin.account.DisableAccountCmd;
@@@ -281,8 -278,8 +274,6 @@@ import org.apache.cloudstack.api.comman
import org.apache.cloudstack.api.command.user.nat.DisableStaticNatCmd;
import org.apache.cloudstack.api.command.user.nat.EnableStaticNatCmd;
import org.apache.cloudstack.api.command.user.nat.ListIpForwardingRulesCmd;
--import org.apache.cloudstack.api.command.user.network.*;
--
import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
import org.apache.cloudstack.api.command.user.network.CreateNetworkACLListCmd;
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
@@@ -404,14 -410,14 +395,10 @@@ import org.apache.cloudstack.api.comman
import org.apache.cloudstack.api.command.user.vpn.ResetVpnConnectionCmd;
import org.apache.cloudstack.api.command.user.vpn.UpdateVpnCustomerGatewayCmd;
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
--import org.apache.cloudstack.api.response.ExtractResponse;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
--import org.apache.commons.codec.binary.Base64;
--import org.apache.log4j.Logger;
--
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.GetVncPortAnswer;
import com.cloud.agent.api.GetVncPortCommand;
@@@ -463,7 -469,7 +450,6 @@@ import com.cloud.deploy.DeploymentPlann
import com.cloud.domain.DomainVO;
import com.cloud.domain.dao.DomainDao;
import com.cloud.event.ActionEvent;
--import com.cloud.event.ActionEventUtils;
import com.cloud.event.EventTypes;
import com.cloud.event.EventVO;
import com.cloud.event.dao.EventDao;
@@@ -514,7 -514,7 +494,6 @@@ import com.cloud.storage.Storage.ImageF
import com.cloud.storage.StorageManager;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Upload;
--import com.cloud.storage.Upload.Mode;
import com.cloud.storage.UploadVO;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.Volume;
@@@ -534,7 -534,7 +513,6 @@@ import com.cloud.storage.upload.UploadM
import com.cloud.tags.ResourceTagVO;
import com.cloud.tags.dao.ResourceTagDao;
import com.cloud.template.TemplateManager;
--import com.cloud.template.VirtualMachineTemplate.TemplateFilter;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
import com.cloud.user.SSHKeyPair;
@@@ -586,84 -576,79 +554,14 @@@ import com.cloud.vm.dao.VMInstanceDao
import edu.emory.mathcs.backport.java.util.Arrays;
import edu.emory.mathcs.backport.java.util.Collections;
- import org.apache.cloudstack.acl.ControlledEntity;
- import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
- import org.apache.cloudstack.api.command.admin.autoscale.DeleteCounterCmd;
- import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
- import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
- import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
- import org.apache.cloudstack.api.command.admin.cluster.UpdateClusterCmd;
- import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
- import org.apache.cloudstack.api.command.admin.config.ListHypervisorCapabilitiesCmd;
- import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
- import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
- import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
- import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
- import org.apache.cloudstack.api.command.admin.pod.CreatePodCmd;
- import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
- import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
- import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
+
-import org.apache.cloudstack.acl.ControlledEntity;
-import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
-import org.apache.cloudstack.api.command.admin.autoscale.DeleteCounterCmd;
-import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
-import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd;
-import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
-import org.apache.cloudstack.api.command.admin.cluster.UpdateClusterCmd;
-import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
-import org.apache.cloudstack.api.command.admin.config.ListHypervisorCapabilitiesCmd;
-import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
-import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
-import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
-import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
-import org.apache.cloudstack.api.command.admin.pod.CreatePodCmd;
-import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
-import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
-import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
-import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
-import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
-import org.apache.cloudstack.api.command.admin.template.PrepareTemplateCmd;
-import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
-import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
-import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
-import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
-import org.apache.cloudstack.api.command.admin.vm.MigrateVMCmd;
-import org.apache.cloudstack.api.command.admin.vm.MigrateVirtualMachineWithVolumeCmd;
-import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
-import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
-import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
-import org.apache.cloudstack.api.command.admin.zone.MarkDefaultZoneForAccountCmd;
-import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
-import org.apache.cloudstack.api.command.user.account.AddAccountToProjectCmd;
-import org.apache.cloudstack.api.command.user.account.DeleteAccountFromProjectCmd;
-import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
-import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
-import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
-import org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd;
-import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
-import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
-import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
-import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
-import org.apache.cloudstack.api.command.user.event.ListEventTypesCmd;
-import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
-import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
-import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
-import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
-import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
-import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
-import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
-import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
-import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
-import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
-import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
-import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
-import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
-import org.apache.cloudstack.api.command.user.tag.CreateTagsCmd;
-import org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd;
-import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
-import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
-import org.apache.cloudstack.api.command.user.vmsnapshot.CreateVMSnapshotCmd;
-import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
-import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
-import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
-import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.cloudstack.api.command.admin.region.AddRegionCmd;
+import org.apache.cloudstack.api.command.admin.region.RemoveRegionCmd;
+import org.apache.cloudstack.api.command.admin.region.UpdateRegionCmd;
- import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
- import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
- import org.apache.cloudstack.api.command.admin.template.PrepareTemplateCmd;
- import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
- import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
- import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
- import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
- import org.apache.cloudstack.api.command.admin.vm.MigrateVMCmd;
- import org.apache.cloudstack.api.command.admin.vm.MigrateVirtualMachineWithVolumeCmd;
- import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
- import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
- import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
- import org.apache.cloudstack.api.command.admin.zone.MarkDefaultZoneForAccountCmd;
- import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
- import org.apache.cloudstack.api.command.user.account.AddAccountToProjectCmd;
- import org.apache.cloudstack.api.command.user.account.DeleteAccountFromProjectCmd;
- import org.apache.cloudstack.api.command.user.account.ListAccountsCmd;
- import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
- import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
- import org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd;
- import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
- import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
- import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
- import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
- import org.apache.cloudstack.api.command.user.event.ListEventTypesCmd;
- import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
- import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
- import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
- import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
- import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
- import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
- import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
- import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
- import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
- import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
- import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
- import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
- import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
- import org.apache.cloudstack.api.command.user.tag.CreateTagsCmd;
- import org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd;
- import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
- import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
- import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
- import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
- import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
- import org.apache.cloudstack.api.command.user.vmsnapshot.CreateVMSnapshotCmd;
- import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
- import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
- import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToVMSnapshotCmd;
- import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
- import org.apache.cloudstack.api.response.ExtractResponse;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
- import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
- import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
- import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
- import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.api.command.admin.config.ListDeploymentPlannersCmd;
++
public class ManagementServerImpl extends ManagerBase implements ManagementServer {
public static final Logger s_logger = Logger.getLogger(ManagementServerImpl.class.getName());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/storage/VolumeManagerImpl.java
index 9af53ee,4b654eb..e98939d
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@@ -733,9 -720,9 +733,9 @@@ public class VolumeManagerImpl extends
// volume.setSize(size);
volume.setInstanceId(null);
volume.setUpdated(new Date());
- volume.setDomainId((caller == null) ? Domain.ROOT_DOMAIN : caller
+ volume.setDomainId((owner == null) ? Domain.ROOT_DOMAIN : owner
.getDomainId());
-
+ volume.setFormat(ImageFormat.valueOf(format));
volume = _volsDao.persist(volume);
try {
stateTransitTo(volume, Event.UploadRequested);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/template/TemplateManagerImpl.java
index 3e3616f,517d4ba..eaf9d25
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@@ -1218,9 -1553,16 +1218,16 @@@ public class TemplateManagerImpl extend
accountNames.add(acct.getAccountName());
}
}
+
+ // also add the owner if not public
+ if (!template.isPublicTemplate()) {
+ Account templateOwner = _accountDao.findById(template.getAccountId());
+ accountNames.add(templateOwner.getAccountName());
+ }
+
return accountNames;
}
-
+
@DB
@Override
public boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissionsCmd cmd) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/98af4240/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
[38/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2587: netscaler_pod_ref DB upgrade is missing from 3.0.2 to
4.x
added missing schema as part of 4.0 to 4.1 upgrade
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/623a26e4
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/623a26e4
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/623a26e4
Branch: refs/heads/object_store
Commit: 623a26e469ca7354a7dbe6b8954276985e289687
Parents: cc49230
Author: Murali Reddy <mu...@gmail.com>
Authored: Thu May 23 21:59:32 2013 +0530
Committer: Murali Reddy <mu...@gmail.com>
Committed: Thu May 23 22:28:17 2013 +0530
----------------------------------------------------------------------
setup/db/db/schema-40to410.sql | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/623a26e4/setup/db/db/schema-40to410.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql
index b7b1c7a..381a4ce 100644
--- a/setup/db/db/schema-40to410.sql
+++ b/setup/db/db/schema-40to410.sql
@@ -1639,3 +1639,15 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Usage', 'DEFAULT', 'manageme
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (163, UUID(), 10, 'Ubuntu 12.04 (32-bit)');
INSERT IGNORE INTO `cloud`.`guest_os` (id, uuid, category_id, display_name) VALUES (164, UUID(), 10, 'Ubuntu 12.04 (64-bit)');
+
+DROP TABLE IF EXISTS `cloud`.`netscaler_pod_ref`;
+CREATE TABLE `cloud`.`netscaler_pod_ref` (
+ `id` bigint unsigned NOT NULL auto_increment COMMENT 'id',
+ `external_load_balancer_device_id` bigint unsigned NOT NULL COMMENT 'id of external load balancer device',
+ `pod_id` bigint unsigned NOT NULL COMMENT 'pod id',
+ PRIMARY KEY (`id`),
+ CONSTRAINT `fk_ns_pod_ref__pod_id` FOREIGN KEY (`pod_id`) REFERENCES `cloud`.`host_pod_ref`(`id`) ON DELETE CASCADE,
+ CONSTRAINT `fk_ns_pod_ref__device_id` FOREIGN KEY (`external_load_balancer_device_id`) REFERENCES `external_load_balancer_devices`(`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'eip.use.multiple.netscalers' , 'false', 'Should be set to true, if there will be multiple NetScaler devices providing EIP service in a zone');
[19/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Add missing license headers
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5b80af0c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5b80af0c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5b80af0c
Branch: refs/heads/object_store
Commit: 5b80af0cda6b88745ff9eeaefdd56345e0edc23b
Parents: 9a33fd1
Author: Likitha Shetty <li...@citrix.com>
Authored: Wed May 22 18:09:06 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Wed May 22 18:17:11 2013 +0530
----------------------------------------------------------------------
.../cloud/network/nicira/DestinationNatRule.java | 16 +++++++++++++++
.../com/cloud/network/nicira/SourceNatRule.java | 16 +++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5b80af0c/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
index 4831041..20afea9 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
@@ -1,3 +1,19 @@
+// 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 com.cloud.network.nicira;
public class DestinationNatRule extends NatRule {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5b80af0c/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
index 5f85ccb..4132da4 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
@@ -1,3 +1,19 @@
+// 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 com.cloud.network.nicira;
public class SourceNatRule extends NatRule {
[36/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2643: Implicit dedication planner isn't listed in non oss builds. The entry for implicit planner was missing in nonoss component context xml. Added it there.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/80a3c053
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/80a3c053
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/80a3c053
Branch: refs/heads/object_store
Commit: 80a3c0535e0a8ad3edba3713a61d063a176191d8
Parents: 4e7f876
Author: Devdeep Singh <de...@gmail.com>
Authored: Thu May 23 16:50:33 2013 +0530
Committer: Devdeep Singh <de...@gmail.com>
Committed: Thu May 23 16:50:33 2013 +0530
----------------------------------------------------------------------
client/tomcatconf/nonossComponentContext.xml.in | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/80a3c053/client/tomcatconf/nonossComponentContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in
index 1b6ee6e..6fa9d38 100644
--- a/client/tomcatconf/nonossComponentContext.xml.in
+++ b/client/tomcatconf/nonossComponentContext.xml.in
@@ -251,7 +251,7 @@
<ref bean="FirstFitPlanner" />
<ref bean="UserDispersingPlanner" />
<ref bean="UserConcentratedPodPlanner" />
-
+ <ref bean="ImplicitDedicationPlanner" />
<!--
<ref bean="BareMetalPlanner" />
-->
[20/50] [abbrv] CLOUDSTACK-2623. Provide appropriate AWS EC2 error
codes in error thrown by CS AWSAPI. Since CS has very few generic errorcode
groups,
in AWSAPI parse the response message and translate the CS error to AWS EC2
error code. Provide support
Posted by mc...@apache.org.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2VolumeFilterSet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2VolumeFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2VolumeFilterSet.java
index b8021f3..af13242 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2VolumeFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2VolumeFilterSet.java
@@ -26,6 +26,7 @@ import java.util.TimeZone;
import java.util.Date;
import com.cloud.bridge.service.exception.EC2ServiceException;
+import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
import com.cloud.bridge.util.EC2RestAuth;
@@ -61,11 +62,9 @@ public class EC2VolumeFilterSet {
String filterName = param.getName();
String value = (String) filterTypes.get( filterName );
- if (null == value)
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 1", 501 );
-
- if (null != value && value.equalsIgnoreCase( "null" ))
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "] - 2", 501 );
+ if ( value == null || value.equalsIgnoreCase("null") ) {
+ throw new EC2ServiceException( ClientError.InvalidFilter, "Filter '" + filterName + "' is invalid");
+ }
// ToDo we could add checks to make sure the type of a filters value is correct (e.g., an integer)
filterSet.add( param );
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java b/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java
index e1f515a..c21e6e9 100644
--- a/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java
+++ b/awsapi/src/com/cloud/bridge/service/exception/EC2ServiceException.java
@@ -26,11 +26,11 @@ public class EC2ServiceException extends RuntimeException {
// ServerError & ClientError are correct as of schema version 2010-08-31
public static enum ServerError {
- InsufficientAddressCapacity("Server.InsufficientAddressCapacity", 500),
- InsufficientInstanceCapacity("Server.InsufficientInstanceCapacity", 500),
- InsufficientReservedInstanceCapacity("Server.InsufficientReservedInstanceCapacity", 500),
- InternalError("Server.InternalError", 500),
- Unavailable("Server.Unavailable", 501);
+ InsufficientAddressCapacity("Server.InsufficientAddressCapacity", 500),
+ InsufficientInstanceCapacity("Server.InsufficientInstanceCapacity", 500),
+ InsufficientReservedInstanceCapacity("Server.InsufficientReservedInstanceCapacity", 500),
+ InternalError("Server.InternalError", 500),
+ Unavailable("Server.Unavailable", 501);
private String errorString;
private int httpErrorCode;
@@ -45,58 +45,64 @@ public class EC2ServiceException extends RuntimeException {
}
public static enum ClientError {
- AddressLimitExceeded("Client.AddressLimitExceeded", 400),
- AttachmentLimitExceeded("Client.AttachmentLimitExceeded", 400),
- AuthFailure("Client.AuthFailure", 400),
- Blocked("Client.Blocked", 400),
- FilterLimitExceeded("Client.FilterLimitExceeded", 400),
- IdempotentParameterMismatch("Client.IdempotentParameterMismatch", 400),
- IncorrectState("Client.IncorrectState", 400),
- InstanceLimitExceeded("Client.InstanceLimitExceeded", 400),
- InsufficientInstanceCapacity("Client.InsufficientInstanceCapacity", 400),
- InsufficientReservedInstancesCapacity("Client.InsufficientReservedInstancesCapacity", 400),
- InvalidAMIAttributeItemValue("Client.InvalidAMIAttributeItemValue", 400),
- InvalidAMIID_Malformed("Client.InvalidAMIID.Malformed", 400),
- InvalidAMIID_NotFound("Client.InvalidAMIID.NotFound", 400),
- InvalidAMIID_Unavailable("Client.InvalidAMIID.Unavailable", 400),
- InvalidAttachment_NotFound("Client.InvalidAttachment.NotFound", 400),
- InvalidDevice_InUse("Client.InvalidDevice.InUse", 400),
- InvalidGroup_Duplicate("Client.InvalidGroup.Duplicate", 400),
- InvalidGroup_InUse("Client.InvalidGroup.InUse", 400),
- InvalidGroup_NotFound("Client.InvalidGroup.NotFound", 400),
- InvalidGroup_Reserved("Client.InvalidGroup.Reserved", 400),
- InvalidInstanceID_Malformed("Client.InvalidInstanceID.Malformed", 400),
- InvalidInstanceID_NotFound("Client.InvalidInstanceID.NotFound", 400),
- InvalidIPAddress_InUse("Client.InvalidIPAddress.InUse", 400),
- InvalidKeyPair_Duplicate("Client.InvalidKeyPair.Duplicate", 400),
- InvalidKeyPair_Format("Client.InvalidKeyPair.Format", 400),
- InvalidKeyPair_NotFound("Client.InvalidKeyPair.NotFound", 400),
- InvalidManifest("Client.InvalidManifest", 400),
- InvalidParameterCombination("Client.InvalidParameterCombination", 400),
- InvalidParameterValue("Client.InvalidParameterValue", 400),
- InvalidPermission_Duplicate("Client.InvalidPermission.Duplicate", 400),
- InvalidPermission_Malformed("Client.InvalidPermission.Malformed", 400),
- InvalidReservationID_Malformed("Client.InvalidReservationID.Malformed", 400),
- InvalidReservationID_NotFound("Client.InvalidReservationID.NotFound", 400),
- InvalidResourceId_Format("Client.InvalidResourceId.Format", 400),
- InvalidSnapshotID_Malformed("Client.InvalidSnapshotID.Malformed", 400),
- InvalidSnapshot_NotFound("Client.InvalidSnapshot.NotFound", 400),
- InvalidUserID_Malformed("Client.InvalidUserID.Malformed", 400),
- InvalidReservedInstancesId("Client.InvalidReservedInstancesId", 400),
- InvalidReservedInstancesOfferingId("Client.InvalidReservedInstancesOfferingId", 400),
- InvalidVolumeID_Duplicate("Client.InvalidVolumeID.Duplicate", 400),
- InvalidVolumeID_Malformed("Client.InvalidVolumeID.Malformed", 400),
- InvalidVolume_NotFound("Client.InvalidVolume.NotFound", 400),
- InvalidVolumeID_ZoneMismatch("Client.InvalidVolumeID.ZoneMismatch", 400),
- InvalidZone_NotFound("Client.InvalidZone.NotFound", 400),
- NonEBSInstance("Client.NonEBSInstance", 400),
- PendingVerification("Client.PendingVerification", 400),
- PendingSnapshotLimitExceeded("Client.PendingSnapshotLimitExceeded", 400),
- ReservedInstancesLimitExceeded("Client.ReservedInstancesLimitExceeded", 400),
- SnapshotLimitExceeded("Client.SnapshotLimitExceeded", 400),
- UnknownParameter("Client.UnknownParameter", 400),
- Unsupported("Client.Unsupported", 400),
- VolumeLimitExceeded("Client.VolumeLimitExceeded", 400);
+ AddressLimitExceeded("Client.AddressLimitExceeded", 400),
+ AttachmentLimitExceeded("Client.AttachmentLimitExceeded", 400),
+ AuthFailure("Client.AuthFailure", 400),
+ Blocked("Client.Blocked", 400),
+ DependencyViolation("Client.DependencyViolation", 400),
+ FilterLimitExceeded("Client.FilterLimitExceeded", 400),
+ IdempotentParameterMismatch("Client.IdempotentParameterMismatch", 400),
+ IncorrectState("Client.IncorrectState", 400),
+ IncorrectInstanceState("Client.IncorrectInstanceState", 400),
+ InstanceLimitExceeded("Client.InstanceLimitExceeded", 400),
+ InsufficientInstanceCapacity("Client.InsufficientInstanceCapacity", 400),
+ InsufficientReservedInstancesCapacity("Client.InsufficientReservedInstancesCapacity", 400),
+ InvalidAMIAttributeItemValue("Client.InvalidAMIAttributeItemValue", 400),
+ InvalidAMIID_Malformed("Client.InvalidAMIID.Malformed", 400),
+ InvalidAMIID_NotFound("Client.InvalidAMIID.NotFound", 400),
+ InvalidAMIID_Unavailable("Client.InvalidAMIID.Unavailable", 400),
+ InvalidAttachment_NotFound("Client.InvalidAttachment.NotFound", 400),
+ InvalidDevice_InUse("Client.InvalidDevice.InUse", 400),
+ InvalidFilter("Client.InvalidFilter", 400),
+ InvalidGroup_Duplicate("Client.InvalidGroup.Duplicate", 400),
+ InvalidGroup_InUse("Client.InvalidGroup.InUse", 400),
+ InvalidGroup_NotFound("Client.InvalidGroup.NotFound", 400),
+ InvalidGroup_Reserved("Client.InvalidGroup.Reserved", 400),
+ InvalidInstanceID_Malformed("Client.InvalidInstanceID.Malformed", 400),
+ InvalidInstanceID_NotFound("Client.InvalidInstanceID.NotFound", 400),
+ InvalidIPAddress_InUse("Client.InvalidIPAddress.InUse", 400),
+ InvalidKeyPair_Duplicate("Client.InvalidKeyPair.Duplicate", 400),
+ InvalidKeyPair_Format("Client.InvalidKeyPair.Format", 400),
+ InvalidKeyPair_NotFound("Client.InvalidKeyPair.NotFound", 400),
+ InvalidManifest("Client.InvalidManifest", 400),
+ InvalidParameterCombination("Client.InvalidParameterCombination", 400),
+ InvalidParameterValue("Client.InvalidParameterValue", 400),
+ InvalidPermission_Duplicate("Client.InvalidPermission.Duplicate", 400),
+ InvalidPermission_Malformed("Client.InvalidPermission.Malformed", 400),
+ InvalidReservationID_Malformed("Client.InvalidReservationID.Malformed", 400),
+ InvalidReservationID_NotFound("Client.InvalidReservationID.NotFound", 400),
+ InvalidSecurity_RequestHasExpired("Client.InvalidSecurity.RequestHasExpired", 400),
+ InvalidSnapshotID_Malformed("Client.InvalidSnapshotID.Malformed", 400),
+ InvalidSnapshot_NotFound("Client.InvalidSnapshot.NotFound", 400),
+ InvalidUserID_Malformed("Client.InvalidUserID.Malformed", 400),
+ InvalidReservedInstancesId("Client.InvalidReservedInstancesId", 400),
+ InvalidReservedInstancesOfferingId("Client.InvalidReservedInstancesOfferingId", 400),
+ InvalidVolumeID_Duplicate("Client.InvalidVolumeID.Duplicate", 400),
+ InvalidVolumeID_Malformed("Client.InvalidVolumeID.Malformed", 400),
+ InvalidVolume_NotFound("Client.InvalidVolume.NotFound", 400),
+ InvalidVolumeID_ZoneMismatch("Client.InvalidVolumeID.ZoneMismatch", 400),
+ InvalidZone_NotFound("Client.InvalidZone.NotFound", 400),
+ MissingParamter("Client.MissingParamter", 400),
+ NonEBSInstance("Client.NonEBSInstance", 400),
+ PendingVerification("Client.PendingVerification", 400),
+ PendingSnapshotLimitExceeded("Client.PendingSnapshotLimitExceeded", 400),
+ SignatureDoesNotMatch("Client.SignatureDoesNotMatch", 400),
+ ReservedInstancesLimitExceeded("Client.ReservedInstancesLimitExceeded", 400),
+ ResourceLimitExceeded("Client.ResourceLimitExceeded", 400),
+ SnapshotLimitExceeded("Client.SnapshotLimitExceeded", 400),
+ UnknownParameter("Client.UnknownParameter", 400),
+ Unsupported("Client.UnsupportedOperation", 400),
+ VolumeLimitExceeded("Client.VolumeLimitExceeded", 400);
private String errorString;
private int httpErrorCode;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/stack/CloudStackClient.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/stack/CloudStackClient.java b/awsapi/src/com/cloud/stack/CloudStackClient.java
index 5017bd4..fa114f5 100644
--- a/awsapi/src/com/cloud/stack/CloudStackClient.java
+++ b/awsapi/src/com/cloud/stack/CloudStackClient.java
@@ -103,8 +103,8 @@ public class CloudStackClient {
int jobStatus = queryAsyncJobResponse.getAsInt("queryasyncjobresultresponse.jobstatus");
switch(jobStatus) {
case 2:
- throw new Exception(queryAsyncJobResponse.getAsString("queryasyncjobresultresponse.jobresult.errorcode") + " " +
- queryAsyncJobResponse.getAsString("queryasyncjobresultresponse.jobresult.errortext"));
+ throw new Exception(queryAsyncJobResponse.getAsString("queryasyncjobresultresponse.jobresult.errortext") + " Error Code - " +
+ queryAsyncJobResponse.getAsString("queryasyncjobresultresponse.jobresult.errorcode") );
case 0 :
try {
@@ -179,6 +179,7 @@ public class CloudStackClient {
if(errorMessage == null){
errorMessage = "CloudStack API call HTTP response error, HTTP status code: " + statusCode;
}
+ errorMessage = errorMessage.concat(" Error Code - " + Integer.toString(statusCode));
throw new IOException(errorMessage);
}
[46/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Install wizard UI: Add preinstall hook
For fresh install, adds hook to install wizard UI to show a custom
'step' before the initial welcome screen.
Pre-install specified by providing 'cloudStack.preInstall,' which
returns a jQuery object to be displayed. It passes args.complete,
which when called will proceed to the first step of the install
wizard.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f92db64c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f92db64c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f92db64c
Branch: refs/heads/object_store
Commit: f92db64c78778e58821073971152167472ef340d
Parents: cf8ff0c
Author: Brian Federle <bf...@gmail.com>
Authored: Thu May 23 15:59:03 2013 -0700
Committer: Brian Federle <bf...@gmail.com>
Committed: Thu May 23 15:59:03 2013 -0700
----------------------------------------------------------------------
ui/scripts/ui-custom/installWizard.js | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f92db64c/ui/scripts/ui-custom/installWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/installWizard.js b/ui/scripts/ui-custom/installWizard.js
index 86919f9..9f1f4c7 100644
--- a/ui/scripts/ui-custom/installWizard.js
+++ b/ui/scripts/ui-custom/installWizard.js
@@ -298,6 +298,17 @@
* Layout/behavior for each step in wizard
*/
var steps = {
+ start: function(args) {
+ if (cloudStack.preInstall) {
+ return cloudStack.preInstall({
+ complete: function() {
+ goTo('intro');
+ }
+ });
+ }
+
+ return steps.intro(args);
+ },
intro: function(args) {
var $intro = $('<div></div>').addClass('intro what-is-cloudstack');
var $title = $('<div></div>').addClass('title').html(_l('label.what.is.cloudstack'));
@@ -775,7 +786,7 @@
}
};
- var initialStep = steps.intro().addClass('step');
+ var initialStep = steps.start().addClass('step');
showDiagram('');
[15/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2360: listnetscalerloadbalancerresponse is not including any
information about GSLB status
adds the infomration if NetScaler is provisioned as GSLB service
provider
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/62d32045
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/62d32045
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/62d32045
Branch: refs/heads/object_store
Commit: 62d320454a5487dac27631d380cd0cc0e2492e22
Parents: 53499c0
Author: Murali Reddy <mu...@gmail.com>
Authored: Wed May 22 16:25:02 2013 +0530
Committer: Murali Reddy <mu...@gmail.com>
Committed: Wed May 22 16:26:46 2013 +0530
----------------------------------------------------------------------
.../response/NetscalerLoadBalancerResponse.java | 21 +++++++++++++++
.../cloud/network/element/NetscalerElement.java | 4 +++
2 files changed, 25 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/62d32045/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java b/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
index bd25880..1348788 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java
@@ -60,6 +60,15 @@ public class NetscalerLoadBalancerResponse extends BaseResponse {
@SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the management IP address of the external load balancer")
private String ipAddress;
+ @SerializedName(ApiConstants.GSLB_PROVIDER) @Param(description="true if NetScaler device is provisioned to be a GSLB service provider")
+ private Boolean isGslbProvider;
+
+ @SerializedName(ApiConstants.GSLB_PROVIDER_PUBLIC_IP) @Param(description="public IP of the NetScaler representing GSLB site")
+ private String gslbSitePublicIp;
+
+ @SerializedName(ApiConstants.GSLB_PROVIDER_PRIVATE_IP) @Param(description="private IP of the NetScaler representing GSLB site")
+ private String gslbSitePrivateIp;
+
@SerializedName(ApiConstants.POD_IDS) @Param(description="Used when NetScaler device is provider of EIP service." +
" This parameter represents the list of pod's, for which there exists a policy based route on datacenter L3 router to " +
"route pod's subnet IP to a NetScaler device.")
@@ -108,4 +117,16 @@ public class NetscalerLoadBalancerResponse extends BaseResponse {
public void setAssociatedPods(List<Long> pods) {
this.podIds = pods;
}
+
+ public void setGslbProvider(boolean isGslbProvider) {
+ this.isGslbProvider = isGslbProvider;
+ }
+
+ public void setGslbSitePublicIp(String publicIP) {
+ this.gslbSitePublicIp = publicIP;
+ }
+
+ public void setGslbSitePrivateIp(String privateIp) {
+ this.gslbSitePrivateIp = privateIp;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/62d32045/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
index 850962d..13a6900 100644
--- a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
+++ b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java
@@ -589,6 +589,10 @@ public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl impl
response.setDeviceState(lbDeviceVO.getState().name());
response.setObjectName("netscalerloadbalancer");
+ response.setGslbProvider(lbDeviceVO.getGslbProvider());
+ response.setGslbSitePublicIp(lbDeviceVO.getGslbSitePublicIP());
+ response.setGslbSitePrivateIp(lbDeviceVO.getGslbSitePrivateIP());
+
List<Long> associatedPods = new ArrayList<Long>();
List<NetScalerPodVO> currentPodVOs = _netscalerPodDao.listByNetScalerDeviceId(lbDeviceVO.getId());
if (currentPodVOs != null && currentPodVOs.size() > 0) {
[23/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2516: Adding upgrade steps to deal with authenticator changes
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e720e8a1
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e720e8a1
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e720e8a1
Branch: refs/heads/object_store
Commit: e720e8a1a62722c2c032aafe00848079fbd92a03
Parents: 5b80af0
Author: Chip Childers <ch...@apache.org>
Authored: Wed May 22 12:14:47 2013 -0400
Committer: Chip Childers <ch...@apache.org>
Committed: Wed May 22 12:16:13 2013 -0400
----------------------------------------------------------------------
docs/en-US/Release_Notes.xml | 53 ++++++++++++++++++++++++++++++++++++-
1 files changed, 52 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e720e8a1/docs/en-US/Release_Notes.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml
index dca95d3..25e1175 100644
--- a/docs/en-US/Release_Notes.xml
+++ b/docs/en-US/Release_Notes.xml
@@ -4586,7 +4586,7 @@ under the License.
versions of Citrix CloudStack (last version prior to Apache is 3.0.2) and from the releases
made while CloudStack was in the Apache Incubator.</para>
<para>If you run into any issues during upgrades, please feel free to ask questions on
- users@apache.cloudstack.org or dev@apache.cloudstack.org.</para>
+ users@cloudstack.apache.org or dev@cloudstack.apache.org.</para>
<section id="upgrade-from-4.0-to-4.1">
<title>Upgrade from 4.0.x to 4.1.0</title>
<para>This section will guide you from &PRODUCT; 4.0.x versions to &PRODUCT; 4.1.0.</para>
@@ -4647,6 +4647,23 @@ under the License.
automatically. (If you're unsure, we recommend making a backup of the original
<filename>components.xml</filename> to be on the safe side.</para>
</listitem>
+ <listitem>
+ <para>After upgrading to 4.1, API clients are expected to send plain text passwords for login and user creation, instead of MD5 hash. Incase, api client changes are not acceptable, following changes are to be made for backward compatibility:</para>
+ <para>Modify componentsContext.xml, and make PlainTextUserAuthenticator as the default authenticator (1st entry in the userAuthenticators adapter list is default)</para>
+ <programlisting language="XML">
+<!-- Security adapters -->
+<bean id="userAuthenticators" class="com.cloud.utils.component.AdapterList">
+ <property name="Adapters">
+ <list>
+ <ref bean="PlainTextUserAuthenticator"/>
+ <ref bean="MD5UserAuthenticator"/>
+ <ref bean="LDAPUserAuthenticator"/>
+ </list>
+ </property>
+</bean>
+ </programlisting>
+ <para>PlainTextUserAuthenticator works the same way MD5UserAuthenticator worked prior to 4.1.</para>
+ </listitem>
<listitem id="upgrade-deb-packages">
<para>If you are using Ubuntu, follow this procedure to upgrade your packages. If not,
skip to step <xref linkend="upgrade-rpm-packages"/>.</para>
@@ -5111,6 +5128,23 @@ service cloudstack-agent start
</note>
</listitem>
<listitem>
+ <para>After upgrading to 4.1, API clients are expected to send plain text passwords for login and user creation, instead of MD5 hash. Incase, api client changes are not acceptable, following changes are to be made for backward compatibility:</para>
+ <para>Modify componentsContext.xml, and make PlainTextUserAuthenticator as the default authenticator (1st entry in the userAuthenticators adapter list is default)</para>
+ <programlisting language="XML">
+<!-- Security adapters -->
+<bean id="userAuthenticators" class="com.cloud.utils.component.AdapterList">
+ <property name="Adapters">
+ <list>
+ <ref bean="PlainTextUserAuthenticator"/>
+ <ref bean="MD5UserAuthenticator"/>
+ <ref bean="LDAPUserAuthenticator"/>
+ </list>
+ </property>
+</bean>
+ </programlisting>
+ <para>PlainTextUserAuthenticator works the same way MD5UserAuthenticator worked prior to 4.1.</para>
+ </listitem>
+ <listitem>
<para>Start the first Management Server. Do not start any other Management Server nodes
yet.</para>
<programlisting language="Bash"><prompt>#</prompt> service cloudstack-management start</programlisting>
@@ -5689,6 +5723,23 @@ service cloudstack-agent start
</orderedlist>
</listitem>
<listitem>
+ <para>After upgrading to 4.1, API clients are expected to send plain text passwords for login and user creation, instead of MD5 hash. Incase, api client changes are not acceptable, following changes are to be made for backward compatibility:</para>
+ <para>Modify componentsContext.xml, and make PlainTextUserAuthenticator as the default authenticator (1st entry in the userAuthenticators adapter list is default)</para>
+ <programlisting language="XML">
+<!-- Security adapters -->
+<bean id="userAuthenticators" class="com.cloud.utils.component.AdapterList">
+ <property name="Adapters">
+ <list>
+ <ref bean="PlainTextUserAuthenticator"/>
+ <ref bean="MD5UserAuthenticator"/>
+ <ref bean="LDAPUserAuthenticator"/>
+ </list>
+ </property>
+</bean>
+ </programlisting>
+ <para>PlainTextUserAuthenticator works the same way MD5UserAuthenticator worked prior to 4.1.</para>
+ </listitem>
+ <listitem>
<para>If you have made changes to your existing copy of the
<filename>/etc/cloud/management/db.properties</filename> file in your previous-version
CloudStack installation, the changes will be preserved in the upgrade. However, you need
[47/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2628: added networkId parameter to the list of request parameters in listLoadBalancerRules API
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7e6f3f94
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7e6f3f94
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7e6f3f94
Branch: refs/heads/object_store
Commit: 7e6f3f94ba467f8f58ed6b130055bdd6df73815a
Parents: f92db64
Author: Alena Prokharchyk <al...@citrix.com>
Authored: Thu May 23 10:24:44 2013 -0700
Committer: Alena Prokharchyk <al...@citrix.com>
Committed: Thu May 23 16:06:57 2013 -0700
----------------------------------------------------------------------
.../loadbalancer/ListLoadBalancerRulesCmd.java | 9 +++++++
.../api/response/LoadBalancerResponse.java | 11 ++++++++-
server/src/com/cloud/api/ApiResponseHelper.java | 19 ++++++++------
.../network/lb/LoadBalancingRulesManagerImpl.java | 6 ++++
4 files changed, 36 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e6f3f94/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
index e022cc7..21d5b2a 100644
--- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java
@@ -27,6 +27,7 @@ import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.LoadBalancerResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
@@ -62,6 +63,10 @@ public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class,
description = "the availability zone ID")
private Long zoneId;
+
+ @Parameter(name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class,
+ description = "list by network id the rule belongs to")
+ private Long networkId;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
@@ -86,6 +91,10 @@ public class ListLoadBalancerRulesCmd extends BaseListTaggedResourcesCmd {
public Long getZoneId() {
return zoneId;
}
+
+ public Long getNetworkId() {
+ return networkId;
+ }
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e6f3f94/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
index 79b01b1..0f18097 100644
--- a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java
@@ -57,10 +57,14 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
@SerializedName(ApiConstants.ALGORITHM)
@Param(description = "the load balancer algorithm (source, roundrobin, leastconn)")
private String algorithm;
+
+ @SerializedName(ApiConstants.NETWORK_ID)
+ @Param(description = "the id of the guest network the lb rule belongs to")
+ private String networkId;
@SerializedName(ApiConstants.CIDR_LIST) @Param(description="the cidr list to forward traffic from")
private String cidrList;
-
+
@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the account of the load balancer rule")
private String accountName;
@@ -89,6 +93,7 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with load balancer", responseObject = ResourceTagResponse.class)
private List<ResourceTagResponse> tags;
+
public void setId(String id) {
this.id = id;
@@ -160,5 +165,9 @@ public class LoadBalancerResponse extends BaseResponse implements ControlledEnti
public void setTags(List<ResourceTagResponse> tags) {
this.tags = tags;
}
+
+ public void setNetworkId(String networkId) {
+ this.networkId = networkId;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e6f3f94/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index fc1c6a0..540c8e9 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -34,12 +34,6 @@ import java.util.TimeZone;
import javax.inject.Inject;
-import com.cloud.network.vpc.NetworkACL;
-import com.cloud.network.vpc.NetworkACLItem;
-import com.cloud.network.vpc.PrivateGateway;
-import com.cloud.network.vpc.StaticRoute;
-import com.cloud.network.vpc.Vpc;
-import com.cloud.network.vpc.VpcOffering;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
import org.apache.cloudstack.affinity.AffinityGroup;
@@ -49,8 +43,6 @@ import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
-import org.apache.cloudstack.region.PortableIp;
-import org.apache.cloudstack.region.PortableIpRange;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ApplicationLoadBalancerInstanceResponse;
import org.apache.cloudstack.api.response.ApplicationLoadBalancerResponse;
@@ -146,6 +138,8 @@ import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.VpnUsersResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
+import org.apache.cloudstack.region.PortableIp;
+import org.apache.cloudstack.region.PortableIpRange;
import org.apache.cloudstack.region.Region;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.usage.Usage;
@@ -241,6 +235,12 @@ import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityGroupVO;
import com.cloud.network.security.SecurityRule;
import com.cloud.network.security.SecurityRule.SecurityRuleType;
+import com.cloud.network.vpc.NetworkACL;
+import com.cloud.network.vpc.NetworkACLItem;
+import com.cloud.network.vpc.PrivateGateway;
+import com.cloud.network.vpc.StaticRoute;
+import com.cloud.network.vpc.Vpc;
+import com.cloud.network.vpc.VpcOffering;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.NetworkOffering.Detail;
@@ -776,6 +776,9 @@ public class ApiResponseHelper implements ResponseGenerator {
tagResponses.add(tagResponse);
}
lbResponse.setTags(tagResponses);
+
+ Network ntwk = ApiDBUtils.findNetworkById(loadBalancer.getNetworkId());
+ lbResponse.setNetworkId(ntwk.getUuid());
lbResponse.setObjectName("loadbalancer");
return lbResponse;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e6f3f94/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
index 520dd76..0118ca5 100755
--- a/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
+++ b/server/src/com/cloud/network/lb/LoadBalancingRulesManagerImpl.java
@@ -1902,6 +1902,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
String name = cmd.getLoadBalancerRuleName();
String keyword = cmd.getKeyword();
Long instanceId = cmd.getVirtualMachineId();
+ Long networkId = cmd.getNetworkId();
Map<String, String> tags = cmd.getTags();
Account caller = UserContext.current().getCaller();
@@ -1922,6 +1923,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
sb.and("name", sb.entity().getName(), SearchCriteria.Op.LIKE);
sb.and("sourceIpAddress", sb.entity().getSourceIpAddressId(), SearchCriteria.Op.EQ);
+ sb.and("networkId", sb.entity().getNetworkId(), SearchCriteria.Op.EQ);
if (instanceId != null) {
SearchBuilder<LoadBalancerVMMapVO> lbVMSearch = _lb2VmMapDao.createSearchBuilder();
@@ -1979,6 +1981,10 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
if (zoneId != null) {
sc.setJoinParameters("ipSearch", "zoneId", zoneId);
}
+
+ if (networkId != null) {
+ sc.setParameters("networkId", networkId);
+ }
if (tags != null && !tags.isEmpty()) {
int count = 0;
[43/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Fix a small typo in a log line
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b1f4c8e8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b1f4c8e8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b1f4c8e8
Branch: refs/heads/object_store
Commit: b1f4c8e89af1d79f2d5cba03910e93b40e3c0859
Parents: 026c2ce
Author: Wido den Hollander <wi...@42on.com>
Authored: Thu May 23 23:46:55 2013 +0200
Committer: Wido den Hollander <wi...@42on.com>
Committed: Thu May 23 23:46:55 2013 +0200
----------------------------------------------------------------------
.../com/cloud/vm/VirtualMachineManagerImpl.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b1f4c8e8/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
index f487537..c65514b 100755
--- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -358,7 +358,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
}
if (s_logger.isDebugEnabled()) {
- s_logger.debug("Allocaing disks for " + vm);
+ s_logger.debug("Allocating disks for " + vm);
}
if (template.getFormat() == ImageFormat.ISO) {
[27/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2629: ListRouters with networkid throws exception.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/19321d4e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/19321d4e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/19321d4e
Branch: refs/heads/object_store
Commit: 19321d4eeb7accd2bd67af1c8b2c2a5988a23ac0
Parents: c7976b6
Author: Min Chen <mi...@citrix.com>
Authored: Wed May 22 15:27:04 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Wed May 22 15:27:04 2013 -0700
----------------------------------------------------------------------
.../src/com/cloud/api/query/QueryManagerImpl.java | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19321d4e/server/src/com/cloud/api/query/QueryManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/query/QueryManagerImpl.java b/server/src/com/cloud/api/query/QueryManagerImpl.java
index a126925..c586a7b 100644
--- a/server/src/com/cloud/api/query/QueryManagerImpl.java
+++ b/server/src/com/cloud/api/query/QueryManagerImpl.java
@@ -1095,7 +1095,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
}
if (networkId != null) {
- sc.setJoinParameters("nicSearch", "networkId", networkId);
+ sc.setParameters("networkId", networkId);
}
if (vpcId != null) {
[33/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Summary: Code cleanup for KVM - look up domains by name rather than coversion
Detail: We do two strange things, #1, when a vm is created, we create the uuid
for the domain by converting the name into a uuid, then subsequently, any time
we look for a domain, we convert its name to a uuid and domainLookupByUUID. This
is an unnecessary obfuscation, so instead we just do a domainLookupByName. As
a bonus, we are now setting the domain's uuid to be the cloudstack uuid. It is
no longer used anywhere, but will be less confusing to admins. This shouldn't
affect upgrades, since we can always lookup existing VMs by name.
Signed-off-by: Marcus Sorensen <ma...@betterservers.com> 1369287049 -0600
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fce59b8f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fce59b8f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fce59b8f
Branch: refs/heads/object_store
Commit: fce59b8fc42412f87ccbda5cf4f53e1465935070
Parents: 795fd80
Author: Marcus Sorensen <ma...@betterservers.com>
Authored: Wed May 22 23:30:49 2013 -0600
Committer: Marcus Sorensen <ma...@betterservers.com>
Committed: Wed May 22 23:30:49 2013 -0600
----------------------------------------------------------------------
.../kvm/resource/LibvirtComputingResource.java | 45 +++++----------
.../kvm/resource/LibvirtComputingResourceTest.java | 4 +-
2 files changed, 18 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fce59b8f/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 0903855..1e20d75 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -2619,8 +2619,7 @@ ServerResource {
Domain vms = null;
while (retry-- > 0) {
try {
- vms = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ vms = conn.domainLookupByName(vmName);
State s = convertToState(vms.getInfo().state);
return s;
} catch (final LibvirtException e) {
@@ -2712,8 +2711,7 @@ ServerResource {
try {
conn = LibvirtConnection.getConnectionByVmName(cmd.getVmName());
ifaces = getInterfaces(conn, vmName);
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ dm = conn.domainLookupByName(vmName);
dconn = new Connect("qemu+tcp://" + cmd.getDestinationIp()
+ "/system");
/*
@@ -3162,8 +3160,7 @@ ServerResource {
protected LibvirtVMDef createVMFromSpec(VirtualMachineTO vmTO) {
LibvirtVMDef vm = new LibvirtVMDef();
vm.setDomainName(vmTO.getName());
- vm.setDomUUID(UUID.nameUUIDFromBytes(vmTO.getName().getBytes())
- .toString());
+ vm.setDomUUID(vmTO.getUuid());
vm.setDomDescription(vmTO.getOs());
GuestDef guest = new GuestDef();
@@ -3587,8 +3584,7 @@ ServerResource {
KVMStoragePool attachingPool = attachingDisk.getPool();
try {
if (!attach) {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ dm = conn.domainLookupByName(vmName);
LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
String xml = dm.getXMLDesc(0);
parser.parseDomainXML(xml);
@@ -3637,9 +3633,7 @@ ServerResource {
InternalErrorException {
Domain dm = null;
try {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes((vmName
- .getBytes())));
-
+ dm = conn.domainLookupByName(vmName);
if (attach) {
s_logger.debug("Attaching device: " + xml);
dm.attachDevice(xml);
@@ -3870,8 +3864,7 @@ ServerResource {
for (; i < 5; i++) {
try {
Connect conn = LibvirtConnection.getConnectionByVmName(vm);
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vm
- .getBytes()));
+ dm = conn.domainLookupByName(vm);
DomainInfo.DomainState vps = dm.getInfo().state;
if (vps != null
&& vps != DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF
@@ -4008,8 +4001,7 @@ ServerResource {
for (int i = 0; i < vms.length; i++) {
try {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vms[i]
- .getBytes()));
+ dm = conn.domainLookupByName(vms[i]);
DomainInfo.DomainState ps = dm.getInfo().state;
final State state = convertToState(ps);
@@ -4114,8 +4106,7 @@ ServerResource {
Domain dm = null;
String msg = null;
try {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ dm = conn.domainLookupByName(vmName);
String vmDef = dm.getXMLDesc(0);
s_logger.debug(vmDef);
msg = stopVM(conn, vmName);
@@ -4157,8 +4148,7 @@ ServerResource {
/* Retry 3 times, to make sure we can get the vm's status */
for (int i = 0; i < 3; i++) {
try {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ dm = conn.domainLookupByName(vmName);
state = dm.getInfo().state;
break;
} catch (LibvirtException e) {
@@ -4194,8 +4184,7 @@ ServerResource {
protected String stopVM(Connect conn, String vmName, boolean force) {
Domain dm = null;
try {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ dm = conn.domainLookupByName(vmName);
int persist = dm.isPersistent();
if (force) {
if (dm.isActive() == 1) {
@@ -4282,8 +4271,7 @@ ServerResource {
LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
Domain dm = null;
try {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ dm = conn.domainLookupByName(vmName);
String xmlDesc = dm.getXMLDesc(0);
parser.parseDomainXML(xmlDesc);
return parser.getVncPort();
@@ -4328,8 +4316,7 @@ ServerResource {
LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
Domain dm = null;
try {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ dm = conn.domainLookupByName(vmName);
String xmlDesc = dm.getXMLDesc(0);
parser.parseDomainXML(xmlDesc);
return parser.getDescription();
@@ -4427,15 +4414,14 @@ ServerResource {
private Domain getDomain(Connect conn, String vmName)
throws LibvirtException {
return conn
- .domainLookupByUUID(UUID.nameUUIDFromBytes(vmName.getBytes()));
+ .domainLookupByName(vmName);
}
protected List<InterfaceDef> getInterfaces(Connect conn, String vmName) {
LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
Domain dm = null;
try {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ dm = conn.domainLookupByName(vmName);
parser.parseDomainXML(dm.getXMLDesc(0));
return parser.getInterfaces();
@@ -4457,8 +4443,7 @@ ServerResource {
LibvirtDomainXMLParser parser = new LibvirtDomainXMLParser();
Domain dm = null;
try {
- dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName
- .getBytes()));
+ dm = conn.domainLookupByName(vmName);
parser.parseDomainXML(dm.getXMLDesc(0));
return parser.getDisks();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fce59b8f/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
index 39e36d6..0bafd07 100644
--- a/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
+++ b/plugins/hypervisors/kvm/test/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java
@@ -60,6 +60,7 @@ public class LibvirtComputingResourceTest {
LibvirtComputingResource lcr = new LibvirtComputingResource();
VirtualMachineTO to = new VirtualMachineTO(id, name, VirtualMachine.Type.User, cpus, speed, minRam, maxRam, BootloaderType.HVM, os, false, false, vncPassword);
to.setVncAddr(vncAddr);
+ to.setUuid("b0f0a72d-7efb-3cad-a8ff-70ebf30b3af9");
LibvirtVMDef vm = lcr.createVMFromSpec(to);
vm.setHvsType(_hyperVisorType);
@@ -135,6 +136,7 @@ public class LibvirtComputingResourceTest {
LibvirtComputingResource lcr = new LibvirtComputingResource();
VirtualMachineTO to = new VirtualMachineTO(id, name, VirtualMachine.Type.User, cpus, minSpeed, maxSpeed, minRam, maxRam, BootloaderType.HVM, os, false, false, vncPassword);
to.setVncAddr(vncAddr);
+ to.setUuid("b0f0a72d-7efb-3cad-a8ff-70ebf30b3af9");
LibvirtVMDef vm = lcr.createVMFromSpec(to);
vm.setHvsType(_hyperVisorType);
@@ -181,4 +183,4 @@ public class LibvirtComputingResourceTest {
assertEquals(vmStr, vm.toString());
}
-}
\ No newline at end of file
+}
[32/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Summary: KVM - double migration can fail
Detail: Undefine VM after migration. Lingering domain definitions cause
migrations back to the original host to fail, since domain already exists.
BUG-ID: CLOUDSTACK-2640
Bugfix-for: 4.1.0,4.2.0
Signed-off-by: Marcus Sorensen <ma...@betterservers.com> 1369285950 -0600
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/795fd803
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/795fd803
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/795fd803
Branch: refs/heads/object_store
Commit: 795fd803da3eadee0fae1a13d0e97ae57b239657
Parents: 4786420
Author: Marcus Sorensen <ma...@betterservers.com>
Authored: Wed May 22 23:12:30 2013 -0600
Committer: Marcus Sorensen <ma...@betterservers.com>
Committed: Wed May 22 23:12:30 2013 -0600
----------------------------------------------------------------------
.../kvm/resource/LibvirtComputingResource.java | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/795fd803/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index b31fb5d..0903855 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -2728,6 +2728,9 @@ ServerResource {
} finally {
try {
if (dm != null) {
+ if (dm.isPersistent() == 1) {
+ dm.undefine();
+ }
dm.free();
}
if (dconn != null) {
[17/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
portable ip and api changes
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f7eb139c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f7eb139c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f7eb139c
Branch: refs/heads/object_store
Commit: f7eb139ce2cf85f59aa43f4f4da78fa5668fe034
Parents: 62d3204
Author: Radhika PC <ra...@citrix.com>
Authored: Wed May 22 17:27:28 2013 +0530
Committer: Radhika PC <ra...@citrix.com>
Committed: Wed May 22 17:28:06 2013 +0530
----------------------------------------------------------------------
docs/en-US/added-API-commands-4.2.xml | 16 +++
docs/en-US/elastic-ip.xml | 161 +++++++++++++---------------
docs/en-US/portable-ip.xml | 30 +++++
3 files changed, 120 insertions(+), 87 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f7eb139c/docs/en-US/added-API-commands-4.2.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/added-API-commands-4.2.xml b/docs/en-US/added-API-commands-4.2.xml
index 3abb780..177c9a0 100644
--- a/docs/en-US/added-API-commands-4.2.xml
+++ b/docs/en-US/added-API-commands-4.2.xml
@@ -117,5 +117,21 @@
pagesize; projectid (lists objects by project); regionid; tags (lists resources by tags:
key/value pairs)</para>
</listitem>
+ <listitem>
+ <para>createPortableIpAddressRange</para>
+ <para>Creates portable IP addresses from the portable public IP address pool.</para>
+ <para>The request parameters are region id, start ip, end ip, netmask, gateway, and
+ vlan.</para>
+ </listitem>
+ <listitem>
+ <para>deletePortableIpAddressRange</para>
+ <para>Deletes portable IP addresses from the portable public IP address pool.</para>
+ <para>The request parameters is portable ip address range id.</para>
+ </listitem>
+ <listitem>
+ <para>createPortableIpAddressRange</para>
+ <para>Lists portable IP addresses in the portable public IP address pool.</para>
+ <para>The request parameters are elastic ip id and region id.</para>
+ </listitem>
</itemizedlist>
</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f7eb139c/docs/en-US/elastic-ip.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/elastic-ip.xml b/docs/en-US/elastic-ip.xml
index 672fc5a..8ecbd75 100644
--- a/docs/en-US/elastic-ip.xml
+++ b/docs/en-US/elastic-ip.xml
@@ -26,91 +26,78 @@
choice from the EIP pool of your account. Later if required you can reassign the IP address to a
different VM. This feature is extremely helpful during VM failure. Instead of replacing the VM
which is down, the IP address can be reassigned to a new VM in your account. </para>
- <section id="about-eip">
- <title>Elastic IPs in Basic Zone</title>
- <para>Similar to the public IP address, Elastic IP addresses are mapped to their associated
- private IP addresses by using StaticNAT. The EIP service is equipped with StaticNAT (1:1)
- service in an EIP-enabled basic zone. The default network offering,
- DefaultSharedNetscalerEIPandELBNetworkOffering, provides your network with EIP and ELB network
- services if a NetScaler device is deployed in your zone. Consider the following illustration
- for more details.</para>
- <mediaobject>
- <imageobject>
- <imagedata fileref="./images/eip-ns-basiczone.png"/>
- </imageobject>
- <textobject>
- <phrase>eip-ns-basiczone.png: Elastic IP in a NetScaler-enabled Basic Zone.</phrase>
- </textobject>
- </mediaobject>
- <para>In the illustration, a NetScaler appliance is the default entry or exit point for the
- &PRODUCT; instances, and firewall is the default entry or exit point for the rest of the data
- center. Netscaler provides LB services and staticNAT service to the guest networks. The guest
- traffic in the pods and the Management Server are on different subnets / VLANs. The
- policy-based routing in the data center core switch sends the public traffic through the
- NetScaler, whereas the rest of the data center goes through the firewall. </para>
- <para>The EIP work flow is as follows:</para>
- <itemizedlist>
- <listitem>
- <para>When a user VM is deployed, a public IP is automatically acquired from the pool of
- public IPs configured in the zone. This IP is owned by the VM's account.</para>
- </listitem>
- <listitem>
- <para>Each VM will have its own private IP. When the user VM starts, Static NAT is
- provisioned on the NetScaler device by using the Inbound Network Address Translation
- (INAT) and Reverse NAT (RNAT) rules between the public IP and the private IP.</para>
- <note>
- <para>Inbound NAT (INAT) is a type of NAT supported by NetScaler, in which the destination
- IP address is replaced in the packets from the public network, such as the Internet,
- with the private IP address of a VM in the private network. Reverse NAT (RNAT) is a type
- of NAT supported by NetScaler, in which the source IP address is replaced in the packets
- generated by a VM in the private network with the public IP address.</para>
- </note>
- </listitem>
- <listitem>
- <para>This default public IP will be released in two cases:</para>
- <itemizedlist>
- <listitem>
- <para>When the VM is stopped. When the VM starts, it again receives a new public IP, not
- necessarily the same one allocated initially, from the pool of Public IPs.</para>
- </listitem>
- <listitem>
- <para>The user acquires a public IP (Elastic IP). This public IP is associated with the
- account, but will not be mapped to any private IP. However, the user can enable Static
- NAT to associate this IP to the private IP of a VM in the account. The Static NAT rule
- for the public IP can be disabled at any time. When Static NAT is disabled, a new
- public IP is allocated from the pool, which is not necessarily be the same one
- allocated initially.</para>
- </listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- <para>For the deployments where public IPs are limited resources, you have the flexibility to
- choose not to allocate a public IP by default. You can use the Associate Public IP option to
- turn on or off the automatic public IP assignment in the EIP-enabled Basic zones. If you turn
- off the automatic public IP assignment while creating a network offering, only a private IP is
- assigned to a VM when the VM is deployed with that network offering. Later, the user can
- acquire an IP for the VM and enable static NAT.</para>
- <para condition="admin">For more information on the Associate Public IP option, see <xref
- linkend="creating-network-offerings"/>.</para>
- <para condition="install">For more information on the Associate Public IP option, see the
- Administration Guide.</para>
- <note>
- <para>The Associate Public IP feature is designed only for use with user VMs. The System VMs
- continue to get both public IP and private by default, irrespective of the network offering
- configuration.</para>
- </note>
- <para>New deployments which use the default shared network offering with EIP and ELB services to
- create a shared network in the Basic zone will continue allocating public IPs to each user
- VM.</para>
- </section>
- <section id="portable-ip">
- <title>About Portable IP</title>
- <para>Portable IPs in &PRODUCT; are nothing but elastic IPs that can be transferred across
- geographically separated zones. As an administrator, you can provision a pool of portable IPs
- at region level and are available for user consumption. The users can acquire portable IPs if
- admin has provisioned portable public IPs at the region level they are part of. These IPs can
- be use for any service within an advanced zone. You can also use portable IPs for EIP service
- in basic zones. Additionally, a portable IP can be transferred from one network to another
- network.</para>
- </section>
+ <para>Similar to the public IP address, Elastic IP addresses are mapped to their associated
+ private IP addresses by using StaticNAT. The EIP service is equipped with StaticNAT (1:1)
+ service in an EIP-enabled basic zone. The default network offering,
+ DefaultSharedNetscalerEIPandELBNetworkOffering, provides your network with EIP and ELB network
+ services if a NetScaler device is deployed in your zone. Consider the following illustration for
+ more details.</para>
+ <mediaobject>
+ <imageobject>
+ <imagedata fileref="./images/eip-ns-basiczone.png"/>
+ </imageobject>
+ <textobject>
+ <phrase>eip-ns-basiczone.png: Elastic IP in a NetScaler-enabled Basic Zone.</phrase>
+ </textobject>
+ </mediaobject>
+ <para>In the illustration, a NetScaler appliance is the default entry or exit point for the
+ &PRODUCT; instances, and firewall is the default entry or exit point for the rest of the data
+ center. Netscaler provides LB services and staticNAT service to the guest networks. The guest
+ traffic in the pods and the Management Server are on different subnets / VLANs. The policy-based
+ routing in the data center core switch sends the public traffic through the NetScaler, whereas
+ the rest of the data center goes through the firewall. </para>
+ <para>The EIP work flow is as follows:</para>
+ <itemizedlist>
+ <listitem>
+ <para>When a user VM is deployed, a public IP is automatically acquired from the pool of
+ public IPs configured in the zone. This IP is owned by the VM's account.</para>
+ </listitem>
+ <listitem>
+ <para>Each VM will have its own private IP. When the user VM starts, Static NAT is provisioned
+ on the NetScaler device by using the Inbound Network Address Translation (INAT) and Reverse
+ NAT (RNAT) rules between the public IP and the private IP.</para>
+ <note>
+ <para>Inbound NAT (INAT) is a type of NAT supported by NetScaler, in which the destination
+ IP address is replaced in the packets from the public network, such as the Internet, with
+ the private IP address of a VM in the private network. Reverse NAT (RNAT) is a type of NAT
+ supported by NetScaler, in which the source IP address is replaced in the packets
+ generated by a VM in the private network with the public IP address.</para>
+ </note>
+ </listitem>
+ <listitem>
+ <para>This default public IP will be released in two cases:</para>
+ <itemizedlist>
+ <listitem>
+ <para>When the VM is stopped. When the VM starts, it again receives a new public IP, not
+ necessarily the same one allocated initially, from the pool of Public IPs.</para>
+ </listitem>
+ <listitem>
+ <para>The user acquires a public IP (Elastic IP). This public IP is associated with the
+ account, but will not be mapped to any private IP. However, the user can enable Static
+ NAT to associate this IP to the private IP of a VM in the account. The Static NAT rule
+ for the public IP can be disabled at any time. When Static NAT is disabled, a new public
+ IP is allocated from the pool, which is not necessarily be the same one allocated
+ initially.</para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+ </itemizedlist>
+ <para>For the deployments where public IPs are limited resources, you have the flexibility to
+ choose not to allocate a public IP by default. You can use the Associate Public IP option to
+ turn on or off the automatic public IP assignment in the EIP-enabled Basic zones. If you turn
+ off the automatic public IP assignment while creating a network offering, only a private IP is
+ assigned to a VM when the VM is deployed with that network offering. Later, the user can acquire
+ an IP for the VM and enable static NAT.</para>
+ <para condition="admin">For more information on the Associate Public IP option, see <xref
+ linkend="creating-network-offerings"/>.</para>
+ <para condition="install">For more information on the Associate Public IP option, see the
+ Administration Guide.</para>
+ <note>
+ <para>The Associate Public IP feature is designed only for use with user VMs. The System VMs
+ continue to get both public IP and private by default, irrespective of the network offering
+ configuration.</para>
+ </note>
+ <para>New deployments which use the default shared network offering with EIP and ELB services to
+ create a shared network in the Basic zone will continue allocating public IPs to each user
+ VM.</para>
</section>
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f7eb139c/docs/en-US/portable-ip.xml
----------------------------------------------------------------------
diff --git a/docs/en-US/portable-ip.xml b/docs/en-US/portable-ip.xml
new file mode 100644
index 0000000..ec1035e
--- /dev/null
+++ b/docs/en-US/portable-ip.xml
@@ -0,0 +1,30 @@
+<?xml version='1.0' encoding='utf-8' ?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
+%BOOK_ENTITIES;
+]>
+<!-- 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.
+-->
+<section id="portable-ip">
+ <title>About Portable IP</title>
+ <para>Portable IPs in &PRODUCT; are nothing but elastic IPs that can be transferred across
+ geographically separated zones. As an administrator, you can provision a pool of portable IPs at
+ region level and are available for user consumption. The users can acquire portable IPs if admin
+ has provisioned portable public IPs at the region level they are part of. These IPs can be use
+ for any service within an advanced zone. You can also use portable IPs for EIP service in basic
+ zones. Additionally, a portable IP can be transferred from one network to another
+ network.</para>
+</section>
[45/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Populate UUID column for new data introduced in 4.2.0.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cf8ff0cc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cf8ff0cc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cf8ff0cc
Branch: refs/heads/object_store
Commit: cf8ff0cc654e5da4cf7510b964b9ef6cd828c90b
Parents: a46b4d8
Author: Min Chen <mi...@citrix.com>
Authored: Thu May 23 15:43:14 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Thu May 23 15:43:14 2013 -0700
----------------------------------------------------------------------
setup/db/db/schema-410to420.sql | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cf8ff0cc/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index b548035..885eff4 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -353,8 +353,8 @@ ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `lxc_network_lab
UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,LXC' WHERE name='hypervisor.list';
-INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
- VALUES (10, 'routing-10', 'SystemVM Template (LXC)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2', '2755de1f9ef2ce4d6f2bee2efbb4da92', 0, 'SystemVM Template (LXC)', 'QCOW2', 15, 0, 1, 'LXC');
+INSERT INTO `cloud`.`vm_template` (id, uuid, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
+ VALUES (10, UUID(), 'routing-10', 'SystemVM Template (LXC)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2', '2755de1f9ef2ce4d6f2bee2efbb4da92', 0, 'SystemVM Template (LXC)', 'QCOW2', 15, 0, 1, 'LXC');
ALTER TABLE `cloud`.`user_vm` MODIFY user_data TEXT(32768);
[25/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-747: internalLb in VPC - Infrastructure menu - network service provider - add InternalLbVm. Clicking it will lead to a screen that can enable/disable provider and have instances tab that can start/stop LB Instance.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c7b90202
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c7b90202
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c7b90202
Branch: refs/heads/object_store
Commit: c7b902024c321776bc1d00cf23dcf91793cda1d7
Parents: 2957426
Author: Jessica Wang <je...@apache.org>
Authored: Wed May 22 10:42:49 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Wed May 22 10:49:26 2013 -0700
----------------------------------------------------------------------
ui/scripts/system.js | 385 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 383 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c7b90202/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 31e47e4..2e23fc4 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -2708,7 +2708,363 @@
}
}
},
-
+
+ InternalLbVm: {
+ id: 'InternalLbVm',
+ label: 'InternalLbVm',
+ isMaximized: true,
+ type: 'detailView',
+ fields: {
+ name: { label: 'label.name' },
+ ipaddress: { label: 'label.ip.address' },
+ state: { label: 'label.status', indicator: { 'Enabled': 'on' } }
+ },
+ tabs: {
+ network: {
+ title: 'label.network',
+ fields: [
+ {
+ name: { label: 'label.name' }
+ },
+ {
+ id: { label: 'label.id' },
+ state: { label: 'label.state' },
+ physicalnetworkid: { label: 'label.physical.network.ID' },
+ destinationphysicalnetworkid: { label: 'label.destination.physical.network.id' },
+ supportedServices: { label: 'label.supported.services' }
+ }
+ ],
+ dataProvider: function(args) {
+ refreshNspData("InternalLbVm");
+ args.response.success({
+ actionFilter: virtualRouterProviderActionFilter,
+ data: $.extend(nspMap["InternalLbVm"], {
+ supportedServices: nspMap["InternalLbVm"].servicelist.join(', ')
+ })
+ });
+ }
+ },
+
+ instances: {
+ title: 'label.instances',
+ listView: {
+ label: 'label.virtual.appliances',
+ id: 'internallbinstances',
+ fields: {
+ name: { label: 'label.name' },
+ zonename: { label: 'label.zone' },
+ routerType: {
+ label: 'label.type'
+ },
+ state: {
+ converter: function(str) {
+ // For localization
+ return str;
+ },
+ label: 'label.status',
+ indicator: {
+ 'Running': 'on',
+ 'Stopped': 'off',
+ 'Error': 'off'
+ }
+ }
+ },
+ dataProvider: function(args) {
+ var array1 = [];
+ if(args.filterBy != null) {
+ if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
+ switch(args.filterBy.search.by) {
+ case "name":
+ if(args.filterBy.search.value.length > 0)
+ array1.push("&keyword=" + args.filterBy.search.value);
+ break;
+ }
+ }
+ }
+
+ var routers = [];
+ $.ajax({
+ url: createURL("listInternalLoadBalancerVMs&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
+ success: function(json) {
+ var items = json.listinternallbvmssresponse.internalloadbalancervm ?
+ json.listinternallbvmssresponse.internalloadbalancervm : [];
+
+ $(items).map(function(index, item) {
+ routers.push(item);
+ });
+
+ // Get project routers
+ $.ajax({
+ url: createURL("listInternalLoadBalancerVMs&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"),
+ success: function(json) {
+ var items = json.listinternallbvmssresponse.internalloadbalancervm ?
+ json.listinternallbvmssresponse.internalloadbalancervm : [];
+
+ $(items).map(function(index, item) {
+ routers.push(item);
+ });
+ args.response.success({
+ actionFilter: internallbinstanceActionfilter,
+ data: $(routers).map(mapRouterType)
+ });
+ }
+ });
+ }
+ });
+ },
+ detailView: {
+ name: 'Virtual applicance details',
+ actions: {
+ start: {
+ label: 'Start LB VM',
+ messages: {
+ confirm: function(args) {
+ return 'Please confirm you want to start LB VM';
+ },
+ notification: function(args) {
+ return 'Start LB VM';
+ }
+ },
+ action: function(args) {
+ $.ajax({
+ url: createURL('startInternalLoadBalancerVM&id=' + args.context.internallbinstances[0].id),
+ dataType: 'json',
+ async: true,
+ success: function(json) {
+ var jid = json.startinternallbvmresponse.jobid;
+ args.response.success({
+ _custom: {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ return json.queryasyncjobresultresponse.jobresult.internalloadbalancervm;
+ },
+ getActionFilter: function() {
+ return internallbinstanceActionfilter;
+ }
+ }
+ });
+ }
+ });
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ },
+
+ stop: {
+ label: 'Stop LB VM',
+ createForm: {
+ title: 'Please confirm you want to stop LB VM',
+ desc: 'Stop LB VM',
+ fields: {
+ forced: {
+ label: 'force.stop',
+ isBoolean: true,
+ isChecked: false
+ }
+ }
+ },
+ messages: {
+ notification: function(args) {
+ return 'Stop LB VM';
+ }
+ },
+ action: function(args) {
+ var array1 = [];
+ array1.push("&forced=" + (args.data.forced == "on"));
+ $.ajax({
+ url: createURL('stopInternalLoadBalancerVM&id=' + args.context.internallbinstances[0].id + array1.join("")),
+ dataType: 'json',
+ async: true,
+ success: function(json) {
+ var jid = json.stopinternallbvmresponse.jobid;
+ args.response.success({
+ _custom: {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ return json.queryasyncjobresultresponse.jobresult.internalloadbalancervm;
+ },
+ getActionFilter: function() {
+ return internallbinstanceActionfilter;
+ }
+ }
+ });
+ }
+ });
+ },
+ notification: {
+ poll: pollAsyncJobResult
+ }
+ }
+ },
+ tabs: {
+ details: {
+ title: 'label.details',
+ preFilter: function(args) {
+ var hiddenFields = [];
+ if (!args.context.internallbinstances[0].project) {
+ hiddenFields.push('project');
+ hiddenFields.push('projectid');
+ }
+ if(selectedZoneObj.networktype == 'Basic') {
+ hiddenFields.push('publicip'); //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API.
+ }
+ return hiddenFields;
+ },
+ fields: [
+ {
+ name: { label: 'label.name' },
+ project: { label: 'label.project' }
+ },
+ {
+ id: { label: 'label.id' },
+ projectid: { label: 'label.project.id' },
+ state: { label: 'label.state' },
+ guestnetworkid: { label: 'label.network.id' },
+ publicip: { label: 'label.public.ip' },
+ guestipaddress: { label: 'label.guest.ip' },
+ linklocalip: { label: 'label.linklocal.ip' },
+ hostname: { label: 'label.host' },
+ serviceofferingname: { label: 'label.compute.offering' },
+ networkdomain: { label: 'label.network.domain' },
+ domain: { label: 'label.domain' },
+ account: { label: 'label.account' },
+ created: { label: 'label.created', converter: cloudStack.converters.toLocalDate },
+ isredundantrouter: {
+ label: 'label.redundant.router',
+ converter: cloudStack.converters.toBooleanText
+ },
+ redundantRouterState: { label: 'label.redundant.state' }
+ }
+ ],
+ dataProvider: function(args) {
+ $.ajax({
+ url: createURL("listInternalLoadBalancerVMs&id=" + args.context.internallbinstances[0].id),
+ dataType: 'json',
+ async: true,
+ success: function(json) {
+ var jsonObj = json.listinternallbvmssresponse.internalloadbalancervm[0];
+ addExtraPropertiesToRouterInstanceObject(jsonObj);
+ args.response.success({
+ actionFilter: internallbinstanceActionfilter,
+ data: jsonObj
+ });
+ }
+ });
+ }
+ },
+ nics: {
+ title: 'label.nics',
+ multiple: true,
+ fields: [
+ {
+ name: { label: 'label.name', header: true },
+ type: { label: 'label.type' },
+ traffictype: { label: 'label.traffic.type' },
+ networkname: { label: 'label.network.name' },
+ netmask: { label: 'label.netmask' },
+ ipaddress: { label: 'label.ip.address' },
+ id: { label: 'label.id' },
+ networkid: { label: 'label.network.id' },
+ isolationuri: { label: 'label.isolation.uri' },
+ broadcasturi: { label: 'label.broadcast.uri' }
+ }
+ ],
+ dataProvider: function(args) {
+ $.ajax({
+ url: createURL("listInternalLoadBalancerVMs&id=" + args.context.internallbinstances[0].id),
+ dataType: 'json',
+ async: true,
+ success: function(json) {
+ var jsonObj = json.listinternallbvmssresponse.internalloadbalancervm[0].nic;
+
+ args.response.success({
+ actionFilter: internallbinstanceActionfilter,
+ data: $.map(jsonObj, function(nic, index) {
+ var name = 'NIC ' + (index + 1);
+ if (nic.isdefault) {
+ name += ' (' + _l('label.default') + ')';
+ }
+ return $.extend(nic, {
+ name: name
+ });
+ })
+ });
+ }
+ });
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ actions: {
+ enable: {
+ label: 'label.enable.provider',
+ action: function(args) {
+ $.ajax({
+ url: createURL("updateNetworkServiceProvider&id=" + nspMap["InternalLbVm"].id + "&state=Enabled"),
+ dataType: "json",
+ success: function(json) {
+ var jid = json.updatenetworkserviceproviderresponse.jobid;
+ args.response.success(
+ {_custom:
+ {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ $(window).trigger('cloudStack.fullRefresh');
+ }
+ }
+ }
+ );
+ }
+ });
+ },
+ messages: {
+ confirm: function(args) {
+ return 'message.confirm.enable.provider';
+ },
+ notification: function() {
+ return 'label.enable.provider';
+ }
+ },
+ notification: { poll: pollAsyncJobResult }
+ },
+ disable: {
+ label: 'label.disable.provider',
+ action: function(args) {
+ $.ajax({
+ url: createURL("updateNetworkServiceProvider&id=" + nspMap["InternalLbVm"].id + "&state=Disabled"),
+ dataType: "json",
+ success: function(json) {
+ var jid = json.updatenetworkserviceproviderresponse.jobid;
+ args.response.success(
+ {_custom:
+ {
+ jobId: jid,
+ getUpdatedItem: function(json) {
+ $(window).trigger('cloudStack.fullRefresh');
+ }
+ }
+ }
+ );
+ }
+ });
+ },
+ messages: {
+ confirm: function(args) {
+ return 'message.confirm.disable.provider';
+ },
+ notification: function() {
+ return 'label.disable.provider';
+ }
+ },
+ notification: { poll: pollAsyncJobResult }
+ }
+ }
+ },
+
vpcVirtualRouter: {
id: 'vpcVirtualRouterProviders',
label: 'VPC Virtual Router',
@@ -12020,7 +12376,20 @@
}
return allowedActions;
}
+
+ var internallbinstanceActionfilter = function(args) {
+ var jsonObj = args.context.item;
+ var allowedActions = [];
+ if (jsonObj.state == 'Running') {
+ allowedActions.push("stop");
+ }
+ else if (jsonObj.state == 'Stopped') {
+ allowedActions.push("start");
+ }
+ return allowedActions;
+ }
+
var systemvmActionfilter = function(args) {
var jsonObj = args.context.item;
var allowedActions = [];
@@ -12102,6 +12471,9 @@
case "VirtualRouter":
nspMap["virtualRouter"] = items[i];
break;
+ case "InternalLbVm":
+ nspMap["InternalLbVm"] = items[i];
+ break;
case "VpcVirtualRouter":
nspMap["vpcVirtualRouter"] = items[i];
break;
@@ -12178,7 +12550,16 @@
state: nspMap.midoNet? nspMap.midoNet.state : 'Disabled'
}
);
- nspHardcodingArray.push(
+
+ nspHardcodingArray.push(
+ {
+ id: 'InternalLbVm',
+ name: 'InternalLbVm',
+ state: nspMap.InternalLbVm ? nspMap.InternalLbVm.state : 'Disabled'
+ }
+ );
+
+ nspHardcodingArray.push(
{
id: 'vpcVirtualRouter',
name: 'VPC Virtual Router',
[09/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Update the Logical Router NatRules to be compatible with the NVP 3.x.x
platform
Use the Gson adapters to serialize/deserialize the NatRules
Switch the NiciraNvpApi to a single gson Object with the proper adapters
Fix missing order setting for static nat rules and portforwarding rules
Return an error when a port range is passed in a portforwarding rule
The serializer is not required
Fix a bug where an ip address could be released even if it was still in
use for SourceNat
Throw a json parse exception when the type is unknown to the adapter
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4e090796
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4e090796
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4e090796
Branch: refs/heads/object_store
Commit: 4e090796408152af5c06ce72f346ee9ea5d4d404
Parents: 83f84ad
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Fri May 17 13:02:33 2013 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Wed May 22 11:32:16 2013 +0200
----------------------------------------------------------------------
.../cloud/network/nicira/DestinationNatRule.java | 89 ++++
.../src/com/cloud/network/nicira/Match.java | 146 +-----
.../src/com/cloud/network/nicira/NatRule.java | 363 +++++----------
.../src/com/cloud/network/nicira/NiciraNvpApi.java | 67 +++-
.../com/cloud/network/nicira/SourceNatRule.java | 107 +++++
.../cloud/network/resource/NiciraNvpResource.java | 57 +--
.../test/com/cloud/network/nicira/NatRuleTest.java | 43 +-
.../network/resource/NiciraNvpResourceTest.java | 113 +++--
server/src/com/cloud/network/NetworkModelImpl.java | 8 +-
9 files changed, 493 insertions(+), 500 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e090796/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
new file mode 100644
index 0000000..4831041
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/DestinationNatRule.java
@@ -0,0 +1,89 @@
+package com.cloud.network.nicira;
+
+public class DestinationNatRule extends NatRule {
+ private String toDestinationIpAddress;
+ private Integer toDestinationPort;
+
+ public DestinationNatRule() {
+ setType("DestinationNatRule");
+ }
+
+ public String getToDestinationIpAddress() {
+ return toDestinationIpAddress;
+ }
+
+
+ public void setToDestinationIpAddress(String toDestinationIpAddress) {
+ this.toDestinationIpAddress = toDestinationIpAddress;
+ }
+
+
+ public Integer getToDestinationPort() {
+ return toDestinationPort;
+ }
+
+
+ public void setToDestinationPort(Integer toDestinationPort) {
+ this.toDestinationPort = toDestinationPort;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime
+ * result
+ + ((toDestinationIpAddress == null) ? 0
+ : toDestinationIpAddress.hashCode());
+ result = prime
+ * result
+ + ((toDestinationPort == null) ? 0 : toDestinationPort
+ .hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DestinationNatRule other = (DestinationNatRule) obj;
+ if (toDestinationIpAddress == null) {
+ if (other.toDestinationIpAddress != null)
+ return false;
+ } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress))
+ return false;
+ if (toDestinationPort == null) {
+ if (other.toDestinationPort != null)
+ return false;
+ } else if (!toDestinationPort.equals(other.toDestinationPort))
+ return false;
+ return true;
+ }
+
+ @Override
+ public boolean equalsIgnoreUuid(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equalsIgnoreUuid(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ DestinationNatRule other = (DestinationNatRule) obj;
+ if (toDestinationIpAddress == null) {
+ if (other.toDestinationIpAddress != null)
+ return false;
+ } else if (!toDestinationIpAddress.equals(other.toDestinationIpAddress))
+ return false;
+ if (toDestinationPort == null) {
+ if (other.toDestinationPort != null)
+ return false;
+ } else if (!toDestinationPort.equals(other.toDestinationPort))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e090796/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
index 0c4e677..f777782 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/Match.java
@@ -22,15 +22,9 @@ package com.cloud.network.nicira;
public class Match {
private Integer protocol;
private String source_ip_addresses;
- private Boolean source_ip_addresses_not;
private String destination_ip_addresses;
- private Boolean destination_ip_addresses_not;
- private Integer source_port_min;
- private Integer source_port_max;
- private Boolean source_port_not;
- private Integer destination_port_min;
- private Integer destination_port_max;
- private Boolean destination_port_not;
+ private Integer source_port;
+ private Integer destination_port;
private String ethertype = "IPv4";
public Integer getProtocol() {
@@ -41,54 +35,22 @@ public class Match {
this.protocol = protocol;
}
- public Integer getSourcePortMin() {
- return source_port_min;
+ public Integer getSourcePort() {
+ return source_port;
}
- public void setSourcePortMin(Integer source_port_min) {
- this.source_port_min = source_port_min;
+ public void setSourcePort(Integer source_port) {
+ this.source_port = source_port;
}
-
- public Integer getSourcePortMax() {
- return source_port_max;
- }
-
- public void setSourcePortMax(Integer source_port_max) {
- this.source_port_max = source_port_max;
- }
-
- public Boolean isSourcePortNot() {
- return source_port_not;
- }
-
- public void setSourcePortNot(Boolean source_port_not) {
- this.source_port_not = source_port_not;
- }
-
- public Integer getDestinationPortMin() {
- return destination_port_min;
- }
-
- public void setDestinationPortMin(Integer destination_port_min) {
- this.destination_port_min = destination_port_min;
- }
-
- public Integer getDestinationPortMax() {
- return destination_port_max;
+
+ public Integer getDestinationPort() {
+ return destination_port;
}
- public void setDestinationPortMax(Integer destination_port_max) {
- this.destination_port_max = destination_port_max;
+ public void setDestinationPort(Integer destination_port) {
+ this.destination_port = destination_port;
}
-
- public Boolean isDestinationPortNot() {
- return destination_port_not;
- }
-
- public void setDestinationPortNot(Boolean destination_port_not) {
- this.destination_port_not = destination_port_not;
- }
-
+
public String getEthertype() {
return ethertype;
}
@@ -105,14 +67,6 @@ public class Match {
this.source_ip_addresses = source_ip_addresses;
}
- public boolean isSourceIpAddressesNot() {
- return source_ip_addresses_not;
- }
-
- public void setSourceIpAddresses_not(boolean source_ip_addresses_not) {
- this.source_ip_addresses_not = source_ip_addresses_not;
- }
-
public String getDestinationIpAddresses() {
return destination_ip_addresses;
}
@@ -121,14 +75,6 @@ public class Match {
this.destination_ip_addresses = destination_ip_addresses;
}
- public Boolean isDestinationIpAddressesNot() {
- return destination_ip_addresses_not;
- }
-
- public void setDestinationIpAddressesNot(Boolean destination_ip_addresses_not) {
- this.destination_ip_addresses_not = destination_ip_addresses_not;
- }
-
@Override
public int hashCode() {
final int prime = 31;
@@ -139,19 +85,7 @@ public class Match {
: destination_ip_addresses.hashCode());
result = prime
* result
- + ((destination_ip_addresses_not == null) ? 0
- : destination_ip_addresses_not.hashCode());
- result = prime
- * result
- + ((destination_port_max == null) ? 0 : destination_port_max
- .hashCode());
- result = prime
- * result
- + ((destination_port_min == null) ? 0 : destination_port_min
- .hashCode());
- result = prime
- * result
- + ((destination_port_not == null) ? 0 : destination_port_not
+ + ((destination_port == null) ? 0 : destination_port
.hashCode());
result = prime * result
+ ((ethertype == null) ? 0 : ethertype.hashCode());
@@ -161,16 +95,8 @@ public class Match {
* result
+ ((source_ip_addresses == null) ? 0 : source_ip_addresses
.hashCode());
- result = prime
- * result
- + ((source_ip_addresses_not == null) ? 0
- : source_ip_addresses_not.hashCode());
- result = prime * result
- + ((source_port_max == null) ? 0 : source_port_max.hashCode());
- result = prime * result
- + ((source_port_min == null) ? 0 : source_port_min.hashCode());
result = prime * result
- + ((source_port_not == null) ? 0 : source_port_not.hashCode());
+ + ((source_port == null) ? 0 : source_port.hashCode());
return result;
}
@@ -189,26 +115,10 @@ public class Match {
} else if (!destination_ip_addresses
.equals(other.destination_ip_addresses))
return false;
- if (destination_ip_addresses_not == null) {
- if (other.destination_ip_addresses_not != null)
+ if (destination_port == null) {
+ if (other.destination_port != null)
return false;
- } else if (!destination_ip_addresses_not
- .equals(other.destination_ip_addresses_not))
- return false;
- if (destination_port_max == null) {
- if (other.destination_port_max != null)
- return false;
- } else if (!destination_port_max.equals(other.destination_port_max))
- return false;
- if (destination_port_min == null) {
- if (other.destination_port_min != null)
- return false;
- } else if (!destination_port_min.equals(other.destination_port_min))
- return false;
- if (destination_port_not == null) {
- if (other.destination_port_not != null)
- return false;
- } else if (!destination_port_not.equals(other.destination_port_not))
+ } else if (!destination_port.equals(other.destination_port))
return false;
if (ethertype == null) {
if (other.ethertype != null)
@@ -225,26 +135,10 @@ public class Match {
return false;
} else if (!source_ip_addresses.equals(other.source_ip_addresses))
return false;
- if (source_ip_addresses_not == null) {
- if (other.source_ip_addresses_not != null)
- return false;
- } else if (!source_ip_addresses_not
- .equals(other.source_ip_addresses_not))
- return false;
- if (source_port_max == null) {
- if (other.source_port_max != null)
- return false;
- } else if (!source_port_max.equals(other.source_port_max))
- return false;
- if (source_port_min == null) {
- if (other.source_port_min != null)
- return false;
- } else if (!source_port_min.equals(other.source_port_min))
- return false;
- if (source_port_not == null) {
- if (other.source_port_not != null)
+ if (source_port == null) {
+ if (other.source_port != null)
return false;
- } else if (!source_port_not.equals(other.source_port_not))
+ } else if (!source_port.equals(other.source_port))
return false;
return true;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e090796/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
index b66ffa8..93de51e 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NatRule.java
@@ -16,267 +16,114 @@
// under the License.
package com.cloud.network.nicira;
+import java.util.UUID;
+
/**
*
*/
-public class NatRule {
- protected Match match;
- protected String to_source_ip_address_min;
- protected String to_source_ip_address_max;
- protected Integer to_source_port_min;
- protected Integer to_source_port_max;
- protected String uuid;
- protected String type;
- protected String to_destination_ip_address_min;
- protected String to_destination_ip_address_max;
- protected Integer to_destination_port;
-
- public NatRule() {}
-
- public Match getMatch() {
- return match;
- }
-
- public void setMatch(Match match) {
- this.match = match;
- }
-
- public String getToSourceIpAddressMin() {
- return to_source_ip_address_min;
- }
-
- public void setToSourceIpAddressMin(String to_source_ip_address_min) {
- this.to_source_ip_address_min = to_source_ip_address_min;
- }
-
- public String getToSourceIpAddressMax() {
- return to_source_ip_address_max;
- }
-
- public void setToSourceIpAddressMax(String to_source_ip_address_max) {
- this.to_source_ip_address_max = to_source_ip_address_max;
- }
-
- public Integer getToSourcePortMin() {
- return to_source_port_min;
- }
-
- public void setToSourcePortMin(Integer to_source_port_min) {
- this.to_source_port_min = to_source_port_min;
- }
-
- public Integer getToSourcePortMax() {
- return to_source_port_max;
- }
-
- public void setToSourcePortMax(Integer to_source_port_max) {
- this.to_source_port_max = to_source_port_max;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public String getToDestinationIpAddressMin() {
- return to_destination_ip_address_min;
- }
-
- public void setToDestinationIpAddressMin(
- String to_destination_ip_address_min) {
- this.to_destination_ip_address_min = to_destination_ip_address_min;
- }
-
- public String getToDestinationIpAddressMax() {
- return to_destination_ip_address_max;
- }
-
- public void setToDestinationIpAddressMax(
- String to_destination_ip_address_max) {
- this.to_destination_ip_address_max = to_destination_ip_address_max;
- }
-
- public Integer getToDestinationPort() {
- return to_destination_port;
- }
-
- public void setToDestinationPort(Integer to_destination_port) {
- this.to_destination_port = to_destination_port;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
+public abstract class NatRule {
+ protected Match match;
+ protected UUID uuid;
+ protected String type;
+ protected int order;
+
+ public NatRule() {
+ }
+
+ public Match getMatch() {
+ return match;
+ }
+
+ public void setMatch(Match match) {
+ this.match = match;
+ }
+
+ public UUID getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(UUID uuid) {
+ this.uuid = uuid;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public int getOrder() {
+ return order;
+ }
+
+ public void setOrder(int order) {
+ this.order = order;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((match == null) ? 0 : match.hashCode());
+ result = prime * result + order;
+ result = prime * result + ((type == null) ? 0 : type.hashCode());
+ result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
+ return result;
+ }
- @Override
- public int hashCode() {
- final int prime = 42;
- int result = 1;
- result = prime * result + ((match == null) ? 0 : match.hashCode());
- result = prime
- * result
- + ((to_destination_ip_address_max == null) ? 0
- : to_destination_ip_address_max.hashCode());
- result = prime
- * result
- + ((to_destination_ip_address_min == null) ? 0
- : to_destination_ip_address_min.hashCode());
- result = prime
- * result
- + ((to_destination_port == null) ? 0 : to_destination_port
- .hashCode());
- result = prime
- * result
- + ((to_source_ip_address_max == null) ? 0
- : to_source_ip_address_max.hashCode());
- result = prime
- * result
- + ((to_source_ip_address_min == null) ? 0
- : to_source_ip_address_min.hashCode());
- result = prime
- * result
- + ((to_source_port_max == null) ? 0 : to_source_port_max
- .hashCode());
- result = prime
- * result
- + ((to_source_port_min == null) ? 0 : to_source_port_min
- .hashCode());
- result = prime * result + ((type == null) ? 0 : type.hashCode());
- result = prime * result + ((uuid == null) ? 0 : uuid.hashCode());
- return result;
- }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NatRule other = (NatRule) obj;
+ if (match == null) {
+ if (other.match != null)
+ return false;
+ } else if (!match.equals(other.match))
+ return false;
+ if (order != other.order)
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ if (uuid == null) {
+ if (other.uuid != null)
+ return false;
+ } else if (!uuid.equals(other.uuid))
+ return false;
+ return true;
+ }
+
+ public boolean equalsIgnoreUuid(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NatRule other = (NatRule) obj;
+ if (match == null) {
+ if (other.match != null)
+ return false;
+ } else if (!match.equals(other.match))
+ return false;
+ if (order != other.order)
+ return false;
+ if (type == null) {
+ if (other.type != null)
+ return false;
+ } else if (!type.equals(other.type))
+ return false;
+ return true;
+ }
+
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- NatRule other = (NatRule) obj;
- if (match == null) {
- if (other.match != null)
- return false;
- } else if (!match.equals(other.match))
- return false;
- if (to_destination_ip_address_max == null) {
- if (other.to_destination_ip_address_max != null)
- return false;
- } else if (!to_destination_ip_address_max
- .equals(other.to_destination_ip_address_max))
- return false;
- if (to_destination_ip_address_min == null) {
- if (other.to_destination_ip_address_min != null)
- return false;
- } else if (!to_destination_ip_address_min
- .equals(other.to_destination_ip_address_min))
- return false;
- if (to_destination_port == null) {
- if (other.to_destination_port != null)
- return false;
- } else if (!to_destination_port.equals(other.to_destination_port))
- return false;
- if (to_source_ip_address_max == null) {
- if (other.to_source_ip_address_max != null)
- return false;
- } else if (!to_source_ip_address_max
- .equals(other.to_source_ip_address_max))
- return false;
- if (to_source_ip_address_min == null) {
- if (other.to_source_ip_address_min != null)
- return false;
- } else if (!to_source_ip_address_min
- .equals(other.to_source_ip_address_min))
- return false;
- if (to_source_port_max == null) {
- if (other.to_source_port_max != null)
- return false;
- } else if (!to_source_port_max.equals(other.to_source_port_max))
- return false;
- if (to_source_port_min == null) {
- if (other.to_source_port_min != null)
- return false;
- } else if (!to_source_port_min.equals(other.to_source_port_min))
- return false;
- if (type == null) {
- if (other.type != null)
- return false;
- } else if (!type.equals(other.type))
- return false;
- if (uuid == null) {
- if (other.uuid != null)
- return false;
- } else if (!uuid.equals(other.uuid))
- return false;
- return true;
- }
-
- public boolean equalsIgnoreUuid(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- NatRule other = (NatRule) obj;
- if (match == null) {
- if (other.match != null)
- return false;
- } else if (!match.equals(other.match))
- return false;
- if (to_destination_ip_address_max == null) {
- if (other.to_destination_ip_address_max != null)
- return false;
- } else if (!to_destination_ip_address_max
- .equals(other.to_destination_ip_address_max))
- return false;
- if (to_destination_ip_address_min == null) {
- if (other.to_destination_ip_address_min != null)
- return false;
- } else if (!to_destination_ip_address_min
- .equals(other.to_destination_ip_address_min))
- return false;
- if (to_destination_port == null) {
- if (other.to_destination_port != null)
- return false;
- } else if (!to_destination_port.equals(other.to_destination_port))
- return false;
- if (to_source_ip_address_max == null) {
- if (other.to_source_ip_address_max != null)
- return false;
- } else if (!to_source_ip_address_max
- .equals(other.to_source_ip_address_max))
- return false;
- if (to_source_ip_address_min == null) {
- if (other.to_source_ip_address_min != null)
- return false;
- } else if (!to_source_ip_address_min
- .equals(other.to_source_ip_address_min))
- return false;
- if (to_source_port_max == null) {
- if (other.to_source_port_max != null)
- return false;
- } else if (!to_source_port_max.equals(other.to_source_port_max))
- return false;
- if (to_source_port_min == null) {
- if (other.to_source_port_min != null)
- return false;
- } else if (!to_source_port_min.equals(other.to_source_port_min))
- return false;
- if (type == null) {
- if (other.type != null)
- return false;
- } else if (!type.equals(other.type))
- return false;
- return true;
- }
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e090796/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
index 039c174..12fa6c0 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/NiciraNvpApi.java
@@ -34,6 +34,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.UUID;
+
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
@@ -41,7 +43,6 @@ import javax.net.ssl.X509TrustManager;
import org.apache.commons.httpclient.ConnectTimeoutException;
import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpConnectionManager;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.HttpMethodBase;
@@ -59,7 +60,15 @@ import org.apache.commons.httpclient.protocol.Protocol;
import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
import org.apache.log4j.Logger;
+
+import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
import com.google.gson.reflect.TypeToken;
public class NiciraNvpApi {
@@ -73,6 +82,9 @@ public class NiciraNvpApi {
private String _adminpass;
private HttpClient _client;
+ private String _nvpversion;
+
+ private Gson _gson;
/* This factory method is protected so we can extend this
* in the unittests.
@@ -118,6 +130,11 @@ public class NiciraNvpApi {
s_logger.warn("Failed to register the TrustingProtocolSocketFactory, falling back to default SSLSocketFactory", e);
}
+ _gson = new GsonBuilder()
+ .registerTypeAdapter(NatRule.class, new NatRuleAdapter())
+ .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
+ .create();
+
}
public void setControllerAddress(String address) {
@@ -170,6 +187,12 @@ public class NiciraNvpApi {
throw new NiciraNvpApiException("Nicira NVP API login failed " + pm.getStatusText());
}
+ // Extract the version for later use
+ if (pm.getResponseHeader("Server") != null) {
+ _nvpversion = pm.getResponseHeader("Server").getValue();
+ s_logger.debug("NVP Controller reports version " + _nvpversion);
+ }
+
// Success; the cookie required for login is kept in _client
}
@@ -290,8 +313,8 @@ public class NiciraNvpApi {
executeUpdateObject(natRule, uri, Collections.<String,String>emptyMap());
}
- public void deleteLogicalRouterNatRule(String logicalRouterUuid, String natRuleUuid) throws NiciraNvpApiException {
- String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat/" + natRuleUuid;
+ public void deleteLogicalRouterNatRule(String logicalRouterUuid, UUID natRuleUuid) throws NiciraNvpApiException {
+ String uri = "/ws.v1/lrouter/" + logicalRouterUuid + "/nat/" + natRuleUuid.toString();
executeDeleteObject(uri);
}
@@ -342,13 +365,11 @@ public class NiciraNvpApi {
throw new NiciraNvpApiException("Hostname/credentials are null or empty");
}
- Gson gson = new Gson();
-
PutMethod pm = (PutMethod) createMethod("put", uri);
pm.setRequestHeader("Content-Type", "application/json");
try {
pm.setRequestEntity(new StringRequestEntity(
- gson.toJson(newObject),"application/json", null));
+ _gson.toJson(newObject),"application/json", null));
} catch (UnsupportedEncodingException e) {
throw new NiciraNvpApiException("Failed to encode json request body", e);
}
@@ -371,13 +392,11 @@ public class NiciraNvpApi {
throw new NiciraNvpApiException("Hostname/credentials are null or empty");
}
- Gson gson = new Gson();
-
PostMethod pm = (PostMethod) createMethod("post", uri);
pm.setRequestHeader("Content-Type", "application/json");
try {
pm.setRequestEntity(new StringRequestEntity(
- gson.toJson(newObject),"application/json", null));
+ _gson.toJson(newObject),"application/json", null));
} catch (UnsupportedEncodingException e) {
throw new NiciraNvpApiException("Failed to encode json request body", e);
}
@@ -393,7 +412,7 @@ public class NiciraNvpApi {
T result;
try {
- result = (T)gson.fromJson(pm.getResponseBodyAsString(), TypeToken.get(newObject.getClass()).getType());
+ result = (T)_gson.fromJson(pm.getResponseBodyAsString(), TypeToken.get(newObject.getClass()).getType());
} catch (IOException e) {
throw new NiciraNvpApiException("Failed to decode json response body", e);
} finally {
@@ -450,10 +469,9 @@ public class NiciraNvpApi {
throw new NiciraNvpApiException("Failed to retrieve object : " + errorMessage);
}
- Gson gson = new Gson();
T returnValue;
try {
- returnValue = (T)gson.fromJson(gm.getResponseBodyAsString(), returnObjectType);
+ returnValue = (T)_gson.fromJson(gm.getResponseBodyAsString(), returnObjectType);
} catch (IOException e) {
s_logger.error("IOException while retrieving response body",e);
throw new NiciraNvpApiException(e);
@@ -577,5 +595,28 @@ public class NiciraNvpApi {
}
-
+ public static class NatRuleAdapter implements JsonDeserializer<NatRule> {
+
+ @Override
+ public NatRule deserialize(JsonElement jsonElement, Type type,
+ JsonDeserializationContext context) throws JsonParseException {
+ JsonObject jsonObject = jsonElement.getAsJsonObject();
+ NatRule natRule = null;
+
+ if (!jsonObject.has("type")) {
+ throw new JsonParseException("Deserializing as a NatRule, but no type present in the json object");
+ }
+
+ String natRuleType = jsonObject.get("type").getAsString();
+ if ("SourceNatRule".equals(natRuleType)) {
+ return context.deserialize(jsonElement, SourceNatRule.class);
+ }
+ else if ("DestinationNatRule".equals(natRuleType)) {
+ return context.deserialize(jsonElement, DestinationNatRule.class);
+ }
+
+ throw new JsonParseException("Failed to deserialize type \"" + natRuleType + "\"");
+ }
+
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e090796/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
new file mode 100644
index 0000000..5f85ccb
--- /dev/null
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/nicira/SourceNatRule.java
@@ -0,0 +1,107 @@
+package com.cloud.network.nicira;
+
+public class SourceNatRule extends NatRule {
+ private String toSourceIpAddressMax;
+ private String toSourceIpAddressMin;
+ private Integer toSourcePort;
+
+ public SourceNatRule() {
+ setType("SourceNatRule");
+ }
+
+ public String getToSourceIpAddressMax() {
+ return toSourceIpAddressMax;
+ }
+
+ public void setToSourceIpAddressMax(String toSourceIpAddressMax) {
+ this.toSourceIpAddressMax = toSourceIpAddressMax;
+ }
+
+ public String getToSourceIpAddressMin() {
+ return toSourceIpAddressMin;
+ }
+
+ public void setToSourceIpAddressMin(String toSourceIpAddressMin) {
+ this.toSourceIpAddressMin = toSourceIpAddressMin;
+ }
+
+ public Integer getToSourcePort() {
+ return toSourcePort;
+ }
+
+ public void setToSourcePort(Integer toSourcePort) {
+ this.toSourcePort = toSourcePort;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime
+ * result
+ + ((toSourceIpAddressMax == null) ? 0 : toSourceIpAddressMax
+ .hashCode());
+ result = prime
+ * result
+ + ((toSourceIpAddressMin == null) ? 0 : toSourceIpAddressMin
+ .hashCode());
+ result = prime * result
+ + ((toSourcePort == null) ? 0 : toSourcePort.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SourceNatRule other = (SourceNatRule) obj;
+ if (toSourceIpAddressMax == null) {
+ if (other.toSourceIpAddressMax != null)
+ return false;
+ } else if (!toSourceIpAddressMax.equals(other.toSourceIpAddressMax))
+ return false;
+ if (toSourceIpAddressMin == null) {
+ if (other.toSourceIpAddressMin != null)
+ return false;
+ } else if (!toSourceIpAddressMin.equals(other.toSourceIpAddressMin))
+ return false;
+ if (toSourcePort == null) {
+ if (other.toSourcePort != null)
+ return false;
+ } else if (!toSourcePort.equals(other.toSourcePort))
+ return false;
+ return true;
+ }
+
+ @Override
+ public boolean equalsIgnoreUuid(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equalsIgnoreUuid(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SourceNatRule other = (SourceNatRule) obj;
+ if (toSourceIpAddressMax == null) {
+ if (other.toSourceIpAddressMax != null)
+ return false;
+ } else if (!toSourceIpAddressMax.equals(other.toSourceIpAddressMax))
+ return false;
+ if (toSourceIpAddressMin == null) {
+ if (other.toSourceIpAddressMin != null)
+ return false;
+ } else if (!toSourceIpAddressMin.equals(other.toSourceIpAddressMin))
+ return false;
+ if (toSourcePort == null) {
+ if (other.toSourcePort != null)
+ return false;
+ } else if (!toSourcePort.equals(other.toSourcePort))
+ return false;
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e090796/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java
index 6a9a006..114c939 100644
--- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java
+++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java
@@ -61,6 +61,7 @@ import com.cloud.agent.api.to.StaticNatRuleTO;
import com.cloud.host.Host;
import com.cloud.host.Host.Type;
import com.cloud.network.nicira.ControlClusterStatus;
+import com.cloud.network.nicira.DestinationNatRule;
import com.cloud.network.nicira.L3GatewayAttachment;
import com.cloud.network.nicira.LogicalRouterConfig;
import com.cloud.network.nicira.LogicalRouterPort;
@@ -75,6 +76,7 @@ import com.cloud.network.nicira.NiciraNvpTag;
import com.cloud.network.nicira.PatchAttachment;
import com.cloud.network.nicira.RouterNextHop;
import com.cloud.network.nicira.SingleDefaultRouteImplictRoutingConfig;
+import com.cloud.network.nicira.SourceNatRule;
import com.cloud.network.nicira.TransportZoneBinding;
import com.cloud.network.nicira.VifAttachment;
import com.cloud.resource.ServerResource;
@@ -449,13 +451,13 @@ public class NiciraNvpResource implements ServerResource {
new PatchAttachment(lrpi.getUuid()));
// Setup the source nat rule
- NatRule snr = new NatRule();
- snr.setType("SourceNatRule");
+ SourceNatRule snr = new SourceNatRule();
snr.setToSourceIpAddressMin(publicNetworkIpAddress.split("/")[0]);
snr.setToSourceIpAddressMax(publicNetworkIpAddress.split("/")[0]);
Match match = new Match();
match.setSourceIpAddresses(internalNetworkAddress);
snr.setMatch(match);
+ snr.setOrder(200);
_niciraNvpApi.createLogicalRouterNatRule(lrc.getUuid(), snr);
} catch (NiciraNvpApiException e) {
// We need to destroy the router if we already created it
@@ -604,7 +606,8 @@ public class NiciraNvpResource implements ServerResource {
continue;
}
- if (rule.getDstPortRange()[0] != rule.getDstPortRange()[1]) {
+ if (rule.getDstPortRange()[0] != rule.getDstPortRange()[1] ||
+ rule.getSrcPortRange()[0] != rule.getSrcPortRange()[1] ) {
return new ConfigurePortForwardingRulesOnLogicalRouterAnswer(cmd, false, "Nicira NVP doesn't support port ranges for port forwarding");
}
@@ -700,32 +703,24 @@ public class NiciraNvpResource implements ServerResource {
natRuleStr.append(" ");
natRuleStr.append(m.getSourceIpAddresses());
natRuleStr.append(" [");
- natRuleStr.append(m.getSourcePortMin());
- natRuleStr.append("-");
- natRuleStr.append(m.getSourcePortMax());
+ natRuleStr.append(m.getSourcePort());
natRuleStr.append(" ] -> ");
natRuleStr.append(m.getDestinationIpAddresses());
natRuleStr.append(" [");
- natRuleStr.append(m.getDestinationPortMin());
- natRuleStr.append("-");
- natRuleStr.append(m.getDestinationPortMax());
+ natRuleStr.append(m.getDestinationPort());
natRuleStr.append(" ]) -->");
if ("SourceNatRule".equals(rule.getType())) {
- natRuleStr.append(rule.getToSourceIpAddressMin());
+ natRuleStr.append(((SourceNatRule)rule).getToSourceIpAddressMin());
natRuleStr.append("-");
- natRuleStr.append(rule.getToSourceIpAddressMax());
+ natRuleStr.append(((SourceNatRule)rule).getToSourceIpAddressMax());
natRuleStr.append(" [");
- natRuleStr.append(rule.getToSourcePortMin());
- natRuleStr.append("-");
- natRuleStr.append(rule.getToSourcePortMax());
+ natRuleStr.append(((SourceNatRule)rule).getToSourcePort());
natRuleStr.append(" ])");
}
else {
- natRuleStr.append(rule.getToDestinationIpAddressMin());
- natRuleStr.append("-");
- natRuleStr.append(rule.getToDestinationIpAddressMax());
+ natRuleStr.append(((DestinationNatRule)rule).getToDestinationIpAddress());
natRuleStr.append(" [");
- natRuleStr.append(rule.getToDestinationPort());
+ natRuleStr.append(((DestinationNatRule)rule).getToDestinationPort());
natRuleStr.append(" ])");
}
return natRuleStr.toString();
@@ -742,23 +737,24 @@ public class NiciraNvpResource implements ServerResource {
protected NatRule[] generateStaticNatRulePair(String insideIp, String outsideIp) {
NatRule[] rulepair = new NatRule[2];
- rulepair[0] = new NatRule();
+ rulepair[0] = new DestinationNatRule();
rulepair[0].setType("DestinationNatRule");
- rulepair[1] = new NatRule();
+ rulepair[0].setOrder(100);
+ rulepair[1] = new SourceNatRule();
rulepair[1].setType("SourceNatRule");
+ rulepair[1].setOrder(100);
Match m = new Match();
m.setDestinationIpAddresses(outsideIp);
rulepair[0].setMatch(m);
- rulepair[0].setToDestinationIpAddressMin(insideIp);
- rulepair[0].setToDestinationIpAddressMax(insideIp);
+ ((DestinationNatRule)rulepair[0]).setToDestinationIpAddress(insideIp);
// create matching snat rule
m = new Match();
m.setSourceIpAddresses(insideIp);
rulepair[1].setMatch(m);
- rulepair[1].setToSourceIpAddressMin(outsideIp);
- rulepair[1].setToSourceIpAddressMax(outsideIp);
+ ((SourceNatRule)rulepair[1]).setToSourceIpAddressMin(outsideIp);
+ ((SourceNatRule)rulepair[1]).setToSourceIpAddressMax(outsideIp);
return rulepair;
@@ -768,9 +764,9 @@ public class NiciraNvpResource implements ServerResource {
// Start with a basic static nat rule, then add port and protocol details
NatRule[] rulepair = generateStaticNatRulePair(insideIp, outsideIp);
- rulepair[0].setToDestinationPort(insidePorts[0]);
- rulepair[0].getMatch().setDestinationPortMin(outsidePorts[0]);
- rulepair[0].getMatch().setDestinationPortMax(outsidePorts[1]);
+ ((DestinationNatRule)rulepair[0]).setToDestinationPort(insidePorts[0]);
+ rulepair[0].getMatch().setDestinationPort(outsidePorts[0]);
+ rulepair[0].setOrder(50);
rulepair[0].getMatch().setEthertype("IPv4");
if ("tcp".equals(protocol)) {
rulepair[0].getMatch().setProtocol(6);
@@ -779,10 +775,9 @@ public class NiciraNvpResource implements ServerResource {
rulepair[0].getMatch().setProtocol(17);
}
- rulepair[1].setToSourcePortMin(outsidePorts[0]);
- rulepair[1].setToSourcePortMax(outsidePorts[1]);
- rulepair[1].getMatch().setSourcePortMin(insidePorts[0]);
- rulepair[1].getMatch().setSourcePortMax(insidePorts[1]);
+ ((SourceNatRule)rulepair[1]).setToSourcePort(outsidePorts[0]);
+ rulepair[1].getMatch().setSourcePort(insidePorts[0]);
+ rulepair[1].setOrder(50);
rulepair[1].getMatch().setEthertype("IPv4");
if ("tcp".equals(protocol)) {
rulepair[1].getMatch().setProtocol(6);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e090796/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java
index 88c5402..8e7245e 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/nicira/NatRuleTest.java
@@ -20,28 +20,33 @@ import static org.junit.Assert.*;
import org.junit.Test;
+import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
public class NatRuleTest {
- Gson gson = new Gson();
+ @Test
+ public void testNatRuleEncoding() {
+ Gson gson = new GsonBuilder()
+ .registerTypeAdapter(NatRule.class, new com.cloud.network.nicira.NiciraNvpApi.NatRuleAdapter())
+ .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
+ .create();
+
+ DestinationNatRule rn1 = new DestinationNatRule();
+ rn1.setToDestinationIpAddress("10.10.10.10");
+ rn1.setToDestinationPort(80);
+ Match mr1 = new Match();
+ mr1.setSourceIpAddresses("11.11.11.11/24");
+ mr1.setEthertype("IPv4");
+ mr1.setProtocol(6);
+ rn1.setMatch(mr1);
+
+ String jsonString = gson.toJson(rn1);
+ NatRule dnr = gson.fromJson(jsonString, NatRule.class);
+
+ assertTrue(dnr instanceof DestinationNatRule);
+ assertTrue(rn1.equals(dnr));
+ }
- @Test
- public void testNatRuleEncoding() {
- NatRule rn1 = new NatRule();
- rn1.setToDestinationIpAddressMax("10.10.10.10");
- rn1.setToDestinationIpAddressMin("10.10.10.10");
- rn1.setToDestinationPort(80);
- Match mr1 = new Match();
- mr1.setSourceIpAddresses("11.11.11.11/24");
- mr1.setEthertype("IPv4");
- mr1.setProtocol(6);
- rn1.setMatch(mr1);
-
-
- String jsonString = gson.toJson(rn1);
- NatRule dnr = gson.fromJson(jsonString, NatRule.class);
-
- assertTrue(rn1.equals(dnr));
- }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e090796/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
index e378910..8b5af3c 100644
--- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
+++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/resource/NiciraNvpResourceTest.java
@@ -25,6 +25,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.UUID;
import javax.naming.ConfigurationException;
@@ -61,6 +62,7 @@ import com.cloud.agent.api.to.StaticNatRuleTO;
import com.cloud.host.Host;
import com.cloud.network.nicira.Attachment;
import com.cloud.network.nicira.ControlClusterStatus;
+import com.cloud.network.nicira.DestinationNatRule;
import com.cloud.network.nicira.LogicalRouterConfig;
import com.cloud.network.nicira.LogicalRouterPort;
import com.cloud.network.nicira.LogicalSwitch;
@@ -69,6 +71,7 @@ import com.cloud.network.nicira.NatRule;
import com.cloud.network.nicira.NiciraNvpApi;
import com.cloud.network.nicira.NiciraNvpApiException;
import com.cloud.network.nicira.NiciraNvpList;
+import com.cloud.network.nicira.SourceNatRule;
public class NiciraNvpResourceTest {
NiciraNvpApi _nvpApi = mock(NiciraNvpApi.class);
@@ -440,8 +443,8 @@ public class NiciraNvpResourceTest {
// Mock the api create calls
NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
- rulepair[0].setUuid("bbbbb");
- rulepair[1].setUuid("ccccc");
+ rulepair[0].setUuid(UUID.randomUUID());
+ rulepair[1].setUuid(UUID.randomUUID());
when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
@@ -452,11 +455,11 @@ public class NiciraNvpResourceTest {
public boolean matches(Object argument) {
NatRule rule = (NatRule) argument;
if (rule.getType().equals("DestinationNatRule") &&
- rule.getToDestinationIpAddressMin().equals("10.10.10.10")) {
+ ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
return true;
}
if (rule.getType().equals("SourceNatRule") &&
- rule.getToSourceIpAddressMin().equals("11.11.11.11")) {
+ ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
return true;
}
return false;
@@ -481,8 +484,8 @@ public class NiciraNvpResourceTest {
// Mock the api create calls
NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
- rulepair[0].setUuid("bbbbb");
- rulepair[1].setUuid("ccccc");
+ rulepair[0].setUuid(UUID.randomUUID());
+ rulepair[1].setUuid(UUID.randomUUID());
when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
// Mock the api find call
@@ -500,11 +503,11 @@ public class NiciraNvpResourceTest {
public boolean matches(Object argument) {
NatRule rule = (NatRule) argument;
if (rule.getType().equals("DestinationNatRule") &&
- rule.getToDestinationIpAddressMin().equals("10.10.10.10")) {
+ ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
return true;
}
if (rule.getType().equals("SourceNatRule") &&
- rule.getToSourceIpAddressMin().equals("11.11.11.11")) {
+ ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
return true;
}
return false;
@@ -529,8 +532,10 @@ public class NiciraNvpResourceTest {
// Mock the api create calls
NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
- rulepair[0].setUuid("bbbbb");
- rulepair[1].setUuid("ccccc");
+ final UUID rule0Uuid = UUID.randomUUID();
+ final UUID rule1Uuid = UUID.randomUUID();
+ rulepair[0].setUuid(rule0Uuid);
+ rulepair[1].setUuid(rule1Uuid);
when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
// Mock the api find call
@@ -543,11 +548,11 @@ public class NiciraNvpResourceTest {
ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
assertTrue(a.getResult());
- verify(_nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<String>() {
+ verify(_nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>() {
@Override
public boolean matches(Object argument) {
- String uuid = (String) argument;
- if ("bbbbb".equals(uuid) || "ccccc".equals(uuid)) {
+ UUID uuid = (UUID) argument;
+ if (rule0Uuid.equals(uuid) || rule1Uuid.equals(uuid)) {
return true;
}
return false;
@@ -572,8 +577,8 @@ public class NiciraNvpResourceTest {
// Mock the api create calls
NatRule[] rulepair = _resource.generateStaticNatRulePair("10.10.10.10", "11.11.11.11");
- rulepair[0].setUuid("bbbbb");
- rulepair[1].setUuid("ccccc");
+ rulepair[0].setUuid(UUID.randomUUID());
+ rulepair[1].setUuid(UUID.randomUUID());
when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException());
// Mock the api find call
@@ -585,7 +590,7 @@ public class NiciraNvpResourceTest {
ConfigureStaticNatRulesOnLogicalRouterAnswer a = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
assertFalse(a.getResult());
- verify(_nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq("bbbbb"));
+ verify(_nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
}
@Test
@@ -611,8 +616,8 @@ public class NiciraNvpResourceTest {
// Mock the api create calls
NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
- rulepair[0].setUuid("bbbbb");
- rulepair[1].setUuid("ccccc");
+ rulepair[0].setUuid(UUID.randomUUID());
+ rulepair[1].setUuid(UUID.randomUUID());
when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
@@ -623,11 +628,11 @@ public class NiciraNvpResourceTest {
public boolean matches(Object argument) {
NatRule rule = (NatRule) argument;
if (rule.getType().equals("DestinationNatRule") &&
- rule.getToDestinationIpAddressMin().equals("10.10.10.10")) {
+ ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
return true;
}
if (rule.getType().equals("SourceNatRule") &&
- rule.getToSourceIpAddressMin().equals("11.11.11.11")) {
+ ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
return true;
}
return false;
@@ -652,8 +657,8 @@ public class NiciraNvpResourceTest {
// Mock the api create calls
NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
- rulepair[0].setUuid("bbbbb");
- rulepair[1].setUuid("ccccc");
+ rulepair[0].setUuid(UUID.randomUUID());
+ rulepair[1].setUuid(UUID.randomUUID());
when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
// Mock the api find call
@@ -671,11 +676,11 @@ public class NiciraNvpResourceTest {
public boolean matches(Object argument) {
NatRule rule = (NatRule) argument;
if (rule.getType().equals("DestinationNatRule") &&
- rule.getToDestinationIpAddressMin().equals("10.10.10.10")) {
+ ((DestinationNatRule)rule).getToDestinationIpAddress().equals("10.10.10.10")) {
return true;
}
if (rule.getType().equals("SourceNatRule") &&
- rule.getToSourceIpAddressMin().equals("11.11.11.11")) {
+ ((SourceNatRule)rule).getToSourceIpAddressMin().equals("11.11.11.11")) {
return true;
}
return false;
@@ -700,8 +705,10 @@ public class NiciraNvpResourceTest {
// Mock the api create calls
NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
- rulepair[0].setUuid("bbbbb");
- rulepair[1].setUuid("ccccc");
+ final UUID rule0Uuid = UUID.randomUUID();
+ final UUID rule1Uuid = UUID.randomUUID();
+ rulepair[0].setUuid(rule0Uuid);
+ rulepair[1].setUuid(rule1Uuid);
when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
// Mock the api find call
@@ -714,11 +721,11 @@ public class NiciraNvpResourceTest {
ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
assertTrue(a.getResult());
- verify(_nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<String>() {
+ verify(_nvpApi, atLeast(2)).deleteLogicalRouterNatRule(eq("aaaaa"), argThat(new ArgumentMatcher<UUID>() {
@Override
public boolean matches(Object argument) {
- String uuid = (String) argument;
- if ("bbbbb".equals(uuid) || "ccccc".equals(uuid)) {
+ UUID uuid = (UUID) argument;
+ if (rule0Uuid.equals(uuid) || rule1Uuid.equals(uuid)) {
return true;
}
return false;
@@ -743,8 +750,8 @@ public class NiciraNvpResourceTest {
// Mock the api create calls
NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80}, "tcp");
- rulepair[0].setUuid("bbbbb");
- rulepair[1].setUuid("ccccc");
+ rulepair[0].setUuid(UUID.randomUUID());
+ rulepair[1].setUuid(UUID.randomUUID());
when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenThrow(new NiciraNvpApiException());
// Mock the api find call
@@ -756,7 +763,7 @@ public class NiciraNvpResourceTest {
ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
assertFalse(a.getResult());
- verify(_nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq("bbbbb"));
+ verify(_nvpApi, atLeastOnce()).deleteLogicalRouterNatRule(eq("aaaaa"), eq(rulepair[0].getUuid()));
}
@Test
@@ -782,8 +789,8 @@ public class NiciraNvpResourceTest {
// Mock the api create calls
NatRule[] rulepair = _resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 80, 85 }, "11.11.11.11", new int[] { 80, 85}, "tcp");
- rulepair[0].setUuid("bbbbb");
- rulepair[1].setUuid("ccccc");
+ rulepair[0].setUuid(UUID.randomUUID());
+ rulepair[1].setUuid(UUID.randomUUID());
when(_nvpApi.createLogicalRouterNatRule(eq("aaaaa"), (NatRule)any())).thenReturn(rulepair[0]).thenReturn(rulepair[1]);
ConfigurePortForwardingRulesOnLogicalRouterAnswer a = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _resource.executeRequest(cmd);
@@ -799,13 +806,15 @@ public class NiciraNvpResourceTest {
assertTrue("DestinationNatRule".equals(rules[0].getType()));
assertTrue("SourceNatRule".equals(rules[1].getType()));
- assertTrue(rules[0].getToDestinationIpAddressMin().equals("10.10.10.10") && rules[0].getToDestinationIpAddressMax().equals("10.10.10.10"));
- assertTrue(rules[0].getToDestinationPort() == null);
- assertTrue(rules[0].getMatch().getDestinationIpAddresses().equals("11.11.11.11"));
+ DestinationNatRule dnr = (DestinationNatRule) rules[0];
+ assertTrue(dnr.getToDestinationIpAddress().equals("10.10.10.10"));
+ assertTrue(dnr.getToDestinationPort() == null);
+ assertTrue(dnr.getMatch().getDestinationIpAddresses().equals("11.11.11.11"));
- assertTrue(rules[1].getToSourceIpAddressMin().equals("11.11.11.11") && rules[1].getToSourceIpAddressMax().equals("11.11.11.11"));
- assertTrue(rules[1].getToSourcePortMin() == null && rules[1].getToSourcePortMax() == null);
- assertTrue(rules[1].getMatch().getSourceIpAddresses().equals("10.10.10.10"));
+ SourceNatRule snr = (SourceNatRule) rules[1];
+ assertTrue(snr.getToSourceIpAddressMin().equals("11.11.11.11") && snr.getToSourceIpAddressMax().equals("11.11.11.11"));
+ assertTrue(snr.getToSourcePort() == null);
+ assertTrue(snr.getMatch().getSourceIpAddresses().equals("10.10.10.10"));
}
@Test
@@ -814,17 +823,19 @@ public class NiciraNvpResourceTest {
assertTrue("DestinationNatRule".equals(rules[0].getType()));
assertTrue("SourceNatRule".equals(rules[1].getType()));
- assertTrue(rules[0].getToDestinationIpAddressMin().equals("10.10.10.10") && rules[0].getToDestinationIpAddressMax().equals("10.10.10.10"));
- assertTrue(rules[0].getToDestinationPort() == 8080);
- assertTrue(rules[0].getMatch().getDestinationIpAddresses().equals("11.11.11.11"));
- assertTrue(rules[0].getMatch().getDestinationPortMin() == 80 && rules[0].getMatch().getDestinationPortMax() == 80);
- assertTrue(rules[0].getMatch().getEthertype().equals("IPv4") && rules[0].getMatch().getProtocol() == 6);
-
- assertTrue(rules[1].getToSourceIpAddressMin().equals("11.11.11.11") && rules[1].getToSourceIpAddressMax().equals("11.11.11.11"));
- assertTrue(rules[1].getToSourcePortMin() == 80 && rules[1].getToSourcePortMax() == 80);
- assertTrue(rules[1].getMatch().getSourceIpAddresses().equals("10.10.10.10"));
- assertTrue(rules[1].getMatch().getSourcePortMin() == 8080 && rules[1].getMatch().getSourcePortMax() == 8080);
- assertTrue(rules[1].getMatch().getEthertype().equals("IPv4") && rules[1].getMatch().getProtocol() == 6);
+ DestinationNatRule dnr = (DestinationNatRule) rules[0];
+ assertTrue(dnr.getToDestinationIpAddress().equals("10.10.10.10"));
+ assertTrue(dnr.getToDestinationPort() == 8080);
+ assertTrue(dnr.getMatch().getDestinationIpAddresses().equals("11.11.11.11"));
+ assertTrue(dnr.getMatch().getDestinationPort() == 80 );
+ assertTrue(dnr.getMatch().getEthertype().equals("IPv4") && dnr.getMatch().getProtocol() == 6);
+
+ SourceNatRule snr = (SourceNatRule) rules[1];
+ assertTrue(snr.getToSourceIpAddressMin().equals("11.11.11.11") && snr.getToSourceIpAddressMax().equals("11.11.11.11"));
+ assertTrue(snr.getToSourcePort() == 80);
+ assertTrue(snr.getMatch().getSourceIpAddresses().equals("10.10.10.10"));
+ assertTrue(snr.getMatch().getSourcePort() == 8080);
+ assertTrue(snr.getMatch().getEthertype().equals("IPv4") && rules[1].getMatch().getProtocol() == 6);
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e090796/server/src/com/cloud/network/NetworkModelImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/network/NetworkModelImpl.java b/server/src/com/cloud/network/NetworkModelImpl.java
index 135fd29..8971f8c 100755
--- a/server/src/com/cloud/network/NetworkModelImpl.java
+++ b/server/src/com/cloud/network/NetworkModelImpl.java
@@ -320,8 +320,12 @@ public class NetworkModelImpl extends ManagerBase implements NetworkModel {
} else {
if (rulesRevoked) {
// no active rules/revoked rules are associated with this public IP, so remove the
- // association with the provider
- ip.setState(State.Releasing);
+ // association with the provider
+ if (ip.isSourceNat()) {
+ s_logger.debug("Not releasing ip " + ip.getAddress().addr() + " as it is in use for SourceNat");
+ } else {
+ ip.setState(State.Releasing);
+ }
} else {
if (ip.getState() == State.Releasing) {
// rules are not revoked yet, so don't let the network service provider revoke the IP
[30/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
- To check if a host is in avoid set, DPM should check the zones/pods/cluster/hosts in teh avoid list - not just the hosts in avoid list.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a69101dc
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a69101dc
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a69101dc
Branch: refs/heads/object_store
Commit: a69101dceb535af2d6c6382b83d26f14d4ef03bf
Parents: c52879b
Author: Prachi Damle <pr...@cloud.com>
Authored: Wed May 22 16:17:14 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Wed May 22 17:06:49 2013 -0700
----------------------------------------------------------------------
.../deploy/DeploymentPlanningManagerImpl.java | 24 +++++---------
1 files changed, 9 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a69101dc/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
index c86d5e1..795b526 100644
--- a/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
+++ b/server/src/com/cloud/deploy/DeploymentPlanningManagerImpl.java
@@ -380,7 +380,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
if (planner instanceof DeploymentClusterPlanner) {
- ExcludeList PlannerAvoidInput = new ExcludeList(avoids.getDataCentersToAvoid(),
+ ExcludeList plannerAvoidInput = new ExcludeList(avoids.getDataCentersToAvoid(),
avoids.getPodsToAvoid(), avoids.getClustersToAvoid(), avoids.getHostsToAvoid(),
avoids.getPoolsToAvoid());
@@ -388,19 +388,19 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
if (clusterList != null && !clusterList.isEmpty()) {
// planner refactoring. call allocators to list hosts
- ExcludeList PlannerAvoidOutput = new ExcludeList(avoids.getDataCentersToAvoid(),
+ ExcludeList plannerAvoidOutput = new ExcludeList(avoids.getDataCentersToAvoid(),
avoids.getPodsToAvoid(), avoids.getClustersToAvoid(), avoids.getHostsToAvoid(),
avoids.getPoolsToAvoid());
- resetAvoidSet(PlannerAvoidOutput, PlannerAvoidInput);
+ resetAvoidSet(plannerAvoidOutput, plannerAvoidInput);
dest = checkClustersforDestination(clusterList, vmProfile, plan, avoids, dc,
- getPlannerUsage(planner), PlannerAvoidOutput);
+ getPlannerUsage(planner), plannerAvoidOutput);
if (dest != null) {
return dest;
}
// reset the avoid input to the planners
- resetAvoidSet(avoids, PlannerAvoidOutput);
+ resetAvoidSet(avoids, plannerAvoidOutput);
} else {
return null;
@@ -815,12 +815,8 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
// remove any hosts/pools that the planners might have added
// to get the list of hosts/pools that Allocators flagged as 'avoid'
- if (allocatorAvoidOutput.getHostsToAvoid() != null && plannerAvoidOutput.getHostsToAvoid() != null) {
- allocatorAvoidOutput.getHostsToAvoid().removeAll(plannerAvoidOutput.getHostsToAvoid());
- }
- if (allocatorAvoidOutput.getPoolsToAvoid() != null && plannerAvoidOutput.getPoolsToAvoid() != null) {
- allocatorAvoidOutput.getPoolsToAvoid().removeAll(plannerAvoidOutput.getPoolsToAvoid());
- }
+
+ resetAvoidSet(allocatorAvoidOutput, plannerAvoidOutput);
// if all hosts or all pools in the cluster are in avoid set after this
// pass, then put the cluster in avoid set.
@@ -829,8 +825,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
List<HostVO> allhostsInCluster = _hostDao.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, clusterVO.getId(),
clusterVO.getPodId(), clusterVO.getDataCenterId(), null);
for (HostVO host : allhostsInCluster) {
- if (allocatorAvoidOutput.getHostsToAvoid() == null
- || !allocatorAvoidOutput.getHostsToAvoid().contains(host.getId())) {
+ if (!allocatorAvoidOutput.shouldAvoid(host)) {
// there's some host in the cluster that is not yet in avoid set
avoidAllHosts = false;
}
@@ -839,8 +834,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
List<StoragePoolVO> allPoolsInCluster = _storagePoolDao.findPoolsByTags(clusterVO.getDataCenterId(),
clusterVO.getPodId(), clusterVO.getId(), null);
for (StoragePoolVO pool : allPoolsInCluster) {
- if (allocatorAvoidOutput.getPoolsToAvoid() == null
- || !allocatorAvoidOutput.getPoolsToAvoid().contains(pool.getId())) {
+ if (!allocatorAvoidOutput.shouldAvoid(pool)) {
// there's some pool in the cluster that is not yet in avoid set
avoidAllPools = false;
}
[16/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
changing default 'GSLB provider' check box value to unchecked in UI
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/53499c08
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/53499c08
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/53499c08
Branch: refs/heads/object_store
Commit: 53499c085873859dca00ee1180720656b137e374
Parents: b3096db
Author: Murali Reddy <mu...@gmail.com>
Authored: Wed May 22 14:05:53 2013 +0530
Committer: Murali Reddy <mu...@gmail.com>
Committed: Wed May 22 16:26:46 2013 +0530
----------------------------------------------------------------------
ui/scripts/system.js | 4 ++--
ui/scripts/zoneWizard.js | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53499c08/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 11365c1..31e47e4 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -3317,7 +3317,7 @@
gslbprovider: {
label: 'GSLB service',
isBoolean: true,
- isChecked: true
+ isChecked: false
},
gslbproviderpublicip: {
label: 'GSLB service Public IP'
@@ -7009,7 +7009,7 @@
gslbprovider: {
label: 'GSLB service',
isBoolean: true,
- isChecked: true
+ isChecked: false
},
gslbproviderpublicip: {
label: 'GSLB service Public IP'
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/53499c08/ui/scripts/zoneWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js
index 9b28c32..5a89cb3 100755
--- a/ui/scripts/zoneWizard.js
+++ b/ui/scripts/zoneWizard.js
@@ -664,7 +664,7 @@
gslbprovider: {
label: 'GSLB service',
isBoolean: true,
- isChecked: true
+ isChecked: false
},
gslbproviderpublicip: {
label: 'GSLB service Public IP'
[07/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
Implicit Dedication - Key and Value for iMplicit Dedication planner
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/5d3e6bd3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/5d3e6bd3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/5d3e6bd3
Branch: refs/heads/object_store
Commit: 5d3e6bd397464f93ba8890aa29cd5a32558c0c0a
Parents: 11f85c9
Author: Pranav Saxena <pr...@citrix.com>
Authored: Wed May 22 14:35:16 2013 +0530
Committer: Pranav Saxena <pr...@citrix.com>
Committed: Wed May 22 14:35:16 2013 +0530
----------------------------------------------------------------------
ui/scripts/configuration.js | 19 +++++++++++++++++--
ui/scripts/docs.js | 9 +++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d3e6bd3/ui/scripts/configuration.js
----------------------------------------------------------------------
diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js
index 8856d4b..fdeaba0 100644
--- a/ui/scripts/configuration.js
+++ b/ui/scripts/configuration.js
@@ -164,6 +164,17 @@
}
},
+ plannerKey:{label:'Planner Key' , docID:'helpImplicitPlannerKey'},
+ plannerMode:{
+ label:'Planner Mode',
+ select:function(args){
+ var items=[];
+ items.push({id:'',description:''});
+ items.push({id:'Strict', description:'Strict'});
+ items.push({id:'Preffered', description:'Preffered'});
+ args.response.success({data:items});
+ }
+ },
domainId: {
label: 'label.domain',
@@ -201,7 +212,11 @@
deploymentplanner: args.data.deploymentPlanner
};
-
+ var array1 =[];
+ if(args.data.plannerMode != null && args.data.plannerKey !=""){
+ array1.push("&serviceofferingdetails[0]." + args.data.plannerKey + "=" + args.data.plannerMode);
+ }
+
if(args.data.networkRate != null && args.data.networkRate.length > 0) {
$.extend(data, {
networkrate: args.data.networkRate
@@ -239,7 +254,7 @@
}
$.ajax({
- url: createURL('createServiceOffering'),
+ url: createURL('createServiceOffering' + array1.join("")),
data: data,
success: function(json) {
var item = json.createserviceofferingresponse.serviceoffering;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5d3e6bd3/ui/scripts/docs.js
----------------------------------------------------------------------
diff --git a/ui/scripts/docs.js b/ui/scripts/docs.js
index 4a70ca1..7c1aaf8 100755
--- a/ui/scripts/docs.js
+++ b/ui/scripts/docs.js
@@ -16,6 +16,15 @@
// under the License.
cloudStack.docs = {
+ //Implicit Planner
+
+ helpImplicitPlannerKey:{
+
+ desc:'Please provide a Planner key for the Implicit Planner you are going to use and then select its mode below .Eg - Planner Key :ImplicitDedicationMode',
+ externalLink:''
+
+ },
+
//Delete/archive events
helpEventsDeleteType:{
[35/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-1396: uuid field is NULL in hypervisore_capability table for Vmware ESXI 5.1
Adding uuid at the time of inserting new entry in hypervisor_capabilities table
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4e7f8768
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4e7f8768
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4e7f8768
Branch: refs/heads/object_store
Commit: 4e7f87681c8ac15aee56e39693d7a328ccf97f7f
Parents: 4fdd026
Author: Koushik Das <ko...@citrix.com>
Authored: Thu May 23 16:07:26 2013 +0530
Committer: Koushik Das <ko...@citrix.com>
Committed: Thu May 23 16:07:26 2013 +0530
----------------------------------------------------------------------
setup/db/db/schema-410to420.sql | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4e7f8768/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index 7b5e9cb..ea7a18d 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -25,8 +25,8 @@ SET foreign_key_checks = 0;
ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `max_hosts_per_cluster` int unsigned DEFAULT NULL COMMENT 'Max. hosts in cluster supported by hypervisor';
ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `storage_motion_supported` int(1) unsigned DEFAULT 0 COMMENT 'Is storage motion supported';
UPDATE `cloud`.`hypervisor_capabilities` SET `max_hosts_per_cluster`=32 WHERE `hypervisor_type`='VMware';
-INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, storage_motion_supported) VALUES ('XenServer', '6.1.0', 50, 1, 13, 1);
-INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES ('VMware', '5.1', 128, 0, 32);
+INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_data_volumes_limit, storage_motion_supported) VALUES (UUID(), 'XenServer', '6.1.0', 50, 1, 13, 1);
+INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled, max_hosts_per_cluster) VALUES (UUID(), 'VMware', '5.1', 128, 0, 32);
DELETE FROM `cloud`.`configuration` where name='vmware.percluster.host.max';
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'AgentManager', 'xen.nics.max', '7', 'Maximum allowed nics for Vms created on Xen');
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'management-server', 'midonet.apiserver.address', 'http://localhost:8081', 'Specify the address at which the Midonet API server can be contacted (if using Midonet)');
@@ -348,7 +348,7 @@ ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `uuid` varchar(40) UNIQUE;
-- START: support for LXC
-INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('LXC', 'default', 50, 1);
+INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(uuid, hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES (UUID(), 'LXC', 'default', 50, 1);
ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `lxc_network_label` varchar(255) DEFAULT 'cloudbr0' COMMENT 'The network name label of the physical device dedicated to this traffic on a LXC host';
UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,LXC' WHERE name='hypervisor.list';
[37/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2612: Correcting missing db qualifiers in schema-302to40.sql
Signed-off-by: Chip Childers <ch...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cc492305
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cc492305
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cc492305
Branch: refs/heads/object_store
Commit: cc492305cead9307b9959fa696e11f0fad415c0a
Parents: 80a3c05
Author: Chip Childers <ch...@gmail.com>
Authored: Thu May 23 17:50:15 2013 +0100
Committer: Chip Childers <ch...@gmail.com>
Committed: Thu May 23 17:50:47 2013 +0100
----------------------------------------------------------------------
setup/db/db/schema-302to40.sql | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc492305/setup/db/db/schema-302to40.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-302to40.sql b/setup/db/db/schema-302to40.sql
index f17f067..7fa7348 100644
--- a/setup/db/db/schema-302to40.sql
+++ b/setup/db/db/schema-302to40.sql
@@ -134,7 +134,7 @@ ALTER TABLE `cloud`.`account` ADD COLUMN `default_zone_id` bigint unsigned;
ALTER TABLE `cloud`.`account` ADD CONSTRAINT `fk_account__default_zone_id` FOREIGN KEY `fk_account__default_zone_id`(`default_zone_id`) REFERENCES `data_center`(`id`) ON DELETE CASCADE;
-DELETE FROM `cloud`.`storage_pool_host_ref` WHERE pool_id IN (SELECT id FROM storage_pool WHERE removed IS NOT NULL);
+DELETE FROM `cloud`.`storage_pool_host_ref` WHERE pool_id IN (SELECT id FROM `cloud`.`storage_pool` WHERE removed IS NOT NULL);
DROP TABLE IF EXISTS `cloud`.`cluster_vsm_map`;
DROP TABLE IF EXISTS `cloud`.`virtual_supervisor_module`;
@@ -179,14 +179,14 @@ CREATE TABLE `cloud`.`port_profile` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-DELETE FROM `cloud`.`storage_pool_host_ref` WHERE pool_id IN (SELECT id FROM storage_pool WHERE removed IS NOT NULL);
+DELETE FROM `cloud`.`storage_pool_host_ref` WHERE pool_id IN (SELECT id FROM `cloud`.`storage_pool` WHERE removed IS NOT NULL);
ALTER TABLE `cloud`.`service_offering` MODIFY `nw_rate` smallint(5) unsigned DEFAULT '200' COMMENT 'network rate throttle mbits/s';
-- RBD Primary Storage pool support (commit: 406fd95d87bfcdbb282d65589ab1fb6e9fd0018a)
-ALTER TABLE `storage_pool` ADD `user_info` VARCHAR( 255 ) NULL COMMENT 'Authorization information for the storage pool. Used by network filesystems' AFTER `host_address`;
+ALTER TABLE `cloud`.`storage_pool` ADD `user_info` VARCHAR( 255 ) NULL COMMENT 'Authorization information for the storage pool. Used by network filesystems' AFTER `host_address`;
-- Resource tags (commit: 62d45b9670520a1ee8b520509393d4258c689b50)
CREATE TABLE `cloud`.`resource_tags` (
@@ -232,9 +232,9 @@ CREATE TABLE `cloud`.`nicira_nvp_nic_map` (
-- Remove the unique constraint on physical_network_id, provider_name from physical_network_service_providers
-- Because the name of this contraint is not set we need this roundabout way
-- The key is also used by the foreign key constraint so drop and recreate that one
-ALTER TABLE physical_network_service_providers DROP FOREIGN KEY fk_pnetwork_service_providers__physical_network_id;
+ALTER TABLE `cloud`.`physical_network_service_providers` DROP FOREIGN KEY fk_pnetwork_service_providers__physical_network_id;
-SET @constraintname = (select CONCAT(CONCAT('DROP INDEX ', A.CONSTRAINT_NAME), ' ON physical_network_service_providers' )
+SET @constraintname = (select CONCAT(CONCAT('DROP INDEX ', A.CONSTRAINT_NAME), ' ON cloud.physical_network_service_providers' )
from information_schema.key_column_usage A
JOIN information_schema.key_column_usage B ON B.table_name = 'physical_network_service_providers' AND B.COLUMN_NAME = 'provider_name' AND A.COLUMN_NAME ='physical_network_id' AND B.CONSTRAINT_NAME=A.CONSTRAINT_NAME
where A.table_name = 'physical_network_service_providers' LIMIT 1);
@@ -243,7 +243,7 @@ PREPARE stmt1 FROM @constraintname;
EXECUTE stmt1;
DEALLOCATE PREPARE stmt1;
-AlTER TABLE physical_network_service_providers ADD CONSTRAINT `fk_pnetwork_service_providers__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE;
+AlTER TABLE `cloud`.`physical_network_service_providers` ADD CONSTRAINT `fk_pnetwork_service_providers__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE;
UPDATE `cloud`.`configuration` SET description='In second, timeout for creating volume from snapshot' WHERE name='create.volume.from.snapshot.wait';
ALTER TABLE `cloud`.`data_center` ADD COLUMN `is_local_storage_enabled` tinyint NOT NULL DEFAULT 0 COMMENT 'Is local storage offering enabled for this data center; 1: enabled, 0: not';
[22/50] [abbrv] git commit: updated refs/heads/object_store to 98af424
Posted by mc...@apache.org.
CLOUDSTACK-2623. Provide appropriate AWS EC2 error codes in error thrown by CS AWSAPI. Since CS has very few generic errorcode groups, in AWSAPI parse the response message and translate the CS error to AWS EC2 error code.
Provide support for the following error codes -
AuthFailure, DependencyViolation, IncorrectState, InvalidAMIID.NotFound, InvalidAttachment.NotFound, InvalidDevice.InUse, InvalidFilter, InvalidGroup.Duplicate, InvalidGroup.InUse, InvalidGroup.NotFound
InvalidInstanceID.NotFound, InvalidKeyPair.Duplicate, InvalidKeyPair.Format, InvalidKeyPair.NotFound, InvalidParameterCombinatio, InvalidParameterValue, InvalidPermission.Duplicate, InvalidPermission.Malformed
InvalidSnapshot.NotFound, InvalidVolume.NotFound, InvalidVolumeID.Duplicate, InvalidZone.NotFound, MissingParameter, UnsupportedOperation, SignatureDoesNotMatch, InternalError, AddressLimitExceeded, InstanceLimitExceeded
VolumeLimitExceeded, Unavailable, ResourceLimitExceeded
CLOUDSTACK-2624. Support ModifyInstanceAttribute API in AWSAPI.
2 AWS instance attributes will be supported, 'InstanceType' and 'UserData'
As per AWS EC2, to modify both the attributes, the instance must be stopped. If not throw 'IncorrectInstanceState' error
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9a33fd18
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9a33fd18
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9a33fd18
Branch: refs/heads/object_store
Commit: 9a33fd181ffb9d3220edefd1f8d928915b09028a
Parents: 85ff507
Author: Likitha Shetty <li...@citrix.com>
Authored: Wed May 22 16:33:08 2013 +0530
Committer: Likitha Shetty <li...@citrix.com>
Committed: Wed May 22 18:17:11 2013 +0530
----------------------------------------------------------------------
.../com/cloud/bridge/service/EC2MainServlet.java | 2 +-
.../com/cloud/bridge/service/EC2RestServlet.java | 338 +++++---
.../cloud/bridge/service/EC2SoapServiceImpl.java | 87 +-
.../service/core/ec2/EC2AddressFilterSet.java | 16 +-
.../core/ec2/EC2AvailabilityZonesFilterSet.java | 9 +-
.../cloud/bridge/service/core/ec2/EC2Engine.java | 717 ++++++++++-----
.../bridge/service/core/ec2/EC2GroupFilterSet.java | 9 +-
.../bridge/service/core/ec2/EC2ImageFilterSet.java | 8 +-
.../service/core/ec2/EC2InstanceFilterSet.java | 8 +-
.../service/core/ec2/EC2KeyPairFilterSet.java | 16 +-
.../core/ec2/EC2ModifyInstanceAttribute.java | 64 ++
.../bridge/service/core/ec2/EC2RegisterImage.java | 5 +-
.../service/core/ec2/EC2SnapshotFilterSet.java | 10 +-
.../bridge/service/core/ec2/EC2TagsFilterSet.java | 9 +-
.../service/core/ec2/EC2VolumeFilterSet.java | 9 +-
.../service/exception/EC2ServiceException.java | 120 ++--
awsapi/src/com/cloud/stack/CloudStackClient.java | 5 +-
17 files changed, 928 insertions(+), 504 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/EC2MainServlet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/EC2MainServlet.java b/awsapi/src/com/cloud/bridge/service/EC2MainServlet.java
index 8361f6e..4cf5f88 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2MainServlet.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2MainServlet.java
@@ -94,7 +94,7 @@ public class EC2MainServlet extends HttpServlet{
if(!isEC2APIEnabled){
//response.sendError(404, "EC2 API is disabled.");
response.setStatus(404);
- faultResponse(response, "404" , "EC2 API is disabled.");
+ faultResponse(response, "Unavailable" , "EC2 API is disabled");
return;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
index 83645a3..40cabb6 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
@@ -39,7 +39,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import java.util.UUID;
import javax.inject.Inject;
@@ -92,10 +91,9 @@ import com.amazon.ec2.DescribeVolumesResponse;
import com.amazon.ec2.DetachVolumeResponse;
import com.amazon.ec2.DisassociateAddressResponse;
import com.amazon.ec2.GetPasswordDataResponse;
-import com.amazon.ec2.GroupItemType;
import com.amazon.ec2.ImportKeyPairResponse;
-import com.amazon.ec2.LaunchPermissionItemType;
import com.amazon.ec2.ModifyImageAttributeResponse;
+import com.amazon.ec2.ModifyInstanceAttributeResponse;
import com.amazon.ec2.RebootInstancesResponse;
import com.amazon.ec2.RegisterImageResponse;
import com.amazon.ec2.ReleaseAddressResponse;
@@ -105,9 +103,7 @@ import com.amazon.ec2.RunInstancesResponse;
import com.amazon.ec2.StartInstancesResponse;
import com.amazon.ec2.StopInstancesResponse;
import com.amazon.ec2.TerminateInstancesResponse;
-import com.cloud.bridge.model.CloudStackUserVO;
import com.cloud.bridge.model.UserCredentialsVO;
-import com.cloud.bridge.persist.dao.CloudStackConfigurationDao;
import com.cloud.bridge.persist.dao.CloudStackUserDaoImpl;
import com.cloud.bridge.persist.dao.OfferingDaoImpl;
import com.cloud.bridge.persist.dao.UserCredentialsDaoImpl;
@@ -143,6 +139,7 @@ import com.cloud.bridge.service.core.ec2.EC2InstanceFilterSet;
import com.cloud.bridge.service.core.ec2.EC2IpPermission;
import com.cloud.bridge.service.core.ec2.EC2KeyPairFilterSet;
import com.cloud.bridge.service.core.ec2.EC2ModifyImageAttribute;
+import com.cloud.bridge.service.core.ec2.EC2ModifyInstanceAttribute;
import com.cloud.bridge.service.core.ec2.EC2RebootInstances;
import com.cloud.bridge.service.core.ec2.EC2RegisterImage;
import com.cloud.bridge.service.core.ec2.EC2ReleaseAddress;
@@ -151,8 +148,6 @@ import com.cloud.bridge.service.core.ec2.EC2SecurityGroup;
import com.cloud.bridge.service.core.ec2.EC2SnapshotFilterSet;
import com.cloud.bridge.service.core.ec2.EC2StartInstances;
import com.cloud.bridge.service.core.ec2.EC2StopInstances;
-import com.cloud.bridge.service.core.ec2.EC2TagKeyValue;
-import com.cloud.bridge.service.core.ec2.EC2TagTypeId;
import com.cloud.bridge.service.core.ec2.EC2Tags;
import com.cloud.bridge.service.core.ec2.EC2TagsFilterSet;
import com.cloud.bridge.service.core.ec2.EC2Volume;
@@ -289,6 +284,7 @@ public class EC2RestServlet extends HttpServlet {
else if (action.equalsIgnoreCase( "DetachVolume" )) detachVolume(request, response);
else if (action.equalsIgnoreCase( "DisassociateAddress" )) disassociateAddress(request, response);
else if (action.equalsIgnoreCase( "ModifyImageAttribute" )) modifyImageAttribute(request, response);
+ else if (action.equalsIgnoreCase( "ModifyInstanceAttribute" )) modifyInstanceAttribute(request, response);
else if (action.equalsIgnoreCase( "RebootInstances" )) rebootInstances(request, response);
else if (action.equalsIgnoreCase( "RegisterImage" )) registerImage(request, response);
else if (action.equalsIgnoreCase( "ReleaseAddress" )) releaseAddress(request, response);
@@ -318,8 +314,14 @@ public class EC2RestServlet extends HttpServlet {
} catch( EC2ServiceException e ) {
response.setStatus(e.getErrorCode());
- if (e.getCause() != null && e.getCause() instanceof AxisFault)
- faultResponse(response, ((AxisFault)e.getCause()).getFaultCode().getLocalPart(), e.getMessage());
+ if (e.getCause() != null && e.getCause() instanceof AxisFault) {
+ String errorCode = ((AxisFault)e.getCause()).getFaultCode().getLocalPart();
+ if (errorCode.startsWith("Client.")) // only in a SOAP API client error code is prefixed with Client.
+ errorCode = errorCode.split("Client.")[1];
+ else if (errorCode.startsWith("Server.")) // only in a SOAP API server error code is prefixed with Server.
+ errorCode = errorCode.split("Server.")[1];
+ faultResponse(response, errorCode, e.getMessage());
+ }
else {
logger.error("EC2ServiceException: " + e.getMessage(), e);
endResponse(response, e.toString());
@@ -395,11 +397,6 @@ public class EC2RestServlet extends HttpServlet {
endResponse(response, "SetUserKeys exception " + e.getMessage());
return;
}
-
- // prime UserContext here
-// logger.debug("initializing context");
- UserContext context = UserContext.current();
-
try {
txn = Transaction.open(Transaction.AWSAPI_DB);
// -> use the keys to see if the account actually exists
@@ -681,17 +678,23 @@ public class EC2RestServlet extends HttpServlet {
String[] volumeId = request.getParameterValues( "VolumeId" );
if ( null != volumeId && 0 < volumeId.length )
EC2request.setId( volumeId[0] );
- else { response.sendError(530, "Missing VolumeId parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - VolumeId");
+ }
String[] instanceId = request.getParameterValues( "InstanceId" );
if ( null != instanceId && 0 < instanceId.length )
EC2request.setInstanceId( instanceId[0] );
- else { response.sendError(530, "Missing InstanceId parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
+ }
String[] device = request.getParameterValues( "Device" );
if ( null != device && 0 < device.length )
EC2request.setDevice( device[0] );
- else { response.sendError(530, "Missing Device parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - Device");
+ }
// -> execute the request
AttachVolumeResponse EC2response = EC2SoapServiceImpl.toAttachVolumeResponse( ServiceProvider.getInstance().getEC2Engine().attachVolume( EC2request ));
@@ -709,7 +712,9 @@ public class EC2RestServlet extends HttpServlet {
String[] groupName = request.getParameterValues( "GroupName" );
if ( null != groupName && 0 < groupName.length )
EC2request.setName( groupName[0] );
- else { response.sendError(530, "Missing GroupName parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - GroupName");
+ }
// -> not clear how many parameters there are until we fail to get IpPermissions.n.IpProtocol
int nCount = 1, mCount;
@@ -772,8 +777,7 @@ public class EC2RestServlet extends HttpServlet {
} while( true );
if (1 == nCount) {
- response.sendError(530, "At least one IpPermissions required" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - IpPermissions");
}
// -> execute the request
@@ -790,7 +794,9 @@ public class EC2RestServlet extends HttpServlet {
String[] groupName = request.getParameterValues( "GroupName" );
if ( null != groupName && 0 < groupName.length )
EC2request.setName( groupName[0] );
- else { response.sendError(530, "Missing GroupName parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter 'Groupname'");
+ }
// -> not clear how many parameters there are until we fail to get IpPermissions.n.IpProtocol
int nCount = 1;
@@ -852,8 +858,9 @@ public class EC2RestServlet extends HttpServlet {
} while( true );
- if (1 == nCount) { response.sendError(530, "At least one IpPermissions required" ); return; }
-
+ if (1 == nCount) {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - IpPermissions");
+ }
// -> execute the request
AuthorizeSecurityGroupIngressResponse EC2response = EC2SoapServiceImpl.toAuthorizeSecurityGroupIngressResponse(
@@ -868,7 +875,9 @@ public class EC2RestServlet extends HttpServlet {
String[] volumeId = request.getParameterValues( "VolumeId" );
if ( null != volumeId && 0 < volumeId.length )
EC2request.setId(volumeId[0]);
- else { response.sendError(530, "Missing VolumeId parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter 'VolumeId'");
+ }
String[] instanceId = request.getParameterValues( "InstanceId" );
if ( null != instanceId && 0 < instanceId.length )
@@ -890,7 +899,9 @@ public class EC2RestServlet extends HttpServlet {
String[] volumeId = request.getParameterValues( "VolumeId" );
if ( null != volumeId && 0 < volumeId.length )
EC2request.setId(volumeId[0]);
- else { response.sendError(530, "Missing VolumeId parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - VolumeId");
+ }
// -> execute the request
DeleteVolumeResponse EC2response = EC2SoapServiceImpl.toDeleteVolumeResponse( ServiceProvider.getInstance().getEC2Engine().deleteVolume( EC2request ));
@@ -904,7 +915,9 @@ public class EC2RestServlet extends HttpServlet {
String[] zoneName = request.getParameterValues( "AvailabilityZone" );
if ( null != zoneName && 0 < zoneName.length )
EC2request.setZoneName( zoneName[0] );
- else { response.sendError(530, "Missing AvailabilityZone parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing parameter - AvailabilityZone");
+ }
String[] size = request.getParameterValues( "Size" );
String[] snapshotId = request.getParameterValues("SnapshotId");
@@ -922,9 +935,9 @@ public class EC2RestServlet extends HttpServlet {
} else if (useSnapshot && !useSize) {
EC2request.setSnapshotId(snapshotId[0]);
} else if (useSize && useSnapshot) {
- response.sendError(530, "Size and SnapshotId parameters are mutually exclusive" ); return;
+ throw new EC2ServiceException( ClientError.InvalidParameterCombination, "Parameters 'Size' and 'SnapshotId' are mutually exclusive");
} else {
- response.sendError(530, "Size or SnapshotId has to be specified" ); return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Parameter 'Size' or 'SnapshotId' has to be specified");
}
@@ -941,12 +954,15 @@ public class EC2RestServlet extends HttpServlet {
String[] name = request.getParameterValues( "GroupName" );
if ( null != name && 0 < name.length )
groupName = name[0];
- else { response.sendError(530, "Missing GroupName parameter" ); return; }
-
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - GroupName");
+ }
String[] desc = request.getParameterValues( "GroupDescription" );
if ( null != desc && 0 < desc.length )
groupDescription = desc[0];
- else { response.sendError(530, "Missing GroupDescription parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - GroupDescription");
+ }
// -> execute the request
CreateSecurityGroupResponse EC2response = EC2SoapServiceImpl.toCreateSecurityGroupResponse( ServiceProvider.getInstance().getEC2Engine().createSecurityGroup( groupName, groupDescription ));
@@ -960,7 +976,9 @@ public class EC2RestServlet extends HttpServlet {
String[] name = request.getParameterValues( "GroupName" );
if ( null != name && 0 < name.length )
groupName = name[0];
- else { response.sendError(530, "Missing GroupName parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - GroupName");
+ }
// -> execute the request
DeleteSecurityGroupResponse EC2response = EC2SoapServiceImpl.toDeleteSecurityGroupResponse( ServiceProvider.getInstance().getEC2Engine().deleteSecurityGroup( groupName ));
@@ -974,7 +992,9 @@ public class EC2RestServlet extends HttpServlet {
String[] snapSet = request.getParameterValues( "SnapshotId" );
if ( null != snapSet && 0 < snapSet.length )
snapshotId = snapSet[0];
- else { response.sendError(530, "Missing SnapshotId parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - SnapshotId");
+ }
// -> execute the request
DeleteSnapshotResponse EC2response = EC2SoapServiceImpl.toDeleteSnapshotResponse( ServiceProvider.getInstance().getEC2Engine().deleteSnapshot( snapshotId ));
@@ -988,7 +1008,9 @@ public class EC2RestServlet extends HttpServlet {
String[] volSet = request.getParameterValues( "VolumeId" );
if ( null != volSet && 0 < volSet.length )
volumeId = volSet[0];
- else { response.sendError(530, "Missing VolumeId parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - VolumeId");
+ }
// -> execute the request
EC2Engine engine = ServiceProvider.getInstance().getEC2Engine();
@@ -1003,7 +1025,9 @@ public class EC2RestServlet extends HttpServlet {
String[] imageId = request.getParameterValues( "ImageId" );
if ( null != imageId && 0 < imageId.length )
image.setId( imageId[0] );
- else { response.sendError(530, "Missing ImageId parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - ImageId");
+ }
// -> execute the request
DeregisterImageResponse EC2response = EC2SoapServiceImpl.toDeregisterImageResponse( ServiceProvider.getInstance().getEC2Engine().deregisterImage( image ));
@@ -1017,16 +1041,25 @@ public class EC2RestServlet extends HttpServlet {
String[] instanceId = request.getParameterValues( "InstanceId" );
if ( null != instanceId && 0 < instanceId.length )
EC2request.setInstanceId( instanceId[0] );
- else { response.sendError(530, "Missing InstanceId parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
+ }
String[] name = request.getParameterValues( "Name" );
if ( null != name && 0 < name.length )
EC2request.setName( name[0] );
- else { response.sendError(530, "Missing Name parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - Name");
+ }
String[] description = request.getParameterValues( "Description" );
- if ( null != description && 0 < description.length )
+ if ( null != description && 0 < description.length ) {
+ if (description[0].length() > 255)
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Length of the value of parameter Description should be less than 255");
EC2request.setDescription( description[0] );
+ }
+
// -> execute the request
CreateImageResponse EC2response = EC2SoapServiceImpl.toCreateImageResponse( ServiceProvider.getInstance().getEC2Engine().createImage( EC2request ));
@@ -1040,16 +1073,23 @@ public class EC2RestServlet extends HttpServlet {
String[] location = request.getParameterValues( "ImageLocation" );
if ( null != location && 0 < location.length )
EC2request.setLocation( location[0] );
- else { response.sendError(530, "Missing ImageLocation parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing parameter - ImageLocation");
+ }
String[] cloudRedfined = request.getParameterValues( "Architecture" );
if ( null != cloudRedfined && 0 < cloudRedfined.length )
EC2request.setArchitecture( cloudRedfined[0] );
- else { response.sendError(530, "Missing Architecture parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - Architecture");
+ }
String[] name = request.getParameterValues( "Name" );
if ( null != name && 0 < name.length )
EC2request.setName( name[0] );
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - Name");
+ }
String[] description = request.getParameterValues( "Description" );
if ( null != description && 0 < description.length )
@@ -1068,9 +1108,8 @@ public class EC2RestServlet extends HttpServlet {
if ( imageId != null && imageId.length > 0 )
ec2request.setImageId( imageId[0]);
else {
- response.sendError(530, "Missing ImageId parameter" );
- return;
- }
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - ImageId");
+ }
String[] description = request.getParameterValues( "Description.Value" );
if ( description != null && description.length > 0 ) {
@@ -1082,8 +1121,8 @@ public class EC2RestServlet extends HttpServlet {
if (ec2request.getLaunchPermissionSet().length > 0)
ec2request.setAttribute(ImageAttribute.launchPermission);
else {
- response.sendError(530, "Missing Attribute parameter - Description/LaunchPermission should be provided" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter,
+ "Missing required parameter - Description/LaunchPermission should be provided");
}
}
@@ -1135,8 +1174,7 @@ public class EC2RestServlet extends HttpServlet {
if ( imageId != null && imageId.length > 0)
ec2request.setImageId(imageId[0]);
else {
- response.sendError(530, "Missing ImageId parameter" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - ImageId");
}
String[] attribute = request.getParameterValues( "Attribute" );
@@ -1144,12 +1182,11 @@ public class EC2RestServlet extends HttpServlet {
if (attribute[0].equalsIgnoreCase("launchPermission"))
ec2request.setAttribute(ImageAttribute.launchPermission);
else {
- response.sendError(501, "Unsupported Attribute - only launchPermission supported" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter,
+ "Missing required parameter - Description/LaunchPermission should be provided");
}
} else {
- response.sendError(530, "Missing Attribute parameter" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - Attribute");
}
EC2ImageLaunchPermission launchPermission = new EC2ImageLaunchPermission();
@@ -1170,12 +1207,13 @@ public class EC2RestServlet extends HttpServlet {
String[] imageId = request.getParameterValues( "ImageId" );
if ( null != imageId && 0 < imageId.length )
EC2request.setTemplateId( imageId[0] );
- else { response.sendError(530, "Missing ImageId parameter" ); return; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - ImageId");
+ }
String[] minCount = request.getParameterValues( "MinCount" );
if ( minCount == null || minCount.length < 1) {
- response.sendError(530, "Missing MinCount parameter" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - MinCount");
} else if ( Integer.parseInt(minCount[0]) < 1) {
throw new EC2ServiceException(ClientError.InvalidParameterValue,
"Value of parameter MinCount should be greater than 0");
@@ -1185,8 +1223,7 @@ public class EC2RestServlet extends HttpServlet {
String[] maxCount = request.getParameterValues( "MaxCount" );
if ( maxCount == null || maxCount.length < 1) {
- response.sendError(530, "Missing MaxCount parameter" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - MaxCount");
} else if ( Integer.parseInt(maxCount[0]) < 1) {
throw new EC2ServiceException(ClientError.InvalidParameterValue,
"Value of parameter MaxCount should be greater than 0");
@@ -1250,7 +1287,9 @@ public class EC2RestServlet extends HttpServlet {
}
}
}
- if (0 == count) { response.sendError(530, "Missing InstanceId parameter" ); return; }
+ if (0 == count) {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
+ }
// -> execute the request
RebootInstancesResponse EC2response = EC2SoapServiceImpl.toRebootInstancesResponse( ServiceProvider.getInstance().getEC2Engine().rebootInstances(EC2request));
@@ -1274,7 +1313,9 @@ public class EC2RestServlet extends HttpServlet {
}
}
}
- if (0 == count) { response.sendError(530, "Missing InstanceId parameter" ); return; }
+ if (0 == count) {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
+ }
// -> execute the request
StartInstancesResponse EC2response = EC2SoapServiceImpl.toStartInstancesResponse( ServiceProvider.getInstance().getEC2Engine().startInstances(EC2request));
@@ -1298,7 +1339,9 @@ public class EC2RestServlet extends HttpServlet {
}
}
}
- if (0 == count) { response.sendError(530, "Missing InstanceId parameter" ); return; }
+ if (0 == count) {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
+ }
String[] force = request.getParameterValues("Force");
if ( force != null) {
@@ -1327,7 +1370,9 @@ public class EC2RestServlet extends HttpServlet {
}
}
}
- if (0 == count) { response.sendError(530, "Missing InstanceId parameter" ); return; }
+ if (0 == count) {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
+ }
// -> execute the request
EC2request.setDestroyInstances( true );
@@ -1364,7 +1409,8 @@ public class EC2RestServlet extends HttpServlet {
}
// -> execute the request
- DescribeAvailabilityZonesResponse EC2response = EC2SoapServiceImpl.toDescribeAvailabilityZonesResponse( ServiceProvider.getInstance().getEC2Engine().handleRequest( EC2request ));
+ DescribeAvailabilityZonesResponse EC2response = EC2SoapServiceImpl.toDescribeAvailabilityZonesResponse(
+ ServiceProvider.getInstance().getEC2Engine().describeAvailabilityZones( EC2request ));
serializeResponse(response, EC2response);
}
@@ -1404,8 +1450,7 @@ public class EC2RestServlet extends HttpServlet {
if (imageId != null && imageId.length > 0)
ec2request.setImageId(imageId[0]);
else {
- response.sendError(530, "Missing ImageId parameter");
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - ImageId");
}
String[] attribute = request.getParameterValues( "Attribute" );
@@ -1415,12 +1460,11 @@ public class EC2RestServlet extends HttpServlet {
else if (attribute[0].equalsIgnoreCase("launchPermission"))
ec2request.setAttribute(ImageAttribute.launchPermission);
else {
- response.sendError(501, "Unsupported Attribute - description and launchPermission supported" );
- return;
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Only values supported for paramter Attribute are - Description/LaunchPermission");
}
} else {
- response.sendError(530, "Missing Attribute parameter");
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - Attribute");
}
DescribeImageAttributeResponse EC2response = EC2SoapServiceImpl.toDescribeImageAttributeResponse( ServiceProvider.getInstance().getEC2Engine().describeImageAttribute( ec2request ));
@@ -1501,9 +1545,8 @@ public class EC2RestServlet extends HttpServlet {
EC2Engine engine = ServiceProvider.getInstance().getEC2Engine();
String publicIp = request.getParameter( "PublicIp" );
- if (publicIp == null) {
- response.sendError(530, "Missing PublicIp parameter");
- return;
+ if (publicIp == null) {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - PublicIp");
}
EC2ReleaseAddress ec2Request = new EC2ReleaseAddress();
@@ -1522,13 +1565,11 @@ public class EC2RestServlet extends HttpServlet {
String publicIp = request.getParameter( "PublicIp" );
if (null == publicIp) {
- response.sendError(530, "Missing PublicIp parameter" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - PublicIp");
}
String instanceId = request.getParameter( "InstanceId" );
if (null == instanceId) {
- response.sendError(530, "Missing InstanceId parameter" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
}
EC2AssociateAddress ec2Request = new EC2AssociateAddress();
@@ -1548,8 +1589,7 @@ public class EC2RestServlet extends HttpServlet {
String publicIp = request.getParameter( "PublicIp" );
if (null == publicIp) {
- response.sendError(530, "Missing PublicIp parameter" );
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - PublicIp");
}
EC2DisassociateAddress ec2Request = new EC2DisassociateAddress();
@@ -1597,27 +1637,20 @@ public class EC2RestServlet extends HttpServlet {
private void describeInstanceAttribute( HttpServletRequest request, HttpServletResponse response )
throws ADBException, XMLStreamException, IOException {
EC2DescribeInstances EC2request = new EC2DescribeInstances();
- String instanceType = null;
+ String[] instanceId = request.getParameterValues( "InstanceId" );
+ if ( instanceId != null && instanceId.length > 0)
+ EC2request.addInstanceId( instanceId[0] );
+ else
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
- // -> we are only handling queries about the "Attribute=instanceType"
- Enumeration<?> names = request.getParameterNames();
- while( names.hasMoreElements()) {
- String key = (String)names.nextElement();
- if (key.startsWith("Attribute")) {
- String[] value = request.getParameterValues( key );
- if (null != value && 0 < value.length && value[0].equalsIgnoreCase( "instanceType" )) {
- instanceType = value[0];
- break;
- }
+ String[] attribute = request.getParameterValues( "Attribute" );
+ if (attribute != null && attribute.length > 0) {
+ if ( !attribute[0].equalsIgnoreCase("instanceType") ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Only value supported for paramter Attribute is 'instanceType'");
}
- }
- if ( null != instanceType ) {
- String[] value = request.getParameterValues( "InstanceId" );
- EC2request.addInstanceId( value[0] );
- }
- else {
- response.sendError(501, "Unsupported - only instanceType supported" );
- return;
+ } else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - Attribute");
}
// -> execute the request
@@ -1625,6 +1658,38 @@ public class EC2RestServlet extends HttpServlet {
serializeResponse(response, EC2response);
}
+ private void modifyInstanceAttribute(HttpServletRequest request, HttpServletResponse response)
+ throws ADBException, XMLStreamException, IOException {
+ EC2ModifyInstanceAttribute ec2Request = new EC2ModifyInstanceAttribute();
+
+ String[] instanceId = request.getParameterValues( "InstanceId" );
+ if ( instanceId != null && instanceId.length > 0 )
+ ec2Request.setInstanceId(instanceId[0]);
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
+ }
+
+ String[] instanceType = request.getParameterValues( "InstanceType.Value" );
+ String[] userData = request.getParameterValues( "UserData.Value" );
+
+ if ( instanceType != null && userData != null ) {
+ throw new EC2ServiceException( ClientError.InvalidParameterCombination, "Only one attribute can be" +
+ " specified at a time");
+ }
+ if ( instanceType != null && instanceType.length > 0 ) {
+ ec2Request.setInstanceType(instanceType[0]);
+ } else if ( userData != null && userData.length > 0 ) {
+ ec2Request.setUserData(userData[0]);
+ } else {
+ throw new EC2ServiceException( ClientError.MissingParamter,
+ "Missing parameter - InstanceType/UserData should be provided");
+ }
+
+ // -> execute the request
+ ModifyInstanceAttributeResponse EC2response = EC2SoapServiceImpl.toModifyInstanceAttributeResponse(
+ ServiceProvider.getInstance().getEC2Engine().modifyInstanceAttribute( ec2Request ));
+ serializeResponse(response, EC2response);
+ }
private void describeSnapshots( HttpServletRequest request, HttpServletResponse response )
throws ADBException, XMLStreamException, IOException
@@ -1653,7 +1718,8 @@ public class EC2RestServlet extends HttpServlet {
// -> execute the request
EC2Engine engine = ServiceProvider.getInstance().getEC2Engine();
- DescribeSnapshotsResponse EC2response = EC2SoapServiceImpl.toDescribeSnapshotsResponse( engine.handleRequest( EC2request ));
+ DescribeSnapshotsResponse EC2response = EC2SoapServiceImpl.toDescribeSnapshotsResponse(
+ engine.describeSnapshots( EC2request ));
serializeResponse(response, EC2response);
}
@@ -1685,7 +1751,9 @@ public class EC2RestServlet extends HttpServlet {
}
// -> execute the request
- DescribeVolumesResponse EC2response = EC2SoapServiceImpl.toDescribeVolumesResponse( ServiceProvider.getInstance().getEC2Engine().handleRequest( EC2request ));
+ EC2Engine engine = ServiceProvider.getInstance().getEC2Engine();
+ DescribeVolumesResponse EC2response = EC2SoapServiceImpl.toDescribeVolumesResponse(
+ ServiceProvider.getInstance().getEC2Engine().describeVolumes( EC2request ), engine);
serializeResponse(response, EC2response);
}
@@ -1779,10 +1847,13 @@ public class EC2RestServlet extends HttpServlet {
throws ADBException, XMLStreamException, IOException {
String keyName = request.getParameter("KeyName");
+ if ( keyName == null ) {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - KeyName");
+ }
+
String publicKeyMaterial = request.getParameter("PublicKeyMaterial");
- if (keyName==null && publicKeyMaterial==null) {
- response.sendError(530, "Missing parameter");
- return;
+ if ( publicKeyMaterial == null ) {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - PublicKeyMaterial");
}
if (!publicKeyMaterial.contains(" "))
@@ -1804,9 +1875,8 @@ public class EC2RestServlet extends HttpServlet {
private void createKeyPair(HttpServletRequest request, HttpServletResponse response)
throws ADBException, XMLStreamException, IOException {
String keyName = request.getParameter("KeyName");
- if (keyName==null) {
- response.sendError(530, "Missing KeyName parameter");
- return;
+ if (keyName==null) {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - KeyName");
}
EC2CreateKeyPair ec2Request = new EC2CreateKeyPair();
@@ -1823,8 +1893,7 @@ public class EC2RestServlet extends HttpServlet {
throws ADBException, XMLStreamException, IOException {
String keyName = request.getParameter("KeyName");
if (keyName==null) {
- response.sendError(530, "Missing KeyName parameter");
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - KeyName");
}
EC2DeleteKeyPair ec2Request = new EC2DeleteKeyPair();
@@ -1839,8 +1908,7 @@ public class EC2RestServlet extends HttpServlet {
throws ADBException, XMLStreamException, IOException {
String instanceId = request.getParameter("InstanceId");
if (instanceId==null) {
- response.sendError(530, "Missing InstanceId parameter");
- return;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - InstanceId");
}
GetPasswordDataResponse EC2Response = EC2SoapServiceImpl.toGetPasswordData(
@@ -1881,8 +1949,7 @@ public class EC2RestServlet extends HttpServlet {
nCount++;
} while (true);
if ( resourceIdList.isEmpty() ) {
- response.sendError(530, "At least one Resource is required" );
- return null;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - ResourceId");
}
ec2Request = EC2SoapServiceImpl.toResourceTypeAndIds(ec2Request, resourceIdList);
@@ -1899,8 +1966,7 @@ public class EC2RestServlet extends HttpServlet {
nCount++;
} while (true);
if ( resourceTagList.isEmpty() ) {
- response.sendError(530, "At least one Tag is required" );
- return null;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - ResourceTag");
}
ec2Request = EC2SoapServiceImpl.toResourceTag(ec2Request, resourceTagList);
@@ -1944,69 +2010,76 @@ public class EC2RestServlet extends HttpServlet {
String[] awsAccess = request.getParameterValues( "AWSAccessKeyId" );
if ( null != awsAccess && 0 < awsAccess.length )
cloudAccessKey = awsAccess[0];
- else { response.sendError(530, "Missing AWSAccessKeyId parameter" ); return false; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - AWSAccessKeyId");
+ }
String[] clientSig = request.getParameterValues( "Signature" );
if ( null != clientSig && 0 < clientSig.length )
signature = clientSig[0];
- else { response.sendError(530, "Missing Signature parameter" ); return false; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - Signature");
+ }
String[] method = request.getParameterValues( "SignatureMethod" );
if ( null != method && 0 < method.length )
{
sigMethod = method[0];
if (!sigMethod.equals( "HmacSHA256" ) && !sigMethod.equals( "HmacSHA1" )) {
- response.sendError(531, "Unsupported SignatureMethod value: " + sigMethod + " expecting: HmacSHA256 or HmacSHA1" );
- return false;
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Unsupported SignatureMethod value: " + sigMethod + " expecting: HmacSHA256 or HmacSHA1");
}
+ } else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - SignatureMethod");
}
- else { response.sendError(530, "Missing SignatureMethod parameter" ); return false; }
String[] version = request.getParameterValues( "Version" );
if ( null != version && 0 < version.length )
{
if (!version[0].equals( wsdlVersion )) {
- response.sendError(531, "Unsupported Version value: " + version[0] + " expecting: " + wsdlVersion );
- return false;
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Unsupported Version value: " + version[0] + " expecting: " + wsdlVersion);
}
+ } else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - Version");
}
- else { response.sendError(530, "Missing Version parameter" ); return false; }
String[] sigVersion = request.getParameterValues( "SignatureVersion" );
if ( null != sigVersion && 0 < sigVersion.length )
{
if (!sigVersion[0].equals( "2" )) {
- response.sendError(531, "Unsupported SignatureVersion value: " + sigVersion[0] + " expecting: 2" );
- return false;
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Unsupported SignatureVersion value: " + sigVersion[0] + " expecting: 2");
}
}
- else { response.sendError(530, "Missing SignatureVersion parameter" ); return false; }
+ else {
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter - SignatureVersion");
+ }
// -> can have only one but not both { Expires | Timestamp } headers
String[] expires = request.getParameterValues( "Expires" );
if ( null != expires && 0 < expires.length )
{
// -> contains the date and time at which the signature included in the request EXPIRES
- if (hasSignatureExpired( expires[0] )) {
- response.sendError(531, "Expires parameter indicates signature has expired: " + expires[0] );
- return false;
+ if (hasSignatureExpired( expires[0] )) { //InvalidSecurity.RequestHasExpired
+ throw new EC2ServiceException( ClientError.InvalidSecurity_RequestHasExpired,
+ "Expires parameter indicates signature has expired: " + expires[0]);
}
}
else
{ // -> contains the date and time at which the request is SIGNED
String[] time = request.getParameterValues( "Timestamp" );
if ( null == time || 0 == time.length ) {
- response.sendError(530, "Missing Timestamp and Expires parameter, one is required" );
- return false;
+ throw new EC2ServiceException( ClientError.MissingParamter, "Missing required parameter -" +
+ " Timestamp/Expires");
}
}
// [B] Use the access key to get the users secret key from the cloud DB
cloudSecretKey = userDao.getSecretKeyByAccessKey( cloudAccessKey );
if ( cloudSecretKey == null ) {
- logger.debug("No Secret key found for Access key '" + cloudAccessKey + "' in the the EC2 service");
- throw new EC2ServiceException( ClientError.AuthFailure, "No Secret key found for Access key '" + cloudAccessKey +
- "' in the the EC2 service" );
+ logger.debug( "Access key '" + cloudAccessKey + "' not found in the the EC2 service ");
+ throw new EC2ServiceException( ClientError.AuthFailure, "Access key '" + cloudAccessKey + "' not found in the the EC2 service ");
}
// [C] Verify the signature
@@ -2050,8 +2123,9 @@ public class EC2RestServlet extends HttpServlet {
UserContext.current().initContext( cloudAccessKey, cloudSecretKey, cloudAccessKey, "REST request", null );
return true;
}
- else throw new PermissionDeniedException("Invalid signature");
- }
+ else throw new EC2ServiceException( ClientError.SignatureDoesNotMatch,
+ "The request signature calculated does not match the signature provided by the user.");
+ }
/**
* We check this to reduce replay attacks.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java b/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
index dc0d993..f6ac971 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
@@ -53,6 +53,7 @@ import com.cloud.bridge.service.core.ec2.EC2DescribeKeyPairs;
import com.cloud.bridge.service.core.ec2.EC2DescribeKeyPairsResponse;
import com.cloud.bridge.service.core.ec2.EC2ImageFilterSet;
import com.cloud.bridge.service.core.ec2.EC2ImageLaunchPermission;
+import com.cloud.bridge.service.core.ec2.EC2ModifyInstanceAttribute;
import com.cloud.bridge.service.core.ec2.EC2ResourceTag;
import com.cloud.bridge.service.core.ec2.EC2DescribeSecurityGroups;
import com.cloud.bridge.service.core.ec2.EC2DescribeSecurityGroupsResponse;
@@ -96,7 +97,6 @@ import com.cloud.bridge.service.core.ec2.EC2Volume;
import com.cloud.bridge.service.core.ec2.EC2VolumeFilterSet;
import com.cloud.bridge.service.exception.EC2ServiceException;
import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
-import com.cloud.bridge.service.exception.EC2ServiceException.ServerError;
import com.cloud.bridge.util.EC2RestAuth;
@@ -273,8 +273,8 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
List<String> resourceTypeList = new ArrayList<String>();
for (String resourceId : resourceIdList) {
if (!resourceId.contains(":") || resourceId.split(":").length != 2) {
- throw new EC2ServiceException( ClientError.InvalidResourceId_Format,
- "Invalid Format. ResourceId format is resource-type:resource-uuid");
+ throw new EC2ServiceException( ClientError.InvalidParameterValue,
+ "Invalid usage. ResourceId format is resource-type:resource-uuid");
}
String resourceType = resourceId.split(":")[0];
if (resourceTypeList.isEmpty())
@@ -356,7 +356,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
request.setFilterSet( toAvailabiltyZonesFilterSet(fst));
}
- return toDescribeAvailabilityZonesResponse( engine.handleRequest( request ));
+ return toDescribeAvailabilityZonesResponse( engine.describeAvailabilityZones( request ));
}
/**
@@ -422,11 +422,11 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
EmptyElementType instanceType = diag.getInstanceType();
// -> toEC2DescribeInstances
- if (null != instanceType) {
- request.addInstanceId( diat.getInstanceId());
+ if (null != instanceType) {
+ request.addInstanceId( diat.getInstanceId());
return toDescribeInstanceAttributeResponse( engine.describeInstances( request ));
}
- throw new EC2ServiceException( ClientError.Unsupported, "Unsupported - only instanceType supported");
+ throw new EC2ServiceException( ClientError.Unsupported, "Unsupported - only instanceType supported");
}
@@ -549,7 +549,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
request = toSnapshotFilterSet( request, fst, timeFilters );
}
- return toDescribeSnapshotsResponse(engine.handleRequest(request));
+ return toDescribeSnapshotsResponse(engine.describeSnapshots(request));
}
public DescribeTagsResponse describeTags(DescribeTags decsribeTags) {
@@ -588,7 +588,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
request = toVolumeFilterSet( request, fst, timeFilters );
}
- return toDescribeVolumesResponse( engine.handleRequest( request ));
+ return toDescribeVolumesResponse( engine.describeVolumes( request ), engine);
}
public DetachVolumeResponse detachVolume(DetachVolume detachVolume) {
@@ -629,6 +629,26 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
throw new EC2ServiceException( ClientError.Unsupported, "Unsupported - can only modify image description or launchPermission");
}
+ public ModifyInstanceAttributeResponse modifyInstanceAttribute(ModifyInstanceAttribute modifyInstanceAttribute) {
+ EC2ModifyInstanceAttribute request = new EC2ModifyInstanceAttribute();
+
+ ModifyInstanceAttributeType modifyInstanceAttribute2 = modifyInstanceAttribute.getModifyInstanceAttribute();
+ ModifyInstanceAttributeTypeChoice_type0 mia = modifyInstanceAttribute2.getModifyInstanceAttributeTypeChoice_type0();
+
+ request.setInstanceId(modifyInstanceAttribute2.getInstanceId());
+
+ // we only support instanceType and userData
+ if (mia.getInstanceType() != null) {
+ request.setInstanceType(mia.getInstanceType().getValue());
+ } else if (mia.getUserData() != null) {
+ request.setUserData(mia.getUserData().getValue());
+ } else {
+ throw new EC2ServiceException( ClientError.MissingParamter,
+ "Missing required parameter - InstanceType/UserData should be provided");
+ }
+ return toModifyInstanceAttributeResponse(engine.modifyInstanceAttribute(request));
+ }
+
private void setAccountOrGroupList(LaunchPermissionItemType[] items, EC2ModifyImageAttribute request, String operation){
EC2ImageLaunchPermission launchPermission = new EC2ImageLaunchPermission();
@@ -858,26 +878,20 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
response.setUnmonitorInstancesResponse( param1 );
return response;
}
-
-
- public static DescribeImageAttributeResponse toDescribeImageAttributeResponse(EC2DescribeImagesResponse engineResponse) {
- DescribeImageAttributeResponse response = new DescribeImageAttributeResponse();
- DescribeImageAttributeResponseType param1 = new DescribeImageAttributeResponseType();
-
- EC2Image[] imageSet = engineResponse.getImageSet();
- if ( 0 < imageSet.length ) {
- DescribeImageAttributeResponseTypeChoice_type0 param2 = new DescribeImageAttributeResponseTypeChoice_type0();
- NullableAttributeValueType param3 = new NullableAttributeValueType();
- param3.setValue( imageSet[0].getDescription());
- param2.setDescription( param3 );
- param1.setDescribeImageAttributeResponseTypeChoice_type0( param2 );
- param1.setImageId( imageSet[0].getId());
- }
-
- param1.setRequestId( UUID.randomUUID().toString());
- response.setDescribeImageAttributeResponse( param1 );
- return response;
- }
+
+ /**
+ * @param modifyInstanceAttribute
+ * @return
+ */
+ public static ModifyInstanceAttributeResponse toModifyInstanceAttributeResponse(Boolean status) {
+ ModifyInstanceAttributeResponse miat = new ModifyInstanceAttributeResponse();
+
+ ModifyInstanceAttributeResponseType param = new ModifyInstanceAttributeResponseType();
+ param.set_return(status);
+ param.setRequestId(UUID.randomUUID().toString());
+ miat.setModifyInstanceAttributeResponse(param);
+ return miat;
+ }
public static DescribeImageAttributeResponse toDescribeImageAttributeResponse(EC2ImageAttributes engineResponse) {
DescribeImageAttributeResponse response = new DescribeImageAttributeResponse();
@@ -1311,7 +1325,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
}
// toMethods
- public static DescribeVolumesResponse toDescribeVolumesResponse( EC2DescribeVolumesResponse engineResponse )
+ public static DescribeVolumesResponse toDescribeVolumesResponse( EC2DescribeVolumesResponse engineResponse, EC2Engine engine )
{
DescribeVolumesResponse response = new DescribeVolumesResponse();
DescribeVolumesResponseType param1 = new DescribeVolumesResponseType();
@@ -1342,8 +1356,8 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
AttachmentSetItemResponseType param5 = new AttachmentSetItemResponseType();
param5.setVolumeId(vol.getId().toString());
param5.setInstanceId(vol.getInstanceId().toString());
- String devicePath = engine.cloudDeviceIdToDevicePath( vol.getHypervisor(), vol.getDeviceId());
- param5.setDevice( devicePath );
+ String devicePath = engine.cloudDeviceIdToDevicePath( vol.getHypervisor(), vol.getDeviceId());
+ param5.setDevice( devicePath );
param5.setStatus(vol.getAttachmentState());
if (vol.getAttached() == null) {
param5.setAttachTime( cal );
@@ -1876,7 +1890,10 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
param1.setVolumeId( engineResponse.getId().toString());
Long volSize = new Long( engineResponse.getSize());
param1.setSize( volSize.toString());
- param1.setSnapshotId( "" );
+ if (engineResponse.getSnapshotId() != null)
+ param1.setSnapshotId( engineResponse.getSnapshotId() );
+ else
+ param1.setSnapshotId( "" );
param1.setAvailabilityZone( engineResponse.getZoneName());
if ( null != engineResponse.getState())
param1.setStatus( engineResponse.getState());
@@ -2503,10 +2520,6 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
public ImportVolumeResponse importVolume(ImportVolume importVolume) {
throw new EC2ServiceException(ClientError.Unsupported, "This operation is not available");
}
-
- public ModifyInstanceAttributeResponse modifyInstanceAttribute(ModifyInstanceAttribute modifyInstanceAttribute) {
- throw new EC2ServiceException(ClientError.Unsupported, "This operation is not available");
- }
public ModifySnapshotAttributeResponse modifySnapshotAttribute(ModifySnapshotAttribute modifySnapshotAttribute) {
throw new EC2ServiceException(ClientError.Unsupported, "This operation is not available");
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AddressFilterSet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AddressFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AddressFilterSet.java
index 1823b26..153fdde 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AddressFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AddressFilterSet.java
@@ -26,6 +26,9 @@ import java.util.Map;
import org.apache.log4j.Logger;
+import com.cloud.bridge.service.exception.EC2ServiceException;
+import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
+
public class EC2AddressFilterSet {
protected final static Logger logger = Logger.getLogger(EC2KeyPairFilterSet.class);
@@ -43,16 +46,9 @@ public class EC2AddressFilterSet {
String filterName = param.getName();
String value = (String) filterTypes.get( filterName );
- if (null == value) {
- // Changing this to silently ignore
- logger.error("Unsupported filter [" + filterName + "] - 1");
- return;
- }
-
- if (null != value && value.equalsIgnoreCase( "null" )) {
- logger.error("Unsupported filter [" + filterName + "] - 2");
- return;
- }
+ if ( value == null || value.equalsIgnoreCase("null") ) {
+ throw new EC2ServiceException( ClientError.InvalidFilter, "Filter '" + filterName + "' is invalid");
+ }
// ToDo we could add checks to make sure the type of a filters value is correct (e.g., an integer)
filterSet.add( param );
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9a33fd18/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZonesFilterSet.java
----------------------------------------------------------------------
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZonesFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZonesFilterSet.java
index aa3897a..7dba8ab 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZonesFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZonesFilterSet.java
@@ -26,6 +26,7 @@ import java.util.Map;
import com.cloud.bridge.service.exception.EC2ServiceException;
+import com.cloud.bridge.service.exception.EC2ServiceException.ClientError;
public class EC2AvailabilityZonesFilterSet {
@@ -43,11 +44,9 @@ public class EC2AvailabilityZonesFilterSet {
String filterName = param.getName();
String value = (String) filterTypes.get( filterName );
- if (null == value)
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "]", 501 );
-
- if (null != value && value.equalsIgnoreCase( "null" ))
- throw new EC2ServiceException( "Unsupported filter [" + filterName + "]", 501 );
+ if ( value == null || value.equalsIgnoreCase("null") ) {
+ throw new EC2ServiceException( ClientError.InvalidFilter, "Filter '" + filterName + "' is invalid");
+ }
filterSet.add( param );
}