Merge branch 'master' into vim51_win8

This commit is contained in:
Min Chen 2013-02-28 14:25:26 -08:00
commit 801e5269ea
31 changed files with 886 additions and 175 deletions

View File

@ -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;
protected ScaleVmAnswer() {
}
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> K getNextInSequence(final Class<K> clazz, final String name) {
return getRandomlyIncreasingNextInSequence(clazz, name);
public ScaleVmAnswer(ScaleVmCommand cmd, boolean result, String detail) {
super(cmd, result, detail);
}
}

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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<Long> networkIds;

View File

@ -22,7 +22,7 @@
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j-cloud.xml</param-value>
<param-value>classpath:log4j-cloud.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>

View File

@ -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

View File

@ -48,7 +48,6 @@
<bean id="consoleProxyManagerImpl" class="com.cloud.consoleproxy.ConsoleProxyManagerImpl" />
<bean id="securityGroupManagerImpl2" class="com.cloud.network.security.SecurityGroupManagerImpl2" />
<bean id="premiumSecondaryStorageManagerImpl" class="com.cloud.secstorage.PremiumSecondaryStorageManagerImpl" />
<!-- <bean id="randomlyIncreasingVMInstanceDaoImpl" class="com.cloud.vm.dao.RandomlyIncreasingVMInstanceDaoImpl" /> -->
<bean id="userVmDaoImpl" class="com.cloud.vm.dao.UserVmDaoImpl" />
<bean id="ipv6AddressManagerImpl" class="com.cloud.network.Ipv6AddressManagerImpl" />

View File

@ -49,7 +49,6 @@
<bean id="consoleProxyManagerImpl" class="com.cloud.consoleproxy.ConsoleProxyManagerImpl" />
<bean id="securityGroupManagerImpl2" class="com.cloud.network.security.SecurityGroupManagerImpl2" />
<bean id="premiumSecondaryStorageManagerImpl" class="com.cloud.secstorage.PremiumSecondaryStorageManagerImpl" />
<!-- <bean id="randomlyIncreasingVMInstanceDaoImpl" class="com.cloud.vm.dao.RandomlyIncreasingVMInstanceDaoImpl" /> -->
<bean id="userVmDaoImpl" class="com.cloud.vm.dao.UserVmDaoImpl" />
<bean id="ipv6AddressManagerImpl" class="com.cloud.network.Ipv6AddressManagerImpl" />
@ -123,13 +122,14 @@
<!--
Storage pool allocators
-->
<bean id="LocalStoragePoolAllocator" class="com.cloud.storage.allocator.LocalStoragePoolAllocator">
<bean id="LocalStoragePoolAllocator" class="org.apache.cloudstack.storage.allocator.LocalStoragePoolAllocator">
<property name="name" value="LocalStorage"/>
</bean>
<bean id="FirstFitStoragePoolAllocator" class="com.cloud.storage.allocator.FirstFitStoragePoolAllocator">
<!--
<bean id="FirstFitStoragePoolAllocator" class="org.apache.cloudstack.storage.allocator.FirstFitStoragePoolAllocator">
<property name="name" value="Storage"/>
</bean>
-->
<bean id="UserConcentratedAllocator" class="com.cloud.agent.manager.allocator.impl.UserConcentratedAllocator">
<property name="name" value="User First"/>
</bean>

6
debian/control vendored
View File

@ -2,7 +2,7 @@ Source: cloudstack
Section: libs
Priority: extra
Maintainer: Wido den Hollander <wido@widodh.nl>
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.

14
debian/rules vendored
View File

@ -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

View File

@ -21,10 +21,23 @@
specific language governing permissions and limitations
under the License.
-->
<section id="vlan-provisioning">
<title>VLAN Provisioning</title>
<para>&PRODUCT; automatically creates and destroys interfaces bridged to VLANs on the hosts. In general the administrator does not need to manage this process.</para>
<para>&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.</para>
<para>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. </para>
<title>VLAN Provisioning</title>
<para>&PRODUCT; automatically creates and destroys interfaces bridged to VLANs on the hosts. In
general the administrator does not need to manage this process.</para>
<para>&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.</para>
<para>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.</para>
<para>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.</para>
</section>

View File

@ -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<VirtualMachineEn
@Override
public VirtualMachineEntityImpl getObject() throws Exception {
return new VirtualMachineEntityImpl();
return ComponentContext.inject(VirtualMachineEntityImpl.class.newInstance());
}
@Override

View File

