diff --git a/server/src/com/cloud/vm/dao/RandomlyIncreasingVMInstanceDaoImpl.java b/api/src/com/cloud/agent/api/ScaleVmAnswer.java similarity index 59% rename from server/src/com/cloud/vm/dao/RandomlyIncreasingVMInstanceDaoImpl.java rename to api/src/com/cloud/agent/api/ScaleVmAnswer.java index cc5c5368a81..31d6e44155f 100644 --- a/server/src/com/cloud/vm/dao/RandomlyIncreasingVMInstanceDaoImpl.java +++ b/api/src/com/cloud/agent/api/ScaleVmAnswer.java @@ -14,23 +14,15 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.vm.dao; +package com.cloud.agent.api; +public class ScaleVmAnswer extends Answer { -import javax.ejb.Local; - -import org.apache.log4j.Logger; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; - -@Local(value = { UserVmDao.class }) -public class RandomlyIncreasingVMInstanceDaoImpl extends UserVmDaoImpl { - - public static final Logger s_logger = Logger.getLogger(RandomlyIncreasingVMInstanceDaoImpl.class); - - @Override - public K getNextInSequence(final Class clazz, final String name) { - return getRandomlyIncreasingNextInSequence(clazz, name); + protected ScaleVmAnswer() { } + public ScaleVmAnswer(ScaleVmCommand cmd, boolean result, String detail) { + super(cmd, result, detail); + } + } diff --git a/api/src/com/cloud/agent/api/ScaleVmCommand.java b/api/src/com/cloud/agent/api/ScaleVmCommand.java new file mode 100644 index 00000000000..e5078d5e8c0 --- /dev/null +++ b/api/src/com/cloud/agent/api/ScaleVmCommand.java @@ -0,0 +1,113 @@ +// 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.agent.api; + +import com.cloud.agent.api.to.VirtualMachineTO; + +public class ScaleVmCommand extends Command { + + VirtualMachineTO vm; + String vmName; + int cpus; + Integer speed; + long minRam; + long maxRam; + + public VirtualMachineTO getVm() { + return vm; + } + + public void setVm(VirtualMachineTO vm) { + this.vm = vm; + } + + public int getCpus() { + return cpus; + } + + public ScaleVmCommand(String vmName, int cpus, + Integer speed, long minRam, long maxRam) { + super(); + this.vmName = vmName; + this.cpus = cpus; + //this.speed = speed; + this.minRam = minRam; + this.maxRam = maxRam; + this.vm = new VirtualMachineTO(1L, vmName, null, cpus, null, minRam, maxRam, null, null, false, false, null); + /*vm.setName(vmName); + vm.setCpus(cpus); + vm.setRam(minRam, maxRam);*/ + } + + public void setCpus(int cpus) { + this.cpus = cpus; + } + + public Integer getSpeed() { + return speed; + } + + public void setSpeed(Integer speed) { + this.speed = speed; + } + + public long getMinRam() { + return minRam; + } + + public void setMinRam(long minRam) { + this.minRam = minRam; + } + + public long getMaxRam() { + return maxRam; + } + + public void setMaxRam(long maxRam) { + this.maxRam = maxRam; + } + + public String getVmName() { + return vmName; + } + + public void setVmName(String vmName) { + this.vmName = vmName; + } + + public VirtualMachineTO getVirtualMachine() { + return vm; + } + + @Override + public boolean executeInSequence() { + return true; + } + + protected ScaleVmCommand() { + } + + public ScaleVmCommand(VirtualMachineTO vm) { + this.vm = vm; + } + + public boolean getLimitCpuUse() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/api/src/org/apache/cloudstack/api/ACL.java b/api/src/org/apache/cloudstack/api/ACL.java index 3623d1ac523..ce93b6aa7ae 100644 --- a/api/src/org/apache/cloudstack/api/ACL.java +++ b/api/src/org/apache/cloudstack/api/ACL.java @@ -22,10 +22,14 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; +import org.apache.cloudstack.acl.SecurityChecker.AccessType; + @Retention(RetentionPolicy.RUNTIME) @Target({ FIELD }) public @interface ACL { + AccessType accessType() default AccessType.ListEntry; + boolean checkKeyAccess() default false; boolean checkValueAccess() default false; } diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java index 0ac6476cf43..21a45f8cc7f 100755 --- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -24,6 +24,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; @@ -53,7 +54,6 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.network.IpAddress; import com.cloud.network.Network; import com.cloud.network.Network.IpAddresses; import com.cloud.offering.DiskOffering; @@ -103,7 +103,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { private Long domainId; //Network information - @ACL + @ACL(accessType = AccessType.UseNetwork) @Parameter(name=ApiConstants.NETWORK_IDS, type=CommandType.LIST, collectionType=CommandType.UUID, entityType=NetworkResponse.class, description="list of network ids used by virtual machine. Can't be specified with ipToNetworkList parameter") private List networkIds; diff --git a/client/WEB-INF/web.xml b/client/WEB-INF/web.xml index 626305b82fa..da2f13c8cf7 100644 --- a/client/WEB-INF/web.xml +++ b/client/WEB-INF/web.xml @@ -22,7 +22,7 @@ log4jConfigLocation - /WEB-INF/classes/log4j-cloud.xml + classpath:log4j-cloud.xml org.springframework.web.util.Log4jConfigListener diff --git a/client/tomcatconf/classpath.conf.in b/client/tomcatconf/classpath.conf.in index 5625f69ed33..3ae0fb4d778 100644 --- a/client/tomcatconf/classpath.conf.in +++ b/client/tomcatconf/classpath.conf.in @@ -16,11 +16,23 @@ # specific language governing permissions and limitations # under the License. -# We use WEB-INF/lib in the webapp for including things into -# the classpath nowdays - -for jar in /usr/share/tomcat6/lib/*.jar; do - CLASSPATH=$jar:$CLASSPATH +SYSTEMJARS="@SYSTEMJARS@" +SCP=$(build-classpath $SYSTEMJARS 2>/dev/null) ; if [ $? != 0 ] ; then export SCP="@SYSTEMCLASSPATH@" ; fi +MCP="@MSCLASSPATH@" +DCP="@DEPSCLASSPATH@" +CLASSPATH=$SCP:$DCP:$MCP:@MSCONF@:@SETUPDATADIR@ +for jarfile in "@PREMIUMJAVADIR@"/* ; do + if [ ! -e "$jarfile" ] ; then continue ; fi + CLASSPATH=$jarfile:$CLASSPATH +done +for plugin in "@PLUGINJAVADIR@"/* ; do + if [ ! -e "$plugin" ] ; then continue ; fi + CLASSPATH=$plugin:$CLASSPATH +done +for vendorconf in "@MSCONF@"/vendor/* ; do + if [ ! -d "$vendorconf" ] ; then continue ; fi + CLASSPATH=$vendorconf:$CLASSPATH done -CLASSPATH=${CLASSPATH}/usr/share/cloudstack-management/webapps/client/WEB-INF/lib/mysql-connector-java-5.1.21.jar export CLASSPATH +PATH=/sbin:/usr/sbin:$PATH +export PATH diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in index fd8bf283b0e..9061178e32a 100644 --- a/client/tomcatconf/componentContext.xml.in +++ b/client/tomcatconf/componentContext.xml.in @@ -48,7 +48,6 @@ - diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in index 2773d54c41c..20e0c32db57 100644 --- a/client/tomcatconf/nonossComponentContext.xml.in +++ b/client/tomcatconf/nonossComponentContext.xml.in @@ -49,7 +49,6 @@ - @@ -123,13 +122,14 @@ - + - + diff --git a/debian/control b/debian/control index 659084c38ae..98a390f1402 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: cloudstack Section: libs Priority: extra Maintainer: Wido den Hollander -Build-Depends: debhelper (>= 7), openjdk-6-jdk, tomcat6, genisoimage, +Build-Depends: debhelper (>= 7), openjdk-6-jdk | openjdk-7-jdk, tomcat6, genisoimage, python-mysqldb, maven3 | maven (>= 3), python (>= 2.6.6-3~) Standards-Version: 3.8.1 Homepage: http://www.cloudstack.org/ @@ -22,7 +22,7 @@ Description: CloudStack server library Package: cloudstack-agent Architecture: all -Depends: openjdk-6-jre, cloudstack-common (= ${source:Version}), lsb-base (>= 3.2), openssh-client, libvirt0, sysvinit-utils, chkconfig, qemu-kvm, libvirt-bin, uuid-runtime, rsync, grep, iproute, ebtables, vlan, wget, jsvc +Depends: openjdk-6-jre | openjdk-7-jre, cloudstack-common (= ${source:Version}), lsb-base (>= 3.2), openssh-client, libvirt0, sysvinit-utils, chkconfig, qemu-kvm, libvirt-bin, uuid-runtime, rsync, grep, iproute, ebtables, vlan, wget, jsvc Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts Description: CloudStack agent The CloudStack agent is in charge of managing shared computing resources in @@ -31,7 +31,7 @@ Description: CloudStack agent Package: cloudstack-usage Architecture: all -Depends: openjdk-6-jre, cloudstack-common (= ${source:Version}), jsvc +Depends: openjdk-6-jre | openjdk-7-jre, cloudstack-common (= ${source:Version}), jsvc Description: CloudStack usage monitor The CloudStack usage monitor provides usage accounting across the entire cloud for cloud operators to charge based on usage parameters. diff --git a/debian/rules b/debian/rules index d537d86204b..d4002f37985 100755 --- a/debian/rules +++ b/debian/rules @@ -60,7 +60,7 @@ install: # cloudstack-agent mkdir debian/tmp/etc/cloud/agent mkdir debian/tmp/var/log/cloudstack/agent - install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-4.1.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-agent/lib/cloudstack-agent-kvm.jar + install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-4.2.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-agent/lib/cloudstack-agent-kvm.jar install -D packaging/debian/init/cloud-agent debian/tmp/etc/init.d/ install -D agent/bindir/cloud-setup-agent.in debian/tmp/usr/bin/cloud-setup-agent install -D agent/bindir/cloud-ssh.in debian/tmp/usr/bin/cloud-ssh @@ -80,14 +80,14 @@ install: mkdir debian/tmp/var/lib/cloud/management mkdir debian/tmp/var/lib/cloud/mnt cp -r client/target/utilities/scripts/db/* debian/tmp/usr/share/cloudstack-management/setup/ - cp -r client/target/cloud-client-ui-4.1.0-SNAPSHOT/* debian/tmp/usr/share/cloudstack-management/webapps/client/ + cp -r client/target/cloud-client-ui-4.2.0-SNAPSHOT/* debian/tmp/usr/share/cloudstack-management/webapps/client/ cp server/target/conf/* debian/tmp/etc/cloud/server/ cp client/target/conf/* debian/tmp/etc/cloud/management/ ln -s tomcat6-nonssl.conf debian/tmp/etc/cloud/management/tomcat6.conf mkdir -p debian/tmp/etc/cloud/management/Catalina/localhost/client install -D packaging/debian/init/cloud-management debian/tmp/etc/init.d/cloud-management install -D client/bindir/cloud-update-xenserver-licenses.in debian/tmp/usr/bin/cloud-update-xenserver-licenses - install -D server/target/cloud-server-4.1.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-management/lib/cloudstack-server.jar + install -D server/target/cloud-server-4.2.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-management/lib/cloudstack-server.jar ln -s /usr/share/tomcat6/bin debian/tmp/usr/share/cloudstack-management/bin ln -s ../../../etc/cloud/management debian/tmp/usr/share/cloudstack-management/conf ln -s /usr/share/tomcat6/lib debian/tmp/usr/share/cloudstack-management/lib @@ -109,9 +109,9 @@ install: install -D client/target/utilities/bin/cloud-set-guest-sshkey debian/tmp/usr/bin install -D client/target/utilities/bin/cloud-setup-databases debian/tmp/usr/bin install -D client/target/utilities/bin/cloud-setup-management debian/tmp/usr/bin - install -D console-proxy/dist/systemvm.iso debian/tmp/usr/share/cloudstack-common/vms/systemvm.iso - install -D core/target/cloud-core-4.1.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-common/lib/cloudstack-core.jar - install -D api/target/cloud-api-4.1.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-common/lib/cloudstack-api.jar + install -D services/console-proxy/server/dist/systemvm.iso debian/tmp/usr/share/cloudstack-common/vms/systemvm.iso + install -D core/target/cloud-core-4.2.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-common/lib/cloudstack-core.jar + install -D api/target/cloud-api-4.2.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-common/lib/cloudstack-api.jar # cloudstack-python mkdir -p debian/tmp/usr/lib/python2.7/dist-packages @@ -120,7 +120,7 @@ install: # cloudstack-usage mkdir debian/tmp/etc/cloud/usage mkdir debian/tmp/var/log/cloudstack/usage - install -D usage/target/cloud-usage-4.1.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-usage/lib/cloudstack-usage.jar + install -D usage/target/cloud-usage-4.2.0-SNAPSHOT.jar debian/tmp/usr/share/cloudstack-usage/lib/cloudstack-usage.jar cp usage/target/transformed/* debian/tmp/etc/cloud/usage/ ln -s ../management/db.properties debian/tmp/etc/cloud/usage/db.properties install -D packaging/debian/init/cloud-usage debian/tmp/etc/init.d diff --git a/docs/en-US/vlan-provisioning.xml b/docs/en-US/vlan-provisioning.xml index 8abd5da0a75..9345647d47a 100644 --- a/docs/en-US/vlan-provisioning.xml +++ b/docs/en-US/vlan-provisioning.xml @@ -21,10 +21,23 @@ specific language governing permissions and limitations under the License. --> -
- VLAN Provisioning - &PRODUCT; automatically creates and destroys interfaces bridged to VLANs on the hosts. In general the administrator does not need to manage this process. - &PRODUCT; manages VLANs differently based on hypervisor type. For XenServer or KVM, the VLANs are created on only the hosts where they will be used and then they are destroyed when all guests that require them have been terminated or moved to another host. - For vSphere the VLANs are provisioned on all hosts in the cluster even if there is no guest running on a particular Host that requires the VLAN. This allows the administrator to perform live migration and other functions in vCenter without having to create the VLAN on the destination Host. Additionally, the VLANs are not removed from the Hosts when they are no longer needed. + VLAN Provisioning + &PRODUCT; automatically creates and destroys interfaces bridged to VLANs on the hosts. In + general the administrator does not need to manage this process. + &PRODUCT; manages VLANs differently based on hypervisor type. For XenServer or KVM, the + VLANs are created on only the hosts where they will be used and then they are destroyed when all + guests that require them have been terminated or moved to another host. + For vSphere the VLANs are provisioned on all hosts in the cluster even if there is no guest + running on a particular Host that requires the VLAN. This allows the administrator to perform + live migration and other functions in vCenter without having to create the VLAN on the + destination Host. Additionally, the VLANs are not removed from the Hosts when they are no longer + needed. + You can use the same VLANs on different physical networks provided that each physical + network has its own underlying layer-2 infrastructure, such as switches. For example, you can + specify VLAN range 500 to 1000 while deploying physical networks A and B in an Advanced zone + setup. This capability allows you to set up an additional layer-2 physical infrastructure on a + different physical NIC and use the same set of VLANs if you run out of VLANs. Another advantage + is that you can use the same set of IPs for different customers, each one with their own routers + and the guest networks on different physical NICs.
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java index 2e8638eec07..e8ad8e47745 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java @@ -16,6 +16,7 @@ // under the License. package org.apache.cloudstack.engine.cloud.entity.api; +import com.cloud.utils.component.ComponentContext; import org.springframework.beans.factory.FactoryBean; import org.springframework.stereotype.Component; @@ -24,7 +25,7 @@ public class VirtualMachineEntityFactory implements FactoryBean entitiesToAccess) { + private void doAccessChecks(BaseCmd cmd, Map entitiesToAccess) { Account caller = UserContext.current().getCaller(); Account owner = _accountMgr.getActiveAccountById(cmd.getEntityOwnerId()); @@ -118,9 +120,9 @@ public class ApiDispatcher { if(!entitiesToAccess.isEmpty()){ //check that caller can access the owner account. _accountMgr.checkAccess(caller, null, true, owner); - for(Object entity : entitiesToAccess) { + for (Object entity : entitiesToAccess.keySet()) { if (entity instanceof ControlledEntity) { - _accountMgr.checkAccess(caller, null, true, (ControlledEntity) entity); + _accountMgr.checkAccess(caller, entitiesToAccess.get(entity), true, (ControlledEntity) entity); } else if (entity instanceof InfrastructureEntity) { //FIXME: Move this code in adapter, remove code from Account manager @@ -162,11 +164,11 @@ public class ApiDispatcher { @SuppressWarnings({ "unchecked", "rawtypes" }) public static void processParameters(BaseCmd cmd, Map params) { - List entitiesToAccess = new ArrayList(); + Map entitiesToAccess = new HashMap(); Map unpackedParams = cmd.unpackParams(params); - + cmd = ComponentContext.getTargetObject(cmd); - + if (cmd instanceof BaseListCmd) { Object pageSizeObj = unpackedParams.get(ApiConstants.PAGE_SIZE); Long pageSize = null; @@ -258,7 +260,7 @@ public class ApiDispatcher { List listParam = (List) field.get(cmd); for (Long entityId : listParam) { Object entityObj = s_instance._entityMgr.findById(entity, entityId); - entitiesToAccess.add(entityObj); + entitiesToAccess.put(entityObj, checkAccess.accessType()); } break; /* @@ -279,7 +281,7 @@ public class ApiDispatcher { case LONG: case UUID: Object entityObj = s_instance._entityMgr.findById(entity, (Long) field.get(cmd)); - entitiesToAccess.add(entityObj); + entitiesToAccess.put(entityObj, checkAccess.accessType()); break; default: break; diff --git a/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java b/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java index 3aef29b954a..1c23cb8e5e1 100755 --- a/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java +++ b/server/src/com/cloud/capacity/dao/CapacityDaoImpl.java @@ -305,10 +305,17 @@ public class CapacityDaoImpl extends GenericDaoBase implements } ResultSet rs = pstmt.executeQuery(); while (rs.next()) { + Long capacityPodId = null; + Long capacityClusterId = null; + + if(level != 1 && rs.getLong(6) != 0) + capacityPodId = rs.getLong(6); + if(level == 3 && rs.getLong(7) != 0) + capacityClusterId = rs.getLong(7); + SummedCapacity summedCapacity = new SummedCapacity( rs.getLong(1), rs.getLong(2), rs.getFloat(3), (short)rs.getLong(4), rs.getLong(5), - level != 1 ? rs.getLong(6): null, - level == 3 ? rs.getLong(7): null); + capacityPodId, capacityClusterId); result.add(summedCapacity); } diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index 6bf7f955269..9566285051d 100755 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -130,7 +130,6 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio @Inject private ResourceCountDao _resourceCountDao; @Inject private NetworkOfferingServiceMapDao _ntwkOfferingServiceMapDao; @Inject private IdentityDao _identityDao; - @Inject private RegionDao _regionDao; public ConfigurationServerImpl() { setRunLevel(ComponentLifecycle.RUN_LEVEL_FRAMEWORK_BOOTSTRAP); @@ -234,8 +233,6 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio // Create default networks createDefaultNetworks(); - createDefaultRegion(); - // Create userIpAddress ranges // Update existing vlans with networkId @@ -338,21 +335,23 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio @DB protected void saveUser() { - //ToDo: Add regionId to default users and accounts + int region_id = _configDao.getRegionId(); // insert system account - String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, region_id) VALUES (1, UUID(), 'system', '1', '1', '1')"; + String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, region_id) VALUES (1, UUID(), 'system', '1', '1', ?)"; Transaction txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); + stmt.setInt(1, region_id); stmt.executeUpdate(); } catch (SQLException ex) { } // insert system user insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, region_id)" + - " VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now(), '1')"; + " VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now(), ?)"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); + stmt.setInt(1, region_id); stmt.executeUpdate(); } catch (SQLException ex) { } @@ -365,21 +364,23 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio String lastname = "cloud"; // create an account for the admin user first - insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, region_id) VALUES (" + id + ", UUID(), '" + username + "', '1', '1', '1')"; + insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, region_id) VALUES (" + id + ", UUID(), '" + username + "', '1', '1', ?)"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); + stmt.setInt(1, region_id); stmt.executeUpdate(); } catch (SQLException ex) { } // now insert the user insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, state, region_id) " + - "VALUES (" + id + ", UUID(), '" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled', '1')"; + "VALUES (" + id + ", UUID(), '" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled', ?)"; txn = Transaction.currentTxn(); try { PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql); + stmt.setInt(1, region_id); stmt.executeUpdate(); } catch (SQLException ex) { } @@ -1272,9 +1273,4 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio return svcProviders; } - private void createDefaultRegion(){ - //Get Region name and URL from db.properties - _regionDao.persist(new RegionVO(_regionDao.getRegionId(), "Local", "http://localhost:8080/client/api", "", "")); - } - } diff --git a/server/src/com/cloud/upgrade/dao/Upgrade40to41.java b/server/src/com/cloud/upgrade/dao/Upgrade40to41.java index e7fea237700..92687643185 100644 --- a/server/src/com/cloud/upgrade/dao/Upgrade40to41.java +++ b/server/src/com/cloud/upgrade/dao/Upgrade40to41.java @@ -17,6 +17,7 @@ package com.cloud.upgrade.dao; +import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; @@ -33,48 +34,95 @@ import java.util.UUID; import org.apache.log4j.Logger; public class Upgrade40to41 implements DbUpgrade { - final static Logger s_logger = Logger.getLogger(Upgrade40to41.class); + final static Logger s_logger = Logger.getLogger(Upgrade40to41.class); - @Override - public String[] getUpgradableVersionRange() { - return new String[] { "4.0.0", "4.1.0" }; - } + @Override + public String[] getUpgradableVersionRange() { + return new String[] { "4.0.0", "4.1.0" }; + } - @Override - public String getUpgradedVersion() { - return "4.1.0"; - } + @Override + public String getUpgradedVersion() { + return "4.1.0"; + } - @Override - public boolean supportsRollingUpgrade() { - return false; - } + @Override + public boolean supportsRollingUpgrade() { + return false; + } - @Override - public File[] getPrepareScripts() { - String script = Script.findScript("", "db/schema-40to410.sql"); + @Override + public File[] getPrepareScripts() { + String script = Script.findScript("", "db/schema-40to410.sql"); if (script == null) { throw new CloudRuntimeException("Unable to find db/schema-40to410.sql"); } return new File[] { new File(script) }; - } + } - @Override - public void performDataMigration(Connection conn) { + @Override + public void performDataMigration(Connection conn) { + updateRegionEntries(conn); upgradeEIPNetworkOfferings(conn); upgradeEgressFirewallRules(conn); - } + } - @Override - public File[] getCleanupScripts() { + @Override + public File[] getCleanupScripts() { String script = Script.findScript("", "db/schema-40to410-cleanup.sql"); if (script == null) { throw new CloudRuntimeException("Unable to find db/schema-40to410-cleanup.sql"); } return new File[] { new File(script) }; - } + } + + private void updateRegionEntries(Connection conn) { + int region_id = Transaction.s_region_id; + PreparedStatement pstmt = null; + try { + //Update regionId in region table + s_logger.debug("Updating region table with Id: "+region_id); + pstmt = conn.prepareStatement("update `cloud`.`region` set id = ?"); + pstmt.setInt(1, region_id); + pstmt.executeUpdate(); + + //Update regionId in account table + s_logger.debug("Updating account table with Id: "+region_id); + pstmt = conn.prepareStatement("update `cloud`.`account` set region_id = ?"); + pstmt.setInt(1, region_id); + pstmt.executeUpdate(); + + //Update regionId in user table + s_logger.debug("Updating user table with Id: "+region_id); + pstmt = conn.prepareStatement("update `cloud`.`user` set region_id = ?"); + pstmt.setInt(1, region_id); + pstmt.executeUpdate(); + + //Update regionId in domain table + s_logger.debug("Updating domain table with Id: "+region_id); + pstmt = conn.prepareStatement("update `cloud`.`domain` set region_id = ?"); + pstmt.setInt(1, region_id); + pstmt.executeUpdate(); + + //Update regionId in cloud_usage account table + s_logger.debug("Updating cloud_usage account table with Id: "+region_id); + pstmt = conn.prepareStatement("update `cloud_usage`.`account` set region_id = ?"); + pstmt.setInt(1, region_id); + pstmt.executeUpdate(); + s_logger.debug("Successfully updated region entries with regionId: "+region_id); + } catch (SQLException e) { + throw new CloudRuntimeException("Error while updating region entries", e); + } finally { + try { + if (pstmt != null) { + pstmt.close(); + } + } catch (SQLException e) { + } + } + } private void upgradeEIPNetworkOfferings(Connection conn) { PreparedStatement pstmt = null; diff --git a/setup/db/db/schema-40to410.sql b/setup/db/db/schema-40to410.sql index 2cd7926cfe6..936a9c744a0 100644 --- a/setup/db/db/schema-40to410.sql +++ b/setup/db/db/schema-40to410.sql @@ -260,7 +260,8 @@ CREATE TABLE `cloud`.`region` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; --- INSERT INTO `cloud`.`region` values ('1','Local','http://localhost:8080/client/api','',''); +INSERT INTO `cloud`.`region` values ('1','Local','http://localhost:8080/client/api','',''); + ALTER TABLE `cloud`.`account` ADD COLUMN `region_id` int unsigned NOT NULL DEFAULT '1'; ALTER TABLE `cloud`.`user` ADD COLUMN `region_id` int unsigned NOT NULL DEFAULT '1'; ALTER TABLE `cloud`.`domain` ADD COLUMN `region_id` int unsigned NOT NULL DEFAULT '1'; diff --git a/tools/appliance/build.sh b/tools/appliance/build.sh index 4d9d8bd19dd..f0ac377a62b 100644 --- a/tools/appliance/build.sh +++ b/tools/appliance/build.sh @@ -41,32 +41,36 @@ done # Get appliance uuids machine_uuid=`vboxmanage showvminfo $appliance | grep UUID | head -1 | awk '{print $2}'` hdd_uuid=`vboxmanage showvminfo $appliance | grep vdi | head -1 | awk '{print $8}' | cut -d ')' -f 1` +hdd_path=`vboxmanage list hdds | grep $appliance | grep vdi | cut -c 14-` # Compact the virtual hdd vboxmanage modifyhd $hdd_uuid --compact # Start exporting -rm -fr dist +rm -fr dist *.ova *.vhd *.vdi *.qcow* *.bz2 mkdir dist +# Export for Xen +vboxmanage internalcommands converttoraw "$hdd_path" raw.img +vhd-util convert -s 0 -t 1 -i raw.img -o $appliance-$build_date-$branch-xen.vhd +bzip2 $appliance-$build_date-$branch-xen.vhd +echo "$appliance exported for Xen: dist/$appliance-$build_date-$branch-xen.vhd.bz2" + +# Export for KVM +vboxmanage internalcommands converttoraw "$hdd_path" raw.img +qemu-img convert -f raw -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2 +rm raw.img +bzip2 $appliance-$build_date-$branch-kvm.qcow2 +echo "$appliance exported for KVM: dist/$appliance-$build_date-$branch-kvm.qcow2.bz2" + # Export for VMWare vSphere -vboxmanage export $machine_uuid --output dist/$appliance-$build_date-$branch-vmware.ova +vboxmanage export $machine_uuid --output $appliance-$build_date-$branch-vmware.ova echo "$appliance exported for VMWare: dist/$appliance-$build_date-$branch-vmware.ova" # Export for HyperV -vboxmanage clonehd $hdd_uuid dist/$appliance-$build_date-$branch-hyperv.vhd --format VHD -bzip2 dist/$appliance-$build_date-$branch-hyperv.vhd +vboxmanage clonehd $hdd_uuid $appliance-$build_date-$branch-hyperv.vhd --format VHD +bzip2 $appliance-$build_date-$branch-hyperv.vhd echo "$appliance exported for HyperV: dist/$appliance-$build_date-$branch-hyperv.vhd.bz2" -# Export for KVM -vboxmanage clonehd $hdd_uuid dist/raw.img --format RAW -qemu-img convert -f raw -O qcow2 dist/raw.img dist/$appliance-$build_date-$branch-kvm.qcow2 -bzip2 dist/$appliance-$build_date-$branch-kvm.qcow2 -echo "$appliance exported for KVM: dist/$appliance-$build_date-$branch-kvm.qcow2.bz2" - -# Export for Xen -# This will be an overwrite convert so, do it at the end -vhd-util convert -s 0 -t 1 -i dist/raw.img -o dist/$appliance-$build_date-$branch-xen.vhd -bzip2 dist/$appliance-$build_date-$branch-xen.vhd -echo "$appliance exported for Xen: dist/$appliance-$build_date-$branch-xen.vhd.bz2" +mv *.bz2 *.ova dist/ diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/definitions/systemvmtemplate/cleanup.sh index c6a1e9068d6..9e98ab03531 100644 --- a/tools/appliance/definitions/systemvmtemplate/cleanup.sh +++ b/tools/appliance/definitions/systemvmtemplate/cleanup.sh @@ -2,6 +2,7 @@ #apt-get -y remove linux-headers-$(uname -r) build-essential apt-get -y remove dictionaries-common busybox apt-get -y autoremove +apt-get autoclean apt-get clean # Removing leftover leases and persistent rules diff --git a/tools/appliance/definitions/systemvmtemplate/definition.rb b/tools/appliance/definitions/systemvmtemplate/definition.rb index df9589c12cf..a6be769deee 100644 --- a/tools/appliance/definitions/systemvmtemplate/definition.rb +++ b/tools/appliance/definitions/systemvmtemplate/definition.rb @@ -1,7 +1,7 @@ Veewee::Definition.declare({ :cpu_count => '1', :memory_size=> '256', - :disk_size => '2048', :disk_format => 'VDI', :hostiocache => 'off', + :disk_size => '2000', :disk_format => 'VDI', :hostiocache => 'off', :os_type_id => 'Debian', :iso_file => "debian-wheezy-DI-b4-i386-netinst.iso", :iso_src => "http://cdimage.debian.org/cdimage/wheezy_di_beta4/i386/iso-cd/debian-wheezy-DI-b4-i386-netinst.iso", diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh index cbe2aab35ef..268379c1759 100644 --- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh +++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh @@ -27,7 +27,7 @@ install_packages() { # Basic packages apt-get --no-install-recommends -q -y --force-yes install rsyslog logrotate cron chkconfig insserv net-tools ifupdown vim-tiny netbase iptables - apt-get --no-install-recommends -q -y --force-yes install openssh-server openssl grub-legacy e2fsprogs dhcp3-client dnsmasq tcpdump socat wget + apt-get --no-install-recommends -q -y --force-yes install openssh-server openssl grub-legacy e2fsprogs dhcp3-client tcpdump socat wget apt-get --no-install-recommends -q -y --force-yes install python bzip2 sed gawk diffutils grep gzip less tar telnet ftp rsync traceroute psmisc lsof procps monit inetutils-ping iputils-arping httping apt-get --no-install-recommends -q -y --force-yes install dnsutils zip unzip ethtool uuid file iproute acpid virt-what sudo @@ -127,11 +127,22 @@ fix_hostname() { sed -i '/127.0.1.1/d' /etc/hosts } +fix_locale() { + cat >> /etc/default/locale << EOF +LANG=en_US.UTF-8 +LC_ALL=en_US.UTF-8 +EOF + cat >> /etc/locale.gen << EOF +en_US.UTF-8 UTF-8 +EOF +} + do_fixes() { fix_nameserver fix_inittab fix_acpid fix_hostname + fix_locale } configure_apache2() { diff --git a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh index 3fc80f7a704..cb793084f73 100644 --- a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh +++ b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh @@ -1,5 +1,6 @@ # Clean up stuff copied in by veewee -rm -f /root/* +rm -fv /root/*.iso +rm -fv /root/base.sh /root/cleanup.sh /root/postinstall.sh /root/zerodisk.sh echo "Cleaning up" diff --git a/ui/scripts/docs.js b/ui/scripts/docs.js index 5a38613f076..0ccedc5ddb1 100755 --- a/ui/scripts/docs.js +++ b/ui/scripts/docs.js @@ -20,6 +20,20 @@ cloudStack.docs = { desc: 'Any desired login ID. Must be unique in the current domain. The same username can exist in other domains, including sub-domains.', externalLink: '' }, + + helpOverridePublicNetwork:{ + desc:'Choose to override zone wide traffic label for guest traffic for this cluster', + externalLink:'' + + }, + + helpOverrideGuestNetwork:{ + + desc:'Choose to override zone wide traffic label for guest traffic for this cluster', + externalLink:'' + + }, + helpAccountPassword: { desc: 'Any desired password', externalLink: '' diff --git a/ui/scripts/network.js b/ui/scripts/network.js index daa09c78f3e..6fcd46040ef 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -4447,6 +4447,11 @@ cidr: { label: 'label.cidr' }, networkdomain: { label: 'label.network.domain' }, state: { label: 'label.state' }, + ispersistent:{ + label:'Persistent ', + converter:cloudStack.converters.toBooleanText + + }, restartrequired: { label: 'label.restart.required', converter: function(booleanValue) { diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 176b61ceaeb..2f105aff2ae 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -1104,8 +1104,9 @@ name: { label: 'label.name' }, type: { label: 'label.type' }, vlan: { label: 'label.vlan.id' }, - cidr: { label: 'label.cidr' }, - scope: { label: 'label.scope' } + cidr: { label: 'IPv4 CIDR' }, + ip6cidr: { label: 'IPv6 CIDR'} + //scope: { label: 'label.scope' } }, actions: { add: { @@ -1352,12 +1353,12 @@ if(this.id == selectedNetworkOfferingId) { if(this.guestiptype == "Isolated") { //*** Isolated *** if(this.specifyipranges == false) { - $form.find('.form-item[rel=guestStartIp]').hide(); - $form.find('.form-item[rel=guestEndIp]').hide(); + $form.find('.form-item[rel=startipv4]').hide(); + $form.find('.form-item[rel=endipv4]').hide(); } else { - $form.find('.form-item[rel=guestStartIp]').css('display', 'inline-block'); - $form.find('.form-item[rel=guestEndIp]').css('display', 'inline-block'); + $form.find('.form-item[rel=startipv4]').css('display', 'inline-block'); + $form.find('.form-item[rel=endipv4]').css('display', 'inline-block'); } var includingSourceNat = false; @@ -1369,20 +1370,20 @@ } } if(includingSourceNat == true) { //Isolated with SourceNat - cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=guestGateway]')); //make guestGateway optional - cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=guestNetmask]')); //make guestNetmask optional + cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=ip4gateway]')); //make ip4gateway optional + cloudStack.dialog.createFormField.validation.required.remove($form.find('.form-item[rel=ip4Netmask]')); //make ip4Netmask optional } else { //Isolated with no SourceNat - cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestGateway]')); //make guestGateway required - cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestNetmask]')); //make guestNetmask required + cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=ip4gateway]')); //make ip4gateway required + cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=ip4Netmask]')); //make ip4Netmask required } } else { //*** Shared *** - $form.find('.form-item[rel=guestStartIp]').css('display', 'inline-block'); - $form.find('.form-item[rel=guestEndIp]').css('display', 'inline-block'); + $form.find('.form-item[rel=startipv4]').css('display', 'inline-block'); + $form.find('.form-item[rel=endipv4]').css('display', 'inline-block'); - cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestGateway]')); //make guestGateway required - cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=guestNetmask]')); //make guestNetmask required + cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=ip4gateway]')); //make ip4gateway required + cloudStack.dialog.createFormField.validation.required.add($form.find('.form-item[rel=ip4Netmask]')); //make ip4Netmask required } if(this.specifyvlan == false) { @@ -1400,24 +1401,47 @@ } }, - guestGateway: { - label: 'label.guest.gateway', + //IPv4 (begin) + ip4gateway: { + label: 'IPv4 Gateway', docID: 'helpGuestNetworkZoneGateway' }, - guestNetmask: { - label: 'label.guest.netmask', + ip4Netmask: { + label: 'IPv4 Netmask', docID: 'helpGuestNetworkZoneNetmask' }, - guestStartIp: { - label: 'label.guest.start.ip', - validation: { required: true }, + startipv4: { + label: 'IPv4 Start IP', + validation: { required: true }, docID: 'helpGuestNetworkZoneStartIP' - }, - guestEndIp: { - label: 'label.guest.end.ip', - validation: { required: true }, + }, + endipv4: { + label: 'IPv4 End IP', + validation: { required: true }, docID: 'helpGuestNetworkZoneEndIP' - }, + }, + //IPv4 (end) + + //IPv6 (begin) + ip6gateway: { + label: 'IPv6 Gateway', + docID: 'helpGuestNetworkZoneGateway' + }, + ip6cidr: { + label: 'IPv6 CIDR' + }, + startipv6: { + label: 'IPv6 Start IP', + validation: { required: true }, + docID: 'helpGuestNetworkZoneStartIP' + }, + endipv6: { + label: 'IPv6 End IP', + validation: { required: true }, + docID: 'helpGuestNetworkZoneEndIP' + }, + //IPv6 (end) + networkdomain: { label: 'label.network.domain', docID: 'helpGuestNetworkZoneNetworkDomain' @@ -1473,16 +1497,28 @@ array1.push("&acltype=domain"); //server-side will make it Root domain (i.e. domainid=1) } - if(args.data.guestGateway != null && args.data.guestGateway.length > 0) - array1.push("&gateway=" + args.data.guestGateway); - if(args.data.guestNetmask != null && args.data.guestNetmask.length > 0) - array1.push("&netmask=" + args.data.guestNetmask); - - if(($form.find('.form-item[rel=guestStartIp]').css("display") != "none") && (args.data.guestStartIp != null && args.data.guestStartIp.length > 0)) - array1.push("&startip=" + args.data.guestStartIp); - if(($form.find('.form-item[rel=guestEndIp]').css("display") != "none") && (args.data.guestEndIp != null && args.data.guestEndIp.length > 0)) - array1.push("&endip=" + args.data.guestEndIp); - + //IPv4 (begin) + if(args.data.ip4gateway != null && args.data.ip4gateway.length > 0) + array1.push("&gateway=" + args.data.ip4gateway); + if(args.data.ip4Netmask != null && args.data.ip4Netmask.length > 0) + array1.push("&netmask=" + args.data.ip4Netmask); + if(($form.find('.form-item[rel=startipv4]').css("display") != "none") && (args.data.startipv4 != null && args.data.startipv4.length > 0)) + array1.push("&startip=" + args.data.startipv4); + if(($form.find('.form-item[rel=endipv4]').css("display") != "none") && (args.data.endipv4 != null && args.data.endipv4.length > 0)) + array1.push("&endip=" + args.data.endipv4); + //IPv4 (end) + + //IPv6 (begin) + if(args.data.ip6gateway != null && args.data.ip6gateway.length > 0) + array1.push("&gateway=" + args.data.ip6gateway); + if(args.data.ip6cidr != null && args.data.ip6cidr.length > 0) + array1.push("&netmask=" + args.data.ip6cidr); + if(($form.find('.form-item[rel=startipv6]').css("display") != "none") && (args.data.startipv6 != null && args.data.startipv6.length > 0)) + array1.push("&startip=" + args.data.startipv6); + if(($form.find('.form-item[rel=endipv6]').css("display") != "none") && (args.data.endipv6 != null && args.data.endipv6.length > 0)) + array1.push("&endip=" + args.data.endipv6); + //IPv6 (end) + if(args.data.networkdomain != null && args.data.networkdomain.length > 0) array1.push("&networkdomain=" + todb(args.data.networkdomain)); @@ -1841,9 +1877,13 @@ label: 'label.network.offering.id' }, - gateway: { label: 'label.gateway' }, + gateway: { label: 'IPv4 Gateway' }, //netmask: { label: 'label.netmask' }, - cidr: { label: 'label.cidr' }, + cidr: { label: 'IPv4 CIDR' }, + + ip6gateway: { label: 'IPv6 Gateway' }, + ip6cidr: { label: 'IPv6 CIDR' }, + networkdomaintext: { label: 'label.network.domain' }, @@ -7347,6 +7387,7 @@ docID: 'helpClusterHypervisor', select: function(args) { var vSwitchEnabled = false; + var dvSwitchEnabled = false; $.ajax({ url: createURL("listHypervisors"), @@ -7375,6 +7416,21 @@ } } }); + + //Check whether dvSwitch is enabled or not + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.dvswitch' + }, + async: false, + success: function(json) { + if (json.listconfigurationsresponse.configuration[0].value == 'true') { + dvSwitchEnabled = true; + } + } + }); + args.$select.bind("change", function(event) { var $form = $(this).closest('form'); @@ -7390,6 +7446,31 @@ if ($(this).val() == "VMware") { //$('li[input_sub_group="external"]', $dialogAddCluster).show(); + + if(dvSwitchEnabled){ + // $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'inline-block'); + // $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'inline-block'); + // $form.find('.form-item[rel=vSwitchPublicName]').css('display','inline-block'); + //$form.find('.form-item[rel=vSwitchGuestName]').css('display','inline-block'); + $form.find('.form-item[rel=overridepublictraffic]').css('display','inline-block'); + $form.find('.form-item[rel=overridepublictraffic]').find('input[type=checkbox]').removeAttr('checked'); + + $form.find('.form-item[rel=overrideguesttraffic]').css('display','inline-block'); + $form.find('.form-item[rel=overrideguesttraffic]').find('input[type=checkbox]').removeAttr('checked'); + + + + } + else { + // $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none'); + // $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none'); + // $form.find('.form-item[rel=vSwitchPublicName]').css('display','none'); + // $form.find('.form-item[rel=vSwitchGuestName]').css('display','none'); + $form.find('.form-item[rel=overridepublictraffic]').css('display','none'); + $form.find('.form-item[rel=overrideguesttraffic]').css('display','none'); + + + } $form.find('.form-item[rel=vCenterHost]').css('display', 'inline-block'); $form.find('.form-item[rel=vCenterUsername]').css('display', 'inline-block'); $form.find('.form-item[rel=vCenterPassword]').css('display', 'inline-block'); @@ -7401,6 +7482,16 @@ $vsmFields.css('display', 'none'); } } else { + + + $form.find('.form-item[rel=overridepublictraffic]').css('display', 'none'); + $form.find('.form-item[rel=overrideguesttraffic]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchPublicName]').css('display','none'); + $form.find('.form-item[rel=vSwitchGuestName]').css('display','none'); + + $form.find('.form-item[rel=vCenterHost]').css('display', 'none'); $form.find('.form-item[rel=vCenterUsername]').css('display', 'none'); $form.find('.form-item[rel=vCenterPassword]').css('display', 'none'); @@ -7453,6 +7544,7 @@ }, //hypervisor==VMWare begins here + vCenterHost: { label: 'label.vcenter.host', docID: 'helpClustervCenterHost', @@ -7474,6 +7566,136 @@ docID: 'helpClustervCenterDatacenter', validation: { required: true } }, + + overridepublictraffic:{ + label:'Override Public-Traffic', + isBoolean:true, + isHidden:true, + isChecked:false, + docID:'helpOverridePublicNetwork' + + }, + + + vSwitchPublicType:{ + label: 'Public Traffic vSwitch Type', + select: function(args) { + var vSwitchEnabled = false; + var items = [] + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.nexus.vswitch' + }, + async: false, + success: function(json) { + if (json.listconfigurationsresponse.configuration[0].value == 'true') { + vSwitchEnabled = true; + } + } + }); + + if(vSwitchEnabled) { + + items.push({ id:" nexusdvs" , description: "Cisco Nexus 1000v Distributed Virtual Switch"}); + + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + + + + + } + + // items.push({id: "" , description:" " }); + else{ + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + + + items.push({ id:" nexusdvs" , description: "Cisco Nexus 1000v Distributed Virtual Switch"}); + } + + args.response.success({data: items}); + }, + isHidden:true, + dependsOn:'overridepublictraffic' + }, + + vSwitchPublicName:{ + label:'Public Traffic vSwitch Name', + dependsOn:'overridepublictraffic', + isHidden:true + + + }, + + overrideguesttraffic:{ + label:'Override Guest-Traffic', + isBoolean:true, + isHidden:true, + isChecked:false, + docID:'helpOverrideGuestNetwork' + + }, + + + vSwitchGuestType:{ + label: 'Guest Traffic vSwitch Type', + select: function(args) { + var items = [] + // items.push({id: "" , description:" " }); + + var vSwitchEnabled = false; + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.nexus.vswitch' + }, + async: false, + success: function(json) { + if (json.listconfigurationsresponse.configuration[0].value == 'true') { + vSwitchEnabled = true; + } + } + }); + + + if(vSwitchEnabled){ + items.push({ id:" nexusdvs" , description: "Cisco Nexus 1000v Distributed Virtual Switch"}); + + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + + + } + + + else{ + + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + + items.push({ id:" nexusdvs" , description: "Cisco Nexus 1000v Distributed Virtual Switch"}); + + + } + args.response.success({data: items}); + }, + isHidden:true, + dependsOn:'overrideguesttraffic' + + }, + + vSwitchGuestName:{ + label:' Guest Traffic vSwitch Name', + dependsOn:'overrideguesttraffic', + isHidden:true + + + }, + + vsmipaddress: { label: 'Nexus 1000v IP Address', validation: { required: true }, @@ -7519,6 +7741,21 @@ if(args.data.hypervisor == "VMware") { array1.push("&username=" + todb(args.data.vCenterUsername)); array1.push("&password=" + todb(args.data.vCenterPassword)); + + //vSwitch Public Type + if(args.data.vSwitchPublicType != "") + array1.push("&publicvswitchtype=" + args.data.vSwitchPublicType); + + if(args.data.vSwitchPublicName != "") + array1.push("&publicvswitchname=" +args.data.vSwitchPublicName); + + + //vSwitch Guest Type + if(args.data.vSwitchGuestType != "") + array1.push("&guestvswitchtype=" + args.data.vSwitchGuestType); + + if(args.data.vSwitchGuestName !="") + array1.push("&guestvswitchname=" +args.data.vSwitchGuestName); if (args.data.vsmipaddress) { array1.push('&vsmipaddress=' + args.data.vsmipaddress); @@ -9709,8 +9946,10 @@ listView: { section: 'guest-IP-range', fields: { - startip: { label: 'label.start.IP' }, - endip: { label: 'label.end.IP' } + startip: { label: 'IPv4 Start IP' }, + endip: { label: 'IPv4 End IP' }, + startipv6: { label: 'IPv6 Start IP' }, + endipv6: { label: 'IPv6 End IP' } }, dataProvider: function(args) { @@ -9731,16 +9970,24 @@ createForm: { title: 'label.add.ip.range', fields: { - guestStartIp: { label: 'label.guest.start.ip' }, - guestEndIp: { label: 'label.guest.end.ip' } + startipv4: { label: 'IPv4 Start IP' }, + endipv4: { label: 'IPv4 End IP' }, + startipv6: { label: 'IPv6 Start IP' }, + endipv6: { label: 'IPv6 End IP' } } }, action: function(args) { var array2 = []; - array2.push("&startip=" + args.data.guestStartIp); - var endip = args.data.guestEndIp; - if(endip != null && endip.length > 0) - array2.push("&endip=" + endip); + if(args.data.startipv4 != null && args.data.startipv4.length > 0) + array2.push("&startip=" + args.data.startipv4); + if(args.data.endipv4 != null && args.data.endipv4.length > 0) + array2.push("&endip=" + args.data.endipv4); + + if(args.data.startipv6 != null && args.data.startipv6.length > 0) + array2.push("&startipv6=" + args.data.startipv6); + if(args.data.endipv6 != null && args.data.endipv6.length > 0) + array2.push("&endipv6=" + args.data.endipv6); + $.ajax({ url: createURL("createVlanIpRange&forVirtualNetwork=false&networkid=" + args.context.networks[0].id + array2.join("")), dataType: "json", diff --git a/ui/scripts/ui-custom/regions.js b/ui/scripts/ui-custom/regions.js index 744a9d9ecb3..02496726903 100644 --- a/ui/scripts/ui-custom/regions.js +++ b/ui/scripts/ui-custom/regions.js @@ -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. + (function($, cloudStack) { $(window).bind('cloudStack.ready', function() { // Region switcher diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index c198a91c52b..4281ca283fa 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -1690,6 +1690,13 @@ state: { label: 'label.state' }, + + ispersistent:{ + label:'Persistent ', + converter:cloudStack.converters.toBooleanText + + }, + restartrequired: { label: 'label.restart.required', converter: function(booleanValue) { diff --git a/ui/scripts/zoneWizard.js b/ui/scripts/zoneWizard.js index 8b5171bd9c2..d8684fb8e28 100755 --- a/ui/scripts/zoneWizard.js +++ b/ui/scripts/zoneWizard.js @@ -344,14 +344,24 @@ label: 'label.name', validation: { required: true }, desc: 'message.tooltip.zone.name' }, - dns1: { - label: 'label.dns.1', validation: { required: true }, + ip4dns1: { + label: 'IPv4 DNS1', validation: { required: true }, desc: 'message.tooltip.dns.1' }, - dns2: { - label: 'label.dns.2', + ip4dns2: { + label: 'IPv4 DNS2', desc: 'message.tooltip.dns.2' }, + + ip6dns1: { + label: 'IPv6 DNS1', + desc: 'message.tooltip.dns.1' + }, + ip6dns2: { + label: 'IPv6 DNS2', + desc: 'message.tooltip.dns.2' + }, + internaldns1: { label: 'label.internal.dns.1', validation: { required: true }, desc: 'message.tooltip.internal.dns.1' @@ -732,7 +742,7 @@ }); var vSwitchEnabled = false; - + var dvSwitchEnabled = false; // Check whether vSwitch capability is enabled $.ajax({ url: createURL('listConfigurations'), @@ -747,6 +757,17 @@ } }); + //Check whether dvSwitch is enabled or not + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.dvswitch' + }, + async: false, + success: function(json) { if (json.listconfigurationsresponse.configuration[0].value == 'true') { dvSwitchEnabled = true; + } + } }); + args.$select.bind("change", function(event) { var $form = $(this).closest('form'); var $vsmFields = $form.find('[rel]').filter(function() { @@ -761,6 +782,35 @@ if($(this).val() == "VMware") { //$('li[input_sub_group="external"]', $dialogAddCluster).show(); + if(dvSwitchEnabled ){ + /* $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'inline-block'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'inline-block'); + + $form.find('.form-item[rel=vSwitchPublicName]').css('display','inline-block'); + $form.find('.form-item[rel=vSwitchGuestName]').css('display','inline-block'); + + $form.find('.form-item[rel=overridepublictraffic]').find('input[type=checkbox]').css('display','inline-block'); + $form.find('.form-item[rel=overrideguesttraffic]').find('input[type=checkbox]').css('display','inline-block');*/ + + $form.find('.form-item[rel=overridepublictraffic]').css('display','inline-block'); + $form.find('.form-item[rel=overridepublictraffic]').find('input[type=checkbox]').removeAttr('checked'); + + $form.find('.form-item[rel=overrideguesttraffic]').css('display','inline-block'); + $form.find('.form-item[rel=overrideguesttraffic]').find('input[type=checkbox]').removeAttr('checked'); + + + + } + else { + /* $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchPublicName]').css('display','none'); + $form.find('.form-item[rel=vSwitchGuestName]').css('display','none');*/ + $form.find('.form-item[rel=overridepublictraffic]').css('display','none'); + $form.find('.form-item[rel=overrideguesttraffic]').css('display','none'); + + } + $form.find('[rel=vCenterHost]').css('display', 'block'); $form.find('[rel=vCenterUsername]').css('display', 'block'); $form.find('[rel=vCenterPassword]').css('display', 'block'); @@ -775,6 +825,15 @@ } else { //$('li[input_group="vmware"]', $dialogAddCluster).hide(); + + $form.find('.form-item[rel=overridepublictraffic]').css('display', 'none'); + $form.find('.form-item[rel=overrideguesttraffic]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchPublicName]').css('display','none'); + $form.find('.form-item[rel=vSwitchGuestName]').css('display','none'); + + $form.find('[rel=vCenterHost]').css('display', 'none'); $form.find('[rel=vCenterUsername]').css('display', 'none'); $form.find('[rel=vCenterPassword]').css('display', 'none'); @@ -791,6 +850,7 @@ }, //hypervisor==VMWare begins here + vCenterHost: { label: 'label.vcenter.host', validation: { required: true } @@ -808,6 +868,131 @@ label: 'label.vcenter.datacenter', validation: { required: true } }, + + overridepublictraffic:{ + label:'Override Public-Traffic', + isBoolean:true, + isHidden:true + + }, + + + vSwitchPublicType:{ + label: 'Public Traffic vSwitch Type', + select: function(args) { + var items = [] + var vSwitchEnabled = false; + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.nexus.vswitch' + }, + async: false, + success: function(json) { + if (json.listconfigurationsresponse.configuration[0].value == 'true') { + vSwitchEnabled = true; + } + } + }); + + if(vSwitchEnabled) { + + items.push({ id:" nexusdvs" , description: "Cisco Nexus 1000v Distributed Virtual Switch"}); + + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + + + + + } + + // items.push({id: " ", description: " "}); + else{ + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + + + items.push({ id:" nexusdvs" , description: "Cisco Nexus 1000v Distributed Virtual Switch"}); + + } + args.response.success({data: items}); + }, + isHidden:true, + dependsOn:'overridepublictraffic' + }, + + vSwitchPublicName:{ + label:'vSwitch Public Traffic Name', + dependsOn:'overridepublictraffic', + isHidden:true + + + }, + + overrideguesttraffic:{ + label:'Override Guest-Traffic', + isBoolean:true, + isHidden:true + + }, + + + vSwitchGuestType:{ + label: 'Guest Traffic vSwitch Type', + select: function(args) { + var items = [] + //items.push({ id:" ", description:" "}); + + var vSwitchEnabled = false; + var items = [] + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.nexus.vswitch' + }, + async: false, + success: function(json) { + if (json.listconfigurationsresponse.configuration[0].value == 'true') { + vSwitchEnabled = true; + } + } + }); + + if(vSwitchEnabled) { + + items.push({ id:" nexusdvs" , description: "Cisco Nexus 1000v Distributed Virtual Switch"}); + + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + + + + + } + else{ + + items.push({id: "vmwaresvs", description: "VMware vNetwork Standard Virtual Switch"}); + items.push({id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch"}); + + items.push({ id:" nexusdvs" , description: "Cisco Nexus 1000v Distributed Virtual Switch"}); + + } + args.response.success({data: items}); + + }, isHidden:true, + dependsOn:'overrideguesttraffic' + + }, + + vSwitchGuestName:{ + label:'vSwitch Guest Traffic Name', + dependsOn:'overrideguesttraffic', + isHidden:true + + }, + + //Cisco Nexus Vswitch vsmipaddress: { label: 'Nexus 1000v IP Address', validation: { required: true }, @@ -1319,11 +1504,19 @@ if (args.data.zone.localstorageenabled == 'on') { array1.push("&localstorageenabled=true"); } - array1.push("&dns1=" + todb(args.data.zone.dns1)); - - var dns2 = args.data.zone.dns2; - if (dns2 != null && dns2.length > 0) - array1.push("&dns2=" + todb(dns2)); + + //IPv4 + if (args.data.zone.ip4dns1 != null && args.data.zone.ip4dns1.length > 0) + array1.push("&dns1=" + todb(args.data.zone.ip4dns1)); + if (args.data.zone.ip4dns2 != null && args.data.zone.ip4dns2.length > 0) + array1.push("&dns2=" + todb(args.data.zone.ip4dns2)); + + //IPv6 + if (args.data.zone.ip6dns1 != null && args.data.zone.ip6dns1.length > 0) + array1.push("&ip6dns1=" + todb(args.data.zone.ip6dns1)); + if (args.data.zone.ip6dns2 != null && args.data.zone.ip6dns2.length > 0) + array1.push("&ip6dns2=" + todb(args.data.zone.ip6dns2)); + array1.push("&internaldns1="+todb(args.data.zone.internaldns1)); @@ -2917,7 +3110,23 @@ array1.push("&username=" + todb(args.data.cluster.vCenterUsername)); array1.push("&password=" + todb(args.data.cluster.vCenterPassword)); - if (args.data.cluster.vsmipaddress) { // vSwitch is enabled + //dvswitch is enabled + if(args.data.cluster.vSwitchPublicType != "") + array1.push('&publicvswitchtype=' + args.data.cluster.vSwitchPublicType); + + if(args.data.cluster.vSwitchPublicName != "") + array1.push("&publicvswitchname=" +args.data.cluster.vSwitchPublicName); + + + + if(args.data.cluster.vSwitchGuestType != "") + array1.push('&guestvswitchtype=' + args.data.cluster.vSwitchGuestType); + + if(args.data.cluster.vSwitchGuestName !="") + array1.push("&guestvswitchname=" +args.data.cluster.vSwitchGuestName); + + + if (args.data.cluster.vsmipaddress) { // vSwitch is enabled array1.push('&vsmipaddress=' + args.data.cluster.vsmipaddress); array1.push('&vsmusername=' + args.data.cluster.vsmusername); array1.push('&vsmpassword=' + args.data.cluster.vsmpassword);