diff --git a/.gitignore b/.gitignore index 7d89223ac65..b067d85024e 100644 --- a/.gitignore +++ b/.gitignore @@ -16,7 +16,6 @@ dist/ cloud-*.tar.bz2 *.log *.pyc -*.cfg build.number api.log.*.gz cloud.log.*.* diff --git a/agent/.classpath b/agent/.classpath index 536dd38714f..6046323a95e 100644 --- a/agent/.classpath +++ b/agent/.classpath @@ -1,4 +1,22 @@ + diff --git a/agent/.project b/agent/.project index 166ff6cc1f3..8ee5c2aa6b9 100644 --- a/agent/.project +++ b/agent/.project @@ -1,4 +1,22 @@ + agent diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties index 9b5d36ed9b2..5e3c8db0660 100644 --- a/agent/conf/agent.properties +++ b/agent/conf/agent.properties @@ -18,7 +18,7 @@ # Sample configuration file for CloudStack agent #resource= the java class, which agent load to execute -resource=com.cloud.agent.resource.computing.LibvirtComputingResource +resource=com.cloud.hypervisor.kvm.resource.LibvirtComputingResource #workers= number of threads running in agent workers=5 diff --git a/agent/conf/dummy.agent.properties b/agent/conf/dummy.agent.properties index ab3f6380d88..5f8fefa8716 100644 --- a/agent/conf/dummy.agent.properties +++ b/agent/conf/dummy.agent.properties @@ -1,3 +1,20 @@ +# 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. + resource=com.cloud.agent.resource.DummyResource host.mac.address=06\:95\:a4\:00\:03\:ee guest.network.device=cloudbr0 diff --git a/agent/conf/environment.properties.in b/agent/conf/environment.properties.in index 7fcf570538f..b077f9e39ae 100644 --- a/agent/conf/environment.properties.in +++ b/agent/conf/environment.properties.in @@ -18,4 +18,4 @@ # management server compile-time environment parameters paths.pid=@PIDDIR@ -paths.scripts=@AGENTLIBDIR@ +paths.script=@AGENTLIBDIR@ diff --git a/agent/conf/log4j-cloud.xml.in b/agent/conf/log4j-cloud.xml.in index 7cb5c6dbaf9..fdbba19e903 100644 --- a/agent/conf/log4j-cloud.xml.in +++ b/agent/conf/log4j-cloud.xml.in @@ -1,4 +1,22 @@ + diff --git a/agent/doc/README-iscsi.txt b/agent/doc/README-iscsi.txt index 6ad468c6a16..03e6d00d4d1 100644 --- a/agent/doc/README-iscsi.txt +++ b/agent/doc/README-iscsi.txt @@ -1,3 +1,20 @@ +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. + 0. Contents =========== ../sbin/vnetd: userspace daemon that runs the vnet diff --git a/agent/doc/README.txt b/agent/doc/README.txt index 3eb90d5949e..f36f50314ca 100644 --- a/agent/doc/README.txt +++ b/agent/doc/README.txt @@ -1,3 +1,20 @@ +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. + 0. Contents =========== sbin/vnetd: userspace daemon that runs the vnet diff --git a/agent/scripts/run.sh b/agent/scripts/run.sh index 55543fe6b69..1fa427539fd 100755 --- a/agent/scripts/run.sh +++ b/agent/scripts/run.sh @@ -17,4 +17,4 @@ # under the License. #run.sh runs the agent client. -java $1 -Xms128M -Xmx384M -cp cglib-nodep-2.2.jar:trilead-ssh2-build213.jar:cloud-api.jar:cloud-core-extras.jar:cloud-utils.jar:cloud-agent.jar:cloud-console-proxy.jar:cloud-console-common.jar:freemarker.jar:log4j-1.2.15.jar:ws-commons-util-1.0.2.jar:xmlrpc-client-3.1.3.jar:cloud-core.jar:xmlrpc-common-3.1.3.jar:javaee-api-5.0-1.jar:gson-1.3.jar:commons-httpclient-3.1.jar:commons-logging-1.1.1.jar:commons-codec-1.4.jar:commons-collections-3.2.1.jar:commons-pool-1.4.jar:apache-log4j-extras-1.0.jar:libvirt-0.4.5.jar:jna.jar:.:/etc/cloud:./conf com.cloud.agent.AgentShell +java $1 -Xms128M -Xmx384M -cp cglib-nodep-2.2.jar:trilead-ssh2-build213.jar:cloud-api.jar:cloud-core-extras.jar:cloud-utils.jar:cloud-agent.jar:cloud-console-proxy.jar:cloud-console-common.jar:freemarker.jar:log4j-1.2.15.jar:ws-commons-util-1.0.2.jar:xmlrpc-client-3.1.3.jar:cloud-core.jar:xmlrpc-common-3.1.3.jar:javaee-api-5.0-1.jar:gson-1.3.jar:commons-httpclient-3.1.jar:commons-logging-1.1.1.jar:commons-codec-1.4.jar:commons-collections-3.2.1.jar:commons-pool-1.4.jar:apache-log4j-extras-1.0.jar:libvirt-0.4.5.jar:jna.jar:.:/etc/cloud:./*:/usr/share/java/*:./conf com.cloud.agent.AgentShell diff --git a/api/src/com/cloud/api/response/NicResponse.java b/api/src/com/cloud/api/response/NicResponse.java index 010cf4992e5..69d5c31f66c 100755 --- a/api/src/com/cloud/api/response/NicResponse.java +++ b/api/src/com/cloud/api/response/NicResponse.java @@ -29,6 +29,9 @@ public class NicResponse extends BaseResponse { @SerializedName("networkid") @Param(description="the ID of the corresponding network") private final IdentityProxy networkId = new IdentityProxy("networks"); + + @SerializedName("networkname") @Param(description="the name of the corresponding network") + private String networkName ; @SerializedName(ApiConstants.NETMASK) @Param(description="the netmask of the nic") private String netmask; @@ -69,6 +72,10 @@ public class NicResponse extends BaseResponse { this.networkId.setValue(networkid); } + public void setNetworkName(String networkname) { + this.networkName = networkname; + } + public void setNetmask(String netmask) { this.netmask = netmask; } diff --git a/api/src/com/cloud/network/element/ConnectivityProvider.java b/api/src/com/cloud/network/element/ConnectivityProvider.java new file mode 100644 index 00000000000..81cac03ace7 --- /dev/null +++ b/api/src/com/cloud/network/element/ConnectivityProvider.java @@ -0,0 +1,21 @@ +// 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.element; + +public interface ConnectivityProvider extends NetworkElement { + +} diff --git a/build/build-cloud-plugins.xml b/build/build-cloud-plugins.xml index c16474d3fbf..a7a1f39aad3 100755 --- a/build/build-cloud-plugins.xml +++ b/build/build-cloud-plugins.xml @@ -198,9 +198,14 @@ - - + + + + + + + diff --git a/build/build-marvin.xml b/build/build-marvin.xml index daa77b91301..6daac03f2ce 100644 --- a/build/build-marvin.xml +++ b/build/build-marvin.xml @@ -40,7 +40,7 @@ - + @@ -50,7 +50,7 @@ - + diff --git a/build/developer.xml b/build/developer.xml index ecd6939b988..f9c581e52c0 100755 --- a/build/developer.xml +++ b/build/developer.xml @@ -241,7 +241,7 @@ - + @@ -269,7 +269,7 @@ - + @@ -401,7 +401,7 @@ - + diff --git a/build/package.xml b/build/package.xml index 30dde943acc..68220c4f174 100755 --- a/build/package.xml +++ b/build/package.xml @@ -82,7 +82,6 @@ - @@ -93,6 +92,7 @@ + @@ -112,7 +112,7 @@ - + @@ -291,6 +291,17 @@ + + + + + + + + + + + diff --git a/cloud.spec b/cloud.spec index 63a7e8aae71..fcfa7409b20 100644 --- a/cloud.spec +++ b/cloud.spec @@ -532,6 +532,7 @@ fi %files agent-libs %defattr(0644,root,root,0755) %{_javadir}/%{name}-agent.jar +%{_javadir}/%{name}-kvm.jar %files agent %defattr(0644,root,root,0755) diff --git a/debian/cloud-agent-libs.install b/debian/cloud-agent-libs.install index 538f0686fac..157b0a66812 100644 --- a/debian/cloud-agent-libs.install +++ b/debian/cloud-agent-libs.install @@ -1 +1,2 @@ /usr/share/java/cloud-agent.jar +/usr/share/java/cloud-plugin-hypervisor-kvm.jar diff --git a/docs/publican.cfg b/docs/publican.cfg new file mode 100644 index 00000000000..fb5a16f6dc5 --- /dev/null +++ b/docs/publican.cfg @@ -0,0 +1,10 @@ +# Config::Simple 4.58 +# Tue May 29 00:57:27 2012 + +xml_lang: en-US +type: Book +docname: release-notes-3.0.4 +brand: cloudstack +chunk_first: 0 +chunk_section_depth: 0 +toc_section_depth: 1 diff --git a/docs/runbook/en-US/Environment.xml b/docs/runbook/en-US/Environment.xml index 9048e1aa0a2..99161d9cb69 100644 --- a/docs/runbook/en-US/Environment.xml +++ b/docs/runbook/en-US/Environment.xml @@ -68,6 +68,13 @@ ONBOOT="no" configure that file so that it specifies the IP address, netmask, etc., as shown in the following example: + + Hardware Addresses + You should not use the hardware address (aka MAC address) from our example + for your configuration. It is network interface specific, so you should keep the + address already provided in the HWADDR directive. + + DEVICE=eth0 HWADDR=52:54:00:B9:A6:C0 @@ -77,6 +84,8 @@ BOOTPROTO=none IPADDR=172.16.10.2 NETMASK=255.255.255.0 GATEWAY=172.16.10.1 +DNS1=8.8.8.8 +DNS2=8.8.4.4 IP Addressing @@ -89,26 +98,10 @@ GATEWAY=172.16.10.1 192.168.55.2 - - Hardware Addresses - You should not use the hardware address (aka MAC address) from our example - for your configuration. It is network interface specific, so you should keep the - address already provided in the HWADDR directive. - - Now that we have the configuration files properly set up, we need to run a few commands to start up the network # chkconfig network on # service network start - This should bring the network up successfully, but we now need to enable name resolution. - To do that we will edit /etc/resolv.conf. These instructions will add - one of the nameservers from Google, though you are free to add a local nameserver if you wish. - Your /etc/resolv.conf should modified to look like: - - -nameserver 8.8.8.8 - -
Hostname @@ -195,8 +188,6 @@ SELINUXTYPE=targeted # mkdir /primary # mkdir /secondary -# chmod 777 /primary -# chmod 777 /secondary CentOS 6.x releases use NFSv4 by default. NFSv4 requires that domain setting matches on all clients. In our case, the domain is cloud.priv, so ensure that the domain setting in /etc/idmapd.conf @@ -215,17 +206,17 @@ STATD_OUTGOING_PORT=2020 Edit the file /etc/sysconfig/iptables --A INPUT -m state --state NEW -p udp --dport 111 -j ACCEPT --A INPUT -m state --state NEW -p tcp --dport 111 -j ACCEPT --A INPUT -m state --state NEW -p tcp --dport 2049 -j ACCEPT --A INPUT -m state --state NEW -p tcp --dport 32803 -j ACCEPT --A INPUT -m state --state NEW -p udp --dport 32769 -j ACCEPT --A INPUT -m state --state NEW -p tcp --dport 892 -j ACCEPT --A INPUT -m state --state NEW -p udp --dport 892 -j ACCEPT --A INPUT -m state --state NEW -p tcp --dport 875 -j ACCEPT --A INPUT -m state --state NEW -p udp --dport 875 -j ACCEPT --A INPUT -m state --state NEW -p tcp --dport 662 -j ACCEPT --A INPUT -m state --state NEW -p udp --dport 662 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 111 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 111 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 32803 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 32769 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 892 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 892 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 875 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 875 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p tcp --dport 662 -j ACCEPT +-A INPUT -s 172.16.10.0/24 -m state --state NEW -p udp --dport 662 -j ACCEPT Now you can restart the iptables service with the following command: diff --git a/patches/systemvm/debian/config/etc/sysctl.conf b/patches/systemvm/debian/config/etc/sysctl.conf index 71b90f08d2a..7f945b0d4b1 100644 --- a/patches/systemvm/debian/config/etc/sysctl.conf +++ b/patches/systemvm/debian/config/etc/sysctl.conf @@ -40,3 +40,10 @@ net.ipv4.netfilter.ip_conntrack_max=1000000 net.ipv4.tcp_tw_reuse=1 net.ipv4.tcp_max_tw_buckets=1000000 net.core.somaxconn=1000000 + +# Disable IPv6 +net.ipv6.conf.all.disable_ipv6 = 1 +net.ipv6.conf.all.forwarding = 0 +net.ipv6.conf.all.accept_ra = 0 +net.ipv6.conf.all.accept_redirects = 0 +net.ipv6.conf.all.autoconf = 0 diff --git a/plugins/hypervisors/kvm/.classpath b/plugins/hypervisors/kvm/.classpath new file mode 100644 index 00000000000..9e6fddb7e90 --- /dev/null +++ b/plugins/hypervisors/kvm/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/plugins/hypervisors/kvm/.project b/plugins/hypervisors/kvm/.project new file mode 100755 index 00000000000..4a89b9efafc --- /dev/null +++ b/plugins/hypervisors/kvm/.project @@ -0,0 +1,23 @@ + + + KVM + + + + + + org.python.pydev.PyDevBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + org.python.pydev.pythonNature + + diff --git a/plugins/hypervisors/kvm/.pydevproject b/plugins/hypervisors/kvm/.pydevproject new file mode 100644 index 00000000000..a9cca037b33 --- /dev/null +++ b/plugins/hypervisors/kvm/.pydevproject @@ -0,0 +1,7 @@ + + + + +Default +python 2.7 + diff --git a/plugins/hypervisors/kvm/build.xml b/plugins/hypervisors/kvm/build.xml new file mode 100755 index 00000000000..9a572496fc3 --- /dev/null +++ b/plugins/hypervisors/kvm/build.xml @@ -0,0 +1,137 @@ + + + + + + + Cloud Stack ant build file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/agent/src/com/cloud/agent/resource/computing/FakeComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/FakeComputingResource.java similarity index 99% rename from agent/src/com/cloud/agent/resource/computing/FakeComputingResource.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/FakeComputingResource.java index abfa4787a51..83f69768495 100644 --- a/agent/src/com/cloud/agent/resource/computing/FakeComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/FakeComputingResource.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.io.File; import java.io.FileInputStream; @@ -97,7 +97,6 @@ import com.cloud.resource.ServerResourceBase; import com.cloud.storage.Storage; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.Volume; -import com.cloud.storage.VolumeVO; import com.cloud.storage.template.TemplateInfo; import com.cloud.utils.PropertiesUtil; import com.cloud.utils.exception.CloudRuntimeException; diff --git a/agent/src/com/cloud/agent/resource/computing/KVMGuestOsMapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java similarity index 99% rename from agent/src/com/cloud/agent/resource/computing/KVMGuestOsMapper.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java index 22f3935c59c..e3615ad9dfd 100644 --- a/agent/src/com/cloud/agent/resource/computing/KVMGuestOsMapper.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMGuestOsMapper.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.util.HashMap; import java.util.Map; diff --git a/agent/src/com/cloud/agent/resource/computing/KVMHABase.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHABase.java similarity index 99% rename from agent/src/com/cloud/agent/resource/computing/KVMHABase.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHABase.java index ed29a627468..2cb60d74907 100644 --- a/agent/src/com/cloud/agent/resource/computing/KVMHABase.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHABase.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.io.File; import java.util.concurrent.Callable; @@ -23,7 +23,6 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; -import org.libvirt.Connect; import org.libvirt.LibvirtException; import org.libvirt.StoragePool; import org.libvirt.StoragePoolInfo; diff --git a/agent/src/com/cloud/agent/resource/computing/KVMHAChecker.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAChecker.java similarity index 97% rename from agent/src/com/cloud/agent/resource/computing/KVMHAChecker.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAChecker.java index f5b8a32bcee..68deca0d464 100644 --- a/agent/src/com/cloud/agent/resource/computing/KVMHAChecker.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAChecker.java @@ -14,14 +14,13 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import org.apache.log4j.Logger; -import org.libvirt.Connect; import com.cloud.utils.script.OutputInterpreter; import com.cloud.utils.script.Script; diff --git a/agent/src/com/cloud/agent/resource/computing/KVMHAMonitor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java similarity index 98% rename from agent/src/com/cloud/agent/resource/computing/KVMHAMonitor.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java index 09d5c83928f..c4e121b8ae8 100644 --- a/agent/src/com/cloud/agent/resource/computing/KVMHAMonitor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.util.ArrayList; import java.util.List; diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtCapXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtCapXMLParser.java similarity index 99% rename from agent/src/com/cloud/agent/resource/computing/LibvirtCapXMLParser.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtCapXMLParser.java index 4c5fa29485c..704af23b703 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtCapXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtCapXMLParser.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.io.IOException; import java.io.StringReader; diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java similarity index 98% rename from agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 3fcce795ae2..643a4e83f38 100755 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.io.BufferedReader; import java.io.File; @@ -153,26 +153,26 @@ import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.StorageFilerTO; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.agent.api.to.VolumeTO; -import com.cloud.agent.resource.computing.KVMHABase.NfsStoragePool; -import com.cloud.agent.resource.computing.LibvirtVMDef.ConsoleDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.DevicesDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.DiskDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.DiskDef.diskProtocol; -import com.cloud.agent.resource.computing.LibvirtVMDef.FeaturesDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.GraphicDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.GuestDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.GuestResourceDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.InputDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.InterfaceDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.InterfaceDef.hostNicType; -import com.cloud.agent.resource.computing.LibvirtVMDef.SerialDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.TermPolicy; -import com.cloud.agent.resource.computing.LibvirtVMDef.ClockDef; +import com.cloud.hypervisor.kvm.resource.KVMHABase.NfsStoragePool; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ConsoleDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DevicesDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef.diskProtocol; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.FeaturesDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GraphicDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GuestDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.GuestResourceDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InputDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.hostNicType; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ClockDef; import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource; -import com.cloud.agent.storage.KVMPhysicalDisk; -import com.cloud.agent.storage.KVMPhysicalDisk.PhysicalDiskFormat; -import com.cloud.agent.storage.KVMStoragePool; -import com.cloud.agent.storage.KVMStoragePoolManager; +import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk; +import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat; +import com.cloud.hypervisor.kvm.storage.KVMStoragePool; +import com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager; import com.cloud.dc.Vlan; import com.cloud.exception.InternalErrorException; import com.cloud.host.Host.Type; diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtConnection.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java similarity index 97% rename from agent/src/com/cloud/agent/resource/computing/LibvirtConnection.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java index d3a231871bb..981d343004d 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtConnection.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtConnection.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import org.apache.log4j.Logger; import org.libvirt.Connect; diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtDomainXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java similarity index 96% rename from agent/src/com/cloud/agent/resource/computing/LibvirtDomainXMLParser.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java index 62155349b66..55fbfaa4fdc 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtDomainXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtDomainXMLParser.java @@ -14,14 +14,12 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; -import java.util.SortedMap; -import java.util.TreeMap; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -32,13 +30,12 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; -import org.xml.sax.Attributes; import org.xml.sax.InputSource; import org.xml.sax.SAXException; -import com.cloud.agent.resource.computing.LibvirtVMDef.DiskDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.InterfaceDef; -import com.cloud.agent.resource.computing.LibvirtVMDef.InterfaceDef.nicModel; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DiskDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.nicModel; /** * @author chiradeep diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtNetworkDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtNetworkDef.java similarity index 99% rename from agent/src/com/cloud/agent/resource/computing/LibvirtNetworkDef.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtNetworkDef.java index 7f757dec967..6df3bd1e962 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtNetworkDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtNetworkDef.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.util.ArrayList; import java.util.List; diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtSecretDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtSecretDef.java similarity index 98% rename from agent/src/com/cloud/agent/resource/computing/LibvirtSecretDef.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtSecretDef.java index f7e10c38ddf..454dbf31cf5 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtSecretDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtSecretDef.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; public class LibvirtSecretDef { diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java similarity index 99% rename from agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolDef.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java index 9c285284563..e181ceac5a3 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolDef.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; public class LibvirtStoragePoolDef { public enum poolType { diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java similarity index 99% rename from agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolXMLParser.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java index cff4c2b74aa..a349d5edf8c 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtStoragePoolXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStoragePoolXMLParser.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.io.IOException; import java.io.StringReader; diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeDef.java similarity index 98% rename from agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeDef.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeDef.java index ef8e22e6008..d5cd91a954c 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeDef.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; public class LibvirtStorageVolumeDef { public enum volFormat { diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java similarity index 98% rename from agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeXMLParser.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java index 163ca2b19db..3a4d94bdc58 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtStorageVolumeXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtStorageVolumeXMLParser.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.io.IOException; import java.io.StringReader; diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java similarity index 99% rename from agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java index 3b07bcd16b7..998f39372a9 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtVMDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java @@ -14,10 +14,9 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/agent/src/com/cloud/agent/resource/computing/LibvirtXMLParser.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtXMLParser.java similarity index 97% rename from agent/src/com/cloud/agent/resource/computing/LibvirtXMLParser.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtXMLParser.java index b73ea0f0c3f..3a614037d85 100644 --- a/agent/src/com/cloud/agent/resource/computing/LibvirtXMLParser.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtXMLParser.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.resource.computing; +package com.cloud.hypervisor.kvm.resource; import java.io.IOException; import java.io.StringReader; diff --git a/agent/src/com/cloud/agent/storage/KVMPhysicalDisk.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java similarity index 98% rename from agent/src/com/cloud/agent/storage/KVMPhysicalDisk.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java index cb790d94620..08f51a494fa 100644 --- a/agent/src/com/cloud/agent/storage/KVMPhysicalDisk.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMPhysicalDisk.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.storage; +package com.cloud.hypervisor.kvm.storage; public class KVMPhysicalDisk { private String path; diff --git a/agent/src/com/cloud/agent/storage/KVMStoragePool.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePool.java similarity index 93% rename from agent/src/com/cloud/agent/storage/KVMStoragePool.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePool.java index f1192ede940..5437e7c69b0 100644 --- a/agent/src/com/cloud/agent/storage/KVMStoragePool.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePool.java @@ -14,11 +14,11 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.storage; +package com.cloud.hypervisor.kvm.storage; import java.util.List; -import com.cloud.agent.storage.KVMPhysicalDisk.PhysicalDiskFormat; +import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat; import com.cloud.storage.Storage.StoragePoolType; public interface KVMStoragePool { diff --git a/agent/src/com/cloud/agent/storage/KVMStoragePoolManager.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java similarity index 93% rename from agent/src/com/cloud/agent/storage/KVMStoragePoolManager.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java index a82318d2c2d..491f7724ea3 100644 --- a/agent/src/com/cloud/agent/storage/KVMStoragePoolManager.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java @@ -14,15 +14,15 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.storage; +package com.cloud.hypervisor.kvm.storage; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import com.cloud.agent.resource.computing.KVMHABase; -import com.cloud.agent.resource.computing.KVMHABase.PoolType; -import com.cloud.agent.resource.computing.KVMHAMonitor; -import com.cloud.agent.storage.KVMPhysicalDisk.PhysicalDiskFormat; +import com.cloud.hypervisor.kvm.resource.KVMHABase; +import com.cloud.hypervisor.kvm.resource.KVMHABase.PoolType; +import com.cloud.hypervisor.kvm.resource.KVMHAMonitor; +import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.StorageLayer; diff --git a/agent/src/com/cloud/agent/storage/KVMVirtualDisk.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMVirtualDisk.java similarity index 95% rename from agent/src/com/cloud/agent/storage/KVMVirtualDisk.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMVirtualDisk.java index c454b12f853..d773cf4650b 100644 --- a/agent/src/com/cloud/agent/storage/KVMVirtualDisk.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMVirtualDisk.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.storage; +package com.cloud.hypervisor.kvm.storage; public class KVMVirtualDisk { diff --git a/agent/src/com/cloud/agent/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java similarity index 97% rename from agent/src/com/cloud/agent/storage/LibvirtStorageAdaptor.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java index da000aaff19..90003f9cc2b 100644 --- a/agent/src/com/cloud/agent/storage/LibvirtStorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.storage; +package com.cloud.hypervisor.kvm.storage; import java.io.File; import java.net.URI; @@ -33,17 +33,17 @@ import org.libvirt.StorageVol; import org.libvirt.StoragePoolInfo.StoragePoolState; import com.cloud.agent.api.ManageSnapshotCommand; -import com.cloud.agent.resource.computing.LibvirtConnection; -import com.cloud.agent.resource.computing.LibvirtSecretDef; -import com.cloud.agent.resource.computing.LibvirtSecretDef.usage; -import com.cloud.agent.resource.computing.LibvirtStoragePoolDef; -import com.cloud.agent.resource.computing.LibvirtStoragePoolXMLParser; -import com.cloud.agent.resource.computing.LibvirtStorageVolumeDef; -import com.cloud.agent.resource.computing.LibvirtStoragePoolDef.poolType; -import com.cloud.agent.resource.computing.LibvirtStoragePoolDef.authType; -import com.cloud.agent.resource.computing.LibvirtStorageVolumeDef.volFormat; -import com.cloud.agent.resource.computing.LibvirtStorageVolumeXMLParser; -import com.cloud.agent.storage.KVMPhysicalDisk.PhysicalDiskFormat; +import com.cloud.hypervisor.kvm.resource.LibvirtConnection; +import com.cloud.hypervisor.kvm.resource.LibvirtSecretDef; +import com.cloud.hypervisor.kvm.resource.LibvirtSecretDef.usage; +import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef; +import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolXMLParser; +import com.cloud.hypervisor.kvm.resource.LibvirtStorageVolumeDef; +import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.poolType; +import com.cloud.hypervisor.kvm.resource.LibvirtStoragePoolDef.authType; +import com.cloud.hypervisor.kvm.resource.LibvirtStorageVolumeDef.volFormat; +import com.cloud.hypervisor.kvm.resource.LibvirtStorageVolumeXMLParser; +import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat; import com.cloud.exception.InternalErrorException; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.StorageLayer; diff --git a/agent/src/com/cloud/agent/storage/LibvirtStoragePool.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java similarity index 97% rename from agent/src/com/cloud/agent/storage/LibvirtStoragePool.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java index 943b8b268fd..bc428e1273c 100644 --- a/agent/src/com/cloud/agent/storage/LibvirtStoragePool.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStoragePool.java @@ -14,13 +14,13 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.storage; +package com.cloud.hypervisor.kvm.storage; import java.util.List; import org.libvirt.StoragePool; -import com.cloud.agent.storage.KVMPhysicalDisk.PhysicalDiskFormat; +import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat; import com.cloud.storage.Storage.StoragePoolType; public class LibvirtStoragePool implements KVMStoragePool { diff --git a/agent/src/com/cloud/agent/storage/StorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/StorageAdaptor.java similarity index 94% rename from agent/src/com/cloud/agent/storage/StorageAdaptor.java rename to plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/StorageAdaptor.java index 82386772ba4..be6c5c0bda2 100644 --- a/agent/src/com/cloud/agent/storage/StorageAdaptor.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/StorageAdaptor.java @@ -14,13 +14,11 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.agent.storage; +package com.cloud.hypervisor.kvm.storage; import java.util.List; -import org.libvirt.StoragePool; - -import com.cloud.agent.storage.KVMPhysicalDisk.PhysicalDiskFormat; +import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat; import com.cloud.storage.Storage.StoragePoolType; public interface StorageAdaptor { diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java index ba4b9614520..ff9d020d7f3 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java @@ -90,7 +90,7 @@ import com.cloud.vm.VirtualMachineProfile; import com.cloud.vm.dao.NicDao; @Local(value = NetworkElement.class) -public class NiciraNvpElement extends AdapterBase implements NetworkElement, NiciraNvpElementService, ResourceStateAdapter { +public class NiciraNvpElement extends AdapterBase implements ConnectivityProvider, NiciraNvpElementService, ResourceStateAdapter { private static final Logger s_logger = Logger.getLogger(NiciraNvpElement.class); private static final Map> capabilities = setCapabilities(); diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java index 3bac88b6b97..6cafe36b655 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java @@ -160,9 +160,9 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { } // Name is either the given name or the uuid - String name = implemented.getName(); + String name = network.getName(); if (name == null || name.isEmpty()) { - name = implemented.getUuid(); + name = ((NetworkVO)network).getUuid(); } if (name.length() > 40 ) { name = name.substring(0, 39); // max length 40 @@ -179,7 +179,7 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { String transportzoneuuid = niciraNvpHost.getDetail("transportzoneuuid"); String transportzoneisotype = niciraNvpHost.getDetail("transportzoneisotype"); - CreateLogicalSwitchCommand cmd = new CreateLogicalSwitchCommand(transportzoneuuid, transportzoneisotype, network.getName(), + CreateLogicalSwitchCommand cmd = new CreateLogicalSwitchCommand(transportzoneuuid, transportzoneisotype, name, context.getDomain().getName() + "-" + context.getAccount().getAccountName()); CreateLogicalSwitchAnswer answer = (CreateLogicalSwitchAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); 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 ae7b37e6edb..69fd26f0d86 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 @@ -170,7 +170,7 @@ public class NiciraNvpResource implements ServerResource { private Answer executeRequest(CreateLogicalSwitchCommand cmd) { LogicalSwitch logicalSwitch = new LogicalSwitch(); - logicalSwitch.setDisplay_name("lswitch-" + cmd.getOwnerName()); + logicalSwitch.setDisplay_name("lswitch-" + cmd.getName()); logicalSwitch.setPort_isolation_enabled(false); // Set transport binding diff --git a/python/lib/cloudutils/serviceConfig.py b/python/lib/cloudutils/serviceConfig.py index 539e26ae732..b4ada22dff2 100755 --- a/python/lib/cloudutils/serviceConfig.py +++ b/python/lib/cloudutils/serviceConfig.py @@ -8,7 +8,7 @@ # 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. -# +# # Automatically generated by addcopyright.py at 04/03/2012 from utilities import writeProgressBar, bash from cloudException import CloudRuntimeException, CloudInternalException, formatExceptionInfo @@ -26,7 +26,7 @@ class serviceCfgBase(object): self.cfoHandlers = [] self.syscfg = syscfg self.netMgrRunning = False - + def configration(self): writeProgressBar("Configure " + self.serviceName + " ...", None) result = False @@ -34,7 +34,7 @@ class serviceCfgBase(object): result = self.config() if result is None: result = False - + self.status = result writeProgressBar(None, result) return result @@ -53,29 +53,29 @@ class serviceCfgBase(object): raise CloudRuntimeException("Configure %s failed, Please check the /var/log/cloud/setupManagement.log for detail"%self.serviceName) else: raise CloudRuntimeException("Configure %s failed, Please check the /var/log/cloud/setupAgent.log for detail"%self.serviceName) - + def backup(self): if self.status is None: return True - + writeProgressBar("Restore " + self.serviceName + " ...", None) result = False try: for cfo in self.cfoHandlers: cfo.backup() - + result = self.restore() except (CloudRuntimeException, CloudInternalException), e: logging.debug(e) writeProgressBar(None, result) - + def config(self): return True - + def restore(self): return True - + class networkConfigBase: def __init__(self, syscfg): self.netcfg = networkConfig() @@ -93,9 +93,9 @@ class networkConfigBase: if not self.netcfg.isBridge(br): raise CloudInternalException("%s is not a bridge"%br) preCfged = True - + return preCfged - + def cfgNetwork(self, dev=None, brName=None): if dev is None: device = self.netcfg.getDefaultNetwork() @@ -116,7 +116,7 @@ class networkConfigBase: enslavedDev = self.netcfg.getEnslavedDev(device.name, 1) if enslavedDev is None: raise CloudInternalException("Failed to get enslaved devices on bridge:%s"%device.name) - + brDevice = device device = self.netcfg.getDevInfo(enslavedDev) brName = brDevice.name @@ -124,7 +124,7 @@ class networkConfigBase: self.brName = brName self.dev = device.name - + def writeToCfgFile(self): pass @@ -133,7 +133,7 @@ class networkConfigUbuntu(serviceCfgBase, networkConfigBase): super(networkConfigUbuntu, self).__init__(syscfg) networkConfigBase.__init__(self, syscfg) self.netCfgFile = "/etc/network/interfaces" - + def getNetworkMethod(self, line): if line.find("static") != -1: return "static" @@ -142,7 +142,7 @@ class networkConfigUbuntu(serviceCfgBase, networkConfigBase): else: logging.debug("Failed to find the network method from:%s"%line) raise CloudInternalException("Failed to find the network method from /etc/network/interfaces") - + def addBridge(self, br, dev): bash("ifdown %s"%dev.name) for line in file(self.netCfgFile).readlines(): @@ -177,34 +177,34 @@ class networkConfigUbuntu(serviceCfgBase, networkConfigBase): raise CloudInternalException("Missing device configuration, Need to add your network configuration into /etc/network/interfaces at first") else: raise CloudInternalException("Missing bridge/device network configuration, need to add your network configuration into /etc/network/interfaces at first") - + def config(self): try: if super(networkConfigUbuntu, self).isPreConfiged(): return True - + self.netMgrRunning = self.syscfg.svo.isServiceRunning("network-manager") super(networkConfigUbuntu, self).cfgNetwork() if self.netMgrRunning: self.syscfg.svo.stopService("network-manager") self.syscfg.svo.disableService("network-manager") - + if not bash("ifup %s"%self.brName).isSuccess(): raise CloudInternalException("Can't start network:%s"%self.brName, bash.getErrMsg(self)) - + self.syscfg.env.nics.append(self.brName) self.syscfg.env.nics.append(self.brName) self.syscfg.env.nics.append(self.brName) return True except: raise - + def restore(self): try: if self.netMgrRunning: self.syscfg.svo.enableService("network-manager") self.syscfg.svo.startService("network-manager") - + bash("/etc/init.d/networking stop") bash("/etc/init.d/networking start") return True @@ -216,11 +216,11 @@ class networkConfigRedhat(serviceCfgBase, networkConfigBase): def __init__(self, syscfg): super(networkConfigRedhat, self).__init__(syscfg) networkConfigBase.__init__(self, syscfg) - + def writeToCfgFile(self, brName, dev): self.devCfgFile = "/etc/sysconfig/network-scripts/ifcfg-%s"%dev.name self.brCfgFile = "/etc/sysconfig/network-scripts/ifcfg-%s"%brName - + isDevExist = os.path.exists(self.devCfgFile) isBrExist = os.path.exists(self.brCfgFile) if isDevExist and isBrExist: @@ -234,35 +234,35 @@ class networkConfigRedhat(serviceCfgBase, networkConfigBase): raise CloudInternalException("Missing device configuration, Need to add your network configuration into /etc/sysconfig/network-scripts at first") else: raise CloudInternalException("Missing bridge/device network configuration, need to add your network configuration into /etc/sysconfig/network-scripts at first") - - + + def addBridge(self, brName, dev): bash("ifdown %s"%dev.name) - + if not os.path.exists(self.brCfgFile): shutil.copy(self.devCfgFile, self.brCfgFile) - + #config device file at first: disable nm, set onboot=yes if not cfo = configFileOps(self.devCfgFile, self) cfo.addEntry("NM_CONTROLLED", "no") cfo.addEntry("ONBOOT", "yes") cfo.addEntry("BRIDGE", brName) cfo.save() - + cfo = configFileOps(self.brCfgFile, self) cfo.addEntry("NM_CONTROLLED", "no") cfo.addEntry("ONBOOT", "yes") cfo.addEntry("DEVICE", brName) cfo.addEntry("TYPE", "Bridge") cfo.save() - + def config(self): try: if super(networkConfigRedhat, self).isPreConfiged(): return True - + super(networkConfigRedhat, self).cfgNetwork() - + self.netMgrRunning = self.syscfg.svo.isServiceRunning("NetworkManager") if self.netMgrRunning: self.syscfg.svo.stopService("NetworkManager") @@ -274,14 +274,14 @@ class networkConfigRedhat(serviceCfgBase, networkConfigBase): if not bash("service network restart").isSuccess(): raise CloudInternalException("Can't restart network") - + self.syscfg.env.nics.append(self.brName) self.syscfg.env.nics.append(self.brName) self.syscfg.env.nics.append(self.brName) return True except: raise - + def restore(self): try: if self.netMgrRunning: @@ -292,12 +292,12 @@ class networkConfigRedhat(serviceCfgBase, networkConfigBase): except: logging.debug(formatExceptionInfo()) return False - + class cgroupConfig(serviceCfgBase): def __init__(self, syscfg): super(cgroupConfig, self).__init__(syscfg) self.serviceName = "Cgroup" - + def config(self): try: cfo = configFileOps("/etc/cgconfig.conf", self) @@ -314,14 +314,14 @@ class cgroupConfig(serviceCfgBase): cfo = configFileOps("/etc/cgrules.conf", self) cfgline = "root:/usr/sbin/libvirtd cpu virt/\n" cfo.add_lines(cfgline) - + self.syscfg.svo.stopService("cgred", True) if not self.syscfg.svo.enableService("cgred"): return False return True except: raise - + def restore(self): try: self.syscfg.svo.stopService("cgconfig") @@ -332,7 +332,7 @@ class cgroupConfig(serviceCfgBase): except: logging.debug(formatExceptionInfo()) return False - + class nfsConfig(serviceCfgBase): def __init__(self, syscfg): super(nfsConfig, self).__init__(syscfg) @@ -342,24 +342,24 @@ class nfsConfig(serviceCfgBase): try: if not os.path.exists("/etc/nfsmount.conf"): return True - + cfo = configFileOps("/etc/nfsmount.conf") cfo.addEntry("AC", "False") cfo.save() - + self.syscfg.svo.enableService("rpcbind") self.syscfg.svo.stopService("rpcbind") self.syscfg.svo.startService("rpcbind") - + self.syscfg.svo.enableService("nfs") self.syscfg.svo.stopService("nfs") self.syscfg.svo.startService("nfs") - + return True except: logging.debug(formatExceptionInfo()) return False - + class securityPolicyConfigUbuntu(serviceCfgBase): def __init__(self, syscfg): super(securityPolicyConfigUbuntu, self).__init__(syscfg) @@ -371,7 +371,7 @@ class securityPolicyConfigUbuntu(serviceCfgBase): if not cmd.isSuccess() or cmd.getStdout() == "": self.spRunning = False return True - + if not bash("apparmor_status |grep libvirt").isSuccess(): return True @@ -384,7 +384,7 @@ class securityPolicyConfigUbuntu(serviceCfgBase): except: raise CloudRuntimeException("Failed to configure apparmor, please see the /var/log/cloud/setupAgent.log for detail, \ or you can manually disable it before starting myCloud") - + def restore(self): try: self.syscfg.svo.enableService("apparmor") @@ -393,7 +393,7 @@ class securityPolicyConfigUbuntu(serviceCfgBase): except: logging.debug(formatExceptionInfo()) return False - + class securityPolicyConfigRedhat(serviceCfgBase): def __init__(self, syscfg): super(securityPolicyConfigRedhat, self).__init__(syscfg) @@ -401,10 +401,10 @@ class securityPolicyConfigRedhat(serviceCfgBase): def config(self): selinuxEnabled = True - + if not bash("selinuxenabled").isSuccess(): selinuxEnabled = False - + if selinuxEnabled: try: bash("setenforce 0") @@ -416,7 +416,7 @@ class securityPolicyConfigRedhat(serviceCfgBase): or you can manually disable it before starting myCloud") else: return True - + def restore(self): try: bash("setenforce 1") @@ -429,7 +429,7 @@ class libvirtConfigRedhat(serviceCfgBase): def __init__(self, syscfg): super(libvirtConfigRedhat, self).__init__(syscfg) self.serviceName = "Libvirt" - + def config(self): try: cfo = configFileOps("/etc/libvirt/libvirtd.conf", self) @@ -438,14 +438,14 @@ class libvirtConfigRedhat(serviceCfgBase): cfo.addEntry("auth_tcp", "\"none\"") cfo.addEntry("listen_tls", "0") cfo.save() - + cfo = configFileOps("/etc/sysconfig/libvirtd", self) cfo.addEntry("export CGROUP_DAEMON", "'cpu:/virt'") cfo.addEntry("LIBVIRTD_ARGS", "-l") cfo.save() - + filename = "/etc/libvirt/qemu.conf" - + cfo = configFileOps(filename, self) cfo.addEntry("cgroup_controllers", "[\"cpu\"]") cfo.addEntry("security_driver", "\"none\"") @@ -453,23 +453,23 @@ class libvirtConfigRedhat(serviceCfgBase): cfo.addEntry("group", "\"root\"") cfo.addEntry("vnc_listen", "\"0.0.0.0\"") cfo.save() - + self.syscfg.svo.stopService("libvirtd") if not self.syscfg.svo.startService("libvirtd"): return False - + return True except: raise - + def restore(self): pass - + class libvirtConfigUbuntu(serviceCfgBase): def __init__(self, syscfg): super(libvirtConfigUbuntu, self).__init__(syscfg) self.serviceName = "Libvirt" - + def setupLiveMigration(self): cfo = configFileOps("/etc/libvirt/libvirtd.conf", self) cfo.addEntry("listen_tcp", "1") @@ -477,20 +477,20 @@ class libvirtConfigUbuntu(serviceCfgBase): cfo.addEntry("auth_tcp", "\"none\""); cfo.addEntry("listen_tls", "0") cfo.save() - + if os.path.exists("/etc/init/libvirt-bin.conf"): cfo = configFileOps("/etc/init/libvirt-bin.conf", self) cfo.replace_line("exec /usr/sbin/libvirtd","exec /usr/sbin/libvirtd -d -l") else: cfo = configFileOps("/etc/default/libvirt-bin", self) cfo.replace_or_add_line("libvirtd_opts=","libvirtd_opts='-l -d'") - + def config(self): try: self.setupLiveMigration() - + filename = "/etc/libvirt/qemu.conf" - + cfo = configFileOps(filename, self) cfo.addEntry("security_driver", "\"none\"") cfo.addEntry("user", "\"root\"") @@ -511,12 +511,12 @@ class libvirtConfigUbuntu(serviceCfgBase): except: logging.debug(formatExceptionInfo()) return False - + class firewallConfigUbuntu(serviceCfgBase): def __init__(self, syscfg): super(firewallConfigUbuntu, self).__init__(syscfg) self.serviceName = "Firewall" - + def config(self): try: ports = "22 1798 16509".split() @@ -529,43 +529,43 @@ class firewallConfigUbuntu(serviceCfgBase): return True except: raise - + def restore(self): return True - + class firewallConfigBase(serviceCfgBase): def __init__(self, syscfg): super(firewallConfigBase, self).__init__(syscfg) - self.serviceName = "Firewall" + self.serviceName = "Firewall" self.rules = [] - + def allowPort(self, port): status = False try: status = bash("iptables-save|grep INPUT|grep -w %s"%port).isSuccess() except: pass - - if not status: + + if not status: redo = False result = True try: result = bash("iptables -I INPUT -p tcp -m tcp --dport %s -j ACCEPT"%port).isSuccess() except: redo = True - + if not result or redo: bash("sleep 30") bash("iptables -I INPUT -p tcp -m tcp --dport %s -j ACCEPT"%port) - + def config(self): try: for port in self.ports: self.allowPort(port) - + for rule in self.rules: bash("iptables " + rule) - + bash("iptables-save > /etc/sysconfig/iptables") self.syscfg.svo.stopService("iptables") self.syscfg.svo.startService("iptables") @@ -575,7 +575,7 @@ class firewallConfigBase(serviceCfgBase): def restore(self): return True - + class firewallConfigAgent(firewallConfigBase): def __init__(self, syscfg): super(firewallConfigAgent, self).__init__(syscfg) @@ -595,10 +595,10 @@ class cloudAgentConfig(serviceCfgBase): self.serviceName = "myCloud" elif syscfg.env.agentMode == "Console": self.serviceName = "Console Proxy" - + def configMyCloud(self): try: - cfo = configFileOps("/etc/cloud/agent/agent.properties", self) + cfo = configFileOps("/etc/cloud/agent/agent.properties", self) cfo.addEntry("host", self.syscfg.env.mgtSvr) cfo.addEntry("zone", self.syscfg.env.zone) cfo.addEntry("port", "443") @@ -611,16 +611,16 @@ class cloudAgentConfig(serviceCfgBase): cfo.addEntry("mount.path", "/mnt") cfo.addEntry("resource", "com.cloud.storage.resource.LocalSecondaryStorageResource|com.cloud.agent.resource.computing.CloudZonesComputingResource") cfo.save() - + #self.syscfg.svo.stopService("cloud-agent") #self.syscfg.svo.enableService("cloud-agent") return True except: raise - + def configAgent(self): try: - cfo = configFileOps("/etc/cloud/agent/agent.properties", self) + cfo = configFileOps("/etc/cloud/agent/agent.properties", self) cfo.addEntry("host", self.syscfg.env.mgtSvr) cfo.addEntry("zone", self.syscfg.env.zone) cfo.addEntry("pod", self.syscfg.env.pod) @@ -632,19 +632,19 @@ class cloudAgentConfig(serviceCfgBase): cfo.addEntry("guid", str(self.syscfg.env.uuid)) if cfo.getEntry("local.storage.uuid") == "": cfo.addEntry("local.storage.uuid", str(bash("uuidgen").getStdout())) - cfo.addEntry("resource", "com.cloud.agent.resource.computing.LibvirtComputingResource") + cfo.addEntry("resource", "com.cloud.hypervisor.kvm.resource.LibvirtComputingResource") cfo.save() - + self.syscfg.svo.stopService("cloud-agent") bash("sleep 30") self.syscfg.svo.enableService("cloud-agent") return True except: raise - + def configConsole(self): try: - cfo = configFileOps("/etc/cloud/agent/agent.properties", self) + cfo = configFileOps("/etc/cloud/agent/agent.properties", self) cfo.addEntry("host", self.syscfg.env.mgtSvr) cfo.addEntry("zone", self.syscfg.env.zone) cfo.addEntry("pod", self.syscfg.env.pod) @@ -656,13 +656,13 @@ class cloudAgentConfig(serviceCfgBase): cfo.addEntry("guid", str(self.syscfg.env.uuid)) cfo.addEntry("resource", "com.cloud.agent.resource.computing.consoleProxyResource") cfo.save() - + self.syscfg.svo.stopService("cloud-agent") self.syscfg.svo.enableService("cloud-agent") return True except: raise - + def config(self): if self.syscfg.env.agentMode == "Agent": return self.configAgent() @@ -670,7 +670,7 @@ class cloudAgentConfig(serviceCfgBase): return self.configMyCloud() elif self.syscfg.env.agentMode == "console": return self.configConsole() - + def restore(self): return True @@ -688,10 +688,10 @@ class sudoersConfig(serviceCfgBase): return True except: raise - + def restore(self): return True - + class firewallConfigServer(firewallConfigBase): def __init__(self, syscfg): super(firewallConfigServer, self).__init__(syscfg) @@ -708,18 +708,18 @@ class ubuntuFirewallConfigServer(firewallConfigServer): status = bash("iptables-save|grep INPUT|grep -w %s"%port).isSuccess() except: pass - - if not status: + + if not status: bash("ufw allow %s/tcp"%port) - + def config(self): try: for port in self.ports: self.allowPort(port) - - #FIXME: urgly make /root writable + + #FIXME: urgly make /root writable bash("sudo chmod 0777 /root") - + return True except: raise diff --git a/scripts/vm/hypervisor/xenserver/setupxenserver.sh b/scripts/vm/hypervisor/xenserver/setupxenserver.sh index d3ade09c757..57456b3926c 100755 --- a/scripts/vm/hypervisor/xenserver/setupxenserver.sh +++ b/scripts/vm/hypervisor/xenserver/setupxenserver.sh @@ -23,6 +23,20 @@ usage() { } +if [ ! -f "/etc/modprobe.d/disable-ipv6" ] ; then + # disable IPv6 until reboot + if [ -d "/proc/sys/net/ipv6/conf/all" ] ; then + /sbin/sysctl -w net.ipv6.conf.all.forwarding=0 + /sbin/sysctl -w net.ipv6.conf.all.accept_ra=0 + /sbin/sysctl -w net.ipv6.conf.all.accept_redirects=0 + /sbin/sysctl -w net.ipv6.conf.all.autoconf=0 + /sbin/sysctl -w net.ipv6.conf.all.disable_ipv6=1 + fi + + # reinstate the disable-ipv6 file + echo "alias ipv6 no" > /etc/modprobe.d/disable-ipv6 + echo "alias net-pf-10 off" >> /etc/modprobe.d/disable-ipv6 +fi #removing iptables entry for vnc ports iptables -D RH-Firewall-1-INPUT -p tcp -m tcp --dport 5900:6099 -j ACCEPT 2>&1 diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java index 844c8b9c59f..62e8acb0642 100755 --- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -88,7 +88,7 @@ import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostTagsDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.HypervisorGuruManager; -import com.cloud.hypervisor.kvm.resource.KvmDummyResourceBase; +import com.cloud.hypervisor.kvm.discoverer.KvmDummyResourceBase; import com.cloud.network.dao.IPAddressDao; import com.cloud.resource.Discoverer; import com.cloud.resource.ResourceManager; diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java index 2b97d03d903..4f9f529cd86 100755 --- a/server/src/com/cloud/api/ApiResponseHelper.java +++ b/server/src/com/cloud/api/ApiResponseHelper.java @@ -1578,6 +1578,7 @@ public class ApiResponseHelper implements ResponseGenerator { nicResponse.setGateway(singleNicProfile.getGateway()); nicResponse.setNetmask(singleNicProfile.getNetmask()); nicResponse.setNetworkid(singleNicProfile.getNetworkId()); + nicResponse.setNetworkName(ApiDBUtils.findNetworkById(singleNicProfile.getNetworkId()).getName()); if (acct.getType() == Account.ACCOUNT_TYPE_ADMIN) { if (singleNicProfile.getBroadCastUri() != null) { nicResponse.setBroadcastUri(singleNicProfile.getBroadCastUri().toString()); diff --git a/server/src/com/cloud/baremetal/BareMetalResourceBase.java b/server/src/com/cloud/baremetal/BareMetalResourceBase.java index 24f80026bbf..8c14ccecf2e 100755 --- a/server/src/com/cloud/baremetal/BareMetalResourceBase.java +++ b/server/src/com/cloud/baremetal/BareMetalResourceBase.java @@ -56,7 +56,6 @@ import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.api.ApiConstants; import com.cloud.host.Host.Type; import com.cloud.hypervisor.Hypervisor; -import com.cloud.hypervisor.kvm.resource.KvmDummyResourceBase; import com.cloud.resource.ServerResource; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.OutputInterpreter; diff --git a/core/src/com/cloud/hypervisor/kvm/resource/KvmDummyResourceBase.java b/server/src/com/cloud/hypervisor/kvm/discoverer/KvmDummyResourceBase.java similarity index 97% rename from core/src/com/cloud/hypervisor/kvm/resource/KvmDummyResourceBase.java rename to server/src/com/cloud/hypervisor/kvm/discoverer/KvmDummyResourceBase.java index d49780f60bb..3386ff792bb 100644 --- a/core/src/com/cloud/hypervisor/kvm/resource/KvmDummyResourceBase.java +++ b/server/src/com/cloud/hypervisor/kvm/discoverer/KvmDummyResourceBase.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.hypervisor.kvm.resource; +package com.cloud.hypervisor.kvm.discoverer; import java.util.HashMap; import java.util.Map; @@ -31,7 +31,6 @@ import com.cloud.host.Host.Type; import com.cloud.hypervisor.Hypervisor; import com.cloud.resource.ServerResource; import com.cloud.resource.ServerResourceBase; -import com.cloud.vm.VirtualMachine.State; public class KvmDummyResourceBase extends ServerResourceBase implements ServerResource { private String _zoneId; diff --git a/server/src/com/cloud/hypervisor/kvm/discoverer/KvmServerDiscoverer.java b/server/src/com/cloud/hypervisor/kvm/discoverer/KvmServerDiscoverer.java old mode 100755 new mode 100644 index fa47a20c307..03746e7b35b --- a/server/src/com/cloud/hypervisor/kvm/discoverer/KvmServerDiscoverer.java +++ b/server/src/com/cloud/hypervisor/kvm/discoverer/KvmServerDiscoverer.java @@ -51,11 +51,9 @@ import com.cloud.host.Status; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.hypervisor.kvm.resource.KvmDummyResourceBase; +import com.cloud.hypervisor.kvm.discoverer.KvmDummyResourceBase; import com.cloud.network.NetworkManager; import com.cloud.network.PhysicalNetworkSetupInfo; -import com.cloud.network.PhysicalNetworkVO; -import com.cloud.network.Networks.TrafficType; import com.cloud.resource.Discoverer; import com.cloud.resource.DiscovererBase; import com.cloud.resource.ResourceManager; @@ -66,9 +64,6 @@ import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.component.Inject; import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SSHCmdHelper; -import com.trilead.ssh2.ChannelCondition; -import com.trilead.ssh2.SCPClient; -import com.trilead.ssh2.Session; @Local(value=Discoverer.class) public class KvmServerDiscoverer extends DiscovererBase implements Discoverer, diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index 36db1dcf80c..64031402d1d 100755 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -127,6 +127,7 @@ import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; import com.cloud.network.dao.PhysicalNetworkServiceProviderVO; import com.cloud.network.dao.PhysicalNetworkTrafficTypeDao; import com.cloud.network.dao.PhysicalNetworkTrafficTypeVO; +import com.cloud.network.element.ConnectivityProvider; import com.cloud.network.element.DhcpServiceProvider; import com.cloud.network.element.FirewallServiceProvider; import com.cloud.network.element.IpDeployer; @@ -959,6 +960,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag deployer = ((PortForwardingServiceProvider) element).getIpDeployer(network); } else if (element instanceof RemoteAccessVPNServiceProvider) { deployer = ((RemoteAccessVPNServiceProvider) element).getIpDeployer(network); + } else if (element instanceof ConnectivityProvider) { + // Nothing to do + s_logger.debug("ConnectivityProvider " + element.getClass().getSimpleName() + " has no ip associations"); + continue; } else { throw new CloudRuntimeException("Fail to get ip deployer for element: " + element); } @@ -2970,6 +2975,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag "service disabled are allowed in security group enabled zone"); } } + + //don't allow eip/elb networks in Advance zone + if (ntwkOff.getElasticIp() || ntwkOff.getElasticLb()) { + throw new InvalidParameterValueException("Elastic IP and Elastic LB services are supported in zone of type " + NetworkType.Basic); + } } // VlanId can be specified only when network offering supports it @@ -3273,11 +3283,15 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, permittedAccounts)); - } else if (domainId == null || listAll) { + } else if (domainId == null) { networksToReturn.addAll(listAccountSpecificNetworksByDomainPath( buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path, isRecursive)); + networksToReturn.addAll(listDomainSpecificNetworksByDomainPath( + buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, guestIpType, trafficType, + physicalNetworkId, aclType, skipProjectNetworks, restartRequired, specifyIpRanges, vpcId, tags), searchFilter, path, + isRecursive)); } } else { networksToReturn = _networksDao.search(buildNetworkSearchCriteria(sb, keyword, id, isSystem, zoneId, @@ -3458,6 +3472,22 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag return _networksDao.search(sc, searchFilter); } + private List listDomainSpecificNetworksByDomainPath(SearchCriteria sc, Filter searchFilter, String path, boolean isRecursive) { + SearchCriteria accountSC = _networksDao.createSearchCriteria(); + accountSC.addAnd("aclType", SearchCriteria.Op.EQ, ACLType.Domain.toString()); + + if (path != null) { + if (isRecursive) { + sc.setJoinParameters("domainSearch", "path", path + "%"); + } else { + sc.setJoinParameters("domainSearch", "path", path); + } + } + + sc.addAnd("id", SearchCriteria.Op.SC, accountSC); + return _networksDao.search(sc, searchFilter); + } + @Override @ActionEvent(eventType = EventTypes.EVENT_NETWORK_DELETE, eventDescription = "deleting network", async = true) public boolean deleteNetwork(long networkId) { @@ -3657,7 +3687,10 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag s_logger.debug("Sending destroy to " + element); } - element.destroy(network); + if (!element.destroy(network)) { + success = false; + s_logger.warn("Unable to complete destroy of the network: failed to destroy network element " + element.getName()); + } } catch (ResourceUnavailableException e) { s_logger.warn("Unable to complete destroy of the network due to element: " + element.getName(), e); success = false; @@ -6223,6 +6256,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag success = false; } + //release all static nats for the network + if (!_rulesMgr.applyStaticNatForNetwork(networkId, false, caller, true)) { + s_logger.warn("Failed to disable static nats as part of shutdownNetworkRules for network id " + networkId); + success = false; + } // Get all ip addresses, mark as releasing and release them on the backend Network network = getNetwork(networkId); diff --git a/server/src/com/cloud/network/rules/RulesManager.java b/server/src/com/cloud/network/rules/RulesManager.java index 072cfc9f2d5..4b83e04eb28 100644 --- a/server/src/com/cloud/network/rules/RulesManager.java +++ b/server/src/com/cloud/network/rules/RulesManager.java @@ -78,4 +78,13 @@ public interface RulesManager extends RulesService { boolean disableStaticNat(long ipAddressId, Account caller, long callerUserId, boolean releaseIpIfElastic) throws ResourceUnavailableException; + /** + * @param networkId + * @param continueOnError + * @param caller + * @param forRevoke + * @return + */ + boolean applyStaticNatForNetwork(long networkId, boolean continueOnError, Account caller, boolean forRevoke); + } diff --git a/server/src/com/cloud/network/rules/RulesManagerImpl.java b/server/src/com/cloud/network/rules/RulesManagerImpl.java index 928e6b86542..3e000a35b92 100755 --- a/server/src/com/cloud/network/rules/RulesManagerImpl.java +++ b/server/src/com/cloud/network/rules/RulesManagerImpl.java @@ -1255,15 +1255,60 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager { @Override public boolean applyStaticNatForIp(long sourceIpId, boolean continueOnError, Account caller, boolean forRevoke) { + IpAddress sourceIp = _ipAddressDao.findById(sourceIpId); + + List staticNats = createStaticNatForIp(sourceIp, caller, forRevoke); + + if (staticNats != null && !staticNats.isEmpty()) { + try { + if (!_networkMgr.applyStaticNats(staticNats, continueOnError)) { + return false; + } + } catch (ResourceUnavailableException ex) { + s_logger.warn("Failed to create static nat rule due to ", ex); + return false; + } + } + + return true; + } + + + @Override + public boolean applyStaticNatForNetwork(long networkId, boolean continueOnError, Account caller, boolean forRevoke) { + List staticNatIps = _ipAddressDao.listStaticNatPublicIps(networkId); List staticNats = new ArrayList(); - IpAddress sourceIp = _ipAddressDao.findById(sourceIpId); + for (IpAddress staticNatIp : staticNatIps) { + staticNats.addAll(createStaticNatForIp(staticNatIp, caller, forRevoke)); + } + + if (staticNats != null && !staticNats.isEmpty()) { + if (forRevoke) { + s_logger.debug("Found " + staticNats.size() + " static nats to disable for network id " + networkId); + } + try { + if (!_networkMgr.applyStaticNats(staticNats, continueOnError)) { + return false; + } + } catch (ResourceUnavailableException ex) { + s_logger.warn("Failed to create static nat rule due to ", ex); + return false; + } + } else { + s_logger.debug("Found 0 static nat rules to apply for network id " + networkId); + } - if (!sourceIp.isOneToOneNat()) { - s_logger.debug("Source ip id=" + sourceIpId + " is not one to one nat"); return true; } + protected List createStaticNatForIp(IpAddress sourceIp, Account caller, boolean forRevoke) { + List staticNats = new ArrayList(); + if (!sourceIp.isOneToOneNat()) { + s_logger.debug("Source ip id=" + sourceIp + " is not one to one nat"); + return staticNats; + } + Long networkId = sourceIp.getAssociatedWithNetworkId(); if (networkId == null) { throw new CloudRuntimeException("Ip address is not associated with any network"); @@ -1292,19 +1337,9 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager { } StaticNatImpl staticNat = new StaticNatImpl(sourceIp.getAllocatedToAccountId(), sourceIp.getAllocatedInDomainId(), - networkId, sourceIpId, dstIp, forRevoke); + networkId, sourceIp.getId(), dstIp, forRevoke); staticNats.add(staticNat); - - try { - if (!_networkMgr.applyStaticNats(staticNats, continueOnError)) { - return false; - } - } catch (ResourceUnavailableException ex) { - s_logger.warn("Failed to create static nat rule due to ", ex); - return false; - } - - return true; + return staticNats; } @Override diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java index 347346203e3..14b5df57a4b 100755 --- a/server/src/com/cloud/resource/ResourceManagerImpl.java +++ b/server/src/com/cloud/resource/ResourceManagerImpl.java @@ -98,7 +98,7 @@ import com.cloud.host.dao.HostDetailsDao; import com.cloud.host.dao.HostTagsDao; import com.cloud.hypervisor.Hypervisor; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.hypervisor.kvm.resource.KvmDummyResourceBase; +import com.cloud.hypervisor.kvm.discoverer.KvmDummyResourceBase; import com.cloud.network.IPAddressVO; import com.cloud.network.dao.IPAddressDao; import com.cloud.org.Cluster; diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 4522557afc5..49121548cf4 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -344,7 +344,8 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager SecurityGroupVMMapDao _securityGroupVMMapDao; @Inject protected ItWorkDao _workDao; - VolumeHostDao _volumeHostDao; + @Inject + protected VolumeHostDao _volumeHostDao; @Inject ResourceTagDao _resourceTagDao; diff --git a/server/test/com/cloud/vm/MockUserVmManagerImpl.java b/server/test/com/cloud/vm/MockUserVmManagerImpl.java index 31065fe48a6..62db70cf203 100644 --- a/server/test/com/cloud/vm/MockUserVmManagerImpl.java +++ b/server/test/com/cloud/vm/MockUserVmManagerImpl.java @@ -417,4 +417,10 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService, Mana return null; } + @Override + public void prepareStop(VirtualMachineProfile profile) { + // TODO Auto-generated method stub + + } + } diff --git a/setup/apidoc/gen_toc.py b/setup/apidoc/gen_toc.py index 09ea0a1a45a..1f7fe36d556 100644 --- a/setup/apidoc/gen_toc.py +++ b/setup/apidoc/gen_toc.py @@ -136,6 +136,7 @@ def choose_category(fn): return v raise Exception('Need to add a category for %s to %s:known_categories' % (fn, __file__)) + sys.exit(1) for f in sys.argv: diff --git a/setup/apidoc/generateadmincommands.xsl b/setup/apidoc/generateadmincommands.xsl index cf617190689..73872a32102 100644 --- a/setup/apidoc/generateadmincommands.xsl +++ b/setup/apidoc/generateadmincommands.xsl @@ -124,23 +124,11 @@ version="1.0"> - - - - -
diff --git a/setup/apidoc/generatecommand.xsl b/setup/apidoc/generatecommand.xsl index ad39788dc28..0d2e8622711 100644 --- a/setup/apidoc/generatecommand.xsl +++ b/setup/apidoc/generatecommand.xsl @@ -161,22 +161,13 @@ version="1.0">
  • Contacts
  • -

    Copyright 2010 CloudStack, Inc. All rights reserved

    +

    Copyright © 2012 The Apache Software Foundation, Licensed under the + Apache License, Version 2.0.
    + Apache and the Apache feather logo are trademarks of The Apache Software Foundation.

    + - - - -
    diff --git a/setup/apidoc/generatedomainadmincommands.xsl b/setup/apidoc/generatedomainadmincommands.xsl index d59f1837962..f7e560c7680 100644 --- a/setup/apidoc/generatedomainadmincommands.xsl +++ b/setup/apidoc/generatedomainadmincommands.xsl @@ -126,23 +126,12 @@ version="1.0"> - - - -
    diff --git a/setup/apidoc/generatetoc_footer.xsl b/setup/apidoc/generatetoc_footer.xsl index fc5bd393706..5bc2cf46659 100644 --- a/setup/apidoc/generatetoc_footer.xsl +++ b/setup/apidoc/generatetoc_footer.xsl @@ -8,22 +8,11 @@ - - - - -
    diff --git a/setup/apidoc/generateusercommands.xsl b/setup/apidoc/generateusercommands.xsl index fff5d826e90..3ec3a62c425 100644 --- a/setup/apidoc/generateusercommands.xsl +++ b/setup/apidoc/generateusercommands.xsl @@ -124,23 +124,12 @@ version="1.0"> - - - -
    diff --git a/setup/db/create-schema.sql b/setup/db/create-schema.sql index ad6ea24ea16..71c2d7518e4 100755 --- a/setup/db/create-schema.sql +++ b/setup/db/create-schema.sql @@ -2010,8 +2010,7 @@ CREATE TABLE `cloud`.`physical_network_service_providers` ( `removed` datetime COMMENT 'date removed if not null', PRIMARY KEY (`id`), CONSTRAINT `fk_pnetwork_service_providers__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE, - CONSTRAINT `uc_service_providers__uuid` UNIQUE (`uuid`), - UNIQUE KEY(`physical_network_id`, `provider_name`) + CONSTRAINT `uc_service_providers__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `cloud`.`external_load_balancer_devices` ( diff --git a/setup/db/db/schema-303to40.sql b/setup/db/db/schema-303to40.sql index 01710b10736..746c4964f0b 100644 --- a/setup/db/db/schema-303to40.sql +++ b/setup/db/db/schema-303to40.sql @@ -19,10 +19,10 @@ -- Schema upgrade from 3.0.3 to 4.0.0; --; -# RBD Primary Storage pool support (commit: 406fd95d87bfcdbb282d65589ab1fb6e9fd0018a) +-- 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`; -# Resource tags (commit: 62d45b9670520a1ee8b520509393d4258c689b50) +-- Resource tags (commit: 62d45b9670520a1ee8b520509393d4258c689b50) CREATE TABLE `cloud`.`resource_tags` ( `id` bigint unsigned NOT NULL auto_increment COMMENT 'id', `uuid` varchar(40), @@ -41,7 +41,7 @@ CREATE TABLE `cloud`.`resource_tags` ( CONSTRAINT `uc_resource_tags__uuid` UNIQUE (`uuid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -# Nicira Integration (commit: 79c7da07abd4294f150851aa0c2d06a28564c5a9) +-- Nicira Integration (commit: 79c7da07abd4294f150851aa0c2d06a28564c5a9) CREATE TABLE `cloud`.`external_nicira_nvp_devices` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id', `uuid` varchar(255) UNIQUE, @@ -61,3 +61,21 @@ CREATE TABLE `cloud`.`nicira_nvp_nic_map` ( `nic` varchar(255) UNIQUE COMMENT 'cloudstack uuid of the nic connected to this logical switch port', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- rrq 5839 +-- 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; + +SET @constraintname = (select CONCAT(CONCAT('DROP INDEX ', A.CONSTRAINT_NAME), ' ON 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'); + +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 + diff --git a/tools/devcloud/vagrant/Vagrantfile b/tools/devcloud/basebuild/Vagrantfile similarity index 66% rename from tools/devcloud/vagrant/Vagrantfile rename to tools/devcloud/basebuild/Vagrantfile index d2a9c9926c7..eee8127cd2f 100644 --- a/tools/devcloud/vagrant/Vagrantfile +++ b/tools/devcloud/basebuild/Vagrantfile @@ -19,13 +19,15 @@ # under the License. Vagrant::Config.run do |config| - config.vm.box = "devcloudbase-ubuntu-12-04-64bit" + config.vm.box = "devcloud" # TODO: Get a URL to host the base image # config.vm.box_url = "http://domain.com/path/to/above.box" + config.vm.guest = :xen + config.ssh.username = "devcloud" # Uncomment this line to enable the console for debugging the # build process. - #config.vm.boot_mode = :gui + config.vm.boot_mode = :gui # Setup port forwarding config.vm.forward_port 22, 2222 @@ -46,27 +48,4 @@ Vagrant::Config.run do |config| puppet.module_path = "puppet-devcloudinitial" end - # Enable provisioning with Puppet stand alone. Puppet manifests - # are contained in a directory path relative to this Vagrantfile. - # You will need to create the manifests directory and a manifest in - # the file my_box.pp in the manifests_path directory. - # - # An example Puppet manifest to provision the message of the day: - # - # # group { "puppet": - # # ensure => "present", - # # } - # # - # # File { owner => 0, group => 0, mode => 0644 } - # # - # # file { '/etc/motd': - # # content => "Welcome to your Vagrant-built virtual machine! - # # Managed by Puppet.\n" - # # } - # - # config.vm.provision :puppet do |puppet| - # puppet.manifests_path = "manifests" - # puppet.manifest_file = "my_box.pp" - # end - end diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/Modulefile b/tools/devcloud/basebuild/puppet-devcloudinitial/Modulefile similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/Modulefile rename to tools/devcloud/basebuild/puppet-devcloudinitial/Modulefile diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/grub b/tools/devcloud/basebuild/puppet-devcloudinitial/files/grub similarity index 98% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/grub rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/grub index 88138000e20..34613daf474 100644 --- a/tools/devcloud/puppet/puppet-devcloudinitial/files/grub +++ b/tools/devcloud/basebuild/puppet-devcloudinitial/files/grub @@ -3,7 +3,7 @@ # For full documentation of the options in this file, see: # info -f grub -n 'Simple configuration' -GRUB_DEFAULT=0 +GRUB_DEFAULT=2 #GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=2 diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/interfaces b/tools/devcloud/basebuild/puppet-devcloudinitial/files/interfaces similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/interfaces rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/interfaces diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/network.conf b/tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/network.conf rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/xen-defaults b/tools/devcloud/basebuild/puppet-devcloudinitial/files/xen-defaults similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/xen-defaults rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/xen-defaults diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/files/xend b/tools/devcloud/basebuild/puppet-devcloudinitial/files/xend similarity index 100% rename from tools/devcloud/puppet/puppet-devcloudinitial/files/xend rename to tools/devcloud/basebuild/puppet-devcloudinitial/files/xend diff --git a/tools/devcloud/basebuild/puppet-devcloudinitial/init.pp b/tools/devcloud/basebuild/puppet-devcloudinitial/init.pp new file mode 100644 index 00000000000..213ef597008 --- /dev/null +++ b/tools/devcloud/basebuild/puppet-devcloudinitial/init.pp @@ -0,0 +1,18 @@ +# 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. + +include puppet-devcloudinitial diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp b/tools/devcloud/basebuild/puppet-devcloudinitial/manifests/init.pp similarity index 67% rename from tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp rename to tools/devcloud/basebuild/puppet-devcloudinitial/manifests/init.pp index 79988c6934b..a3c5c3d8855 100644 --- a/tools/devcloud/puppet/puppet-devcloudinitial/manifests/init.pp +++ b/tools/devcloud/basebuild/puppet-devcloudinitial/manifests/init.pp @@ -1,15 +1,32 @@ +# 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. + class puppet-devcloudinitial { package { 'linux-headers-3.2.0-23-generic': ensure => latest, } - package { 'xen-hypervisor-4.1-amd64': + package { 'xen-hypervisor-4.1-i386': ensure => latest, } package { 'xcp-xapi': - require => Package['xen-hypervisor-4.1-amd64'], + require => Package['xen-hypervisor-4.1-i386'], ensure => latest, } @@ -38,7 +55,7 @@ class puppet-devcloudinitial { } file { '/etc/default/grub': - require => Package['xen-hypervisor-4.1-amd64'], + require => Package['xen-hypervisor-4.1-i386'], ensure => 'file', source => 'puppet:///modules/puppet-devcloudinitial/grub', group => '0', @@ -53,7 +70,7 @@ class puppet-devcloudinitial { } file { '/usr/share/qemu': - require => Package['xen-hypervisor-4.1-amd64'], + require => Package['xen-hypervisor-4.1-i386'], ensure => 'directory', group => '0', mode => '755', @@ -78,7 +95,7 @@ class puppet-devcloudinitial { } file { '/etc/default/xen': - require => Package['xen-hypervisor-4.1-amd64'], + require => Package['xen-hypervisor-4.1-i386'], ensure => 'file', source => 'puppet:///modules/puppet-devcloudinitial/xen-defaults', group => '0', diff --git a/tools/devcloud/devcloudbox/Vagrantfile b/tools/devcloud/devcloudbox/Vagrantfile new file mode 100644 index 00000000000..121a9f58a94 --- /dev/null +++ b/tools/devcloud/devcloudbox/Vagrantfile @@ -0,0 +1,51 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# 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. + +Vagrant::Config.run do |config| + config.vm.box = "devcloud" + # TODO: Get a URL to host the base image + # config.vm.box_url = "http://domain.com/path/to/above.box" + config.vm.guest = :xen + config.ssh.username = "devcloud" + + # Uncomment this line to enable the console for debugging the + # build process. + # config.vm.boot_mode = :gui + + # Setup port forwarding + config.vm.forward_port 22, 2222 + config.vm.forward_port 8080, 8080 + config.vm.forward_port 8443, 8443 + config.vm.forward_port 5901, 5901 + config.vm.forward_port 8787, 8787 + config.vm.forward_port 8250, 8250 + + # Ensure the VM has the right virtual resources + #config.vm. + + config.vm.provision :puppet do |puppet| + puppet.manifests_path = "puppet-devcloud" + puppet.manifest_file = "init.pp" + puppet.with_ssh = true + puppet.pp_path = "/etc/puppet" + puppet.module_path = "puppet-devcloud" + end + +end diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/Modulefile b/tools/devcloud/devcloudbox/puppet-devcloud/Modulefile new file mode 100644 index 00000000000..7da4c4cf590 --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/Modulefile @@ -0,0 +1,8 @@ +name 'puppet-devcloud' +version '0.0.1' +source '' +author 'Apache Software Foundation' +license 'Apache 2.0' +summary 'CloudStack DevCloud configuration module' +description 'Devcloud setup module.' +project_page 'http://cloudstack.org' diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/configebtables.sh b/tools/devcloud/devcloudbox/puppet-devcloud/files/configebtables.sh new file mode 100644 index 00000000000..741884ee665 --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/files/configebtables.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# 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. +mac=`/sbin/ifconfig xenbr0 |/bin/grep HWaddr |/usr/bin/awk '{print $5}'` +/sbin/ebtables -I FORWARD -d ! $mac -i eth0 -p IPV4 --ip-prot udp --ip-dport 67:68 -j DROP +exit 0 diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/configlocalstorage.sh b/tools/devcloud/devcloudbox/puppet-devcloud/files/configlocalstorage.sh new file mode 100644 index 00000000000..ab47d2dad4f --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/files/configlocalstorage.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# 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/xe sr-list | /bin/grep local-storage +rc=$? +if [[ $rc != 0 ]] ; then + hostuuid=`xe host-list |grep uuid|awk '{print $5}'`; + xe sr-create host-uuid=$hostuuid name-label=local-storage shared=false type=file device-config:location=/opt/storage/primary +fi +exit 0 diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/configvnc.sh b/tools/devcloud/devcloudbox/puppet-devcloud/files/configvnc.sh new file mode 100644 index 00000000000..b13a7a307ab --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/files/configvnc.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# 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. + +grep 0.0.0.0 /usr/lib/xcp/lib/vncterm-wrapper +rc=$? +if [[ $rc != 0 ]] ; then + sed -i 's/VNCTERM_LISTEN=.\+/VNCTERM_LISTEN="-v 0.0.0.0:1"/' /usr/lib/xcp/lib/vncterm-wrapper +fi +exit 0 diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/exports b/tools/devcloud/devcloudbox/puppet-devcloud/files/exports new file mode 100644 index 00000000000..55fdcfe9468 --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/files/exports @@ -0,0 +1 @@ +/opt/storage/secondary *(rw,no_subtree_check,no_root_squash,fsid=0) diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save b/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save new file mode 100644 index 00000000000..c556398ca15 --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/files/iptables.save @@ -0,0 +1,17 @@ +# Generated by iptables-save v1.4.12 on Sat Jul 28 03:18:44 2012 +*mangle +:PREROUTING ACCEPT [397:23804] +:INPUT ACCEPT [397:23804] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [238:22820] +:POSTROUTING ACCEPT [238:22820] +-A POSTROUTING -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill +COMMIT +# Completed on Sat Jul 28 03:18:44 2012 +# Generated by iptables-save v1.4.12 on Sat Jul 28 03:18:44 2012 +*filter +:INPUT ACCEPT [453:27164] +:FORWARD ACCEPT [0:0] +:OUTPUT ACCEPT [273:26476] +COMMIT +# Completed on Sat Jul 28 03:18:44 2012 diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/startdevcloud.sh b/tools/devcloud/devcloudbox/puppet-devcloud/files/startdevcloud.sh new file mode 100644 index 00000000000..f496891d40f --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/files/startdevcloud.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +# 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. + +export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32 +cd /opt/cloudstack/incubator-cloudstack/ +nohup ant run > /dev/null 2>&1 & +exit 0 diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/files/updatecode.sh b/tools/devcloud/devcloudbox/puppet-devcloud/files/updatecode.sh new file mode 100644 index 00000000000..15e191aacb9 --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/files/updatecode.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# 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. + +cd /opt/cloudstack +git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git +rc=$? +if [[ $rc != 0 ]] ; then + cd /opt/cloudstack/incubator-cloudstack + git pull origin master +fi +exit 0 diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/init.pp b/tools/devcloud/devcloudbox/puppet-devcloud/init.pp new file mode 100644 index 00000000000..2574392251a --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/init.pp @@ -0,0 +1,18 @@ +# 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. + +include puppet-devcloud diff --git a/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp b/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp new file mode 100644 index 00000000000..b84ec265ddf --- /dev/null +++ b/tools/devcloud/devcloudbox/puppet-devcloud/manifests/init.pp @@ -0,0 +1,320 @@ +# 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. + +class puppet-devcloud { + + package { 'ebtables': + ensure => latest, + } + + service { 'ebtables': + require => Package['ebtables'], + ensure => 'running', + enable => 'true', + } + + package { 'iptables': + ensure => latest, + } + + file { '/etc/iptables.save': + require => Package['iptables'], + ensure => 'file', + source => 'puppet:///modules/puppet-devcloud/iptables.save', + group => '0', + mode => '644', + owner => '0', + } + + file { '/tmp/configebtables.sh': + ensure => 'file', + source => 'puppet:///modules/puppet-devcloud/configebtables.sh', + group => '0', + mode => '777', + owner => '0', + } + + exec { "/tmp/configebtables.sh": + require => [ + File['/tmp/configebtables.sh'], + Service['ebtables'] + ], + subscribe => Package['ebtables'], + refreshonly => true, + cwd => '/', + path => '/sbin/:/usr/bin/:/bin', + } + + package { 'nfs-server': + ensure => latest, + } + + file { '/opt/storage': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + } + + file { '/opt/storage/secondary': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + } + + file { '/opt/storage/secondary/template': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + } + + file { '/opt/storage/secondary/template/tmpl': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + } + + file { '/opt/storage/secondary/template/tmpl/1': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + } + + file { '/opt/storage/secondary/template/tmpl/1/1': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + } + + file { '/opt/storage/secondary/template/tmpl/1/5': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + } + + file { '/etc/exports': + require => Package['nfs-server'], + ensure => 'file', + source => 'puppet:///modules/puppet-devcloud/exports', + mode => '644', + owner => '0', + group => '0', + } + + service { 'nfs-kernel-server': + require => Package['nfs-server'], + ensure => 'running', + enable => 'true', + } + + exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/1/dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd -P /opt/storage/secondary/template/tmpl/1/1/': + creates => '/opt/storage/secondary/template/tmpl/1/1/dc68eb4c-228c-4a78-84fa-b80ae178fbfd.vhd', + require => File['/opt/storage/secondary/template/tmpl/1/1/'], + timeout => '0', + } + + exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/1/template.properties -P /opt/storage/secondary/template/tmpl/1/1/': + creates => '/opt/storage/secondary/template/tmpl/1/1/template.properties', + require => File['/opt/storage/secondary/template/tmpl/1/1/'], + } + + exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd -P /opt/storage/secondary/template/tmpl/1/5/': + creates => '/opt/storage/secondary/template/tmpl/1/5/ce5b212e-215a-3461-94fb-814a635b2215.vhd', + require => File['/opt/storage/secondary/template/tmpl/1/5/'], + timeout => '0', + } + + exec { '/usr/bin/wget http://download.cloud.com/templates/devcloud/defaulttemplates/5/template.properties -P /opt/storage/secondary/template/tmpl/1/5/': + creates => '/opt/storage/secondary/template/tmpl/1/5/template.properties', + require => File['/opt/storage/secondary/template/tmpl/1/5/'], + } + + exec { 'getecho': + command => '/usr/bin/wget http://download.cloud.com/templates/devcloud/echo -P /usr/lib/xcp/plugins/', + creates => '/usr/lib/xcp/plugins/echo', + } + + exec { '/bin/chmod -R 777 /usr/lib/xcp': + require => Exec['getecho'], + } + + file { '/opt/storage/primary': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + } + + file { '/tmp/configlocalstorage.sh': + ensure => 'file', + group => '0', + mode => '777', + owner => '0', + source => 'puppet:///modules/puppet-devcloud/configlocalstorage.sh', + } + + exec { "configlocal": + require => [ + File['/opt/storage/primary'], + File['/tmp/configlocalstorage.sh'] + ], + command => '/tmp/configlocalstorage.sh', + cwd => '/', + } + + file { '/tmp/configvnc.sh': + ensure => 'file', + source => 'puppet:///modules/puppet-devcloud/configvnc.sh', + mode => '777', + group => '0', + owner => '0', + } + + exec { "configvnc": + require => File['/tmp/configvnc.sh'], + command => '/tmp/configvnc.sh', + cwd => '/', + } + + package { 'git': + ensure => latest, + } + + package { 'unzip': + ensure => latest, + } + + package { 'mysql-server': + ensure => latest, + } + + package { 'ant': + ensure => latest, + } + + package { 'openjdk-6-jdk': + ensure => latest, + } + + file { '/opt/cloudstack': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + } + + file { '/tmp/updatecode.sh': + ensure => 'file', + source => 'puppet:///modules/puppet-devcloud/updatecode.sh', + mode => '777', + owner => '0', + group => '0', + } + + exec { 'get_code': + require => [ + Package['git'], + File['/opt/cloudstack/'], + File['/tmp/updatecode.sh'] + ], + command => '/tmp/updatecode.sh', + cwd => '/opt/cloudstack/', + timeout => '0', + } + + file { '/opt/cloudstack/incubator-cloudstack/target': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + require => Exec['get_code'], + } + + file { '/opt/cloudstack/incubator-cloudstack/dist': + ensure => 'directory', + group => '0', + mode => '755', + owner => '0', + require => Exec['get_code'], + } + + exec { 'downloadtomcat': + command => '/usr/bin/wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip -P /opt/cloudstack/', + creates => '/opt/cloudstack/apache-tomcat-6.0.32.zip', + require => File['/opt/cloudstack/'], + timeout => '0', + } + + exec { "unziptomcat": + require => [ + Package['unzip'], + Exec["downloadtomcat"] + ], + creates => "/opt/cloudstack/apache-tomcat-6.0.32", + command => "/usr/bin/unzip apache-tomcat-6.0.32.zip", + cwd => "/opt/cloudstack", + timeout => '0', + } + + exec { "catalina_home": + require => Exec["unziptomcat"], + unless => '/bin/grep CATALINA_HOME /root/.bashrc', + command => '/bin/echo "export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32" >> /root/.bashrc', + cwd => '/', + } + + package { 'mkisofs': + ensure => latest, + } + + exec { "build_cloudstack": + require => [ + Package['ant'], + Exec["catalina_home"], + File['/opt/cloudstack/incubator-cloudstack/dist'], + File['/opt/cloudstack/incubator-cloudstack/target'], + Package['mkisofs'] + ], + command => "/usr/bin/ant clean-all build-all deploy-server deploydb", + cwd => "/opt/cloudstack/incubator-cloudstack/", + timeout => '0', + } + + file { '/opt/cloudstack/startdevcloud.sh': + ensure => 'file', + source => 'puppet:///modules/puppet-devcloud/startdevcloud.sh', + mode => '777', + owner => '0', + group => '0', + } + + exec { "start_cloudstack": + require => [ + Exec["build_cloudstack"], + File["/opt/cloudstack/startdevcloud.sh"] + ], + command => "/opt/cloudstack/startdevcloud.sh", + cwd => "/opt/cloudstack/", + } + +} diff --git a/tools/devcloud/devcloudsetup.sh b/tools/devcloud/devcloudsetup.sh index b5a97cb091a..f8b69faa92e 100644 --- a/tools/devcloud/devcloudsetup.sh +++ b/tools/devcloud/devcloudsetup.sh @@ -121,7 +121,7 @@ postsetup() { mkdir incubator-cloudstack/dist wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.zip -P /opt/cloudstack/ unzip apache-tomcat-6.0.32.zip - echo "exportCATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32" >> /root/.bashrc + echo "export CATALINA_HOME=/opt/cloudstack/apache-tomcat-6.0.32" >> /root/.bashrc cd ~ fi diff --git a/tools/devcloud/puppet/README b/tools/devcloud/puppet/README deleted file mode 100644 index f15f440abd1..00000000000 --- a/tools/devcloud/puppet/README +++ /dev/null @@ -1,12 +0,0 @@ -To use: - -Preconfiguration phase - -- [setup your box in vagrant and place the contents of tools/devcloud/puppet into the box's folder] -- vagrant up; vagrant ssh -- sudo bash -- ln -s /vagrant/puppet-devcloudinitial /etc/puppet/modules/puppet-devcloudinitial -- cd /vagrant -- puppet apply --fsconfig fileserver.conf --debug --verbose -e "include puppet-devcloudinitial" - -Postconfiguration phase - -TODO diff --git a/tools/devcloud/puppet/puppet-devcloudinitial/init.pp b/tools/devcloud/puppet/puppet-devcloudinitial/init.pp deleted file mode 100644 index bf70cec2580..00000000000 --- a/tools/devcloud/puppet/puppet-devcloudinitial/init.pp +++ /dev/null @@ -1 +0,0 @@ -include puppet-devcloudinitial diff --git a/tools/devcloud/ubuntu_install/README b/tools/devcloud/ubuntu_install/README deleted file mode 100644 index 7432dbc3297..00000000000 --- a/tools/devcloud/ubuntu_install/README +++ /dev/null @@ -1 +0,0 @@ -Nothing in this directory yet, but it will contain the scripts and preconfiguration files to build the basic Ubuntu 12.04 server used in devcloud. diff --git a/tools/devcloud/vagrant/vagrant.pp b/tools/devcloud/vagrant/vagrant.pp deleted file mode 100644 index 1be66262876..00000000000 --- a/tools/devcloud/vagrant/vagrant.pp +++ /dev/null @@ -1,43 +0,0 @@ -group { 'vagranttest': - ensure => 'present', - gid => '5000', -} - -group { 'admin': - ensure => 'present', - gid => '1002', -} - -user { 'vagranttest': - ensure => 'present', - comment => 'vagrant,,,', - gid => '5000', - groups => ['adm', 'cdrom', 'dip', 'plugdev', 'lpadmin', 'sambashare', 'admin'], - home => '/home/vagranttest', - shell => '/bin/bash', - uid => '5000', -} - -file { '/home/vagranttest': - ensure => 'directory', - group => '1002', - mode => '755', - owner => '5000', -} - -file { '/home/vagranttest/.ssh': - ensure => 'directory', - group => '1002', - mode => '775', - owner => '5000', -} - -$auth_key = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" - -file { '/home/vagranttest/.ssh/authorized_keys': - ensure => 'file', - content => $auth_key, - group => '1002', - mode => '664', - owner => '5000', -} diff --git a/tools/devcloud/veewee/postinstall.sh b/tools/devcloud/veewee/postinstall.sh new file mode 100644 index 00000000000..a650501fb61 --- /dev/null +++ b/tools/devcloud/veewee/postinstall.sh @@ -0,0 +1,42 @@ +# 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. + +apt-get -y update +apt-get -y upgrade +apt-get -y install vim +apt-get -y install ruby +apt-get -y install rubygems +apt-get -y install puppet +apt-get clean + +# Setup sudo to allow no-password sudo for "admin" +groupadd -r admin +usermod -a -G admin devcloud +sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers +sed -i -e 's/%admin ALL=(ALL) ALL/%admin ALL=NOPASSWD:ALL/g' /etc/sudoers + +mkdir /home/devcloud/.ssh +chmod 700 /home/devcloud/.ssh +cd /home/devcloud/.ssh +wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' -O authorized_keys +chmod 600 /home/devcloud/.ssh/authorized_keys +chown -R devcloud /home/devcloud/.ssh + +# Zero out the free space to save space in the final image: +dd if=/dev/zero of=/EMPTY bs=1M +rm -f /EMPTY + diff --git a/tools/marvin/marvin/NoseTestExecuteEngine.py b/tools/marvin/marvin/NoseTestExecuteEngine.py deleted file mode 100644 index ca1afb4f528..00000000000 --- a/tools/marvin/marvin/NoseTestExecuteEngine.py +++ /dev/null @@ -1,102 +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. - -from functools import partial -import unittest -import nose -import nose.config -import nose.core -import os -import sys -import logging -from cloudstackTestCase import cloudstackTestCase -from nose.suite import ContextSuite, ContextSuiteFactory - -class CloudStackTestSelector(nose.selector.Selector): - """ - custom test selector for cloudstackTestCase - """ - - def wantClass(self, cls): - if issubclass(cls, cloudstackTestCase): - return nose.selector.Selector.wantClass(self, cls) - -def testCaseLogger(message, logger=None): - if logger is not None: - logger.debug(message) - -class NoseTestExecuteEngine(object): - def __init__(self, testclient=None, workingdir=None, clientLog=None, resultLog=None, format="text"): - self.testclient = testclient - self.logformat = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s") - self.suite = [] - realPath = os.path.abspath(workingdir) - - if clientLog is not None: - self.logfile = clientLog - self.logger = logging.getLogger("NoseTestExecuteEngine") - fh = logging.FileHandler(self.logfile) - fh.setFormatter(self.logformat) - self.logger.addHandler(fh) - self.logger.setLevel(logging.DEBUG) - if resultLog is not None: - ch = logging.StreamHandler() - ch.setLevel(logging.ERROR) - ch.setFormatter(self.logformat) - self.logger.addHandler(ch) - fp = open(resultLog, "w") - self.testResultLogFile = fp - else: - self.testResultLogFile = sys.stdout - - if workingdir is not None and os.path.exists(realPath + '/' + '__init__.py'): - self.loader = nose.loader.TestLoader() - [self.suite.append(test) for test in self.loader.discover(workingdir, "test*.py")] - for test in self.suite: - self.injectTestCase(test) - print self.suite[0].countTestCases() - else: - raise Exception("Single module test runs unsupported using Nose") - - if format == "text": - self.runner = nose.core.TextTestRunner(stream=self.testResultLogFile, descriptions=1, verbosity=2, config=None) - else: - raise Exception("XML runner not supported under nose") - - def runTests(self): - #testProgram = nose.core.TestProgram(argv=["--process-timeout=3600"], testRunner = self.runner, testLoader = self.loader) - testProgram = nose.core.TestProgram(argv=["--process-timeout=3600"], testRunner = self.runner, suite = self.suite) - testProgram.runTests() - - def injectTestCase(self, testSuites): - for test in testSuites: - if isinstance(test, unittest.BaseTestSuite): - self.injectTestCase(test) - else: - #logger bears the name of the test class - testcaselogger = logging.getLogger("testclient.testcase.%s"%test.__class__.__name__) - fh = logging.FileHandler(self.logfile) - fh.setFormatter(self.logformat) - testcaselogger.addHandler(fh) - testcaselogger.setLevel(logging.DEBUG) - - #inject testclient and logger into each unittest - setattr(test, "testClient", self.testclient) - setattr(test, "debug", partial(testCaseLogger, logger=testcaselogger)) - setattr(test.__class__, "clstestclient", self.testclient) - if hasattr(test, "UserName"): - self.testclient.createNewApiClient(test.UserName, test.DomainName, test.AcctType) diff --git a/tools/marvin/marvin/TestCaseExecuteEngine.py b/tools/marvin/marvin/TestCaseExecuteEngine.py index 79089ab41d7..44a44aa141c 100644 --- a/tools/marvin/marvin/TestCaseExecuteEngine.py +++ b/tools/marvin/marvin/TestCaseExecuteEngine.py @@ -27,7 +27,7 @@ def testCaseLogger(message, logger=None): logger.debug(message) class TestCaseExecuteEngine(object): - def __init__(self, testclient, testcaseLogFile=None, testResultLogFile=None, format="text"): + def __init__(self, testclient, testcaseLogFile=None, testResultLogFile=None, format="text", xmlDir="xml-reports"): """ Initialize the testcase execution engine, just the basics here @var testcaseLogFile: client log file @@ -55,6 +55,8 @@ class TestCaseExecuteEngine(object): self.testResultLogFile = fp else: self.testResultLogFile = sys.stdout + if self.format == "xml" and (xmlDir is not None): + self.xmlDir = xmlDir def loadTestsFromDir(self, testDirectory): """ Load the test suites from a package with multiple test files """ @@ -91,4 +93,4 @@ class TestCaseExecuteEngine(object): if self.format == "text": unittest.TextTestRunner(stream=self.testResultLogFile, verbosity=2).run(self.suite) elif self.format == "xml": - xmlrunner.XMLTestRunner(output=self.testResultLogFile, verbose=True).run(self.suite) + xmlrunner.XMLTestRunner(output=self.xmlDir, verbose=True).run(self.suite) diff --git a/tools/marvin/marvin/cloudstackConnection.py b/tools/marvin/marvin/cloudstackConnection.py index 37919c082fe..d70c192406e 100644 --- a/tools/marvin/marvin/cloudstackConnection.py +++ b/tools/marvin/marvin/cloudstackConnection.py @@ -17,6 +17,7 @@ import urllib2 import urllib +import httplib import base64 import hmac import hashlib @@ -76,7 +77,7 @@ class cloudConnection(object): self.logging.critical("failed to reach %s because of %s"%(self.mgtSvr, e.reason)) elif hasattr(e, 'code'): self.logging.critical("server returned %d error code"%e.code) - except HTTPException, h: + except httplib.HTTPException, h: self.logging.debug("encountered http Exception %s"%h.args) if self.retries > 0: self.retries = self.retries - 1 diff --git a/tools/marvin/marvin/cloudstackTestCase.py b/tools/marvin/marvin/cloudstackTestCase.py index a85eef7e1dd..4ec764c58bf 100644 --- a/tools/marvin/marvin/cloudstackTestCase.py +++ b/tools/marvin/marvin/cloudstackTestCase.py @@ -48,7 +48,7 @@ class cloudstackTestCase(unittest.case.TestCase): def __init__(self, args): unittest.case.TestCase.__init__(self, args) - self.testClient = cloudstackTestClient.cloudstackTestClient() +# self.testClient = cloudstackTestClient.cloudstackTestClient() @classmethod def getClsTestClient(cls): diff --git a/tools/marvin/marvin/deployAndRun.py b/tools/marvin/marvin/deployAndRun.py index 80d74e4b63e..1c82d9fcc2e 100644 --- a/tools/marvin/marvin/deployAndRun.py +++ b/tools/marvin/marvin/deployAndRun.py @@ -17,12 +17,12 @@ import deployDataCenter import TestCaseExecuteEngine -import NoseTestExecuteEngine from optparse import OptionParser import os if __name__ == "__main__": - parser = OptionParser() + + parser = OptionParser() #TODO: deprecate and use the argparse module parser.add_option("-c", "--config", action="store", default="./datacenterCfg", dest="config", help="the path where the json config file generated, by default is ./datacenterCfg") parser.add_option("-d", "--directory", dest="testCaseFolder", help="the test case directory") @@ -30,8 +30,7 @@ if __name__ == "__main__": parser.add_option("-t", "--client", dest="testcaselog", help="test case log file") parser.add_option("-l", "--load", dest="load", action="store_true", help="only load config, do not deploy, it will only run testcase") parser.add_option("-f", "--file", dest="module", help="run tests in the given file") - parser.add_option("-n", "--nose", dest="nose", action="store_true", help="run tests using nose") - parser.add_option("-x", "--xml", dest="xmlrunner", action="store_true", help="use the xml runner to generate xml reports") + parser.add_option("-x", "--xml", dest="xmlrunner", help="use the xml runner to generate xml reports and path to store xml files") (options, args) = parser.parse_args() testResultLogFile = None @@ -47,8 +46,10 @@ if __name__ == "__main__": else: deploy.deploy() - format = "text" - if options.xmlrunner: + format = "text" + xmlDir = None + if options.xmlrunner is not None: + xmlDir = options.xmlrunner format = "xml" if options.testCaseFolder is None: @@ -56,18 +57,10 @@ if __name__ == "__main__": parser.print_usage() exit(1) else: - if options.nose: - engine = NoseTestExecuteEngine.NoseTestExecuteEngine(deploy.testClient, testCaseLogFile, testResultLogFile, format) - engine.runTestsFromFile(options.module) - else: - engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient, testCaseLogFile, testResultLogFile, format) - engine.loadTestsFromFile(options.module) - engine.run() + engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient, testCaseLogFile, testResultLogFile, format, xmlDir) + engine.loadTestsFromFile(options.module) + engine.run() else: - if options.nose: - engine = NoseTestExecuteEngine.NoseTestExecuteEngine(deploy.testClient, clientLog=testCaseLogFile, resultLog=testResultLogFile, workingdir=options.testCaseFolder, format=format) - engine.runTests() - else: - engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient, testCaseLogFile, testResultLogFile, format) - engine.loadTestsFromDir(options.testCaseFolder) - engine.run() + engine = TestCaseExecuteEngine.TestCaseExecuteEngine(deploy.testClient, testCaseLogFile, testResultLogFile, format, xmlDir) + engine.loadTestsFromDir(options.testCaseFolder) + engine.run() diff --git a/tools/marvin/marvin/deployDataCenter.py b/tools/marvin/marvin/deployDataCenter.py index 91045cd741f..4284d12a542 100644 --- a/tools/marvin/marvin/deployDataCenter.py +++ b/tools/marvin/marvin/deployDataCenter.py @@ -196,26 +196,45 @@ class deployDataCenters(): vrconfig.id = vrprovid vrconfigresponse = \ self.apiClient.configureVirtualRouterElement(vrconfig) + + upnetprov = \ + updateNetworkServiceProvider.updateNetworkServiceProviderCmd() + upnetprov.id = vrprov.nspid + upnetprov.state = "Enabled" + upnetprovresponse = \ + self.apiClient.updateNetworkServiceProvider(upnetprov) if zone.networktype == "Basic" and zone.securitygroupenabled: sgprovider = configGenerator.provider() sgprovider.name = "SecurityGroupProvider" zone.providers.append(sgprovider) - - for prov in zone.providers: - pnetprov = \ - listNetworkServiceProviders.listNetworkServiceProvidersCmd() + + if zone.networktype == "Advanced": + pnetprov = listNetworkServiceProviders.listNetworkServiceProvidersCmd() pnetprov.physicalnetworkid = phynetwrk.id - pnetprov.name = prov.name pnetprov.state = "Disabled" - pnetprovs = self.apiClient.listNetworkServiceProviders(pnetprov) - - upnetprov = \ - updateNetworkServiceProvider.updateNetworkServiceProviderCmd() - upnetprov.id = pnetprovs[0].id - upnetprov.state = "Enabled" - upnetprovresponse = \ - self.apiClient.updateNetworkServiceProvider(upnetprov) + pnetprov.name = "VpcVirtualRouter" + pnetprovres = self.apiClient.listNetworkServiceProviders(pnetprov) + + if pnetprovres and len(pnetprovres) > 0: + vpcvrprov = listVirtualRouterElements.listVirtualRouterElementsCmd() + vpcvrprov.nspid = pnetprovres[0].id + vpcvrprovresponse = self.apiClient.listVirtualRouterElements(vpcvrprov) + vpcvrprovid = vpcvrprovresponse[0].id + + vpcvrconfig = \ + configureVirtualRouterElement.configureVirtualRouterElementCmd() + vpcvrconfig.enabled = "true" + vpcvrconfig.id = vpcvrprovid + vpcvrconfigresponse = \ + self.apiClient.configureVirtualRouterElement(vpcvrconfig) + + upnetprov = \ + updateNetworkServiceProvider.updateNetworkServiceProviderCmd() + upnetprov.id = vpcvrprov.nspid + upnetprov.state = "Enabled" + upnetprovresponse = \ + self.apiClient.updateNetworkServiceProvider(upnetprov) def addTrafficTypes(self, physical_network_id, traffictypes=None, \ network_labels=None): diff --git a/tools/marvin/marvin/marvinPlugin.py b/tools/marvin/marvin/marvinPlugin.py new file mode 100644 index 00000000000..5e0c6dadb32 --- /dev/null +++ b/tools/marvin/marvin/marvinPlugin.py @@ -0,0 +1,117 @@ +# 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 marvin +import logging +import nose.core +from marvin.cloudstackTestCase import cloudstackTestCase +from marvin import deployDataCenter +from nose.plugins.base import Plugin +from functools import partial + +def testCaseLogger(message, logger=None): + if logger is not None: + logger.debug(message) + +class MarvinPlugin(Plugin): + """ + Custom plugin for the cloudstackTestCases to be run using nose + """ + + name = "marvin" + def configure(self, options, config): + self.enabled = 1 + self.enableOpt = "--with-marvin" + self.logformat = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s") + + if options.debug_log: + self.logger = logging.getLogger("NoseTestExecuteEngine") + self.debug_stream = logging.FileHandler(options.debug_log) + self.debug_stream.setFormatter(self.logformat) + self.logger.addHandler(self.debug_stream) + self.logger.setLevel(logging.DEBUG) + + if options.result_log: + ch = logging.StreamHandler() + ch.setLevel(logging.ERROR) + ch.setFormatter(self.logformat) + self.logger.addHandler(ch) + self.result_stream = open(options.result_log, "w") + else: + self.result_stream = sys.stderr + + deploy = deployDataCenter.deployDataCenters(options.config) + deploy.loadCfg() if options.load else deploy.deploy() + self.setClient(deploy.testClient) + + cfg = nose.config.Config() + cfg.logStream = self.result_stream + cfg.debugLog = self.debug_stream + + self.testrunner = nose.core.TextTestRunner(stream=self.result_stream, descriptions=True, verbosity=2, config=config) + + def options(self, parser, env): + """ + Register command line options + """ + parser.add_option("--marvin-config", action="store", + default=env.get('MARVIN_CONFIG', './datacenter.cfg'), + dest="config", + help="Marvin's configuration file where the datacenter information is specified [MARVIN_CONFIG]") + parser.add_option("--result-log", action="store", + default=env.get('RESULT_LOG', 'result.log'), + dest="result_log", + help="The path to the results file where test summary will be written to [RESULT_LOG]") + parser.add_option("--client-log", action="store", + default=env.get('DEBUG_LOG', 'debug.log'), + dest="debug_log", + help="The path to the testcase debug logs [DEBUG_LOG]") + parser.add_option("--load", action="store_true", default=False, dest="load", + help="Only load the deployment configuration given") + + Plugin.options(self, parser, env) + + def __init__(self): + Plugin.__init__(self) + + def prepareTestRunner(self, runner): + return self.testrunner + + def wantClass(self, cls): + if issubclass(cls, cloudstackTestCase): + return True + return None + + def loadTestsFromTestCase(self, cls): + self._injectClients(cls) + + def setClient(self, client): + if client: + self.testclient = client + + def _injectClients(self, test): + testcaselogger = logging.getLogger("testclient.testcase.%s" % test.__name__) + self.debug_stream.setFormatter(logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s")) + testcaselogger.addHandler(self.debug_stream) + testcaselogger.setLevel(logging.DEBUG) + + setattr(test, "testClient", self.testclient) + setattr(test, "debug", partial(testCaseLogger, logger=testcaselogger)) + setattr(test, "clstestclient", self.testclient) + if hasattr(test, "UserName"): + self.testclient.createNewApiClient(test.UserName, test.DomainName, test.AcctType) + diff --git a/tools/marvin/marvin/sandbox/basic/setup.properties b/tools/marvin/marvin/sandbox/basic/setup.properties new file mode 100644 index 00000000000..2cde465440b --- /dev/null +++ b/tools/marvin/marvin/sandbox/basic/setup.properties @@ -0,0 +1,41 @@ +[globals] +#global settings in cloudstack +expunge.delay=60 +expunge.interval=60 +storage.cleanup.interval=300 +account.cleanup.interval=600 +expunge.workers=3 +workers=10 +use.user.concentrated.pod.allocation=false +vm.allocation.algorithm=random +vm.op.wait.interval=5 +guest.domain.suffix=sandbox.xen +instance.name=QA +direct.agent.load.size=1000 +default.page.size=10000 +check.pod.cidrs=true +secstorage.allowed.internal.sites=10.147.28.0/24 +[environment] +dns=10.147.28.6 +mshost=10.147.39.69 +mysql.host=10.147.39.69 +mysql.cloud.user=cloud +mysql.cloud.passwd=cloud +[cloudstack] +#management network +private.gateway=10.147.40.1 +private.pod.startip=10.147.41.121 +private.pod.endip=10.147.41.160 +private.netmask=255.255.254.0 +#public network +public.gateway=10.147.40.1 +public.vlan.startip=10.147.41.162 +public.vlan.endip=10.147.41.200 +public.netmask=255.255.254.0 +#hypervisor host information +hypervisor=XenServer +host=10.147.40.10 +host.password=password +#storage pools +primary.pool=nfs://10.147.28.7:/export/home/automation/sadhu/primary +secondary.pool=nfs://10.147.28.6:/export/home/automation/sadhu/secondary diff --git a/tools/marvin/marvin/setup.py b/tools/marvin/marvin/setup.py new file mode 100644 index 00000000000..dea67df8f89 --- /dev/null +++ b/tools/marvin/marvin/setup.py @@ -0,0 +1,46 @@ +# 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 os +from setuptools import setup + +def read(fname): + return open(os.path.join(os.path.dirname(__file__), fname)).read().strip() + +VERSION = '0.1.0' + +setup( + name = "marvin-nose", + version = VERSION, + author = "Prasanna Santhanam", + author_email = "Prasanna.Santhanam@citrix.com", + description = "Run tests written using CloudStack's Marvin testclient", + license = 'ASL 2.0', + classifiers = [ + "Intended Audience :: Developers", + "Topic :: Software Development :: Testing", + "Programming Language :: Python", + ], + + py_modules = ['marvinPlugin'], + zip_safe = False, + + entry_points = { + 'nose.plugins': ['marvinPlugin = marvinPlugin:MarvinPlugin'] + }, + install_requires = ['nose', 'marvin'], +) diff --git a/tools/marvin/marvin/testSetupSuccess.py b/tools/marvin/marvin/testSetupSuccess.py new file mode 100644 index 00000000000..8a0034cfa9b --- /dev/null +++ b/tools/marvin/marvin/testSetupSuccess.py @@ -0,0 +1,81 @@ +# 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 marvin +import unittest +from marvin.cloudstackTestCase import * +from marvin.cloudstackAPI import * +from time import sleep as delay + +class TestSetupSuccess(cloudstackTestCase): + """ + Test to verify if the cloudstack is ready to launch tests upon + 1. Verify that system VMs are up and running in all zones + 2. Verify that built-in templates are Ready in all zones + """ + @classmethod + def setUpClass(cls): + cls.apiClient = super(TestSetupSuccess, cls).getClsTestClient().getApiClient() + + zones = listZones.listZonesCmd() + cls.zones_list = cls.apiClient.listZones(zones) + cls.retry = 50 + + def test_systemVmReady(self): + """ + system VMs need to be ready and Running for each zone in cloudstack + """ + for z in self.zones_list: + retry = self.retry + while retry != 0: + self.debug("looking for system VMs in zone: %s, %s"%(z.id, z.name)) + sysvms = listSystemVms.listSystemVmsCmd() + sysvms.zoneid = z.id + sysvms.state = 'Running' + sysvms_list = self.apiClient.listSystemVms(sysvms) + if sysvms_list is not None and len(sysvms_list) == 2: + assert len(sysvms_list) == 2 + self.debug("found %d system VMs running {%s}"%(len(sysvms_list), sysvms_list)) + break + retry = retry - 1 + delay(60) #wait a minute for retry + self.assertNotEqual(retry, 0, "system VMs not Running in zone %s"%z.name) + + def test_templateBuiltInReady(self): + """ + built-in templates CentOS to be ready + """ + for z in self.zones_list: + retry = self.retry + while retry != 0: + self.debug("Looking for at least one ready builtin template") + templates = listTemplates.listTemplatesCmd() + templates.templatefilter = 'featured' + templates.listall = 'true' + templates_list = self.apiClient.listTemplates(templates) + if templates_list is not None: + builtins = [tmpl for tmpl in templates_list if tmpl.templatetype == 'BUILTIN' and tmpl.isready == True] + if len(builtins) > 0: + self.debug("Found %d builtins ready for use %s"%(len(builtins), builtins)) + break + retry = retry - 1 + delay(60) #wait a minute for retry + self.assertNotEqual(retry, 0, "builtIn templates not ready in zone %s"%z.name) + + @classmethod + def tearDownClass(cls): + pass diff --git a/tools/marvin/setup.py b/tools/marvin/setup.py index b2d6a40cd4b..96981ee217a 100644 --- a/tools/marvin/setup.py +++ b/tools/marvin/setup.py @@ -18,10 +18,11 @@ from distutils.core import setup from sys import version +import sys if version < "2.7": print "Marvin needs at least python 2.7, found : \n%s"%version - raise + sys.exit(1) setup(name="Marvin", version="0.1.0", @@ -36,8 +37,8 @@ setup(name="Marvin", packages=["marvin", "marvin.cloudstackAPI", "marvin.sandbox", "marvin.sandbox.advanced", "marvin.sandbox.basic", "marvin.pymysql", "marvin.pymysql.constants", "marvin.pymysql.tests"], license="LICENSE.txt", install_requires=[ - "Python>=2.7", "paramiko", - "nose" + "nose", + "unittest-xml-reporting" ], ) diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index dd1b5d848c5..d52b3d3ce81 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -9011,8 +9011,8 @@ div.panel.ui-dialog div.list-view div.fixed-header { .tagger form label.error { position: absolute; color: #FF0000; - left: 42px; - top: 29px; + left: 44px; + top: 28px !important; /*[empty]background-color:;*/ } diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index bca405b2d5b..c2a59ea2157 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -553,7 +553,7 @@ label: 'Edit', action: function(args) { var array1 = []; - if(args.data.displayname != args.context.instances[0].name) + if(args.data.displayname != args.context.instances[0].displayname) array1.push("&displayName=" + args.data.displayname); array1.push("&group=" + args.data.group); @@ -1185,6 +1185,7 @@ fields: [ { name: { label: 'label.name', header: true }, + networkname: {label: 'Network Name' }, ipaddress: { label: 'label.ip.address' }, type: { label: 'label.type' }, gateway: { label: 'label.gateway' }, @@ -1198,17 +1199,28 @@ } ], dataProvider: function(args) { - args.response.success({data: $.map(args.context.instances[0].nic, function(nic, index) { - var name = 'NIC ' + (index + 1); - - if (nic.isdefault) { - name += ' (' + _l('label.default') + ')'; - } - return $.extend(nic, { - name: name + $.ajax({ + url:createURL("listVirtualMachines&details=nics&id=" + args.context.instances[0].id), + dataType: "json", + async:true, + success:function(json) { + // Handling the display of network name for a VM under the NICS tabs + args.response.success({ + data: $.map(args.context.instances[0].nic, function(nic, index) { + var name = 'NIC ' + (index + 1); + var networkname = json.listvirtualmachinesresponse.virtualmachine[0].nic[index].networkname; + if (nic.isdefault) { + name += ' (' + _l('label.default') + ')'; + } + return $.extend(nic, { + name: name, + networkname: networkname + }); + }) + }); + } }); - })}); - } + } }, /** diff --git a/ui/scripts/ui/widgets/tagger.js b/ui/scripts/ui/widgets/tagger.js index f671342c99c..1b9c9289ad3 100644 --- a/ui/scripts/ui/widgets/tagger.js +++ b/ui/scripts/ui/widgets/tagger.js @@ -1,13 +1,43 @@ +// 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) { + var isFormValid = function($form) { + var key = $form.find('input[name=key]').val(); + var value = $form.find('input[name=value]').val(); + + if (!key || !value) { + cloudStack.dialog.notice({ message: 'Please specify a tag key and value' }); + + return false; + } + + return true; + }; + var elems = { inputArea: function(args) { var $form = $('
    ').addClass('tag-input'); var $keyField = $('
    ').addClass('field key'); var $keyLabel = $('