Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cloudstack into disk_io_throttling

This commit is contained in:
Wei Zhou 2013-06-13 13:48:53 +02:00
commit fde158df60
59 changed files with 873 additions and 311 deletions

View File

@ -26,6 +26,7 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
@ -62,6 +63,9 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
@Parameter(name=ApiConstants.ZONE_TYPE, type=CommandType.STRING, description="the network type of the zone that the virtual machine belongs to")
private String zoneType;
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "list snapshots by zone id")
private Long zoneId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -89,6 +93,10 @@ public class ListSnapshotsCmd extends BaseListTaggedResourcesCmd {
public String getZoneType() {
return zoneType;
}
public Long getZoneId() {
return zoneId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////

View File

@ -39,10 +39,10 @@ public class FirewallResponse extends BaseResponse {
private String endPort;
@SerializedName(ApiConstants.IP_ADDRESS_ID) @Param(description="the public ip address id for the firewall rule")
private Long publicIpAddressId;
private String publicIpAddressId;
@SerializedName(ApiConstants.NETWORK_ID) @Param(description="the network id of the firewall rule")
private Long networkId;
private String networkId;
@SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the public ip address for the firewall rule")
private String publicIpAddress;
@ -78,7 +78,7 @@ public class FirewallResponse extends BaseResponse {
this.endPort = endPort;
}
public void setPublicIpAddressId(Long publicIpAddressId) {
public void setPublicIpAddressId(String publicIpAddressId) {
this.publicIpAddressId = publicIpAddressId;
}
@ -86,7 +86,7 @@ public class FirewallResponse extends BaseResponse {
this.publicIpAddress = publicIpAddress;
}
public void setNetworkId(Long networkId) {
public void setNetworkId(String networkId) {
this.networkId = networkId;
}

View File

@ -93,6 +93,10 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
@Param(description = "the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage")
private Snapshot.State state;
@SerializedName(ApiConstants.ZONE_ID)
@Param(description = "id of the availability zone")
private String zoneId;
@SerializedName(ApiConstants.ZONE_NAME)
@Param(description = "name of the availability zone")
private String zoneName;
@ -181,6 +185,9 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe
this.projectName = projectName;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}

View File

@ -91,8 +91,6 @@ public class ServiceProvider extends ManagerBase {
// register service implementation object
Transaction txn = Transaction.open(Transaction.AWSAPI_DB);
txn.close();
serviceMap.put(AmazonS3SkeletonInterface.class, new S3SerializableServiceImplementation(engine));
serviceMap.put(AmazonEC2SkeletonInterface.class, new EC2SoapServiceImpl(EC2_engine));
}
public synchronized static ServiceProvider getInstance() {
@ -101,7 +99,9 @@ public class ServiceProvider extends ManagerBase {
@PostConstruct
void initComponent() {
instance = this;
serviceMap.put(AmazonS3SkeletonInterface.class, new S3SerializableServiceImplementation(engine));
serviceMap.put(AmazonEC2SkeletonInterface.class, new EC2SoapServiceImpl(EC2_engine));
instance = this;
}
public boolean configure(String name, Map<String, Object> params)

View File

@ -23,7 +23,8 @@ public class ScaleVmCommand extends Command {
VirtualMachineTO vm;
String vmName;
int cpus;
Integer speed;
Integer minSpeed;
Integer maxSpeed;
long minRam;
long maxRam;
@ -40,14 +41,15 @@ public class ScaleVmCommand extends Command {
}
public ScaleVmCommand(String vmName, int cpus,
Integer speed, long minRam, long maxRam, boolean limitCpuUse) {
Integer minSpeed, Integer maxSpeed, long minRam, long maxRam, boolean limitCpuUse) {
super();
this.vmName = vmName;
this.cpus = cpus;
this.speed = speed;
this.minSpeed = minSpeed;
this.maxSpeed = maxSpeed;
this.minRam = minRam;
this.maxRam = maxRam;
this.vm = new VirtualMachineTO(1L, vmName, null, cpus, speed, minRam, maxRam, null, null, false, false, null);
this.vm = new VirtualMachineTO(1L, vmName, null, cpus, minSpeed, maxSpeed, minRam, maxRam, null, null, false, limitCpuUse, null);
/*vm.setName(vmName);
vm.setCpus(cpus);
vm.setRam(minRam, maxRam);*/
@ -57,14 +59,22 @@ public class ScaleVmCommand extends Command {
this.cpus = cpus;
}
public Integer getSpeed() {
return speed;
public Integer getMinSpeed() {
return minSpeed;
}
public void setSpeed(Integer speed) {
this.speed = speed;
public void setMinSpeed(Integer minSpeed) {
this.minSpeed = minSpeed;
}
public Integer getMaxSpeed() {
return minSpeed;
}
public void setMaxSpeed(Integer maxSpeed) {
this.maxSpeed = maxSpeed;
}
public long getMinRam() {
return minRam;
}

View File

@ -111,7 +111,7 @@ public class VirtualRoutingResource implements Manager {
private String _routerProxyPath;
private String _createIpAliasPath;
private String _deleteIpAliasPath;
private String _configDhcpPath;
private String _callDnsMasqPath;
private int _timeout;
private int _startTimeout;
@ -625,7 +625,8 @@ public class VirtualRoutingResource implements Manager {
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
final Script command = new Script(_createIpAliasPath, _timeout, s_logger);
List<IpAliasTO> ipAliasTOs = cmd.getIpAliasList();
String args=routerIp+" ";
String args = "";
command.add(routerIp);
for (IpAliasTO ipaliasto : ipAliasTOs) {
args = args + ipaliasto.getAlias_count()+":"+ipaliasto.getRouterip()+":"+ipaliasto.getNetmask()+"-";
}
@ -637,7 +638,8 @@ public class VirtualRoutingResource implements Manager {
protected Answer execute(final DeleteIpAliasCommand cmd) {
final Script command = new Script(_deleteIpAliasPath, _timeout, s_logger);
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
String args = "";
String args ="";
command.add(routerIp);
List<IpAliasTO> revokedIpAliasTOs = cmd.getDeleteIpAliasTos();
for (IpAliasTO ipAliasTO : revokedIpAliasTOs) {
args = args + ipAliasTO.getAlias_count()+":"+ipAliasTO.getRouterip()+":"+ipAliasTO.getNetmask()+"-";
@ -653,32 +655,26 @@ public class VirtualRoutingResource implements Manager {
}
protected Answer execute(final DnsMasqConfigCommand cmd) {
final Script command = new Script(_configDhcpPath, _timeout, s_logger);
final Script command = new Script(_callDnsMasqPath, _timeout, s_logger);
String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP);
DnsMasqConfigurator configurator = new DnsMasqConfigurator();
String [] config = configurator.generateConfiguration(cmd);
File tmpCfgFile = null;
String cfgFileName = routerIp.replace(".","-")+"dns.cgf";
String tmpCfgFileContents = "";
for (int i = 0; i < config.length; i++) {
tmpCfgFileContents += config[i];
tmpCfgFileContents += "\n";
}
File permKey = new File("/root/.ssh/id_rsa.cloud");
String cfgFilePath = "/tmp/"+cfgFileName;
try {
String cfgFilePath = "";
if (routerIp != null) {
tmpCfgFile = File.createTempFile(routerIp.replace('.', '_'), "cfg");
final PrintWriter out
= new PrintWriter(new BufferedWriter(new FileWriter(tmpCfgFile)));
for (int i=0; i < config.length; i++) {
out.println(config[i]);
}
out.close();
cfgFilePath = tmpCfgFile.getAbsolutePath();
}
SshHelper.scpTo(routerIp, 3922, "root", permKey, null, "/tmp/", tmpCfgFileContents.getBytes(), cfgFileName, null);
command.add(routerIp);
command.add(cfgFilePath);
final String result = command.execute();
return new Answer(cmd, result == null, result);
} catch (final IOException e) {
} catch (Exception e) {
return new Answer(cmd, false, e.getMessage());
} finally {
if (tmpCfgFile != null) {
tmpCfgFile.delete();
}
}
}
@ -1209,6 +1205,18 @@ public class VirtualRoutingResource implements Manager {
if (_routerProxyPath == null) {
throw new ConfigurationException("Unable to find router_proxy.sh");
}
_createIpAliasPath = findScript("createipAlias.sh");
if (_createIpAliasPath == null) {
throw new ConfigurationException("unable to find createipAlias.sh");
}
_deleteIpAliasPath = findScript("deleteipAlias.sh");
if (_deleteIpAliasPath == null) {
throw new ConfigurationException("unable to find deleteipAlias.sh");
}
_callDnsMasqPath = findScript("call_dnsmasq.sh");
if (_callDnsMasqPath == null) {
throw new ConfigurationException("unable to find call_dnsmasq.sh");
}
return true;
}

View File

@ -0,0 +1,147 @@
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % BOOK_ENTITIES SYSTEM "cloudstack.ent">
%BOOK_ENTITIES;
]>
<!-- Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<section id="add-remove-nic-ui">
<title>Reconfiguring Physical Networks in VMs</title>
<para>&PRODUCT; provides you the ability to move VMs between networks and reconfigure a VM's
network. You can remove a VM from a physical network and add to a new physical network. You can
also change the default physical network of a virtual machine. With this functionality, hybrid
or traditional server loads can be accommodated with ease. </para>
<para>This feature is supported on XenServer and KVM hypervisors.</para>
<section id="add-nic">
<title>Adding a Physical Network</title>
<orderedlist>
<listitem>
<para>Log in to the CloudPlatform UI as an administrator or end user.</para>
</listitem>
<listitem>
<para>In the left navigation, click Instances.</para>
</listitem>
<listitem>
<para>Choose the VM that you want to work with.</para>
</listitem>
<listitem>
<para>Click the NICs tab.</para>
</listitem>
<listitem>
<para>Click Add network to VM.</para>
<para>The Add network to VM dialog is displayed.</para>
</listitem>
<listitem>
<para>In the drop-down list, select the network that you would like to add this VM
to.</para>
<para> A new NIC is added for this network. You can view the following details in the NICs
page:</para>
<itemizedlist>
<listitem>
<para>ID</para>
</listitem>
<listitem>
<para>Network Name</para>
</listitem>
<listitem>
<para>Type</para>
</listitem>
<listitem>
<para>IP Address</para>
</listitem>
<listitem>
<para>Gateway</para>
</listitem>
<listitem>
<para>Netmask</para>
</listitem>
<listitem>
<para>Is default</para>
</listitem>
<listitem>
<para>CIDR (for IPv6)</para>
</listitem>
</itemizedlist>
</listitem>
</orderedlist>
</section>
<section id="remove-nic">
<title>Removing a Physical Network</title>
<orderedlist>
<listitem>
<para>Log in to the CloudPlatform UI as an administrator or end user.</para>
</listitem>
<listitem>
<para>In the left navigation, click Instances.</para>
</listitem>
<listitem>
<para>Choose the VM that you want to work with.</para>
</listitem>
<listitem>
<para>Click the NICs tab.</para>
</listitem>
<listitem>
<para>Locate the NIC you want to remove.</para>
</listitem>
<listitem>
<para>Click Remove NIC button.<inlinemediaobject>
<imageobject>
<imagedata fileref="./images/remove-nic.png"/>
</imageobject>
<textobject>
<phrase>remove-nic.png: button to remove a NIC</phrase>
</textobject>
</inlinemediaobject></para>
</listitem>
<listitem>
<para>Click Yes to confirm.</para>
</listitem>
</orderedlist>
</section>
<section id="default-nic">
<title>Selecting the Default Physical Network</title>
<orderedlist>
<listitem>
<para>Log in to the CloudPlatform UI as an administrator or end user.</para>
</listitem>
<listitem>
<para>In the left navigation, click Instances.</para>
</listitem>
<listitem>
<para>Choose the VM that you want to work with.</para>
</listitem>
<listitem>
<para>Click the NICs tab.</para>
</listitem>
<listitem>
<para>Locate the NIC you want to work with.</para>
</listitem>
<listitem>
<para>Click the Set default NIC button.<inlinemediaobject>
<imageobject>
<imagedata fileref="./images/set-default-nic.png"/>
</imageobject>
<textobject>
<phrase>set-default-nic.png: button to set a NIC as default one.</phrase>
</textobject>
</inlinemediaobject></para>
</listitem>
<listitem>
<para>Click Yes to confirm.</para>
</listitem>
</orderedlist>
</section>
</section>

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

View File

@ -48,6 +48,7 @@
<xi:include href="dns-dhcp.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="vpn.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="elastic-ip.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="pvlan.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="inter-vlan-routing.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="configure-vpc.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
<xi:include href="persistent-network.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>

View File

@ -110,20 +110,16 @@
url="http://www.cisco.com/en/US/products/hw/switches/ps708/products_tech_note09186a0080094830.shtml"
>Private VLAN Catalyst Switch Support Matrix</ulink>for more information.</para>
</listitem>
<listitem>
<para>Connect a switch to the gateway; connect additional switches to the gateway via a
trunk port: Only Cisco Catalyst 4500 has the PVLAN promiscuous trunk mode to connect both
normal VLAN and PVLAN to a PVLAN-unaware switch. For other Catalyst PVLAN support switch,
connect the switch to upper switch by using cables. The number of cables should be greater
than the number of PVLANs used.</para>
</listitem>
<listitem>
<para>All the layer 2 switches, which are PVLAN-aware, are connected to each other, and one
of them is connected to a router. All the ports connected to the host would be configured
in trunk mode. Allow Management VLAN, Primary VLAN (public) and secondary Isolated VLAN
in trunk mode. Open Management VLAN, Primary VLAN (public) and Secondary Isolated VLAN
ports. Configure the switch port connected to the router in PVLAN promiscuous trunk mode,
which would translate an isolated VLAN to primary VLAN for router, which is PVLAN-unaware.
</para>
which would translate an isolated VLAN to primary VLAN for the PVLAN-unaware router. </para>
<para>Note that only Cisco Catalyst 4500 has the PVLAN promiscuous trunk mode to connect
both normal VLAN and PVLAN to a PVLAN-unaware switch. For other Catalyst PVLAN support
switch, connect the switch to upper switch by using cables. The number of cables should be
greater than the number of PVLANs used.</para>
</listitem>
<listitem>
<para>If your Catalyst switch supports PVLAN, but not PVLAN promiscuous trunk mode, perform
@ -137,15 +133,15 @@
<para>For each PVLAN, perform the following:</para>
<orderedlist numeration="lowerroman">
<listitem>
<para>Connect one port of the Catalyst switch to the upper switch.</para>
<para>Connect a port of the Catalyst switch to the upper switch.</para>
</listitem>
<listitem>
<para>Set the port in the Catalyst Switch in promiscuous mode for one pair of
PVLAN</para>
PVLAN.</para>
</listitem>
<listitem>
<para>Set the port in upper switch to access mode, and allow only the traffic of
primary VLAN of the PVLAN pair.</para>
<para>Set the port in the upper switch to access mode, and allow only the traffic of
the primary VLAN of the PVLAN pair.</para>
</listitem>
</orderedlist>
</listitem>
@ -154,10 +150,99 @@
<listitem>
<para>Configure private VLAN on your physical switches out-of-band.</para>
</listitem>
<listitem>
<para>Open vSwitch (OVS) used by XenServer and KVM does not support PVLAN. Therefore,
simulate PVLAN on OVS for XenServer and KVM by modifying the flow table to achieve the
following:</para>
<itemizedlist>
<listitem>
<para>For every traffic leaving user VMs, tag with the secondary isolated VLAN
ID.</para>
</listitem>
<listitem>
<para>Change the VLAN ID to primary VLAN ID.</para>
<para>This allows the traffic which is tagged with the secondary isolated VLAN ID reach
the DHCP server. </para>
</listitem>
<listitem>
<para>The gateway is PVLAN-unaware; therefore, the switch connected to the gateway
should translate all the secondary VLAN to primary VLAN for communicating with the
gateway.</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</section>
<section id="ability-pvlan">
<title/>
<para/>
<title>Creating a PVLAN-Enabled Guest Network</title>
<orderedlist>
<listitem>
<para>Log in to the CloudPlatform UI as administrator.</para>
</listitem>
<listitem>
<para>In the left navigation, choose Infrastructure.</para>
</listitem>
<listitem>
<para>On Zones, click View More.</para>
</listitem>
<listitem>
<para>Click the zone to which you want to add a guest network.</para>
</listitem>
<listitem>
<para>Click the Physical Network tab.</para>
</listitem>
<listitem>
<para>Click the physical network you want to work with.</para>
</listitem>
<listitem>
<para>On the Guest node of the diagram, click Configure.</para>
</listitem>
<listitem>
<para>Click the Network tab.</para>
</listitem>
<listitem>
<para>Click Add guest network.</para>
<para>The Add guest network window is displayed.</para>
</listitem>
<listitem>
<para>Specify the following:</para>
<itemizedlist>
<listitem>
<para>Name:</para>
</listitem>
<listitem>
<para>Description:</para>
</listitem>
<listitem>
<para>VLAN ID:</para>
</listitem>
<listitem>
<para>Private VLAN ID:</para>
</listitem>
<listitem>
<para>Scope:</para>
</listitem>
<listitem>
<para>Network Offering:</para>
</listitem>
<listitem>
<para>Gateway:</para>
</listitem>
<listitem>
<para>Netmask:</para>
</listitem>
<listitem>
<para>IP Range:</para>
</listitem>
<listitem>
<para>IPv6 CIDR:</para>
</listitem>
<listitem>
<para>Network Domain:</para>
</listitem>
</itemizedlist>
</listitem>
<listitem><para>Click OK to confirm.</para></listitem>
</orderedlist>
</section>
</section>

View File

@ -28,5 +28,6 @@
<para>Each VM has just one default network. The virtual router's DHCP reply will set the guest's default gateway as that for the default network. Multiple non-default networks may be added to a guest in addition to the single, required default network. The administrator can control which networks are available as the default network.</para>
<para>Additional networks can either be available to all accounts or be assigned to a specific account. Networks that are available to all accounts are zone-wide. Any user with access to the zone can create a VM with access to that network. These zone-wide networks provide little or no isolation between guests.Networks that are assigned to a specific account provide strong isolation.</para>
<xi:include href="add-additional-guest-network.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="add-remove-nic-ui.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="change-network-offering-on-guest-network.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>

View File

@ -25,6 +25,7 @@ import java.util.Map;
import javax.inject.Inject;
import com.cloud.storage.VolumeManager;
import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity;
import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity;
import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity;
@ -87,6 +88,9 @@ public class CloudOrchestrator implements OrchestrationService {
@Inject
protected AccountDao _accountDao = null;
@Inject
VolumeManager _volumeMgr;
public CloudOrchestrator() {
}
@ -200,6 +204,7 @@ public class CloudOrchestrator implements OrchestrationService {
"Disk offering " + diskOffering
+ " requires size parameter.");
}
_volumeMgr.validateVolumeSizeRange(size * 1024 * 1024 * 1024);
}
dataDiskOfferings.add(new Pair<DiskOfferingVO, Long>(diskOffering, size));
}
@ -246,7 +251,8 @@ public class CloudOrchestrator implements OrchestrationService {
throw new InvalidParameterValueException("Disk offering "
+ diskOffering + " requires size parameter.");
}
}
_volumeMgr.validateVolumeSizeRange(size * 1024 * 1024 * 1024);
}
rootDiskOffering.first(diskOffering);
rootDiskOffering.second(size);

View File

@ -116,11 +116,27 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
private static final String LIST_CAPACITY_GROUP_BY_CLUSTER_TYPE_PART2 = " GROUP BY cluster_id, capacity_type order by percent desc limit ";
private static final String UPDATE_CAPACITY_STATE = "UPDATE `cloud`.`op_host_capacity` SET capacity_state = ? WHERE ";
/* In the below query"LIST_CLUSTERS_CROSSING_THRESHOLD" the threshold value is getting from the cluster_details table if not present then it gets from the global configuration
*
* CASE statement works like
* if (cluster_details table has thershold value)
* then
* if (value from the cluster_details table is not null)
* then
* query from the cluster_details table
* else
* query from the configuration table
* else
* query from the configuration table
*
* */
private static final String LIST_CLUSTERS_CROSSING_THRESHOLD = "SELECT clusterList.cluster_id " +
"FROM ( SELECT cluster.cluster_id cluster_id, ( (sum(cluster.used) + sum(cluster.reserved) + ?)/sum(cluster.total) ) ratio, cluster.configValue value " +
"FROM ( SELECT capacity.cluster_id cluster_id, capacity.used_capacity used, capacity.reserved_capacity reserved, capacity.total_capacity total, " +
"CASE (SELECT count(*) FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " +
"WHEN 1 THEN ( SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) " +
"WHEN 1 THEN ( CASE WHEN (SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ?) is NULL " +
"THEN (SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?)" +
"ELSE (SELECT details.value FROM `cloud`.`cluster_details` details WHERE details.cluster_id = capacity.cluster_id AND details.name = ? ) END )" +
"ELSE ( SELECT config.value FROM `cloud`.`configuration` config WHERE config.name = ?) " +
"END configValue " +
"FROM `cloud`.`op_host_capacity` capacity " +
@ -168,8 +184,10 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements
pstmt.setString(2, configName);
pstmt.setString(3, configName);
pstmt.setString(4, configName);
pstmt.setLong(5,zoneId);
pstmt.setShort(6,capacityType);
pstmt.setString(5, configName);
pstmt.setString(6, configName);
pstmt.setLong(7,zoneId);
pstmt.setShort(8,capacityType);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {

View File

@ -536,6 +536,11 @@ public class AncientSnapshotStrategy implements SnapshotStrategy {
Long snapshotId = snapInfo.getId();
SnapshotObject snapshot = (SnapshotObject)snapInfo;
if (Snapshot.State.Error.equals(snapshot.getState())) {
_snapshotDao.remove(snapshotId);
return true;
}
if (!Snapshot.State.BackedUp.equals(snapshot.getState())) {
throw new InvalidParameterValueException("Can't delete snapshotshot " + snapshotId + " due to it is not in BackedUp Status");
}

View File

@ -1261,9 +1261,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
if (!result.first()) {
String msg = "SetNetworkACLAnswer on domain router " + routerIp + " failed. message: " + result.second();
s_logger.error(msg);
return new SetNetworkACLAnswer(cmd, false, results);
}
return new SetNetworkACLAnswer(cmd, false, results);
} else {
args="";
args += " -d " + "eth" + ethDeviceNum;
@ -2331,9 +2330,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
VmwareHypervisorHost hyperHost = getHyperHost(context);
VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(cmd.getVmName());
VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
int ramMb = (int) (vmSpec.getMinRam());
int ramMb = (int) (vmSpec.getMinRam()/(1024 * 1024));
VmwareHelper.setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getSpeed(), vmSpec.getSpeed(),(int) (vmSpec.getMaxRam()), ramMb, vmSpec.getLimitCpuUse());
VmwareHelper.setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), vmSpec.getMinSpeed(),(int) (vmSpec.getMaxRam()/(1024 * 1024)), ramMb, vmSpec.getLimitCpuUse());
if(!vmMo.configureVm(vmConfigSpec)) {
throw new Exception("Unable to execute ScaleVmCommand");
@ -3489,7 +3488,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
tgtHyperHost = new HostMO(getServiceContext(), morTgtHost);
morDc = srcHyperHost.getHyperHostDatacenter();
morDcOfTargetHost = tgtHyperHost.getHyperHostDatacenter();
if (morDc != morDcOfTargetHost) {
if (!morDc.getValue().equalsIgnoreCase(morDcOfTargetHost.getValue())) {
String msg = "Source host & target host are in different datacentesr";
throw new CloudRuntimeException(msg);
}

View File

@ -68,10 +68,11 @@ public class VmwareResourceTest {
when(_resource.getHyperHost(context, null)).thenReturn(hyperHost);
doReturn("i-2-3-VM").when(cmd).getVmName();
when(hyperHost.findVmOnHyperHost("i-2-3-VM")).thenReturn(vmMo);
doReturn(1024L).when(vmSpec).getMinRam();
doReturn(536870912L).when(vmSpec).getMinRam();
doReturn(1).when(vmSpec).getCpus();
doReturn(1000).when(vmSpec).getSpeed();
doReturn(1024L).when(vmSpec).getMaxRam();
doReturn(1000).when(vmSpec).getMinSpeed();
doReturn(1000).when(vmSpec).getMaxSpeed();
doReturn(536870912L).when(vmSpec).getMaxRam();
doReturn(false).when(vmSpec).getLimitCpuUse();
when(vmMo.configureVm(vmConfigSpec)).thenReturn(true);

View File

@ -447,6 +447,10 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
return new XenServer602Resource();
else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
return new XenServer610Resource();
else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.83"))
return new XenServer610Resource();
else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0"))
return new XenServer610Resource();
else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
String prodVersionTextShort = record.softwareVersion.get("product_version_text_short").trim();
if ("5.6 SP2".equals(prodVersionTextShort)) {
@ -458,7 +462,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
return new XcpOssResource();
}
String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0 but this one is " + prodBrand + " " + prodVersion;
String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0, 6.1.83, 6.2.0 but this one is " + prodBrand + " " + prodVersion;
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
s_logger.debug(msg);
throw new RuntimeException(msg);
@ -598,6 +602,10 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
resource = XenServer602Resource.class.getName();
} else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0")) {
resource = XenServer610Resource.class.getName();
} else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.83")) {
resource = XenServer610Resource.class.getName();
} else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0")) {
resource = XenServer610Resource.class.getName();
} else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.100")) {
String prodVersionTextShort = details.get("product_version_text_short").trim();
if ("5.6 SP2".equals(prodVersionTextShort)) {
@ -610,7 +618,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
}
if( resource == null ){
String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, 5.6 FP1, 5.6 SP2 and Xenserver 6.0 , 6.0.2, 6.1.0 but this one is " + prodBrand + " " + prodVersion;
String msg = "Only support XCP 1.0.0, 1.1.0, 1.4.x, 1.5 beta, 1.6.x; XenServer 5.6, 5.6 FP1, 5.6 SP2 and Xenserver 6.0 , 6.0.2, 6.1.0, 6.1.83, 6.2.0 but this one is " + prodBrand + " " + prodVersion;
s_logger.debug(msg);
throw new RuntimeException(msg);
}

View File

@ -635,16 +635,16 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
Long staticMemoryMax = vm.getMemoryStaticMax(conn);
Long staticMemoryMin = vm.getMemoryStaticMin(conn);
Long newDynamicMemoryMin = vmSpec.getMinRam() * 1024 * 1024;
Long newDynamicMemoryMax = vmSpec.getMaxRam() * 1024 * 1024;
Long newDynamicMemoryMin = vmSpec.getMinRam();
Long newDynamicMemoryMax = vmSpec.getMaxRam();
if (staticMemoryMin > newDynamicMemoryMin || newDynamicMemoryMax > staticMemoryMax) {
throw new CloudRuntimeException("Cannot scale up the vm because of memory constraint violation: 0 <= memory-static-min <= memory-dynamic-min <= memory-dynamic-max <= memory-static-max ");
}
vm.setMemoryDynamicRange(conn, vmSpec.getMinRam() * 1024 * 1024, vmSpec.getMaxRam() * 1024 * 1024);
vm.setMemoryDynamicRange(conn, newDynamicMemoryMin, newDynamicMemoryMax);
vm.setVCPUsNumberLive(conn, (long)vmSpec.getCpus());
Integer speed = vmSpec.getSpeed();
Integer speed = vmSpec.getMinSpeed();
if (speed != null) {
int cpuWeight = _maxWeight; //cpu_weight

View File

@ -113,10 +113,14 @@ public class CitrixResourceBaseTest {
@Test
public void testScaleVMF2() throws Types.XenAPIException, XmlRpcException {
when(vm.getMemoryStaticMax(conn)).thenReturn(1073741824L);
when(vm.getMemoryStaticMin(conn)).thenReturn(268435456L);
doReturn(536870912L).when(vmSpec).getMinRam();
doReturn(536870912L).when(vmSpec).getMaxRam();
doNothing().when(vm).setMemoryDynamicRange(conn, 536870912L, 536870912L);
doReturn(1).when(vmSpec).getCpus();
doNothing().when(vm).setVCPUsNumberLive(conn, 1L);
doReturn(500).when(vmSpec).getSpeed();
doReturn(500).when(vmSpec).getMinSpeed();
doReturn(false).when(vmSpec).getLimitCpuUse();
Map<String, String> args = (Map<String, String>)mock(HashMap.class);
when(host.callPlugin(conn, "vmops", "add_to_VCPUs_params_live", args)).thenReturn("Success");
@ -132,10 +136,14 @@ public class CitrixResourceBaseTest {
@Test
public void testScaleVMF3() throws Types.XenAPIException, XmlRpcException {
when(vm.getMemoryStaticMax(conn)).thenReturn(1073741824L);
when(vm.getMemoryStaticMin(conn)).thenReturn(268435456L);
doReturn(536870912L).when(vmSpec).getMinRam();
doReturn(536870912L).when(vmSpec).getMaxRam();
doNothing().when(vm).setMemoryDynamicRange(conn, 536870912L, 536870912L);
doReturn(1).when(vmSpec).getCpus();
doNothing().when(vm).setVCPUsNumberLive(conn, 1L);
doReturn(500).when(vmSpec).getSpeed();
doReturn(500).when(vmSpec).getMinSpeed();
doReturn(true).when(vmSpec).getLimitCpuUse();
doReturn(null).when(_resource).callHostPlugin(conn, "vmops", "add_to_VCPUs_params_live", "key", "cap", "value", "100", "vmname", "i-2-3-VM");
Map<String, String> args = (Map<String, String>)mock(HashMap.class);

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# 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.
usage() {
printf "Usage: %s: <domR eth1 ip> <path_to_new_config_file>\n" $(basename $0) >&2
}
set -x
cert="/root/.ssh/id_rsa.cloud"
ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/dnsmasq.sh $2"
exit $?

View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
# 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.
usage() {
printf " %s routerip <alias_count:ip:netmask;alias_count2:ip2:netmask2;....> \n" $(basename $0) >&2
}
set -x
cert="/root/.ssh/id_rsa.cloud"
ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/createIpAlias.sh $2"

View File

@ -0,0 +1,25 @@
#!/usr/bin/env bash
# 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.
usage() {
printf " %s routerip <alias_count:ip:netmask;alias_count2:ip2:netmask2;....> \n" $(basename $0) >&2
}
set -x
cert="/root/.ssh/id_rsa.cloud"
ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/deleteIpAlias.sh $2 $3"

View File

@ -439,7 +439,8 @@ public class ApiResponseHelper implements ResponseGenerator {
DataCenter zone = ApiDBUtils.findZoneById(volume.getDataCenterId());
if (zone != null) {
snapshotResponse.setZoneName(zone.getName());
snapshotResponse.setZoneType(zone.getNetworkType().toString());
snapshotResponse.setZoneType(zone.getNetworkType().toString());
snapshotResponse.setZoneId(zone.getUuid());
}
}
snapshotResponse.setCreated(snapshot.getCreated());
@ -2398,11 +2399,12 @@ public class ApiResponseHelper implements ResponseGenerator {
if (fwRule.getTrafficType() == FirewallRule.TrafficType.Ingress) {
IpAddress ip = ApiDBUtils.findIpAddressById(fwRule.getSourceIpAddressId());
response.setPublicIpAddressId(ip.getId());
response.setPublicIpAddressId(ip.getUuid());
response.setPublicIpAddress(ip.getAddress().addr());
} else if (fwRule.getTrafficType() == FirewallRule.TrafficType.Egress) {
response.setPublicIpAddress(null);
response.setNetworkId(fwRule.getNetworkId());
Network network = ApiDBUtils.findNetworkById(fwRule.getNetworkId());
response.setNetworkId(network.getUuid());
}
FirewallRule.State state = fwRule.getState();

View File

@ -22,7 +22,9 @@ import java.util.List;
import javax.ejb.Local;
import javax.inject.Inject;
import com.cloud.capacity.Capacity;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@ -150,7 +152,8 @@ public class StoragePoolJoinDaoImpl extends GenericDaoBase<StoragePoolJoinVO, Lo
}
long allocatedSize = pool.getUsedCapacity() + pool.getReservedCapacity();
short capacityType = pool.getScope() == ScopeType.HOST ? Capacity.CAPACITY_TYPE_LOCAL_STORAGE : Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED;
long allocatedSize = ApiDBUtils.getStorageCapacitybyPool(pool.getId(), capacityType);
poolResponse.setDiskSizeTotal(pool.getCapacityBytes());
poolResponse.setDiskSizeAllocated(allocatedSize);

View File

@ -39,6 +39,7 @@ import javax.naming.NamingException;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import com.cloud.utils.Pair;
import org.apache.cloudstack.acl.SecurityChecker;
import org.apache.cloudstack.api.ApiConstants.LDAPParams;
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
@ -2498,7 +2499,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
}
}
boolean sameSubnet=false;
Pair<Boolean,Pair<String,String>> sameSubnet= null;
// Can add vlan range only to the network which allows it
if (!network.getSpecifyIpRanges()) {
throw new InvalidParameterValueException("Network " + network + " doesn't support adding ip ranges");
@ -2533,7 +2534,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
sameSubnet=validateIpRange(startIP,endIP,newVlanGateway, newVlanNetmask, vlans, ipv4, ipv6, ip6Gateway, ip6Cidr, startIPv6, endIPv6, network);
}
if (zoneId == null || (ipv4 && (newVlanGateway == null || newVlanNetmask == null)) || (ipv6 && (ip6Gateway == null || ip6Cidr == null))) {
if (zoneId == null || (ipv6 && (ip6Gateway == null || ip6Cidr == null))) {
throw new InvalidParameterValueException("Gateway, netmask and zoneId have to be passed in for virtual and direct untagged networks");
}
@ -2552,54 +2553,80 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
}
Transaction txn = Transaction.currentTxn();
txn.start();
if (sameSubnet == null || sameSubnet.first() == false) {
s_logger.info("adding a new subnet to the network "+network.getId());
}
else {
// if it is same subnet the user might not send the vlan and the netmask details. so we are
//figuring out while validation and setting them here.
newVlanGateway = sameSubnet.second().first();
newVlanNetmask = sameSubnet.second().second();
}
Vlan vlan = createVlanAndPublicIpRange(zoneId, networkId, physicalNetworkId, forVirtualNetwork, podId, startIP,
endIP, newVlanGateway, newVlanNetmask, vlanId, vlanOwner, startIPv6, endIPv6, ip6Gateway, ip6Cidr);
//create an entry in the nic_secondary table. This will be the new gateway that will be configured on the corresponding routervm.
if (sameSubnet == false) {
s_logger.info("adding a new subnet to the network "+network.getId());
}
txn.commit();
return vlan;
}
public boolean validateIpRange(String startIP, String endIP, String newVlanGateway, String newVlanNetmask, List<VlanVO> vlans, boolean ipv4, boolean ipv6, String ip6Gateway, String ip6Cidr, String startIPv6, String endIPv6, Network network) {
String vlanGateway;
String vlanNetmask;
public int checkIfSubsetOrSuperset(String newVlanGateway, String newVlanNetmask, VlanVO vlan, String startIP, String endIP) {
if (newVlanGateway == null && newVlanNetmask==null) {
newVlanGateway = vlan.getVlanGateway();
newVlanNetmask = vlan.getVlanNetmask();
//this means he is trying to add to the existing subnet.
if (NetUtils.sameSubnet(startIP, newVlanGateway, newVlanNetmask)) {
if (NetUtils.sameSubnet(endIP, newVlanGateway, newVlanNetmask)){
return 3;
}
}
return 0;
}
else if (newVlanGateway == null || newVlanGateway ==null){
throw new InvalidParameterValueException("either both netmask and gateway should be passed or both should me omited.");
}
else {
if (!NetUtils.sameSubnet(startIP, newVlanGateway, newVlanNetmask)) {
throw new InvalidParameterValueException("The start ip and gateway do not belong to the same subnet");
}
if (!NetUtils.sameSubnet(endIP, newVlanGateway, newVlanNetmask)) {
throw new InvalidParameterValueException("The end ip and gateway do not belong to the same subnet");
}
}
String cidrnew = NetUtils.getCidrFromGatewayAndNetmask(newVlanGateway, newVlanNetmask);
String existing_cidr = NetUtils.getCidrFromGatewayAndNetmask(vlan.getVlanGateway(), vlan.getVlanNetmask());
return (NetUtils.isNetowrkASubsetOrSupersetOfNetworkB(cidrnew, existing_cidr));
}
public Pair<Boolean,Pair<String,String>> validateIpRange(String startIP, String endIP, String newVlanGateway, String newVlanNetmask, List<VlanVO> vlans, boolean ipv4, boolean ipv6, String ip6Gateway, String ip6Cidr, String startIPv6, String endIPv6, Network network) {
String vlanGateway=null;
String vlanNetmask=null;
boolean sameSubnet = false;
if ( vlans != null && vlans.size() > 0 ) {
for (VlanVO vlan : vlans) {
if (ipv4) {
vlanGateway = vlan.getVlanGateway();
vlanNetmask = vlan.getVlanNetmask();
// Check if ip addresses are in network range
if (!NetUtils.sameSubnet(startIP, vlanGateway, vlanNetmask)) {
if (!NetUtils.sameSubnet(endIP, vlanGateway, vlanNetmask)) {
// check if the the new subnet is not a superset of the existing subnets.
if (NetUtils.isNetworkAWithinNetworkB(NetUtils.getCidrFromGatewayAndNetmask(vlanGateway,vlanNetmask), NetUtils.ipAndNetMaskToCidr(startIP, newVlanNetmask))){
throw new InvalidParameterValueException ("The new subnet is a superset of the existing subnet");
}
// check if the new subnet is not a subset of the existing subnet.
if (NetUtils.isNetworkAWithinNetworkB(NetUtils.ipAndNetMaskToCidr(startIP, newVlanNetmask), NetUtils.getCidrFromGatewayAndNetmask(vlanGateway,vlanNetmask))){
throw new InvalidParameterValueException("The new subnet is a subset of the existing subnet");
}
}
} else if (NetUtils.sameSubnet(endIP, vlanGateway, vlanNetmask)){
// trying to add to the same subnet.
sameSubnet = true;
if (newVlanGateway == null) {
newVlanGateway = vlanGateway;
}
if (!newVlanGateway.equals(vlanGateway)){
throw new InvalidParameterValueException("The gateway of the ip range is not same as the gateway of the subnet.");
}
break;
//check if subset or super set or neither.
int val = checkIfSubsetOrSuperset(newVlanGateway, newVlanNetmask, vlan, startIP, endIP);
if (val == 1) {
// this means that new cidr is a superset of the existing subnet.
throw new InvalidParameterValueException("The subnet you are trying to add is a superset of the existing subnet having gateway"+vlan.getVlanGateway()+" and netmask "+vlan.getVlanNetmask());
}
else {
throw new InvalidParameterValueException("Start ip and End ip is not in vlan range!");
else if (val == 0) {
//this implies the user is trying to add a new subnet which is not a superset or subset of this subnet.
//checking with the other subnets.
continue;
}
else if (val == 2) {
//this means he is trying to add to the same subnet.
throw new InvalidParameterValueException("The subnet you are trying to add is a subset of the existing subnet having gateway"+vlan.getVlanGateway()+" and netmask "+vlan.getVlanNetmask());
}
else if (val == 3) {
sameSubnet =true;
}
}
if (ipv6) {
@ -2614,13 +2641,25 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
_networkModel.checkIp6Parameters(startIPv6, endIPv6, ip6Gateway, ip6Cidr);
}
}
if (sameSubnet == false) {
if (newVlanGateway ==null) {
throw new MissingParameterValueException("The gateway for the new subnet is not specified.");
}
}
}
return sameSubnet;
if (newVlanGateway==null && newVlanNetmask ==null && sameSubnet == false) {
throw new InvalidParameterValueException("The ip range dose not belong to any of the existing subnets, Provide the netmask and gateway if you want to add new subnet");
}
Pair<String,String> vlanDetails=null;
if (sameSubnet){
vlanDetails = new Pair<String, String>(vlanGateway, vlanNetmask);
}
else {
vlanDetails = new Pair<String, String>(newVlanGateway, newVlanNetmask);
}
//check if the gatewayip is the part of the ip range being added.
if (NetUtils.ipRangesOverlap(startIP, endIP, vlanDetails.first(), vlanDetails.first())) {
throw new InvalidParameterValueException("The gateway ip should not be the part of the ip range being added.");
}
Pair<Boolean,Pair<String,String>> result = new Pair<Boolean,Pair<String,String>>(sameSubnet, vlanDetails);
return result;
}
@Override

View File

@ -86,7 +86,7 @@ public abstract class HypervisorGuruBase extends AdapterBase implements Hypervis
}
protected <T extends VirtualMachine> VirtualMachineTO toVirtualMachineTO(VirtualMachineProfile<T> vmProfile) {
protected <T extends VirtualMachine> VirtualMachineTO toVirtualMachineTO(VirtualMachineProfile<T> vmProfile) {
ServiceOffering offering = vmProfile.getServiceOffering();
VirtualMachine vm = vmProfile.getVirtualMachine();

View File

@ -670,8 +670,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
if (network == null) {
throw new InvalidParameterValueException("Invalid network id is given");
}
accountId = network.getAccountId();
domainId = network.getDomainId();
accountId = ipOwner.getAccountId();
domainId = ipOwner.getDomainId();
// Validate network offering
NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(network.getNetworkOfferingId());
@ -2663,7 +2663,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
existingRanges.get(i).second(-1);
}
value = vnetMap.get((existingRanges.get(i).second()));
if (value != null) {
if (value != null && ( (existingRanges.get(i).second()) != (existingRanges.get(i).first()) )) {
vnetMap.remove((existingRanges.get(i).second()));
vnetMap.remove(existingRanges.get(i).first());
vnetMap.put(existingRanges.get(i).first(),value);

View File

@ -109,4 +109,6 @@ public interface VolumeManager extends VolumeApiService {
String getVmNameFromVolumeId(long volumeId);
String getStoragePoolOfVolume(long volumeId);
boolean validateVolumeSizeRange(long size);
}

View File

@ -1334,7 +1334,8 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
return true;
}
private boolean validateVolumeSizeRange(long size) {
@Override
public boolean validateVolumeSizeRange(long size) {
if (size < 0 || (size > 0 && size < (1024 * 1024 * 1024))) {
throw new InvalidParameterValueException(
"Please specify a size of at least 1 Gb.");

View File

@ -178,6 +178,7 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
protected AccountManager _accountMgr;
private Boolean _sslCopy = new Boolean(false);
String _ssvmUrlDomain;
private String _copyAuthPasswd;
private String _proxy = null;
protected SearchBuilder<VMTemplateHostVO> ReadyTemplateStatesSearch;
@ -198,11 +199,8 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
_sslCopy = Boolean.parseBoolean(configs.get("secstorage.encrypt.copy"));
_proxy = configs.get(Config.SecStorageProxy.key());
String cert = configs.get("secstorage.ssl.cert.domain");
if (!"realhostip.com".equalsIgnoreCase(cert)) {
s_logger.warn("Only realhostip.com ssl cert is supported, ignoring self-signed and other certs");
}
_ssvmUrlDomain = configs.get("secstorage.ssl.cert.domain");
_copyAuthPasswd = configs.get("secstorage.copy.password");
_agentMgr.registerForHostEvents(new DownloadListener(this), true, false, false);
@ -318,9 +316,15 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
String hostname = ipAddress;
String scheme = "http";
if (_sslCopy) {
hostname = ipAddress.replace(".", "-");
hostname = hostname + ".realhostip.com";
scheme = "https";
hostname = ipAddress.replace(".", "-");
scheme = "https";
// Code for putting in custom certificates.
if(_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0){
hostname = hostname + "." + _ssvmUrlDomain;
}else{
hostname = hostname + ".realhostip.com";
}
}
return scheme + "://" + hostname + "/copy/SecStorage/" + dir + "/" + path;
}

View File

@ -574,6 +574,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
String intervalTypeStr = cmd.getIntervalType();
String zoneType = cmd.getZoneType();
Map<String, String> tags = cmd.getTags();
Long zoneId = cmd.getZoneId();
Account caller = UserContext.current().getCaller();
List<Long> permittedAccounts = new ArrayList<Long>();
@ -602,6 +603,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
sb.and("snapshotTypeEQ", sb.entity().getsnapshotType(), SearchCriteria.Op.IN);
sb.and("snapshotTypeNEQ", sb.entity().getsnapshotType(), SearchCriteria.Op.NEQ);
sb.and("dataCenterId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
if (tags != null && !tags.isEmpty()) {
SearchBuilder<ResourceTagVO> tagSearch = _resourceTagDao.createSearchBuilder();
@ -641,6 +643,10 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
if(zoneType != null) {
sc.setJoinParameters("zoneSb", "zoneNetworkType", zoneType);
}
if (zoneId != null) {
sc.setParameters("dataCenterId", zoneId);
}
if (name != null) {
sc.setParameters("name", "%" + name + "%");

View File

@ -56,6 +56,7 @@ import com.cloud.utils.DateUtil;
import com.cloud.utils.DateUtil.IntervalType;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.component.ComponentContext;
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.concurrency.TestClock;
import com.cloud.utils.db.DB;
@ -207,10 +208,6 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
List<SnapshotScheduleVO> snapshotsToBeExecuted = _snapshotScheduleDao.getSchedulesToExecute(_currentTimestamp);
s_logger.debug("Got " + snapshotsToBeExecuted.size() + " snapshots to be executed at " + displayTime);
// This is done for recurring snapshots, which are executed by the system automatically
// Hence set user id to that of system
long userId = 1;
for (SnapshotScheduleVO snapshotToBeExecuted : snapshotsToBeExecuted) {
SnapshotScheduleVO tmpSnapshotScheduleVO = null;
long snapshotScheId = snapshotToBeExecuted.getId();
@ -235,7 +232,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
tmpSnapshotScheduleVO = _snapshotScheduleDao.acquireInLockTable(snapshotScheId);
Long eventId = ActionEventUtils.onScheduledActionEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM,
Long eventId = ActionEventUtils.onScheduledActionEvent(User.UID_SYSTEM, volume.getAccountId(),
EventTypes.EVENT_SNAPSHOT_CREATE, "creating snapshot for volume Id:" + volumeId, 0);
Map<String, String> params = new HashMap<String, String>();
@ -246,6 +243,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
params.put("ctxStartEventId", String.valueOf(eventId));
CreateSnapshotCmd cmd = new CreateSnapshotCmd();
ComponentContext.inject(cmd);
ApiDispatcher.getInstance().dispatchCreateCmd(cmd, params);
params.put("id", ""+cmd.getEntityId());
params.put("ctxStartEventId", "1");

View File

@ -106,6 +106,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor {
private String _name;
private Boolean _sslCopy = new Boolean(false);
private String _ssvmUrlDomain;
private ScheduledExecutorService _executor = null;
Timer _timer;
@ -329,8 +330,14 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor {
String scheme = "http";
if (_sslCopy) {
hostname = ipAddress.replace(".", "-");
hostname = hostname + ".realhostip.com";
scheme = "https";
// Code for putting in custom certificates.
if(_ssvmUrlDomain != null && _ssvmUrlDomain.length() > 0){
hostname = hostname + "." + _ssvmUrlDomain;
}else{
hostname = hostname + ".realhostip.com";
}
}
return scheme + "://" + hostname + "/userdata/" + uuid;
}
@ -347,10 +354,7 @@ public class UploadMonitorImpl extends ManagerBase implements UploadMonitor {
final Map<String, String> configs = _configDao.getConfiguration("ManagementServer", params);
_sslCopy = Boolean.parseBoolean(configs.get("secstorage.encrypt.copy"));
String cert = configs.get("secstorage.secure.copy.cert");
if ("realhostip.com".equalsIgnoreCase(cert)) {
s_logger.warn("Only realhostip.com ssl cert is supported, ignoring self-signed and other certs");
}
_ssvmUrlDomain = configs.get("secstorage.ssl.cert.domain");
_agentMgr.registerForHostEvents(new UploadListener(this), true, false, false);
String cleanupInterval = configs.get("extract.url.cleanup.interval");

View File

@ -3421,6 +3421,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
@Override
public void collectVmDiskStatistics (UserVmVO userVm) {
// support KVM and XenServer only
if (!userVm.getHypervisorType().equals(HypervisorType.XenServer)
&& !userVm.getHypervisorType().equals(HypervisorType.KVM))
return;
// Collect vm disk statistics from host before stopping Vm
long hostId = userVm.getHostId();
List<String> vmNames = new ArrayList<String>();

View File

@ -129,6 +129,7 @@ import com.cloud.network.rules.RulesManager;
import com.cloud.offering.ServiceOffering;
import com.cloud.org.Cluster;
import com.cloud.resource.ResourceManager;
import com.cloud.server.ConfigurationServer;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.storage.DiskOfferingVO;
@ -256,6 +257,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
protected RulesManager rulesMgr;
@Inject
protected AffinityGroupVMMapDao _affinityGroupVMMapDao;
@Inject
protected ConfigurationServer _configServer;
protected List<DeploymentPlanner> _planners;
public List<DeploymentPlanner> getPlanners() {
@ -3226,8 +3229,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
long newServiceofferingId = vm.getServiceOfferingId();
ServiceOffering newServiceOffering = _configMgr.getServiceOffering(newServiceofferingId);
HostVO hostVo = _hostDao.findById(vm.hostId);
Float memoryOvercommitRatio = Float.parseFloat(_configServer.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), hostVo.getClusterId()));
Float cpuOvercommitRatio = Float.parseFloat(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), hostVo.getClusterId()));
long minMemory = (long) (newServiceOffering.getRamSize()/memoryOvercommitRatio);
ScaleVmCommand reconfigureCmd = new ScaleVmCommand(vm.getInstanceName(), newServiceOffering.getCpu(),
newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse());
(int) (newServiceOffering.getSpeed()/cpuOvercommitRatio), newServiceOffering.getSpeed(), minMemory * 1024 * 1024, newServiceOffering.getRamSize() * 1024 * 1024, newServiceOffering.getLimitCpuUse());
Long dstHostId = vm.getHostId();
ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Running, vm.getType(), vm.getId());

View File

@ -19,6 +19,7 @@ package com.cloud.configuration;
import com.cloud.dc.VlanVO;
import com.cloud.network.Network;
import com.cloud.network.NetworkModel;
import com.cloud.utils.Pair;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -49,20 +50,20 @@ public class ValidateIpRangeTest {
@Test
public void SameSubnetTest() {
boolean sameSubnet=configurationMgr.validateIpRange("10.147.33.104", "10.147.33.105", "10.147.33.1", "255.255.255.128", vlanVOList, true, false, null, null, null, null,network);
Assert.assertTrue(sameSubnet);
Pair<Boolean,Pair<String,String>> sameSubnet = configurationMgr.validateIpRange("10.147.33.104", "10.147.33.105", "10.147.33.1", "255.255.255.128", vlanVOList, true, false, null, null, null, null,network);
Assert.assertTrue(sameSubnet.first());
}
@Test
public void NewSubnetTest() {
boolean sameSubnet= configurationMgr.validateIpRange("10.147.33.140", "10.147.33.145", "10.147.33.129", "255.255.255.191", vlanVOList, true, false, null, null, null, null,network);
Assert.assertTrue(!sameSubnet);
Pair<Boolean,Pair<String,String>> sameSubnet = configurationMgr.validateIpRange("10.147.33.140", "10.147.33.145", "10.147.33.130", "255.255.255.192", vlanVOList, true, false, null, null, null, null,network);
Assert.assertTrue(!sameSubnet.first());
}
@Test
public void SuperSetTest() {
try {
configurationMgr.validateIpRange("10.147.33.140", "10.147.33.143", "10.147.33.140", "255.255.255.191", vlanVOList, true, false, null, null, null, null,network);
configurationMgr.validateIpRange("10.147.33.10", "10.147.33.20", "10.147.33.21", "255.255.255.0", vlanVOList, true, false, null, null, null, null,network);
} catch (Exception e) {
junit.framework.Assert.assertTrue(e.getMessage().contains("superset"));
}

View File

@ -22,11 +22,13 @@ import com.cloud.agent.api.Answer;
import com.cloud.agent.api.ScaleVmAnswer;
import com.cloud.agent.api.ScaleVmCommand;
import com.cloud.capacity.CapacityManager;
import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.deploy.DeployDestination;
import com.cloud.host.HostVO;
import com.cloud.host.dao.HostDao;
import com.cloud.server.ConfigurationServer;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.VolumeManager;
@ -154,6 +156,10 @@ public class VirtualMachineManagerImplTest {
List<VolumeVO> _rootVols;
@Mock
ItWorkVO _work;
@Mock
ConfigurationServer _configServer;
@Mock
HostVO hostVO;
@Mock ClusterDao _clusterDao;
@Mock HostPodDao _podDao;
@ -199,6 +205,7 @@ public class VirtualMachineManagerImplTest {
_vmMgr._hvGuruMgr = _hvGuruMgr;
_vmMgr._vmSnapshotMgr = _vmSnapshotMgr;
_vmMgr._vmDao = _vmInstanceDao;
_vmMgr._configServer = _configServer;
when(_vmMock.getId()).thenReturn(314l);
when(_vmInstance.getId()).thenReturn(1L);
@ -239,8 +246,12 @@ public class VirtualMachineManagerImplTest {
when(_vmInstanceDao.findById(anyLong())).thenReturn(_vmInstance);
ServiceOfferingVO newServiceOffering = getSvcoffering(512);
when(_hostDao.findById(_vmInstance.hostId)).thenReturn(hostVO);
doReturn(1L).when(hostVO).getClusterId();
when(_configServer.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), 1L)).thenReturn("1.0");
when(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), 1L)).thenReturn("1.0");
ScaleVmCommand reconfigureCmd = new ScaleVmCommand("myVmName", newServiceOffering.getCpu(),
newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse());
newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(), newServiceOffering.getLimitCpuUse());
Answer answer = new ScaleVmAnswer(reconfigureCmd, true, "details");
when(_agentMgr.send(2l, reconfigureCmd)).thenReturn(null);
_vmMgr.reConfigureVm(_vmInstance, getSvcoffering(256), false);

View File

@ -253,7 +253,8 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons
if(s_logger.isTraceEnabled())
s_logger.trace("Ajax client start, frame buffer w: " + width + ", " + height);
/*
int retry = 0;
tracker.initCoverageTest();
while(!tracker.hasFullCoverage() && retry < 10) {
@ -263,6 +264,7 @@ public abstract class ConsoleProxyClientBase implements ConsoleProxyClient, Cons
}
retry++;
}
*/
List<TileInfo> tiles = tracker.scan(true);
String imgUrl = prepareAjaxImage(tiles, true);

View File

@ -64,6 +64,7 @@ public class ConsoleProxyGCThread extends Thread {
public void run() {
boolean bReportLoad = false;
long lastReportTick = System.currentTimeMillis();
while (true) {
cleanupLogging();
bReportLoad = false;
@ -95,10 +96,12 @@ public class ConsoleProxyGCThread extends Thread {
client.closeClient();
}
if(bReportLoad) {
if(bReportLoad || System.currentTimeMillis() - lastReportTick > 5000) {
// report load changes
String loadInfo = new ConsoleProxyClientStatsCollector(connMap).getStatsReport();
ConsoleProxy.reportLoadInfo(loadInfo);
lastReportTick = System.currentTimeMillis();
if(s_logger.isDebugEnabled())
s_logger.debug("Report load change : " + loadInfo);
}

View File

@ -46,7 +46,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
private VncClient client;
private Thread worker;
private boolean workerDone = false;
private volatile boolean workerDone = false;
private int lastModifierStates = 0;
private int lastPointerMask = 0;
@ -80,7 +80,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
String tunnelUrl = getClientParam().getClientTunnelUrl();
String tunnelSession = getClientParam().getClientTunnelSession();
for(int i = 0; i < 15; i++) {
for(int i = 0; i < 15 && !workerDone; i++) {
try {
if(tunnelUrl != null && !tunnelUrl.isEmpty() && tunnelSession != null && !tunnelSession.isEmpty()) {
URI uri = new URI(tunnelUrl);
@ -136,6 +136,7 @@ public class ConsoleProxyVncClient extends ConsoleProxyClientBase {
@Override
public void closeClient() {
workerDone = true;
if(client != null)
client.shutdown();
}

View File

@ -77,8 +77,10 @@ public class VncClientPacketSender implements Runnable, PaintNotificationListene
s_logger.error("Unexpected exception: ", e);
if (connectionAlive) {
closeConnection();
vncConnection.shutdown();
}
} finally {
s_logger.info("Sending thread exit processing, shutdown connection");
vncConnection.shutdown();
}
}

View File

@ -90,8 +90,10 @@ public class VncServerPacketReceiver implements Runnable {
s_logger.error("Unexpected exception: ", e);
if (connectionAlive) {
closeConnection();
vncConnection.shutdown();
}
} finally {
s_logger.info("Receiving thread exit processing, shutdown connection");
vncConnection.shutdown();
}
}

View File

@ -274,7 +274,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -308,7 +308,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.user_account.account.id,
id=self.user_account.id,
listall=True
)
self.assertEqual(
@ -452,7 +452,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -471,7 +471,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
"The admin account created is not enabled."
)
self.debug("Domain admin account created: %s" % self.admin_account.account.id)
self.debug("Domain admin account created: %s" % self.admin_account.id)
#Verify that there should be at least one physical network present in zone.
list_physical_networks_response = PhysicalNetwork.list(
@ -599,7 +599,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
liistall=True
)
self.assertEqual(
@ -693,7 +693,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
self.shared_network_sg = Network.create(
self.api_client,
self.services["shared_network_sg"],
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkofferingid=self.shared_network_offering_sg.id,
zoneid=self.zone.id
)
@ -726,7 +726,7 @@ class TestNetworksInAdvancedSG(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkids=self.shared_network_sg.id,
serviceofferingid=self.service_offering.id
)

View File

@ -169,13 +169,13 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
# 2. Give the user provided user name. Internal name should be
# i-<userid>-<vmid>-display name
self.debug("Deploying VM in account: %s" % self.account.account.name)
self.debug("Deploying VM in account: %s" % self.account.name)
# Spawn an instance in that network
virtual_machine = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.account.name,
domainid=self.account.account.domainid,
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
)
self.debug(
@ -208,11 +208,11 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
# Fetch account ID and VMID from database to check internal name
self.debug("select id from account where uuid = '%s';" \
% self.account.account.id)
% self.account.id)
qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \
% self.account.account.id
% self.account.id
)
self.assertEqual(
isinstance(qresultset, list),
@ -273,12 +273,12 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
# Removing display name from config
del self.services["virtual_machine"]["displayname"]
self.debug("Deploying VM in account: %s" % self.account.account.name)
self.debug("Deploying VM in account: %s" % self.account.name)
virtual_machine = VirtualMachine.create(
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.account.name,
domainid=self.account.account.domainid,
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
)
self.debug(
@ -307,11 +307,11 @@ class TestInstanceNameFlagTrue(cloudstackTestCase):
)
# Fetch account ID and VMID from database to check internal name
self.debug("select id from account where uuid = '%s';" \
% self.account.account.id)
% self.account.id)
qresultset = self.dbclient.execute(
"select id from account where uuid = '%s';" \
% self.account.account.id
% self.account.id
)
self.assertEqual(
isinstance(qresultset, list),

View File

@ -2135,7 +2135,7 @@ class TestGuestNetworkShutDown(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -2145,7 +2145,7 @@ class TestGuestNetworkShutDown(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -2153,7 +2153,7 @@ class TestGuestNetworkShutDown(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -2161,7 +2161,7 @@ class TestGuestNetworkShutDown(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls.lb_rule = LoadBalancerRule.create(
@ -2658,7 +2658,7 @@ class TestServiceProvider(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -2691,7 +2691,7 @@ class TestServiceProvider(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -2721,7 +2721,7 @@ class TestServiceProvider(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -2734,7 +2734,7 @@ class TestServiceProvider(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -2766,7 +2766,7 @@ class TestServiceProvider(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug(
@ -2813,7 +2813,7 @@ class TestServiceProvider(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)

View File

@ -245,7 +245,7 @@ class TestLbSourceNat(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -258,7 +258,7 @@ class TestLbSourceNat(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -294,7 +294,7 @@ class TestLbSourceNat(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -325,7 +325,7 @@ class TestLbSourceNat(cloudstackTestCase):
self.apiclient,
associatednetworkid=self.network.id,
account=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
listall=True,
issourcenat=True,
)
@ -454,7 +454,7 @@ class TestLbOnIpWithPf(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -467,7 +467,7 @@ class TestLbOnIpWithPf(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -503,7 +503,7 @@ class TestLbOnIpWithPf(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -535,7 +535,7 @@ class TestLbOnIpWithPf(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
@ -665,7 +665,7 @@ class TestPfOnIpWithLb(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -678,7 +678,7 @@ class TestPfOnIpWithLb(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -714,7 +714,7 @@ class TestPfOnIpWithLb(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -747,7 +747,7 @@ class TestPfOnIpWithLb(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug("Associated %s with network %s" % (
@ -877,7 +877,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -890,7 +890,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -926,7 +926,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -959,7 +959,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug("Associated %s with network %s" % (
@ -1097,7 +1097,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -1110,7 +1110,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -1146,7 +1146,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -1179,7 +1179,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug("Associated %s with network %s" % (
@ -1371,7 +1371,7 @@ class TestMultipleLbRules(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -1384,7 +1384,7 @@ class TestMultipleLbRules(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -1420,7 +1420,7 @@ class TestMultipleLbRules(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -1455,7 +1455,7 @@ class TestMultipleLbRules(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug("Associated %s with network %s" % (
@ -1501,7 +1501,7 @@ class TestMultipleLbRules(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug("Associated %s with network %s" % (
@ -1688,7 +1688,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -1701,7 +1701,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -1737,7 +1737,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -1772,7 +1772,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug("Associated %s with network %s" % (
@ -1953,7 +1953,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -1963,7 +1963,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -1971,7 +1971,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls.lb_rule = LoadBalancerRule.create(
@ -2176,7 +2176,7 @@ class TestDeleteCreateLBRule(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -2186,7 +2186,7 @@ class TestDeleteCreateLBRule(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -2194,7 +2194,7 @@ class TestDeleteCreateLBRule(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls._cleanup = [
@ -2315,7 +2315,7 @@ class TestVmWithLb(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -2325,7 +2325,7 @@ class TestVmWithLb(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -2333,7 +2333,7 @@ class TestVmWithLb(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -2341,7 +2341,7 @@ class TestVmWithLb(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls.lb_rule_1 = LoadBalancerRule.create(
@ -2355,7 +2355,7 @@ class TestVmWithLb(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls.lb_rule_2 = LoadBalancerRule.create(

View File

@ -212,7 +212,7 @@ class TestLbWithRoundRobin(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -225,7 +225,7 @@ class TestLbWithRoundRobin(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -259,7 +259,7 @@ class TestLbWithRoundRobin(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug("Associated %s with network %s" % (
@ -425,7 +425,7 @@ class TestLbWithLeastConn(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -438,7 +438,7 @@ class TestLbWithLeastConn(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -472,14 +472,14 @@ class TestLbWithLeastConn(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
ip_with_lb_rule = PublicIPAddress.create(
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug("Associated %s with network %s" % (
@ -644,7 +644,7 @@ class TestLbWithSourceIp(cloudstackTestCase):
self.apiclient,
self.services["network"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
zoneid=self.zone.id
)
@ -657,7 +657,7 @@ class TestLbWithSourceIp(cloudstackTestCase):
self.apiclient,
self.services["virtual_machine"],
accountid=self.account.name,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids=[str(self.network.id)]
)
@ -691,7 +691,7 @@ class TestLbWithSourceIp(cloudstackTestCase):
self.apiclient,
accountid=self.account.name,
zoneid=self.zone.id,
domainid=self.account.account.domainid,
domainid=self.account.domainid,
networkid=self.network.id
)
self.debug("Associated %s with network %s" % (
@ -791,7 +791,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -808,7 +808,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -816,7 +816,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls._cleanup = [
@ -1003,7 +1003,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -1020,7 +1020,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -1028,7 +1028,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls._cleanup = [
@ -1212,7 +1212,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -1229,7 +1229,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -1238,7 +1238,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls._cleanup = [
@ -1425,7 +1425,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -1442,7 +1442,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -1451,7 +1451,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls._cleanup = [
@ -1639,7 +1639,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -1656,7 +1656,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -1665,7 +1665,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls._cleanup = [
@ -1853,7 +1853,7 @@ class TestLbAlgoLcSb(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -1870,7 +1870,7 @@ class TestLbAlgoLcSb(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -1878,7 +1878,7 @@ class TestLbAlgoLcSb(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls._cleanup = [

View File

@ -156,7 +156,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
cls.api_client,
cls.services["network"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
zoneid=cls.zone.id
)
@ -166,7 +166,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
cls.api_client,
cls.services["virtual_machine"],
accountid=cls.account.name,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids=[str(cls.network.id)]
)
@ -174,7 +174,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
cls.api_client,
accountid=cls.account.name,
zoneid=cls.zone.id,
domainid=cls.account.account.domainid,
domainid=cls.account.domainid,
networkid=cls.network.id
)
cls._cleanup = [

View File

@ -270,7 +270,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.account.account.id,
id=self.account.id,
listall=True
)
self.assertEqual(
@ -406,7 +406,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.account.account.id,
id=self.account.id,
listall=True
)
self.assertEqual(
@ -495,7 +495,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.account.account.id,
id=self.account.id,
listall=True
)
self.assertEqual(
@ -597,7 +597,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -631,7 +631,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.user_account.account.id,
id=self.user_account.id,
listall=True
)
self.assertEqual(
@ -807,7 +807,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.user_account.name,
domainid=self.user_account.account.domainid,
domainid=self.user_account.domainid,
serviceofferingid=self.service_offering.id,
networkids=self.network.id
)
@ -880,7 +880,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -914,7 +914,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.user_account.account.id,
id=self.user_account.id,
listall=True
)
self.assertEqual(
@ -1027,7 +1027,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["network"],
accountid=self.user_account.name,
domainid=self.user_account.account.domainid,
domainid=self.user_account.domainid,
networkofferingid=self.shared_network_offering.id,
zoneid=self.zone.id
)
@ -1061,7 +1061,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkids=self.network.id,
serviceofferingid=self.service_offering.id
)
@ -1073,7 +1073,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.user_account.name,
domainid=self.user_account.account.domainid,
domainid=self.user_account.domainid,
networkids=self.network.id,
serviceofferingid=self.service_offering.id
)
@ -1146,7 +1146,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -1165,7 +1165,7 @@ class TestSharedNetworks(cloudstackTestCase):
"The admin account created is not enabled."
)
self.debug("Admin type account created: %s" % self.admin_account.account.id)
self.debug("Admin type account created: %s" % self.admin_account.id)
#create domain
self.dom_domain = Domain.create(
@ -1206,7 +1206,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.domain_admin_account.account.id,
id=self.domain_admin_account.id,
listall=True
)
self.assertEqual(
@ -1225,7 +1225,7 @@ class TestSharedNetworks(cloudstackTestCase):
"The domain admin account created is not enabled."
)
self.debug("Domain admin account created: %s" % self.domain_admin_account.account.id)
self.debug("Domain admin account created: %s" % self.domain_admin_account.id)
#Create an user account
self.domain_user_account = Account.create(
@ -1240,7 +1240,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.domain_user_account.account.id,
id=self.domain_user_account.id,
listall=True
)
self.assertEqual(
@ -1259,7 +1259,7 @@ class TestSharedNetworks(cloudstackTestCase):
"The domain user account created is not enabled."
)
self.debug("Domain user account created: %s" % self.domain_user_account.account.id)
self.debug("Domain user account created: %s" % self.domain_user_account.id)
#Verify that there should be at least one physical network present in zone.
list_physical_networks_response = PhysicalNetwork.list(
@ -1388,7 +1388,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkids=self.network.id,
serviceofferingid=self.service_offering.id
)
@ -1400,7 +1400,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.domain_user_account.name,
domainid=self.domain_user_account.account.domainid,
domainid=self.domain_user_account.domainid,
networkids=self.network.id,
serviceofferingid=self.service_offering.id
)
@ -1428,7 +1428,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.domain_admin_account.name,
domainid=self.domain_admin_account.account.domainid,
domainid=self.domain_admin_account.domainid,
networkids=self.network.id,
serviceofferingid=self.service_offering.id
)
@ -1500,7 +1500,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -1519,7 +1519,7 @@ class TestSharedNetworks(cloudstackTestCase):
"The admin account created is not enabled."
)
self.debug("Admin account created: %s" % self.admin_account.account.id)
self.debug("Admin account created: %s" % self.admin_account.id)
self.services["project"]["name"] = "proj-SADJKS"
self.services["project"]["displaytext"] = "proj-SADJKS"
@ -1528,7 +1528,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["project"],
account=self.admin_account.name,
domainid=self.admin_account.account.domainid
domainid=self.admin_account.domainid
)
self.cleanup_projects.append(self.project1)
@ -1558,7 +1558,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["project"],
account=self.admin_account.name,
domainid=self.admin_account.account.domainid
domainid=self.admin_account.domainid
)
self.cleanup_projects.append(self.project2)
@ -1674,7 +1674,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["network"],
projectid=self.project1.id,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkofferingid=self.shared_network_offering.id,
zoneid=self.zone.id
)
@ -1709,7 +1709,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkids=self.network.id,
projectid=self.project2.id,
serviceofferingid=self.service_offering.id
@ -1722,7 +1722,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkids=self.network.id,
projectid=self.project1.id,
serviceofferingid=self.service_offering.id
@ -1784,7 +1784,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -1803,7 +1803,7 @@ class TestSharedNetworks(cloudstackTestCase):
"The admin account created is not enabled."
)
self.debug("Domain admin account created: %s" % self.admin_account.account.id)
self.debug("Domain admin account created: %s" % self.admin_account.id)
#Verify that there should be at least one physical network present in zone.
list_physical_networks_response = PhysicalNetwork.list(
@ -1944,7 +1944,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -1963,7 +1963,7 @@ class TestSharedNetworks(cloudstackTestCase):
"The admin account created is not enabled."
)
self.debug("Admin account created: %s" % self.admin_account.account.id)
self.debug("Admin account created: %s" % self.admin_account.id)
#Verify that there should be at least one physical network present in zone.
list_physical_networks_response = PhysicalNetwork.list(
@ -2129,7 +2129,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -2148,7 +2148,7 @@ class TestSharedNetworks(cloudstackTestCase):
"The admin account created is not enabled."
)
self.debug("Admin account created: %s" % self.admin_account.account.id)
self.debug("Admin account created: %s" % self.admin_account.id)
#Verify that there should be at least one physical network present in zone.
list_physical_networks_response = PhysicalNetwork.list(
@ -2309,7 +2309,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkids=self.network.id,
serviceofferingid=self.service_offering.id
)
@ -2337,7 +2337,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkids=self.network1.id,
serviceofferingid=self.service_offering.id
)
@ -2392,7 +2392,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
liistall=True
)
self.assertEqual(
@ -2540,7 +2540,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.shared_network = Network.create(
self.api_client,
self.services["network"],
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkofferingid=self.shared_network_offering.id,
zoneid=self.zone.id
)
@ -2573,7 +2573,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["isolated_network"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkofferingid=self.isolated_network_offering.id,
zoneid=self.zone.id
)
@ -2601,7 +2601,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkids=self.shared_network.id,
serviceofferingid=self.service_offering.id
)
@ -2628,7 +2628,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["virtual_machine"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkids=self.isolated_network.id,
serviceofferingid=self.service_offering.id
)
@ -2657,7 +2657,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
accountid=self.admin_account.name,
zoneid=self.zone.id,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkid=self.isolated_network.id
)
@ -2730,7 +2730,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -2749,7 +2749,7 @@ class TestSharedNetworks(cloudstackTestCase):
"The admin account created is not enabled."
)
self.debug("Admin type account created: %s" % self.admin_account.account.id)
self.debug("Admin type account created: %s" % self.admin_account.id)
#Verify that there should be at least one physical network present in zone.
list_physical_networks_response = PhysicalNetwork.list(
@ -2845,7 +2845,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["network"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkofferingid=self.shared_network_offering.id,
zoneid=self.zone.id
)
@ -2875,7 +2875,7 @@ class TestSharedNetworks(cloudstackTestCase):
#verify that the account got created with state enabled
list_accounts_response = Account.list(
self.api_client,
id=self.admin_account.account.id,
id=self.admin_account.id,
listall=True
)
self.assertEqual(
@ -2894,7 +2894,7 @@ class TestSharedNetworks(cloudstackTestCase):
"The admin account created is not enabled."
)
self.debug("Admin type account created: %s" % self.admin_account.account.id)
self.debug("Admin type account created: %s" % self.admin_account.id)
#Verify that there should be at least one physical network present in zone.
list_physical_networks_response = PhysicalNetwork.list(
@ -2990,7 +2990,7 @@ class TestSharedNetworks(cloudstackTestCase):
self.api_client,
self.services["network"],
accountid=self.admin_account.name,
domainid=self.admin_account.account.domainid,
domainid=self.admin_account.domainid,
networkofferingid=self.shared_network_offering.id,
zoneid=self.zone.id
)

View File

@ -1734,6 +1734,9 @@ class TestDeleteAccount(cloudstackTestCase):
None,
"Check routers are properly deleted."
)
except cloudstackAPIException:
self.debug("Router is deleted")
except Exception as e:
raise Exception(
"Encountered %s raised while fetching routers for account: %s" % (e,

View File

@ -46,7 +46,7 @@ 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-`
hdd_path=`vboxmanage list hdds | grep "$appliance\/" | grep vdi | cut -c 14-`
# Remove any shared folder
shared_folders=`vboxmanage showvminfo $appliance | grep Name | grep Host`
@ -67,7 +67,7 @@ mkdir dist
set -e
# Export for Xen
vboxmanage internalcommands converttoraw "$hdd_path" img.raw
vboxmanage internalcommands converttoraw -format vdi "$hdd_path" img.raw
faketime '2010-01-01' vhd-util convert -s 0 -t 1 -i img.raw -o stagefixed.vhd
faketime '2010-01-01' vhd-util convert -s 1 -t 2 -i stagefixed.vhd -o $appliance-$build_date-$branch-xen.vhd
rm *.bak
@ -75,7 +75,7 @@ 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
vboxmanage internalcommands converttoraw -format vdi "$hdd_path" raw.img
qemu-img convert -f raw -c -O qcow2 raw.img $appliance-$build_date-$branch-kvm.qcow2
rm raw.img
bzip2 $appliance-$build_date-$branch-kvm.qcow2

View File

@ -640,9 +640,14 @@
name: { label: 'label.name' },
type: { label: 'label.type' }
},
dataProvider: function(args) {
dataProvider: function(args) {
var data = {
domainid: args.context.instances[0].domainid,
account: args.context.instances[0].account
};
$.ajax({
url: createURL('listAffinityGroups'),
data: data,
async: false, //make it sync to avoid dataProvider() being called twice which produces duplicate data
success: function(json) {
var items = [];
@ -1513,6 +1518,7 @@
args.response.success({
_custom: { jobId: json.updatedefaultnicforvirtualmachineresponse.jobid }
});
cloudStack.dialog.notice({message:_l('Please manually update the default NIC on the VM now.')});
}
});
},

View File

@ -544,7 +544,8 @@
name: { label: 'label.name' },
account: { label: 'label.account' },
type: { label: 'label.type' },
cidr: { label: 'label.cidr' }
cidr: { label: 'label.cidr' },
ip6cidr: { label: 'IPv6 CIDR' }
},
advSearchFields: {

View File

@ -3282,6 +3282,8 @@
}
else if(result.jobstatus == 2){
alert("error: " + _s(result.jobresult.errortext));
error('configureGuestTraffic', result.jobresult.errortext, { fn: 'configureGuestTraffic', args: args });
}
}
},

View File

@ -111,8 +111,8 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g
Long vmId = null;
Long volumeId = null;
// Create the usage record for bytes read
String usageDesc = "disk bytes read";
// Create the usage record for disk I/O read (io requests)
String usageDesc = "disk I/O read (io requests)";
if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){
vmId = vmDiskInfo.getVmId();
volumeId = vmDiskInfo.getVolumeId();
@ -122,8 +122,8 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g
UsageTypes.VM_DISK_IO_READ, new Double(ioRead), vmId, null, null, null, vmDiskInfo.getVolumeId(), startDate, endDate, "VirtualMachine");
usageRecords.add(usageRecord);
// Create the usage record for bytes write
usageDesc = "disk bytes write";
// Create the usage record for disk I/O write (io requests)
usageDesc = "disk I/O write (io requests)";
if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){
usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId;
}
@ -131,8 +131,8 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g
UsageTypes.VM_DISK_BYTES_WRITE, new Double(ioWrite), vmId, null, null, null, vmDiskInfo.getVolumeId(), startDate, endDate, "VirtualMachine");
usageRecords.add(usageRecord);
// Create the usage record for bytes read
usageDesc = "disk bytes read";
// Create the usage record for disk I/O read (bytes)
usageDesc = "disk I/O read (bytes)";
if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){
usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId;
}
@ -140,8 +140,8 @@ public static final Logger s_logger = Logger.getLogger(VmDiskUsageParser.class.g
UsageTypes.VM_DISK_BYTES_READ, new Double(bytesRead), vmId, null, null, null, vmDiskInfo.getVolumeId(), startDate, endDate, "VirtualMachine");
usageRecords.add(usageRecord);
// Create the usage record for bytes write
usageDesc = "disk bytes write";
// Create the usage record for disk I/O write (bytes)
usageDesc = "disk I/O write (bytes)";
if ((vmDiskInfo.getVmId() != 0) && (vmDiskInfo.getVolumeId() != 0)){
usageDesc += " for Vm: " + vmId + " and Volume: " + volumeId;
}

View File

@ -61,7 +61,7 @@ public class Ternary<T, U, V> {
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Pair)) {
if (!(obj instanceof Ternary)) {
return false;
}
Ternary<?, ?, ?> that = (Ternary<?, ?, ?>)obj;

View File

@ -795,6 +795,37 @@ public class NetUtils {
return new Pair<String, Integer>(tokens[0], Integer.parseInt(tokens[1]));
}
public static int isNetowrkASubsetOrSupersetOfNetworkB (String cidrA, String cidrB) {
Long[] cidrALong = cidrToLong(cidrA);
Long[] cidrBLong = cidrToLong(cidrB);
long shift =0;
if (cidrALong == null || cidrBLong == null) {
//implies error in the cidr format
return -1;
}
if (cidrALong[1] >= cidrBLong[1]) {
shift = 32 - cidrBLong[1];
}
else {
shift = 32 - cidrALong[1];
}
long result = (cidrALong[0] >> shift) - (cidrBLong[0] >> shift);
if (result == 0) {
if (cidrALong[1] < cidrBLong[1]) {
//this implies cidrA is super set of cidrB
return 1;
}
else if (cidrALong[1] == cidrBLong[1]) {
//this implies both the cidrs are equal
return 3;
}
// implies cidrA is subset of cidrB
return 2;
}
//this implies no overlap.
return 0;
}
public static boolean isNetworkAWithinNetworkB(String cidrA, String cidrB) {
Long[] cidrALong = cidrToLong(cidrA);
Long[] cidrBLong = cidrToLong(cidrB);

View File

@ -0,0 +1,35 @@
// 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
// 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.utils;
import org.junit.Assert;
import org.junit.Test;
public class TernaryTest {
@Test
public void testEquals() {
Assert.assertEquals(new Ternary<String, String, String>("a", "b", "c"), new Ternary<String, String, String>(
"a", "b", "c"));
Assert.assertFalse(new Ternary<String, String, String>("a", "b", "c")
.equals(new Ternary<String, String, String>("a", "b", "d")));
Assert.assertFalse(new Ternary<String, String, String>("a", "b", "c").equals(""));
Assert.assertFalse(new Ternary<String, String, String>("a", "b", "c").equals(null));
Assert.assertFalse(new Ternary<String, String, String>("a", "b", "c")
.equals(new Pair<String, String>("a", "b")));
}
}