@ -176,9 +176,7 @@ public class CloudOrchestrator implements OrchestrationService {
VirtualMachineEntityImpl vmEntity = null;
try {
//vmEntity = _vmEntityFactory.getObject();
vmEntity = VirtualMachineEntityImpl.class.newInstance();
vmEntity = ComponentContext.inject(vmEntity);
vmEntity = _vmEntityFactory.getObject();
} catch (Exception e) {
// add error handling here
}

View File

@ -227,6 +227,10 @@ for name in db.properties log4j-cloud.xml tomcat6-nonssl.conf tomcat6-ssl.conf s
mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/$name \
${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/$name
done
ln -s %{_sysconfdir}/%{name}/management/log4j-cloud.xml \
${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/log4j-cloud.xml
mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/context.xml \
${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost/client

View File

@ -170,7 +170,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
paramGuestVswitchName = _urlParams.get(ApiConstants.VSWITCH_NAME_GUEST_TRAFFIC);
paramPublicVswitchType = _urlParams.get(ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC);
paramPublicVswitchName = _urlParams.get(ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC);
defaultVirtualSwitchType = getDefaultVirtualSwitchType(nexusDVS);
defaultVirtualSwitchType = getDefaultVirtualSwitchType();
}
// Get zone wide traffic labels for Guest traffic and Public traffic
guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(dcId, HypervisorType.VMware);
@ -594,7 +594,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
String guestTrafficLabel = _netmgr.getDefaultGuestTrafficLabel(host.getDataCenterId(), HypervisorType.VMware);
String publicTrafficLabel = _netmgr.getDefaultPublicTrafficLabel(host.getDataCenterId(), HypervisorType.VMware);
_readGlobalConfigParameters();
VirtualSwitchType defaultVirtualSwitchType = getDefaultVirtualSwitchType(nexusDVS);
VirtualSwitchType defaultVirtualSwitchType = getDefaultVirtualSwitchType();
params.put("guestTrafficInfo", getTrafficInfo(TrafficType.Guest, guestTrafficLabel, clusterDetails, defaultVirtualSwitchType));
params.put("publicTrafficInfo", getTrafficInfo(TrafficType.Public, publicTrafficLabel, clusterDetails, defaultVirtualSwitchType));
@ -602,8 +602,13 @@ public class VmwareServerDiscoverer extends DiscovererBase implements
return params;
}
private VirtualSwitchType getDefaultVirtualSwitchType(boolean nexusDVS) {
return nexusDVS ? VirtualSwitchType.NexusDistributedVirtualSwitch : VirtualSwitchType.VMwareDistributedVirtualSwitch;
private VirtualSwitchType getDefaultVirtualSwitchType() {
if (nexusDVS)
return VirtualSwitchType.NexusDistributedVirtualSwitch;
else if(useDVS)
return VirtualSwitchType.VMwareDistributedVirtualSwitch;
else
return VirtualSwitchType.StandardVirtualSwitch;
}
@Override

View File

@ -24,6 +24,7 @@ import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -35,6 +36,7 @@ import javax.inject.Inject;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.InfrastructureEntity;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@ -106,7 +108,7 @@ public class ApiDispatcher {
}
private void doAccessChecks(BaseCmd cmd, List<Object> entitiesToAccess) {
private void doAccessChecks(BaseCmd cmd, Map<Object, AccessType> 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,7 +164,7 @@ public class ApiDispatcher {
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void processParameters(BaseCmd cmd, Map<String, String> params) {
List<Object> entitiesToAccess = new ArrayList<Object>();
Map<Object, AccessType> entitiesToAccess = new HashMap<Object, AccessType>();
Map<String, Object> unpackedParams = cmd.unpackParams(params);
cmd = ComponentContext.getTargetObject(cmd);
@ -258,7 +260,7 @@ public class ApiDispatcher {
List<Long> listParam = (List<Long>) 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;

View File

@ -305,10 +305,17 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> 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);
}

View File

@ -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", "", ""));
}
}

View File

@ -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;

View File

@ -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';

View File

@ -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/

View File

@ -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

View File

@ -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",

View File

@ -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() {

View File

@ -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"

View File

@ -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: ''

View File

@ -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) {

View File

@ -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,15 +1497,27 @@
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);
//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)
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);
//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"),
@ -7376,6 +7417,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');
var $vsmFields = $form.find('.form-item').filter(function() {
@ -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 },
@ -7520,6 +7742,21 @@
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);
array1.push('&vsmusername=' + args.data.vsmusername);
@ -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",

View File

@ -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

View File

@ -1690,6 +1690,13 @@
state: {
label: 'label.state'
},
ispersistent:{
label:'Persistent ',
converter:cloudStack.converters.toBooleanText
},
restartrequired: {
label: 'label.restart.required',
converter: function(booleanValue) {

View File

@ -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);