mirror of https://github.com/apache/cloudstack.git
Merge branch 'master' into internallb1
Conflicts: api/src/com/cloud/network/IpAddress.java server/src/com/cloud/network/NetworkServiceImpl.java setup/db/db/schema-410to420.sql
This commit is contained in:
commit
0cfe96bd00
|
|
@ -78,17 +78,9 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
|
|||
|
||||
boolean getSystem();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
Long getVpcId();
|
||||
|
||||
/**
|
||||
* @param vpcId
|
||||
*/
|
||||
void setVpcId(Long vpcId);
|
||||
String getVmIp();
|
||||
void setVmIp(String vmIp);
|
||||
|
||||
Long getNetworkId();
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ public interface NetworkService {
|
|||
Long startIndex, Long pageSize, String name);
|
||||
|
||||
PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags,
|
||||
String newVnetRangeString, String state);
|
||||
String newVnetRangeString, String state, String removeVlan);
|
||||
|
||||
boolean deletePhysicalNetwork(Long id);
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package com.cloud.network;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
|
@ -59,7 +60,9 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
|
|||
|
||||
Long getDomainId();
|
||||
|
||||
String getVnet();
|
||||
List<Pair<Integer,Integer>> getVnet();
|
||||
|
||||
String getVnetString();
|
||||
|
||||
String getSpeed();
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,4 @@ public interface PublicIpAddress extends ControlledEntity, IpAddress, Vlan, Inte
|
|||
public String getNetmask();
|
||||
|
||||
public String getGateway();
|
||||
|
||||
@Override
|
||||
public String getVlanTag();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -407,6 +407,4 @@ public interface ManagementService {
|
|||
*/
|
||||
List<? extends Capacity> listTopConsumedResources(ListCapacityCmd cmd);
|
||||
|
||||
List<String> listDeploymentPlanners();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import org.apache.cloudstack.acl.ControlledEntity;
|
|||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
|
||||
public interface Account extends ControlledEntity, InternalIdentity, Identity {
|
||||
public enum Type {
|
||||
Normal,
|
||||
|
|
@ -64,4 +65,7 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
|
|||
public Long getDefaultZoneId();
|
||||
|
||||
public String getUuid();
|
||||
|
||||
boolean isDefault();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,5 +72,7 @@ public interface User extends OwnedBy, InternalIdentity {
|
|||
String getRegistrationToken();
|
||||
|
||||
boolean isRegistered();
|
||||
|
||||
boolean isDefault();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,6 +221,7 @@ public class ApiConstants {
|
|||
public static final String VIRTUAL_MACHINE_ID = "virtualmachineid";
|
||||
public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids";
|
||||
public static final String VLAN = "vlan";
|
||||
public static final String REMOVE_VLAN="removevlan";
|
||||
public static final String VLAN_ID = "vlanid";
|
||||
public static final String VM_AVAILABLE = "vmavailable";
|
||||
public static final String VM_LIMIT = "vmlimit";
|
||||
|
|
@ -481,7 +482,6 @@ public class ApiConstants {
|
|||
public static final String PROVIDER_TYPE = "providertype";
|
||||
public static final String AFFINITY_GROUP_IDS = "affinitygroupids";
|
||||
public static final String AFFINITY_GROUP_NAMES = "affinitygroupnames";
|
||||
public static final String DEPLOYMENT_PLANNER = "deploymentplanner";
|
||||
public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile";
|
||||
|
||||
public enum HostDetails {
|
||||
|
|
|
|||
|
|
@ -1,71 +0,0 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.response.DeploymentPlannersResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
@APICommand(name = "listDeploymentPlanners", description = "Lists all DeploymentPlanners available.", responseObject = DeploymentPlannersResponse.class)
|
||||
public class ListDeploymentPlannersCmd extends BaseListCmd {
|
||||
public static final Logger s_logger = Logger.getLogger(ListDeploymentPlannersCmd.class.getName());
|
||||
|
||||
private static final String s_name = "listdeploymentplannersresponse";
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(){
|
||||
List<String> planners = _mgr.listDeploymentPlanners();
|
||||
ListResponse<DeploymentPlannersResponse> response = new ListResponse<DeploymentPlannersResponse>();
|
||||
List<DeploymentPlannersResponse> plannerResponses = new ArrayList<DeploymentPlannersResponse>();
|
||||
|
||||
for (String planner : planners) {
|
||||
DeploymentPlannersResponse plannerResponse = new DeploymentPlannersResponse();
|
||||
plannerResponse.setName(planner);
|
||||
plannerResponse.setObjectName("deploymentPlanner");
|
||||
plannerResponses.add(plannerResponse);
|
||||
}
|
||||
|
||||
response.setResponses(plannerResponses);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -54,6 +54,8 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
|
|||
|
||||
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network")
|
||||
private String vlan;
|
||||
@Parameter(name=ApiConstants.REMOVE_VLAN, type = CommandType.STRING, description ="The vlan range we want to remove")
|
||||
private String removevlan;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -79,6 +81,10 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
|
|||
return vlan;
|
||||
}
|
||||
|
||||
public String getRemoveVlan(){
|
||||
return removevlan;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -95,7 +101,7 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public void execute(){
|
||||
PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(),getNetworkSpeed(), getTags(), getVlan(), getState());
|
||||
PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(),getNetworkSpeed(), getTags(), getVlan(), getState(), getRemoveVlan());
|
||||
PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
this.setResponseObject(response);
|
||||
|
|
|
|||
|
|
@ -84,9 +84,6 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.NETWORKRATE, type=CommandType.INTEGER, description="data transfer rate in megabits per second allowed. Supported only for non-System offering and system offerings having \"domainrouter\" systemvmtype")
|
||||
private Integer networkRate;
|
||||
|
||||
@Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "The deployment planner heuristics used to deploy a VM of this offering, default \"FirstFitPlanner\".")
|
||||
private String deploymentPlanner;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -151,9 +148,6 @@ public class CreateServiceOfferingCmd extends BaseCmd {
|
|||
return networkRate;
|
||||
}
|
||||
|
||||
public String getDeploymentPlanner() {
|
||||
return deploymentPlanner;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.apache.log4j.Logger;
|
|||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.server.ResourceTag;
|
||||
import com.cloud.server.ResourceTag.TaggedResourceType;
|
||||
@APICommand(name = "createTags", description = "Creates resource tag(s)", responseObject = SuccessResponse.class, since = "Burbank")
|
||||
@APICommand(name = "createTags", description = "Creates resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0")
|
||||
public class CreateTagsCmd extends BaseAsyncCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(CreateTagsCmd.class.getName());
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.server.ResourceTag.TaggedResourceType;
|
||||
@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "Burbank")
|
||||
@APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "4.0.0")
|
||||
public class DeleteTagsCmd extends BaseAsyncCmd{
|
||||
public static final Logger s_logger = Logger.getLogger(DeleteTagsCmd.class.getName());
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import org.apache.cloudstack.api.Parameter;
|
|||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ResourceTagResponse;
|
||||
|
||||
@APICommand(name = "listTags", description = "List resource tag(s)", responseObject = ResourceTagResponse.class, since = "Burbank")
|
||||
@APICommand(name = "listTags", description = "List resource tag(s)", responseObject = ResourceTagResponse.class, since = "4.0.0")
|
||||
public class ListTagsCmd extends BaseListProjectAndAccountResourcesCmd{
|
||||
private static final String s_name = "listtagsresponse";
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
|
|||
|
||||
@Parameter(name=ApiConstants.DETAILS, type=CommandType.LIST, collectionType=CommandType.STRING,
|
||||
description="comma separated list of host details requested, " +
|
||||
"value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min]." +
|
||||
"value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min, affgrp]." +
|
||||
" If no parameter is passed in, the details will be defaulted to all" )
|
||||
private List<String> viewDetails;
|
||||
|
||||
|
|
|
|||
|
|
@ -183,6 +183,9 @@ public class AccountResponse extends BaseResponse {
|
|||
|
||||
@SerializedName(ApiConstants.ACCOUNT_DETAILS) @Param(description="details for the account")
|
||||
private Map<String, String> details;
|
||||
|
||||
@SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if account is default, false otherwise", since="4.2.0")
|
||||
private Boolean isDefault;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -381,4 +384,8 @@ public class AccountResponse extends BaseResponse {
|
|||
public void setDefaultZone(String defaultZoneId) {
|
||||
this.defaultZoneId = defaultZoneId;
|
||||
}
|
||||
|
||||
public void setIsDefault(Boolean isDefault) {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
|
|
@ -74,6 +75,9 @@ public class UserResponse extends BaseResponse {
|
|||
|
||||
@SerializedName("iscallerchilddomain") @Param(description="the boolean value representing if the updating target is in caller's child domain")
|
||||
private boolean isCallerChildDomain;
|
||||
|
||||
@SerializedName(ApiConstants.IS_DEFAULT) @Param(description="true if user is default, false otherwise", since="4.2.0")
|
||||
private Boolean isDefault;
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
|
|
@ -206,4 +210,8 @@ public class UserResponse extends BaseResponse {
|
|||
public void setIsCallerChildDomain(boolean isCallerChildDomain) {
|
||||
this.isCallerChildDomain = isCallerChildDomain;
|
||||
}
|
||||
|
||||
public void setIsDefault(Boolean isDefault) {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -614,7 +614,6 @@
|
|||
<property name="UserAuthenticators" value="#{userAuthenticators.Adapters}" />
|
||||
<property name="UserPasswordEncoders" value="#{userPasswordEncoders.Adapters}" />
|
||||
<property name="HostAllocators" value="#{hostAllocators.Adapters}" />
|
||||
<property name="Planners" value="#{deploymentPlanners.Adapters}" />
|
||||
<property name="AffinityGroupProcessors" value="#{affinityProcessors.Adapters}" />
|
||||
</bean>
|
||||
|
||||
|
|
|
|||
|
|
@ -65,6 +65,9 @@ public class AccountVO implements Account {
|
|||
|
||||
@Column(name="default_zone_id")
|
||||
private Long defaultZoneId = null;
|
||||
|
||||
@Column(name = "default")
|
||||
boolean isDefault;
|
||||
|
||||
public AccountVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
|
|
@ -179,4 +182,8 @@ public class AccountVO implements Account {
|
|||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,11 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Table;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.user.Account.State;
|
||||
import com.cloud.utils.db.Encrypt;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
/**
|
||||
* A bean representing a user
|
||||
|
|
@ -92,6 +93,9 @@ public class UserVO implements User, Identity, InternalIdentity {
|
|||
|
||||
@Column(name="uuid")
|
||||
private String uuid;
|
||||
|
||||
@Column(name = "default")
|
||||
boolean isDefault;
|
||||
|
||||
public UserVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
|
|
@ -262,4 +266,9 @@ public class UserVO implements User, Identity, InternalIdentity {
|
|||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -25,11 +25,11 @@
|
|||
<section id="source-build">
|
||||
<title>Building &PRODUCT; from Source</title>
|
||||
<note>
|
||||
<para>Prior to the 4.0.0 incubating release, Ant was used to build &PRODUCT;. Starting with 4.0.0 a migration to Maven is underway.</para>
|
||||
<para>Prior to the 4.0.0 incubating release, Ant was used to build &PRODUCT;. A migration to Maven started in the 4.0.0 cycle, and has completed in 4.1.0.</para>
|
||||
<para>The website and the wiki contain up to date information on the build procedure at:</para>
|
||||
<itemizedlist>
|
||||
<listitem><para><ulink url="https://cwiki.apache.org/CLOUDSTACK/building-with-maven.html">https://cwiki.apache.org/CLOUDSTACK/building-with-maven.html</ulink></para></listitem>
|
||||
<listitem><para><ulink url="http://incubator.apache.org/cloudstack/develop/environment.html">http://incubator.apache.org/cloudstack/develop/environment.html</ulink></para></listitem>
|
||||
<listitem><para><ulink url="https://cwiki.apache.org/CLOUDSTACK/setting-up-cloudstack-development-environment.html">https://cwiki.apache.org/CLOUDSTACK/setting-up-cloudstack-development-environment.html</ulink></para></listitem>
|
||||
</itemizedlist>
|
||||
</note>
|
||||
<para>The overarching steps to build &PRODUCT; are:.</para>
|
||||
|
|
|
|||
|
|
@ -23,6 +23,15 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import org.apache.log4j.Logger;
|
||||
import com.cloud.utils.script.Script;
|
||||
|
||||
import org.libvirt.Connect;
|
||||
import org.libvirt.LibvirtException;
|
||||
import org.libvirt.Secret;
|
||||
import org.libvirt.StoragePool;
|
||||
import org.libvirt.StoragePoolInfo;
|
||||
import org.libvirt.StoragePoolInfo.StoragePoolState;
|
||||
|
||||
import com.cloud.hypervisor.kvm.resource.LibvirtConnection;
|
||||
|
||||
public class KVMHAMonitor extends KVMHABase implements Runnable {
|
||||
private static final Logger s_logger = Logger.getLogger(KVMHAMonitor.class);
|
||||
private Map<String, NfsStoragePool> _storagePool = new ConcurrentHashMap<String, NfsStoragePool>();
|
||||
|
|
@ -45,6 +54,9 @@ public class KVMHAMonitor extends KVMHABase implements Runnable {
|
|||
|
||||
public void removeStoragePool(String uuid) {
|
||||
synchronized (_storagePool) {
|
||||
NfsStoragePool pool = this._storagePool.get(uuid);
|
||||
Script.runSimpleBashScript("umount " + pool._mountDestPath);
|
||||
s_logger.debug("attempted to umount '" + pool._mountDestPath + "'");
|
||||
this._storagePool.remove(uuid);
|
||||
}
|
||||
}
|
||||
|
|
@ -60,7 +72,44 @@ public class KVMHAMonitor extends KVMHABase implements Runnable {
|
|||
@Override
|
||||
public void run() {
|
||||
synchronized (_storagePool) {
|
||||
for (NfsStoragePool primaryStoragePool : _storagePool.values()) {
|
||||
for (String uuid : _storagePool.keySet()) {
|
||||
NfsStoragePool primaryStoragePool = _storagePool.get(uuid);
|
||||
|
||||
// check for any that have been deregistered with libvirt and
|
||||
// skip,remove them
|
||||
|
||||
StoragePool storage = null;
|
||||
try {
|
||||
Connect conn = LibvirtConnection.getConnection();
|
||||
storage = conn.storagePoolLookupByUUIDString(uuid);
|
||||
if (storage == null) {
|
||||
s_logger.debug("Libvirt storage pool " + uuid
|
||||
+" not found, removing from HA list");
|
||||
removeStoragePool(uuid);
|
||||
continue;
|
||||
|
||||
} else if (storage.getInfo().state != StoragePoolState.VIR_STORAGE_POOL_RUNNING) {
|
||||
s_logger.debug("Libvirt storage pool " + uuid
|
||||
+" found, but not running, removing from HA list");
|
||||
|
||||
removeStoragePool(uuid);
|
||||
continue;
|
||||
}
|
||||
s_logger.debug("Found NFS storage pool " + uuid + " in libvirt, continuing");
|
||||
|
||||
} catch (LibvirtException e) {
|
||||
s_logger.debug("Failed to lookup libvirt storage pool " + uuid
|
||||
+ " due to: " + e );
|
||||
|
||||
// we only want to remove pool if it's not found, not if libvirt
|
||||
// connection fails
|
||||
if (e.toString().contains("pool not found")) {
|
||||
s_logger.debug("removing pool from HA monitor since it was deleted");
|
||||
removeStoragePool(uuid);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String result = null;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Script cmd = new Script(_heartBeatPath,
|
||||
|
|
|
|||
|
|
@ -1077,8 +1077,7 @@ ServerResource {
|
|||
*/
|
||||
conn.domainCreateXML(domainXML, 0);
|
||||
} catch (final LibvirtException e) {
|
||||
s_logger.warn("Failed to start domain " + vmName + ": "
|
||||
+ e.getMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1270,7 +1269,7 @@ ServerResource {
|
|||
secondaryStoragePool = _storagePoolMgr.getStoragePoolByURI(
|
||||
secondaryStorageUrl);
|
||||
secondaryStoragePool.createFolder(volumeDestPath);
|
||||
secondaryStoragePool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(secondaryStoragePool.getType(),secondaryStoragePool.getUuid());
|
||||
secondaryStoragePool = _storagePoolMgr.getStoragePoolByURI(
|
||||
secondaryStorageUrl
|
||||
+ volumeDestPath);
|
||||
|
|
@ -1292,7 +1291,7 @@ ServerResource {
|
|||
return new CopyVolumeAnswer(cmd, false, e.toString(), null, null);
|
||||
} finally {
|
||||
if (secondaryStoragePool != null) {
|
||||
secondaryStoragePool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(secondaryStoragePool.getType(),secondaryStoragePool.getUuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1415,7 +1414,7 @@ ServerResource {
|
|||
return null;
|
||||
} finally {
|
||||
if (secondaryPool != null) {
|
||||
secondaryPool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(secondaryPool.getType(),secondaryPool.getUuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2008,7 +2007,7 @@ ServerResource {
|
|||
true);
|
||||
} finally {
|
||||
if (secondaryStoragePool != null) {
|
||||
secondaryStoragePool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(secondaryStoragePool.getType(),secondaryStoragePool.getUuid());
|
||||
}
|
||||
}
|
||||
return new BackupSnapshotAnswer(cmd, true, null, snapshotRelPath
|
||||
|
|
@ -2040,7 +2039,7 @@ ServerResource {
|
|||
return new DeleteSnapshotBackupAnswer(cmd, false, e.toString());
|
||||
} finally {
|
||||
if (secondaryStoragePool != null) {
|
||||
secondaryStoragePool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(secondaryStoragePool.getType(),secondaryStoragePool.getUuid());
|
||||
}
|
||||
}
|
||||
return new DeleteSnapshotBackupAnswer(cmd, true, null);
|
||||
|
|
@ -2069,7 +2068,7 @@ ServerResource {
|
|||
return new Answer(cmd, false, e.toString());
|
||||
} finally {
|
||||
if (secondaryStoragePool != null) {
|
||||
secondaryStoragePool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(secondaryStoragePool.getType(),secondaryStoragePool.getUuid());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2167,10 +2166,10 @@ ServerResource {
|
|||
return new CreatePrivateTemplateAnswer(cmd, false, e.getMessage());
|
||||
} finally {
|
||||
if (secondaryPool != null) {
|
||||
secondaryPool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(secondaryPool.getType(), secondaryPool.getUuid());
|
||||
}
|
||||
if (snapshotPool != null) {
|
||||
snapshotPool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(snapshotPool.getType(), snapshotPool.getUuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2304,7 +2303,7 @@ ServerResource {
|
|||
return new CreatePrivateTemplateAnswer(cmd, false, e.toString());
|
||||
} finally {
|
||||
if (secondaryStorage != null) {
|
||||
secondaryStorage.delete();
|
||||
_storagePoolMgr.deleteStoragePool(secondaryStorage.getType(), secondaryStorage.getUuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2362,7 +2361,7 @@ ServerResource {
|
|||
return new PrimaryStorageDownloadAnswer(e.toString());
|
||||
} finally {
|
||||
if (secondaryPool != null) {
|
||||
secondaryPool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(secondaryPool.getType(),secondaryPool.getUuid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3454,7 +3453,7 @@ ServerResource {
|
|||
KVMStoragePool pool = _storagePoolMgr.getStoragePool(
|
||||
StoragePoolType.Filesystem, poolUuid);
|
||||
if (pool != null) {
|
||||
pool.delete();
|
||||
_storagePoolMgr.deleteStoragePool(pool.getType(),pool.getUuid());
|
||||
}
|
||||
return true;
|
||||
} catch (CloudRuntimeException e) {
|
||||
|
|
|
|||
|
|
@ -532,8 +532,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements
|
|||
throw new CloudRuntimeException("Failed to delete storage pool on host");
|
||||
}
|
||||
|
||||
this.dataStoreHelper.deletePrimaryDataStore(store);
|
||||
return false;
|
||||
return this.dataStoreHelper.deletePrimaryDataStore(store);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -755,6 +755,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
response.setDescription(globalLoadBalancerRule.getDescription());
|
||||
response.setRegionIdId(globalLoadBalancerRule.getRegion());
|
||||
response.setId(globalLoadBalancerRule.getUuid());
|
||||
populateOwner(response, globalLoadBalancerRule);
|
||||
response.setObjectName("globalloadbalancer");
|
||||
return response;
|
||||
}
|
||||
|
|
@ -2655,7 +2656,7 @@ public class ApiResponseHelper implements ResponseGenerator {
|
|||
response.setZoneId(zone.getUuid());
|
||||
}
|
||||
response.setNetworkSpeed(result.getSpeed());
|
||||
response.setVlan(result.getVnet());
|
||||
response.setVlan(result.getVnetString());
|
||||
if (result.getDomainId() != null) {
|
||||
Domain domain = ApiDBUtils.findDomainById(result.getDomainId());
|
||||
if (domain != null) {
|
||||
|
|
|
|||
|
|
@ -1699,6 +1699,7 @@ public class QueryManagerImpl extends ManagerBase implements QueryService {
|
|||
sb.and("typeNEQ", sb.entity().getType(), SearchCriteria.Op.NEQ);
|
||||
sb.and("idNEQ", sb.entity().getId(), SearchCriteria.Op.NEQ);
|
||||
|
||||
|
||||
if (listForDomain && isRecursive) {
|
||||
sb.and("path", sb.entity().getDomainPath(), SearchCriteria.Op.LIKE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,17 +20,16 @@ import java.util.List;
|
|||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.UserResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.query.ViewResponseHelper;
|
||||
import com.cloud.api.query.vo.AccountJoinVO;
|
||||
import com.cloud.api.query.vo.UserAccountJoinVO;
|
||||
import com.cloud.configuration.Resource.ResourceType;
|
||||
import org.apache.cloudstack.api.response.AccountResponse;
|
||||
import org.apache.cloudstack.api.response.UserResponse;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
|
|
@ -66,6 +65,7 @@ public class AccountJoinDaoImpl extends GenericDaoBase<AccountJoinVO, Long> impl
|
|||
accountResponse.setState(account.getState().toString());
|
||||
accountResponse.setNetworkDomain(account.getNetworkDomain());
|
||||
accountResponse.setDefaultZone(account.getDataCenterUuid());
|
||||
accountResponse.setIsDefault(account.isDefault());
|
||||
|
||||
// get network stat
|
||||
accountResponse.setBytesReceived(account.getBytesReceived());
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ public class UserAccountJoinDaoImpl extends GenericDaoBase<UserAccountJoinVO, Lo
|
|||
userResponse.setUsername(usr.getUsername());
|
||||
userResponse.setApiKey(usr.getApiKey());
|
||||
userResponse.setSecretKey(usr.getSecretKey());
|
||||
userResponse.setIsDefault(usr.isDefault());
|
||||
|
||||
// set async job
|
||||
userResponse.setJobId(usr.getJobUuid());
|
||||
|
|
|
|||
|
|
@ -184,6 +184,9 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident
|
|||
|
||||
@Column(name="job_status")
|
||||
private int jobStatus;
|
||||
|
||||
@Column(name = "default")
|
||||
boolean isDefault;
|
||||
|
||||
public AccountJoinVO() {
|
||||
}
|
||||
|
|
@ -672,6 +675,13 @@ public class AccountJoinVO extends BaseViewVO implements InternalIdentity, Ident
|
|||
}
|
||||
|
||||
|
||||
public boolean isDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
|
||||
public void setDefault(boolean isDefault) {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.cloud.utils.db.Encrypt;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
import com.cloud.utils.db.Encrypt;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
|
||||
@Entity
|
||||
@Table(name="user_view")
|
||||
public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, Identity {
|
||||
|
|
@ -116,6 +116,9 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||
|
||||
@Column(name="job_status")
|
||||
private int jobStatus;
|
||||
|
||||
@Column(name = "default")
|
||||
boolean isDefault;
|
||||
|
||||
public UserAccountJoinVO() {
|
||||
}
|
||||
|
|
@ -345,6 +348,13 @@ public class UserAccountJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||
this.jobStatus = jobStatus;
|
||||
}
|
||||
|
||||
public boolean isDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
public void setDefault(boolean isDefault) {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ public enum Config {
|
|||
CPUOverprovisioningFactor("Advanced", ManagementServer.class, String.class, "cpu.overprovisioning.factor", "1", "Used for CPU overprovisioning calculation; available CPU will be (actualCpuCapacity * cpu.overprovisioning.factor)", null),
|
||||
MemOverprovisioningFactor("Advanced", ManagementServer.class, String.class, "mem.overprovisioning.factor", "1", "Used for memory overprovisioning calculation", null),
|
||||
LinkLocalIpNums("Advanced", ManagementServer.class, Integer.class, "linkLocalIp.nums", "10", "The number of link local ip that needed by domR(in power of 2)", null),
|
||||
HypervisorList("Advanced", ManagementServer.class, String.class, "hypervisor.list", HypervisorType.KVM + "," + HypervisorType.XenServer + "," + HypervisorType.VMware + "," + HypervisorType.BareMetal + "," + HypervisorType.Ovm, "The list of hypervisors that this deployment will use.", "hypervisorList"),
|
||||
HypervisorList("Advanced", ManagementServer.class, String.class, "hypervisor.list", HypervisorType.KVM + "," + HypervisorType.XenServer + "," + HypervisorType.VMware + "," + HypervisorType.BareMetal + "," + HypervisorType.Ovm + "," + HypervisorType.LXC, "The list of hypervisors that this deployment will use.", "hypervisorList"),
|
||||
ManagementHostIPAdr("Advanced", ManagementServer.class, String.class, "host", "localhost", "The ip address of management server", null),
|
||||
ManagementNetwork("Advanced", ManagementServer.class, String.class, "management.network.cidr", null, "The cidr of management server network", null),
|
||||
EventPurgeDelay("Advanced", ManagementServer.class, Integer.class, "event.purge.delay", "15", "Events older than specified number days will be purged. Set this value to 0 to never delete events", null),
|
||||
|
|
|
|||
|
|
@ -79,11 +79,10 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
|
|||
* TODO
|
||||
* @param id
|
||||
* @param useVirtualNetwork
|
||||
* @param deploymentPlanner
|
||||
* @return ID
|
||||
*/
|
||||
ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
|
||||
boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner);
|
||||
boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate);
|
||||
|
||||
/**
|
||||
* Creates a new disk offering
|
||||
|
|
|
|||
|
|
@ -1825,16 +1825,16 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
}
|
||||
|
||||
return createServiceOffering(userId, cmd.getIsSystem(), vmType, cmd.getServiceOfferingName(), cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(),
|
||||
localStorageRequired, offerHA, limitCpuUse, volatileVm, cmd.getTags(), cmd.getDomainId(), cmd.getHostTag(), cmd.getNetworkRate(), cmd.getDeploymentPlanner());
|
||||
localStorageRequired, offerHA, limitCpuUse, volatileVm, cmd.getTags(), cmd.getDomainId(), cmd.getHostTag(), cmd.getNetworkRate());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ActionEvent(eventType = EventTypes.EVENT_SERVICE_OFFERING_CREATE, eventDescription = "creating service offering")
|
||||
public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_type, String name, int cpu, int ramSize, int speed, String displayText,
|
||||
boolean localStorageRequired, boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner) {
|
||||
boolean localStorageRequired, boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate) {
|
||||
tags = cleanupTags(tags);
|
||||
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, null, offerHA, limitResourceUse, volatileVm, displayText, localStorageRequired, false, tags, isSystem, vm_type,
|
||||
domainId, hostTag, deploymentPlanner);
|
||||
domainId, hostTag);
|
||||
|
||||
if ((offering = _serviceOfferingDao.persist(offering)) != null) {
|
||||
UserContext.current().setEventDetails("Service offering id=" + offering.getId());
|
||||
|
|
@ -2156,6 +2156,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
vlanOwner = _accountDao.findActiveAccount(accountName, domainId);
|
||||
if (vlanOwner == null) {
|
||||
throw new InvalidParameterValueException("Please specify a valid account.");
|
||||
} else if (vlanOwner.getId() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
// by default vlan is dedicated to system account
|
||||
vlanOwner = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2632,7 +2635,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (vlan == null) {
|
||||
throw new CloudRuntimeException("Unable to acquire vlan configuration: " + vlanDbId);
|
||||
}
|
||||
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("lock vlan " + vlanDbId + " is acquired");
|
||||
}
|
||||
|
|
@ -2707,14 +2710,16 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if ((accountName != null) && (domainId != null)) {
|
||||
vlanOwner = _accountDao.findActiveAccount(accountName, domainId);
|
||||
if (vlanOwner == null) {
|
||||
throw new InvalidParameterValueException("Please specify a valid account");
|
||||
throw new InvalidParameterValueException("Unable to find account by name " + accountName);
|
||||
} else if (vlanOwner.getId() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
throw new InvalidParameterValueException("Please specify a valid account. Cannot dedicate IP range to system account");
|
||||
}
|
||||
}
|
||||
|
||||
// Check if range is valid
|
||||
VlanVO vlan = _vlanDao.findById(vlanDbId);
|
||||
if (vlan == null) {
|
||||
throw new InvalidParameterValueException("Please specify a valid Public IP range id");
|
||||
throw new InvalidParameterValueException("Unable to find vlan by id " + vlanDbId);
|
||||
}
|
||||
|
||||
// Check if range has already been dedicated
|
||||
|
|
@ -2744,7 +2749,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
|
|||
if (allocatedToAccountId != null) {
|
||||
Account accountAllocatedTo = _accountMgr.getActiveAccountById(allocatedToAccountId);
|
||||
if (!accountAllocatedTo.getAccountName().equalsIgnoreCase(accountName))
|
||||
throw new InvalidParameterValueException("Public IP address in range is already allocated to another account");
|
||||
throw new InvalidParameterValueException(ip.getAddress() + " Public IP address in range is allocated to another account ");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,9 +20,11 @@ import java.util.List;
|
|||
|
||||
import com.cloud.dc.DataCenterVnetVO;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
|
||||
public interface DataCenterVnetDao extends GenericDao<DataCenterVnetVO, Long> {
|
||||
public List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId);
|
||||
public List<DataCenterVnetVO> listAllocatedVnetsInRange(long dcId, long physicalNetworkId, Integer start, Integer end);
|
||||
public List<DataCenterVnetVO> findVnet(long dcId, String vnet);
|
||||
public int countZoneVlans(long dcId, boolean onlyCountAllocated);
|
||||
public List<DataCenterVnetVO> findVnet(long dcId, long physicalNetworkId, String vnet);
|
||||
|
|
@ -31,6 +33,10 @@ public interface DataCenterVnetDao extends GenericDao<DataCenterVnetVO, Long> {
|
|||
|
||||
public void delete(long physicalNetworkId);
|
||||
|
||||
public void deleteRange(Transaction txn, long dcId, long physicalNetworkId, int start, int end);
|
||||
|
||||
public void lockRange(long dcId, long physicalNetworkId, Integer start, Integer end);
|
||||
|
||||
public DataCenterVnetVO take(long physicalNetworkId, long accountId, String reservationId);
|
||||
|
||||
public void release(String vnet, long physicalNetworkId, long accountId, String reservationId);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.sql.SQLException;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.dc.DataCenterVnetVO;
|
||||
|
|
@ -46,8 +47,10 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
|
|||
private final SearchBuilder<DataCenterVnetVO> VnetDcSearch;
|
||||
private final SearchBuilder<DataCenterVnetVO> VnetDcSearchAllocated;
|
||||
private final SearchBuilder<DataCenterVnetVO> DcSearchAllocated;
|
||||
private final SearchBuilder<DataCenterVnetVO> DcSearchAllocatedInRange;
|
||||
private final GenericSearchBuilder<DataCenterVnetVO, Integer> countZoneVlans;
|
||||
private final GenericSearchBuilder<DataCenterVnetVO, Integer> countAllocatedZoneVlans;
|
||||
private final SearchBuilder<DataCenterVnetVO> SearchRange;
|
||||
|
||||
public List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId) {
|
||||
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocated.create();
|
||||
|
|
@ -55,6 +58,22 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
|
|||
return listBy(sc);
|
||||
}
|
||||
|
||||
public List<DataCenterVnetVO> listAllocatedVnetsInRange(long dcId, long physicalNetworkId, Integer start, Integer end) {
|
||||
SearchCriteria<DataCenterVnetVO> sc = DcSearchAllocatedInRange.create();
|
||||
sc.setParameters("dc",dcId);
|
||||
sc.setParameters("physicalNetworkId", physicalNetworkId);
|
||||
sc.setParameters("vnetRange", start.toString(), end.toString());
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
public void lockRange(long dcId, long physicalNetworkId, Integer start, Integer end) {
|
||||
SearchCriteria<DataCenterVnetVO> sc = SearchRange.create();
|
||||
sc.setParameters("dc",dcId);
|
||||
sc.setParameters("physicalNetworkId", physicalNetworkId);
|
||||
sc.setParameters("vnetRange", start.toString(), end.toString());
|
||||
lockRows(sc,null,true);
|
||||
}
|
||||
|
||||
public List<DataCenterVnetVO> findVnet(long dcId, String vnet) {
|
||||
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();;
|
||||
sc.setParameters("dc", dcId);
|
||||
|
|
@ -93,11 +112,28 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
|
|||
}
|
||||
stmt.executeBatch();
|
||||
txn.commit();
|
||||
} catch (SQLException e) {
|
||||
if (!e.getMessage().contains("Duplicate")){
|
||||
txn.rollback();
|
||||
txn.close();
|
||||
throw new CloudRuntimeException("Exception caught adding vnet ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteRange(Transaction txn, long dcId, long physicalNetworkId, int start, int end) {
|
||||
String deleteVnet = "DELETE FROM `cloud`.`op_dc_vnet_alloc` WHERE data_center_id=? AND physical_network_id=? AND taken IS NULL AND vnet BETWEEN ? AND ?";
|
||||
try {
|
||||
PreparedStatement stmt = txn.prepareAutoCloseStatement(deleteVnet);
|
||||
stmt.setLong(1,dcId);
|
||||
stmt.setLong(2,physicalNetworkId);
|
||||
stmt.setString(3,((Integer)start).toString());
|
||||
stmt.setString(4,((Integer)end).toString());
|
||||
stmt.execute();
|
||||
} catch (SQLException e) {
|
||||
throw new CloudRuntimeException("Exception caught adding vnet ", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void delete(long physicalNetworkId) {
|
||||
SearchCriteria<DataCenterVnetVO> sc = VnetDcSearch.create();
|
||||
sc.setParameters("physicalNetworkId", physicalNetworkId);
|
||||
|
|
@ -149,6 +185,18 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long
|
|||
DcSearchAllocated.and("physicalNetworkId", DcSearchAllocated.entity().getPhysicalNetworkId(), SearchCriteria.Op.EQ);
|
||||
DcSearchAllocated.and("allocated", DcSearchAllocated.entity().getTakenAt(), SearchCriteria.Op.NNULL);
|
||||
DcSearchAllocated.done();
|
||||
|
||||
DcSearchAllocatedInRange = createSearchBuilder();
|
||||
DcSearchAllocatedInRange.and("dc",DcSearchAllocatedInRange.entity().getDataCenterId(), Op.EQ);
|
||||
DcSearchAllocatedInRange.and("physicalNetworkId", DcSearchAllocatedInRange.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
DcSearchAllocatedInRange.and("allocated", DcSearchAllocatedInRange.entity().getTakenAt(), Op.NNULL);
|
||||
DcSearchAllocatedInRange.and("vnetRange", DcSearchAllocatedInRange.entity().getVnet(), Op.BETWEEN);
|
||||
DcSearchAllocatedInRange.done();
|
||||
|
||||
SearchRange = createSearchBuilder();
|
||||
SearchRange.and("dc", SearchRange.entity().getDataCenterId(), Op.EQ);
|
||||
SearchRange.and("physicalNetworkId", SearchRange.entity().getPhysicalNetworkId(), Op.EQ);
|
||||
SearchRange.and("vnetRange", SearchRange.entity().getVnet(), Op.BETWEEN);
|
||||
|
||||
FreeVnetSearch = createSearchBuilder();
|
||||
FreeVnetSearch.and("dc", FreeVnetSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import javax.naming.ConfigurationException;
|
|||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.response.ExternalFirewallResponse;
|
||||
import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice;
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
|
|
@ -715,8 +716,17 @@ public abstract class ExternalFirewallDeviceManagerImpl extends AdapterBase impl
|
|||
if (pNetwork.getVnet() == null) {
|
||||
throw new CloudRuntimeException("Could not find vlan range for physical Network " + physicalNetworkId + ".");
|
||||
}
|
||||
String vlanRange[] = pNetwork.getVnet().split("-");
|
||||
int lowestVlanTag = Integer.valueOf(vlanRange[0]);
|
||||
Integer lowestVlanTag = null;
|
||||
List<Pair<Integer, Integer>> vnetList = pNetwork.getVnet();
|
||||
//finding the vlanrange in which the vlanTag lies.
|
||||
for (Pair <Integer,Integer> vnet : vnetList){
|
||||
if (vlanTag >= vnet.first() && vlanTag <= vnet.second()){
|
||||
lowestVlanTag = vnet.first();
|
||||
}
|
||||
}
|
||||
if (lowestVlanTag == null) {
|
||||
throw new InvalidParameterValueException ("The vlan tag dose not belong to any of the existing vlan ranges");
|
||||
}
|
||||
return vlanTag - lowestVlanTag;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import javax.inject.Inject;
|
|||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
|
||||
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
|
||||
|
|
@ -53,11 +54,13 @@ import com.cloud.configuration.dao.ConfigurationDao;
|
|||
import com.cloud.dc.DataCenter;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.DataCenterVnetVO;
|
||||
import com.cloud.dc.Pod;
|
||||
import com.cloud.dc.Vlan.VlanType;
|
||||
import com.cloud.dc.VlanVO;
|
||||
import com.cloud.dc.dao.AccountVlanMapDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.DataCenterVnetDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.dc.dao.VlanDao;
|
||||
import com.cloud.deploy.DeployDestination;
|
||||
|
|
@ -261,6 +264,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
HostPodDao _hostPodDao;
|
||||
@Inject
|
||||
InternalLoadBalancerElementService _internalLbElementSvc;
|
||||
@Inject
|
||||
DataCenterVnetDao _datacneter_vnet;
|
||||
|
||||
int _cidrLimit;
|
||||
boolean _allowSubdomainNetworkAccess;
|
||||
|
|
@ -593,7 +598,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
} else if (dc.getNetworkType() == NetworkType.Basic || ntwkOff.getGuestType() == Network.GuestType.Shared) {
|
||||
Account caller = UserContext.current().getCaller();
|
||||
long callerUserId = UserContext.current().getCallerUserId();
|
||||
_accountMgr.checkAccess(caller, AccessType.UseNetwork, false, network);
|
||||
_accountMgr.checkAccess(caller, SecurityChecker.AccessType.UseNetwork, false, network);
|
||||
//handle the basic networks here
|
||||
VirtualMachine vm = _userVmDao.findById(nicVO.getInstanceId());
|
||||
if (vm == null) {
|
||||
|
|
@ -813,18 +818,20 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
// in the zone when using external networking
|
||||
PhysicalNetworkVO pNetwork = _physicalNetworkDao.findById(physicalNetworkId);
|
||||
if (pNetwork.getVnet() != null) {
|
||||
String vlanRange[] = pNetwork.getVnet().split("-");
|
||||
int lowestVlanTag = Integer.valueOf(vlanRange[0]);
|
||||
int highestVlanTag = Integer.valueOf(vlanRange[1]);
|
||||
for (int vlan=lowestVlanTag; vlan <= highestVlanTag; ++vlan) {
|
||||
int offset = vlan - lowestVlanTag;
|
||||
String globalVlanBits = _configDao.getValue(Config.GuestVlanBits.key());
|
||||
int cidrSize = 8 + Integer.parseInt(globalVlanBits);
|
||||
String guestNetworkCidr = zone.getGuestNetworkCidr();
|
||||
String[] cidrTuple = guestNetworkCidr.split("\\/");
|
||||
long newCidrAddress = (NetUtils.ip2Long(cidrTuple[0]) & 0xff000000) | (offset << (32 - cidrSize));
|
||||
if (NetUtils.isNetworksOverlap(NetUtils.long2Ip(newCidrAddress), cidr)) {
|
||||
throw new InvalidParameterValueException("Specified CIDR for shared network conflict with CIDR that is reserved for zone vlan " + vlan);
|
||||
List <Pair<Integer,Integer>> vlanList = pNetwork.getVnet();
|
||||
for (Pair<Integer,Integer> vlanRange : vlanList){
|
||||
Integer lowestVlanTag = vlanRange.first();
|
||||
Integer highestVlanTag = vlanRange.second();
|
||||
for (int vlan=lowestVlanTag; vlan <= highestVlanTag; ++vlan) {
|
||||
int offset = vlan - lowestVlanTag;
|
||||
String globalVlanBits = _configDao.getValue(Config.GuestVlanBits.key());
|
||||
int cidrSize = 8 + Integer.parseInt(globalVlanBits);
|
||||
String guestNetworkCidr = zone.getGuestNetworkCidr();
|
||||
String[] cidrTuple = guestNetworkCidr.split("\\/");
|
||||
long newCidrAddress = (NetUtils.ip2Long(cidrTuple[0]) & 0xff000000) | (offset << (32 - cidrSize));
|
||||
if (NetUtils.isNetworksOverlap(NetUtils.long2Ip(newCidrAddress), cidr)) {
|
||||
throw new InvalidParameterValueException("Specified CIDR for shared network conflict with CIDR that is reserved for zone vlan " + vlan);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2224,7 +2231,6 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
} catch (NumberFormatException e) {
|
||||
throw new InvalidParameterValueException("Please specify valid integers for the vlan range.");
|
||||
}
|
||||
|
||||
if ((vnetStart > vnetEnd) || (vnetStart < 0) || (vnetEnd > 4096)) {
|
||||
s_logger.warn("Invalid vnet range: start range:" + vnetStart + " end range:" + vnetEnd);
|
||||
throw new InvalidParameterValueException("Vnet range should be between 0-4096 and start range should be lesser than or equal to end range");
|
||||
|
|
@ -2318,7 +2324,7 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
@Override
|
||||
@DB
|
||||
@ActionEvent(eventType = EventTypes.EVENT_PHYSICAL_NETWORK_UPDATE, eventDescription = "updating physical network", async = true)
|
||||
public PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags, String newVnetRangeString, String state) {
|
||||
public PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags, String newVnetRangeString, String state, String removeVlan) {
|
||||
|
||||
// verify input parameters
|
||||
PhysicalNetworkVO network = _physicalNetworkDao.findById(id);
|
||||
|
|
@ -2343,6 +2349,12 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
}
|
||||
}
|
||||
|
||||
if (removeVlan != null){
|
||||
List<Integer> tokens = processVlanRange(network,removeVlan);
|
||||
boolean result = removeVlanRange(network, tokens.get(0), tokens.get(1));
|
||||
|
||||
}
|
||||
|
||||
if (tags != null && tags.size() > 1) {
|
||||
throw new InvalidParameterException("Unable to support more than one tag on network yet");
|
||||
}
|
||||
|
|
@ -2369,90 +2381,211 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
|
|||
}
|
||||
|
||||
// Vnet range can be extended only
|
||||
boolean replaceVnet = false;
|
||||
ArrayList<Pair<Integer, Integer>> vnetsToAdd = new ArrayList<Pair<Integer, Integer>>(2);
|
||||
boolean AddVnet = true;
|
||||
List<Pair<Integer, Integer>> vnetsToAdd = new ArrayList<Pair<Integer, Integer>>();
|
||||
|
||||
if (newVnetRangeString != null) {
|
||||
Integer newStartVnet = 0;
|
||||
Integer newEndVnet = 0;
|
||||
String[] newVnetRange = newVnetRangeString.split("-");
|
||||
int maxVnet = 4096;
|
||||
// for GRE phynets allow up to 32bits
|
||||
// TODO: Not happy about this test.
|
||||
// What about guru-like objects for physical networs?
|
||||
s_logger.debug("ISOLATION METHODS:" + network.getIsolationMethods());
|
||||
// Java does not have unsigned types...
|
||||
if (network.getIsolationMethods().contains("GRE")) {
|
||||
maxVnet = (int)(Math.pow(2, 32)-1);
|
||||
}
|
||||
String rangeMessage = " between 0 and " + maxVnet;
|
||||
if (newVnetRange.length < 2) {
|
||||
throw new InvalidParameterValueException("Please provide valid vnet range" + rangeMessage);
|
||||
}
|
||||
List<Integer> tokens = processVlanRange(network, newVnetRangeString);
|
||||
newStartVnet = tokens.get(0);
|
||||
newEndVnet = tokens.get(1);
|
||||
Integer j=0;
|
||||
List <Pair <Integer,Integer>> existingRanges = network.getVnet();
|
||||
if (!existingRanges.isEmpty()) {
|
||||
for (; j < existingRanges.size(); j++){
|
||||
int existingStartVnet = existingRanges.get(j).first();
|
||||
int existingEndVnet = existingRanges.get(j).second();
|
||||
|
||||
if (newVnetRange[0] == null || newVnetRange[1] == null) {
|
||||
throw new InvalidParameterValueException("Please provide valid vnet range" + rangeMessage);
|
||||
}
|
||||
// check if vnet is being extended
|
||||
if (newStartVnet.intValue() >= existingStartVnet & newEndVnet.intValue() <= existingEndVnet) {
|
||||
throw new InvalidParameterValueException("The vlan range you trying to add already exists.");
|
||||
}
|
||||
|
||||
try {
|
||||
newStartVnet = Integer.parseInt(newVnetRange[0]);
|
||||
newEndVnet = Integer.parseInt(newVnetRange[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.warn("Unable to parse vnet range:", e);
|
||||
throw new InvalidParameterValueException("Please provide valid vnet range" + rangeMessage);
|
||||
}
|
||||
if (newStartVnet < 0 || newEndVnet > maxVnet) {
|
||||
throw new InvalidParameterValueException("Vnet range has to be" + rangeMessage);
|
||||
}
|
||||
if (newStartVnet < existingStartVnet & newEndVnet+1 >= existingStartVnet & newEndVnet <= existingEndVnet) {
|
||||
vnetsToAdd.add(new Pair<Integer, Integer>(newStartVnet, existingStartVnet - 1));
|
||||
existingRanges.get(j).first(newStartVnet);
|
||||
AddVnet = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (newStartVnet > newEndVnet) {
|
||||
throw new InvalidParameterValueException("Vnet range has to be" + rangeMessage + " and start range should be lesser than or equal to stop range");
|
||||
}
|
||||
|
||||
if (physicalNetworkHasAllocatedVnets(network.getDataCenterId(), network.getId())) {
|
||||
String[] existingRange = network.getVnet().split("-");
|
||||
int existingStartVnet = Integer.parseInt(existingRange[0]);
|
||||
int existingEndVnet = Integer.parseInt(existingRange[1]);
|
||||
else if (newStartVnet > existingStartVnet & newStartVnet-1 <= existingEndVnet & newEndVnet >= existingEndVnet) {
|
||||
vnetsToAdd.add(new Pair<Integer, Integer>(existingEndVnet + 1, newEndVnet));
|
||||
existingRanges.get(j).second(newEndVnet);
|
||||
AddVnet = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// check if vnet is being extended
|
||||
if (newStartVnet.intValue() > existingStartVnet || newEndVnet.intValue() < existingEndVnet) {
|
||||
throw new InvalidParameterValueException("Can't shrink existing vnet range as it the range has vnets allocated. Only extending existing vnet is supported");
|
||||
else if (newStartVnet< existingStartVnet & newEndVnet > existingEndVnet){
|
||||
vnetsToAdd.add(new Pair<Integer, Integer>(newStartVnet,existingStartVnet-1));
|
||||
vnetsToAdd.add(new Pair<Integer, Integer>(existingEndVnet+1,newEndVnet));
|
||||
existingRanges.get(j).first(newStartVnet);
|
||||
existingRanges.get(j).second(newEndVnet);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (newStartVnet < existingStartVnet) {
|
||||
vnetsToAdd.add(new Pair<Integer, Integer>(newStartVnet, existingStartVnet - 1));
|
||||
}
|
||||
|
||||
if (newEndVnet > existingEndVnet) {
|
||||
vnetsToAdd.add(new Pair<Integer, Integer>(existingEndVnet + 1, newEndVnet));
|
||||
}
|
||||
|
||||
} else {
|
||||
vnetsToAdd.add(new Pair<Integer, Integer>(newStartVnet, newEndVnet));
|
||||
replaceVnet = true;
|
||||
}
|
||||
}
|
||||
if (AddVnet){
|
||||
vnetsToAdd.add(new Pair<Integer, Integer>(newStartVnet, newEndVnet));
|
||||
existingRanges.add(new Pair<Integer, Integer>(newStartVnet,newEndVnet));
|
||||
}
|
||||
|
||||
if (newVnetRangeString != null) {
|
||||
network.setVnet(newVnetRangeString);
|
||||
}
|
||||
Map <Integer,Integer> vnetMap = new HashMap<Integer, Integer>(existingRanges.size());
|
||||
Map <Integer, Integer> IndexMap = new HashMap<Integer, Integer>(existingRanges.size());
|
||||
for (int i=0; i< existingRanges.size(); i++){
|
||||
vnetMap.put(existingRanges.get(i).first(),existingRanges.get(i).second());
|
||||
IndexMap.put(existingRanges.get(i).first(),i);
|
||||
}
|
||||
|
||||
_physicalNetworkDao.update(id, network);
|
||||
Integer value;
|
||||
Integer index;
|
||||
String vnetString = "";
|
||||
for (int i=0; i < existingRanges.size(); i++){
|
||||
value = vnetMap.get((existingRanges.get(i).second()+1));
|
||||
if (value != null) {
|
||||
vnetMap.remove((existingRanges.get(i).second()+1));
|
||||
vnetMap.remove(existingRanges.get(i).first());
|
||||
vnetMap.put(existingRanges.get(i).first(),value);
|
||||
existingRanges.add(new Pair<Integer,Integer>(existingRanges.get(i).first(),value));
|
||||
index = IndexMap.get(existingRanges.get(i).second()+1);
|
||||
existingRanges.get(index).first(-1);
|
||||
existingRanges.get(index).second(-1);
|
||||
existingRanges.get(i).first(-1);
|
||||
existingRanges.get(i).second(-1);
|
||||
}
|
||||
value = vnetMap.get((existingRanges.get(i).second()));
|
||||
if (value != null) {
|
||||
vnetMap.remove((existingRanges.get(i).second()));
|
||||
vnetMap.remove(existingRanges.get(i).first());
|
||||
vnetMap.put(existingRanges.get(i).first(),value);
|
||||
existingRanges.add(new Pair<Integer,Integer>(existingRanges.get(i).first(),value));
|
||||
index = IndexMap.get(existingRanges.get(i).second());
|
||||
existingRanges.get(index).first(-1);
|
||||
existingRanges.get(index).second(-1);
|
||||
existingRanges.get(i).first(-1);
|
||||
existingRanges.get(i).second(-1);
|
||||
}
|
||||
}
|
||||
|
||||
if (replaceVnet) {
|
||||
s_logger.debug("Deleting existing vnet range for the physicalNetwork id= " + id + " and zone id=" + network.getDataCenterId() + " as a part of updatePhysicalNetwork call");
|
||||
_dcDao.deleteVnet(network.getId());
|
||||
}
|
||||
|
||||
for (Pair<Integer, Integer> vnetToAdd : vnetsToAdd) {
|
||||
s_logger.debug("Adding vnet range " + vnetToAdd.first() + "-" + vnetToAdd.second() + " for the physicalNetwork id= " + id + " and zone id=" + network.getDataCenterId()
|
||||
|
||||
if (newVnetRangeString != null) {
|
||||
for (Pair<Integer,Integer> vnetRange : existingRanges ){
|
||||
value=vnetMap.get(vnetRange.first());
|
||||
if (value != null){
|
||||
vnetString = vnetString+vnetRange.first().toString()+"-"+value.toString()+";";
|
||||
}
|
||||
}
|
||||
vnetString = vnetString+"*";
|
||||
vnetString = vnetString.replace(";*","");
|
||||
network.setVnet(vnetString);
|
||||
}
|
||||
|
||||
|
||||
|
||||
_physicalNetworkDao.update(id, network);
|
||||
|
||||
for (Pair<Integer, Integer> vnetToAdd : vnetsToAdd) {
|
||||
s_logger.debug("Adding vnet range " + vnetToAdd.first() + "-" + vnetToAdd.second() + " for the physicalNetwork id= " + id + " and zone id=" + network.getDataCenterId()
|
||||
+ " as a part of updatePhysicalNetwork call");
|
||||
_dcDao.addVnet(network.getDataCenterId(), network.getId(), vnetToAdd.first(), vnetToAdd.second());
|
||||
_dcDao.addVnet(network.getDataCenterId(), network.getId(), vnetToAdd.first(), vnetToAdd.second());
|
||||
}
|
||||
}
|
||||
|
||||
return network;
|
||||
}
|
||||
|
||||
private List<Integer> processVlanRange(PhysicalNetworkVO network, String removeVlan) {
|
||||
Integer StartVnet;
|
||||
Integer EndVnet;
|
||||
String[] VnetRange = removeVlan.split("-");
|
||||
int maxVnet = 4096;
|
||||
// for GRE phynets allow up to 32bits
|
||||
// TODO: Not happy about this test.
|
||||
// What about guru-like objects for physical networs?
|
||||
s_logger.debug("ISOLATION METHODS:" + network.getIsolationMethods());
|
||||
// Java does not have unsigned types...
|
||||
if (network.getIsolationMethods().contains("GRE")) {
|
||||
maxVnet = (int)(Math.pow(2, 32)-1);
|
||||
}
|
||||
String rangeMessage = " between 0 and " + maxVnet;
|
||||
if (VnetRange.length < 2) {
|
||||
throw new InvalidParameterValueException("Please provide valid vnet range" + rangeMessage);
|
||||
}
|
||||
|
||||
if (VnetRange[0] == null || VnetRange[1] == null) {
|
||||
throw new InvalidParameterValueException("Please provide valid vnet range" + rangeMessage);
|
||||
}
|
||||
|
||||
try {
|
||||
StartVnet = Integer.parseInt(VnetRange[0]);
|
||||
EndVnet = Integer.parseInt(VnetRange[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
s_logger.warn("Unable to parse vnet range:", e);
|
||||
throw new InvalidParameterValueException("Please provide valid vnet range" + rangeMessage);
|
||||
}
|
||||
if (StartVnet < 0 || EndVnet > maxVnet) {
|
||||
throw new InvalidParameterValueException("Vnet range has to be" + rangeMessage);
|
||||
}
|
||||
|
||||
if (StartVnet > EndVnet) {
|
||||
throw new InvalidParameterValueException("Vnet range has to be" + rangeMessage + " and start range should be lesser than or equal to stop range");
|
||||
}
|
||||
List<Integer> tokens = new ArrayList<Integer>();
|
||||
tokens.add(StartVnet);
|
||||
tokens.add(EndVnet);
|
||||
return tokens;
|
||||
|
||||
}
|
||||
|
||||
|
||||
private boolean removeVlanRange( PhysicalNetworkVO network, Integer start, Integer end) {
|
||||
Integer temp=0;
|
||||
int i;
|
||||
List <Pair <Integer,Integer>> existingRanges = network.getVnet();
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
_physicalNetworkDao.acquireInLockTable(network.getId(),10);
|
||||
_datacneter_vnet.lockRange(network.getDataCenterId(), network.getId(), start, end);
|
||||
List<DataCenterVnetVO> result = _datacneter_vnet.listAllocatedVnetsInRange(network.getDataCenterId(), network.getId(), start, end);
|
||||
if (!result.isEmpty()){
|
||||
txn.close();
|
||||
throw new InvalidParameterValueException("Some of the vnets from this range are allocated, can only remove a range which has no allocated vnets");
|
||||
}
|
||||
for (i=0; i<existingRanges.size(); i++){
|
||||
if (existingRanges.get(i).first()<= start & existingRanges.get(i).second()>= end){
|
||||
temp = existingRanges.get(i).second();
|
||||
existingRanges.get(i).second(start - 1);
|
||||
existingRanges.add(new Pair<Integer, Integer>((end+1),temp));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (temp == 0){
|
||||
throw new InvalidParameterValueException("The vlan range you are trying to delete dose not exist.");
|
||||
}
|
||||
if(existingRanges.get(i).first() > existingRanges.get(i).second()){
|
||||
existingRanges.remove(i);
|
||||
}
|
||||
if(existingRanges.get(existingRanges.size()-1).first() > existingRanges.get(existingRanges.size()-1).second()){
|
||||
existingRanges.remove(existingRanges.size()-1);
|
||||
}
|
||||
_datacneter_vnet.deleteRange(txn, network.getDataCenterId(), network.getId(), start, end);
|
||||
|
||||
String vnetString="";
|
||||
for (Pair<Integer,Integer> vnetRange : existingRanges ){
|
||||
vnetString=vnetString+vnetRange.first().toString()+"-"+vnetRange.second().toString()+";";
|
||||
}
|
||||
vnetString = vnetString+"*";
|
||||
vnetString = vnetString.replace(";*","");
|
||||
network.setVnet(vnetString);
|
||||
_physicalNetworkDao.update(network.getId(), network);
|
||||
txn.commit();
|
||||
_physicalNetworkDao.releaseFromLockTable(network.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean physicalNetworkHasAllocatedVnets(long zoneId, long physicalNetworkId) {
|
||||
return !_dcDao.listAllocatedVnets(physicalNetworkId).isEmpty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,23 +194,12 @@ public class PublicIp implements PublicIpAddress {
|
|||
public boolean getSystem() {
|
||||
return _addr.getSystem();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.IpAddress#getVpcId()
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Long getVpcId() {
|
||||
return _addr.getVpcId();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.cloud.network.IpAddress#setVpcId(java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public void setVpcId(Long vpcId) {
|
||||
_addr.setVpcId(vpcId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIp6Gateway() {
|
||||
return _vlan.getIp6Gateway();
|
||||
|
|
@ -230,9 +219,4 @@ public class PublicIp implements PublicIpAddress {
|
|||
public String getVmIp() {
|
||||
return _addr.getVmIp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVmIp(String vmIp) {
|
||||
_addr.setVmIp(vmIp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,7 +288,6 @@ public class IPAddressVO implements IpAddress {
|
|||
return vpcId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVpcId(Long vpcId) {
|
||||
this.vpcId = vpcId;
|
||||
}
|
||||
|
|
@ -298,7 +297,6 @@ public class IPAddressVO implements IpAddress {
|
|||
return vmIp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVmIp(String vmIp) {
|
||||
this.vmIp = vmIp;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,9 @@ import javax.persistence.Table;
|
|||
import javax.persistence.TableGenerator;
|
||||
|
||||
import com.cloud.network.PhysicalNetwork;
|
||||
import com.cloud.network.PhysicalNetwork.BroadcastDomainRange;
|
||||
import com.cloud.network.PhysicalNetwork.State;
|
||||
import com.cloud.utils.NumbersUtil;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
/**
|
||||
* NetworkConfigurationVO contains information about a specific physical network.
|
||||
|
|
@ -205,7 +203,21 @@ public class PhysicalNetworkVO implements PhysicalNetwork {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getVnet() {
|
||||
public List<Pair<Integer, Integer>> getVnet() {
|
||||
List <Pair<Integer,Integer>> vnetList = new ArrayList<Pair<Integer, Integer>>();
|
||||
if (vnet != null) {
|
||||
String [] Temp = vnet.split(";");
|
||||
String [] vnetSplit = null;
|
||||
for (String vnetRange : Temp){
|
||||
vnetSplit = vnetRange.split("-");
|
||||
vnetList.add(new Pair<Integer,Integer>(Integer.parseInt(vnetSplit[0]),Integer.parseInt(vnetSplit[1])));
|
||||
}
|
||||
}
|
||||
return vnetList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVnetString() {
|
||||
return vnet;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
|
||||
import com.cloud.event.ActionEventUtils;
|
||||
import com.cloud.utils.Pair;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
|
|
@ -233,8 +234,17 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
|
|||
if (pNetwork.getVnet() == null) {
|
||||
throw new CloudRuntimeException("Could not find vlan range for physical Network " + physicalNetworkId + ".");
|
||||
}
|
||||
String vlanRange[] = pNetwork.getVnet().split("-");
|
||||
int lowestVlanTag = Integer.valueOf(vlanRange[0]);
|
||||
Integer lowestVlanTag = null;
|
||||
List<Pair<Integer, Integer>> vnetList = pNetwork.getVnet();
|
||||
//finding the vlanrange in which the vlanTag lies.
|
||||
for (Pair <Integer,Integer> vnet : vnetList){
|
||||
if (vlanTag >= vnet.first() && vlanTag <= vnet.second()){
|
||||
lowestVlanTag = vnet.first();
|
||||
}
|
||||
}
|
||||
if (lowestVlanTag == null) {
|
||||
throw new InvalidParameterValueException ("The vlan tag dose not belong to any of the existing vlan ranges");
|
||||
}
|
||||
return vlanTag - lowestVlanTag;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||
@DB
|
||||
protected void saveUser() {
|
||||
// insert system account
|
||||
String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id) VALUES (1, UUID(), 'system', '1', '1')";
|
||||
String insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (1, UUID(), 'system', '1', '1', 1)";
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
try {
|
||||
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
|
||||
|
|
@ -341,8 +341,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||
} catch (SQLException ex) {
|
||||
}
|
||||
// insert system user
|
||||
insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created)" +
|
||||
" VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now())";
|
||||
insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, user.default)" +
|
||||
" VALUES (1, UUID(), 'system', RAND(), 1, 'system', 'cloud', now(), 1)";
|
||||
txn = Transaction.currentTxn();
|
||||
try {
|
||||
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
|
||||
|
|
@ -358,7 +358,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||
String lastname = "cloud";
|
||||
|
||||
// create an account for the admin user first
|
||||
insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id) VALUES (" + id + ", UUID(), '" + username + "', '1', '1')";
|
||||
insertSql = "INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, account.default) VALUES (" + id + ", UUID(), '" + username + "', '1', '1', 1)";
|
||||
txn = Transaction.currentTxn();
|
||||
try {
|
||||
PreparedStatement stmt = txn.prepareAutoCloseStatement(insertSql);
|
||||
|
|
@ -367,8 +367,8 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
|
|||
}
|
||||
|
||||
// now insert the user
|
||||
insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, state) " +
|
||||
"VALUES (" + id + ", UUID(), '" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled')";
|
||||
insertSql = "INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname, lastname, created, state, user.default) " +
|
||||
"VALUES (" + id + ", UUID(), '" + username + "', RAND(), 2, '" + firstname + "','" + lastname + "',now(), 'disabled', 1)";
|
||||
|
||||
txn = Transaction.currentTxn();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -699,14 +699,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
private List<UserAuthenticator> _userAuthenticators;
|
||||
private List<UserAuthenticator> _userPasswordEncoders;
|
||||
|
||||
protected List<DeploymentPlanner> _planners;
|
||||
public List<DeploymentPlanner> getPlanners() {
|
||||
return _planners;
|
||||
}
|
||||
public void setPlanners(List<DeploymentPlanner> _planners) {
|
||||
this._planners = _planners;
|
||||
}
|
||||
|
||||
@Inject ClusterManager _clusterMgr;
|
||||
private String _hashKey = null;
|
||||
private String _encryptionKey = null;
|
||||
|
|
@ -3698,15 +3690,4 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listDeploymentPlanners() {
|
||||
List<String> plannersAvailable = new ArrayList<String>();
|
||||
for (DeploymentPlanner planner : _planners) {
|
||||
plannersAvailable.add(planner.getName());
|
||||
}
|
||||
|
||||
return plannersAvailable;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,9 +68,6 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
@Column(name="sort_key")
|
||||
int sortKey;
|
||||
|
||||
@Column(name = "deployment_planner")
|
||||
private String deploymentPlanner = "FirstFitPlanner";
|
||||
|
||||
protected ServiceOfferingVO() {
|
||||
super();
|
||||
}
|
||||
|
|
@ -87,7 +84,6 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
this.volatileVm = false;
|
||||
this.default_use = defaultUse;
|
||||
this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
|
||||
this.deploymentPlanner = "FirstFitPlanner";
|
||||
}
|
||||
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse, boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId) {
|
||||
|
|
@ -101,26 +97,11 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
this.limitCpuUse = limitCpuUse;
|
||||
this.volatileVm = volatileVm;
|
||||
this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
|
||||
this.deploymentPlanner = "FirstFitPlanner";
|
||||
}
|
||||
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitResourceUse, boolean volatileVm, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId, String hostTag) {
|
||||
this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, limitResourceUse, volatileVm, displayText, useLocalStorage, recreatable, tags, systemUse, vm_type, domainId);
|
||||
this.hostTag = hostTag;
|
||||
this.deploymentPlanner = "FirstFitPlanner";
|
||||
}
|
||||
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps,
|
||||
boolean offerHA, boolean limitResourceUse, boolean volatileVm, String displayText, boolean useLocalStorage,
|
||||
boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId,
|
||||
String hostTag, String deploymentPlanner) {
|
||||
this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, limitResourceUse, volatileVm,
|
||||
displayText, useLocalStorage, recreatable, tags, systemUse, vm_type, domainId, hostTag);
|
||||
if (deploymentPlanner != null) {
|
||||
this.deploymentPlanner = deploymentPlanner;
|
||||
} else {
|
||||
this.deploymentPlanner = "FirstFitPlanner";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -227,8 +208,4 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
|||
return volatileVm;
|
||||
}
|
||||
|
||||
public String getDeploymentPlanner() {
|
||||
return deploymentPlanner;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -963,9 +963,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
DataStoreLifeCycle lifeCycle = storeProvider.getDataStoreLifeCycle();
|
||||
DataStore store = dataStoreMgr.getDataStore(
|
||||
sPool.getId(), DataStoreRole.Primary);
|
||||
lifeCycle.deleteDataStore(store);
|
||||
|
||||
return false;
|
||||
return lifeCycle.deleteDataStore(store);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import javax.ejb.Local;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.event.ActionEventUtils;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.acl.SecurityChecker;
|
||||
|
|
@ -53,7 +52,6 @@ import org.apache.log4j.Logger;
|
|||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.query.dao.UserAccountJoinDao;
|
||||
import com.cloud.api.query.vo.ControlledViewEntity;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.configuration.ConfigurationManager;
|
||||
import com.cloud.configuration.ResourceLimit;
|
||||
|
|
@ -65,6 +63,7 @@ import com.cloud.domain.Domain;
|
|||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.domain.dao.DomainDao;
|
||||
import com.cloud.event.ActionEvent;
|
||||
import com.cloud.event.ActionEventUtils;
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.CloudAuthenticationException;
|
||||
|
|
@ -1178,8 +1177,9 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||
|
||||
checkAccess(caller, null, true, account);
|
||||
|
||||
if (account.getId() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
throw new PermissionDeniedException("Account id : " + accountId + " is a system account, delete is not allowed");
|
||||
//don't allow to delete default account (system and admin)
|
||||
if (account.isDefault()) {
|
||||
throw new InvalidParameterValueException("The account is default and can't be removed");
|
||||
}
|
||||
|
||||
// Account that manages project(s) can't be removed
|
||||
|
|
@ -1384,9 +1384,10 @@ public class AccountManagerImpl extends ManagerBase implements AccountManager, M
|
|||
if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) {
|
||||
throw new InvalidParameterValueException("The specified user doesn't exist in the system");
|
||||
}
|
||||
|
||||
if (account.getId() == Account.ACCOUNT_ID_SYSTEM) {
|
||||
throw new InvalidParameterValueException("Account id : " + user.getAccountId() + " is a system account, delete for user associated with this account is not allowed");
|
||||
|
||||
//don't allow to delete default user (system and admin users)
|
||||
if (user.isDefault()) {
|
||||
throw new InvalidParameterValueException("The user is default and can't be removed");
|
||||
}
|
||||
|
||||
checkAccess(UserContext.current().getCaller(), null, true, account);
|
||||
|
|
|
|||
|
|
@ -2264,9 +2264,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||
|
||||
// check if account/domain is with in resource limits to create a new vm
|
||||
boolean isIso = Storage.ImageFormat.ISO == template.getFormat();
|
||||
long size = _templateHostDao.findByTemplateId(template.getId()).getSize();
|
||||
if (diskOfferingId != null) {
|
||||
size += _diskOfferingDao.findById(diskOfferingId).getDiskSize();
|
||||
}
|
||||
resourceLimitCheck(owner, new Long(offering.getCpu()), new Long(offering.getRamSize()));
|
||||
_resourceLimitMgr.checkResourceLimit(owner, ResourceType.volume, (isIso
|
||||
|| diskOfferingId == null ? 1 : 2));
|
||||
_resourceLimitMgr.checkResourceLimit(owner, ResourceType.primary_storage, new Long (size));
|
||||
|
||||
// verify security group ids
|
||||
if (securityGroupIdList != null) {
|
||||
|
|
|
|||
|
|
@ -866,6 +866,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
}
|
||||
}
|
||||
|
||||
if (startedVm == null) {
|
||||
throw new CloudRuntimeException("Unable to start instance '" + vm.getHostName()
|
||||
+ "' (" + vm.getUuid() + "), see management server log for details");
|
||||
}
|
||||
|
||||
return startedVm;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -295,7 +295,7 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro
|
|||
if (!status) {
|
||||
return false;
|
||||
}
|
||||
if ((newState == State.Expunging)) {
|
||||
if ((newState == State.Expunging) || (newState == State.Error)) {
|
||||
// cleanup all affinity groups associations of the Expunged VM
|
||||
SearchCriteria<AffinityGroupVMMapVO> sc = _affinityGroupVMMapDao.createSearchCriteria();
|
||||
sc.addAnd("instanceId", SearchCriteria.Op.EQ, vo.getId());
|
||||
|
|
|
|||
|
|
@ -392,6 +392,7 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
|
|||
//mark all the GSLB-LB mapping to be in revoke state
|
||||
for (GlobalLoadBalancerLbRuleMapVO gslbLbMap : gslbLbMapVos) {
|
||||
gslbLbMap.setRevoke(true);
|
||||
_gslbLbMapDao.update(gslbLbMap.getId(), gslbLbMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -411,6 +412,16 @@ public class GlobalLoadBalancingRulesServiceImpl implements GlobalLoadBalancingR
|
|||
throw new CloudRuntimeException("Failed to update the gloabal load balancer");
|
||||
}
|
||||
|
||||
txn.start();
|
||||
//remove all mappings between GSLB rule and load balancer rules
|
||||
if (gslbLbMapVos != null) {
|
||||
for (GlobalLoadBalancerLbRuleMapVO gslbLbMap : gslbLbMapVos) {
|
||||
_gslbLbMapDao.remove(gslbLbMap.getId());
|
||||
}
|
||||
}
|
||||
//remove the GSLB rule itself
|
||||
_gslbRuleDao.remove(gslbRuleId);
|
||||
txn.commit();
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ public class ConfigurationManagerTest {
|
|||
try {
|
||||
configurationMgr.dedicatePublicIpRange(dedicatePublicIpRangesCmd);
|
||||
} catch (Exception e) {
|
||||
Assert.assertTrue(e.getMessage().contains("Please specify a valid Public IP range id"));
|
||||
Assert.assertTrue(e.getMessage().contains("Unable to find vlan by id"));
|
||||
} finally {
|
||||
txn.close("runDedicatePublicIpRangeInvalidRange");
|
||||
}
|
||||
|
|
@ -306,7 +306,7 @@ public class ConfigurationManagerTest {
|
|||
try {
|
||||
configurationMgr.dedicatePublicIpRange(dedicatePublicIpRangesCmd);
|
||||
} catch (Exception e) {
|
||||
Assert.assertTrue(e.getMessage().contains("Public IP address in range is already allocated to another account"));
|
||||
Assert.assertTrue(e.getMessage().contains("Public IP address in range is allocated to another account"));
|
||||
} finally {
|
||||
txn.close("runDedicatePublicIpRangeIPAdressAllocated");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
}
|
||||
|
||||
@Override
|
||||
public PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags, String newVnetRangeString, String state) {
|
||||
public PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags, String newVnetRangeString, String state, String removeVlan) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF licenses this file
|
||||
// to you under the Apache License, Version 2.0 (the
|
||||
// "License"); you may not use this file except in compliance
|
||||
// with the License. You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing,
|
||||
// software distributed under the License is distributed on an
|
||||
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
// KIND, either express or implied. See the License for the
|
||||
// specific language governing permissions and limitations
|
||||
// under the License.
|
||||
package com.cloud.network;
|
||||
import com.cloud.capacity.CapacityManagerImpl;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.network.NetworkServiceImpl;
|
||||
import com.cloud.network.dao.PhysicalNetworkDao;
|
||||
import com.cloud.network.dao.PhysicalNetworkVO;
|
||||
import com.cloud.utils.Pair;
|
||||
import org.junit.Test;
|
||||
import org.junit.*;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.MockitoAnnotations.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Matchers.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
||||
public class UpdatePhysicalNetworkTest {
|
||||
private PhysicalNetworkDao _physicalNetworkDao = mock(PhysicalNetworkDao.class);
|
||||
private DataCenterDao _datacenterDao = mock(DataCenterDao.class);
|
||||
private DataCenterVO datacentervo = mock(DataCenterVO.class);
|
||||
private PhysicalNetworkVO physicalNetworkVO = mock(PhysicalNetworkVO.class);
|
||||
List<Pair<Integer,Integer>> existingRange = new ArrayList<Pair<Integer, Integer>>();
|
||||
ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class);
|
||||
|
||||
public NetworkServiceImpl setUp() {
|
||||
NetworkServiceImpl networkService = new NetworkServiceImpl();
|
||||
((NetworkServiceImpl)networkService)._dcDao= _datacenterDao;
|
||||
networkService._physicalNetworkDao = _physicalNetworkDao;
|
||||
return networkService;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updatePhysicalNetworkTest(){
|
||||
NetworkServiceImpl networkService = setUp();
|
||||
existingRange.add(new Pair<Integer, Integer>(520, 524));
|
||||
when(_physicalNetworkDao.findById(anyLong())).thenReturn(physicalNetworkVO);
|
||||
when(_datacenterDao.findById(anyLong())).thenReturn(datacentervo);
|
||||
when(_physicalNetworkDao.update(anyLong(), any(physicalNetworkVO.getClass()))).thenReturn(true);
|
||||
when(physicalNetworkVO.getVnet()).thenReturn(existingRange);
|
||||
networkService.updatePhysicalNetwork(1l, null, null, "525-530", null, null);
|
||||
verify(physicalNetworkVO).setVnet(argumentCaptor.capture());
|
||||
assertEquals("520-530", argumentCaptor.getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -435,7 +435,7 @@ public class MockConfigurationManagerImpl extends ManagerBase implements Configu
|
|||
*/
|
||||
@Override
|
||||
public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA,
|
||||
boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner) {
|
||||
boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ public class MockNetworkManagerImpl extends ManagerBase implements NetworkManage
|
|||
*/
|
||||
@Override
|
||||
public PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags,
|
||||
String newVnetRangeString, String state) {
|
||||
String newVnetRangeString, String state, String removeVlan) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,6 @@ CREATE TABLE `cloud`.`affinity_group_vm_map` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `deployment_planner` varchar(255) NOT NULL DEFAULT 'FirstFitPlanner' COMMENT 'Planner heuristics used to deploy a VM of this offering';
|
||||
|
||||
CREATE TABLE nic_secondary_ips (
|
||||
`id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT,
|
||||
|
|
@ -280,6 +279,356 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Project Defaults', 'DEFAULT'
|
|||
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Project Defaults', 'DEFAULT', 'management-server', 'max.project.primary.storage', '200', 'The default maximum primary storage space (in GiB) that can be used for a project');
|
||||
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Project Defaults', 'DEFAULT', 'management-server', 'max.project.secondary.storage', '400', 'The default maximum secondary storage space (in GiB) that can be used for a project');
|
||||
|
||||
|
||||
|
||||
ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id';
|
||||
ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `uuid` varchar(40) UNIQUE;
|
||||
|
||||
-- START: support for LXC
|
||||
|
||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('LXC', 'default', 50, 1);
|
||||
ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `lxc_network_label` varchar(255) DEFAULT 'cloudbr0' COMMENT 'The network name label of the physical device dedicated to this traffic on a LXC host';
|
||||
|
||||
UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,LXC' WHERE name='hypervisor.list';
|
||||
|
||||
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
|
||||
VALUES (10, 'routing-10', 'SystemVM Template (LXC)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2', '2755de1f9ef2ce4d6f2bee2efbb4da92', 0, 'SystemVM Template (LXC)', 'QCOW2', 15, 0, 1, 'LXC');
|
||||
|
||||
-- END: support for LXC
|
||||
|
||||
CREATE TABLE `cloud`.`vm_snapshots` (
|
||||
`id` bigint(20) unsigned NOT NULL auto_increment COMMENT 'Primary Key',
|
||||
`uuid` varchar(40) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`display_name` varchar(255) default NULL,
|
||||
`description` varchar(255) default NULL,
|
||||
`vm_id` bigint(20) unsigned NOT NULL,
|
||||
`account_id` bigint(20) unsigned NOT NULL,
|
||||
`domain_id` bigint(20) unsigned NOT NULL,
|
||||
`vm_snapshot_type` varchar(32) default NULL,
|
||||
`state` varchar(32) NOT NULL,
|
||||
`parent` bigint unsigned default NULL,
|
||||
`current` int(1) unsigned default NULL,
|
||||
`update_count` bigint unsigned NOT NULL DEFAULT 0,
|
||||
`updated` datetime default NULL,
|
||||
`created` datetime default NULL,
|
||||
`removed` datetime default NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT UNIQUE KEY `uc_vm_snapshots_uuid` (`uuid`),
|
||||
INDEX `vm_snapshots_name` (`name`),
|
||||
INDEX `vm_snapshots_vm_id` (`vm_id`),
|
||||
INDEX `vm_snapshots_account_id` (`account_id`),
|
||||
INDEX `vm_snapshots_display_name` (`display_name`),
|
||||
INDEX `vm_snapshots_removed` (`removed`),
|
||||
INDEX `vm_snapshots_parent` (`parent`),
|
||||
CONSTRAINT `fk_vm_snapshots_vm_id__vm_instance_id` FOREIGN KEY `fk_vm_snapshots_vm_id__vm_instance_id` (`vm_id`) REFERENCES `vm_instance` (`id`),
|
||||
CONSTRAINT `fk_vm_snapshots_account_id__account_id` FOREIGN KEY `fk_vm_snapshots_account_id__account_id` (`account_id`) REFERENCES `account` (`id`),
|
||||
CONSTRAINT `fk_vm_snapshots_domain_id__domain_id` FOREIGN KEY `fk_vm_snapshots_domain_id__domain_id` (`domain_id`) REFERENCES `domain` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `vm_snapshot_enabled` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Whether VM snapshot is supported by hypervisor';
|
||||
UPDATE `cloud`.`hypervisor_capabilities` SET `vm_snapshot_enabled`=1 WHERE `hypervisor_type` in ('VMware', 'XenServer');
|
||||
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`user_vm_view`;
|
||||
CREATE VIEW `cloud`.`user_vm_view` AS
|
||||
select
|
||||
vm_instance.id id,
|
||||
vm_instance.name name,
|
||||
user_vm.display_name display_name,
|
||||
user_vm.user_data user_data,
|
||||
account.id account_id,
|
||||
account.uuid account_uuid,
|
||||
account.account_name account_name,
|
||||
account.type account_type,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path,
|
||||
projects.id project_id,
|
||||
projects.uuid project_uuid,
|
||||
projects.name project_name,
|
||||
instance_group.id instance_group_id,
|
||||
instance_group.uuid instance_group_uuid,
|
||||
instance_group.name instance_group_name,
|
||||
vm_instance.uuid uuid,
|
||||
vm_instance.last_host_id last_host_id,
|
||||
vm_instance.vm_type type,
|
||||
vm_instance.vnc_password vnc_password,
|
||||
vm_instance.limit_cpu_use limit_cpu_use,
|
||||
vm_instance.created created,
|
||||
vm_instance.state state,
|
||||
vm_instance.removed removed,
|
||||
vm_instance.ha_enabled ha_enabled,
|
||||
vm_instance.hypervisor_type hypervisor_type,
|
||||
vm_instance.instance_name instance_name,
|
||||
vm_instance.guest_os_id guest_os_id,
|
||||
guest_os.uuid guest_os_uuid,
|
||||
vm_instance.pod_id pod_id,
|
||||
host_pod_ref.uuid pod_uuid,
|
||||
vm_instance.private_ip_address private_ip_address,
|
||||
vm_instance.private_mac_address private_mac_address,
|
||||
vm_instance.vm_type vm_type,
|
||||
data_center.id data_center_id,
|
||||
data_center.uuid data_center_uuid,
|
||||
data_center.name data_center_name,
|
||||
data_center.is_security_group_enabled security_group_enabled,
|
||||
host.id host_id,
|
||||
host.uuid host_uuid,
|
||||
host.name host_name,
|
||||
vm_template.id template_id,
|
||||
vm_template.uuid template_uuid,
|
||||
vm_template.name template_name,
|
||||
vm_template.display_text template_display_text,
|
||||
vm_template.enable_password password_enabled,
|
||||
iso.id iso_id,
|
||||
iso.uuid iso_uuid,
|
||||
iso.name iso_name,
|
||||
iso.display_text iso_display_text,
|
||||
service_offering.id service_offering_id,
|
||||
disk_offering.uuid service_offering_uuid,
|
||||
service_offering.cpu cpu,
|
||||
service_offering.speed speed,
|
||||
service_offering.ram_size ram_size,
|
||||
disk_offering.name service_offering_name,
|
||||
storage_pool.id pool_id,
|
||||
storage_pool.uuid pool_uuid,
|
||||
storage_pool.pool_type pool_type,
|
||||
volumes.id volume_id,
|
||||
volumes.uuid volume_uuid,
|
||||
volumes.device_id volume_device_id,
|
||||
volumes.volume_type volume_type,
|
||||
security_group.id security_group_id,
|
||||
security_group.uuid security_group_uuid,
|
||||
security_group.name security_group_name,
|
||||
security_group.description security_group_description,
|
||||
nics.id nic_id,
|
||||
nics.uuid nic_uuid,
|
||||
nics.network_id network_id,
|
||||
nics.ip4_address ip_address,
|
||||
nics.ip6_address ip6_address,
|
||||
nics.ip6_gateway ip6_gateway,
|
||||
nics.ip6_cidr ip6_cidr,
|
||||
nics.default_nic is_default_nic,
|
||||
nics.gateway gateway,
|
||||
nics.netmask netmask,
|
||||
nics.mac_address mac_address,
|
||||
nics.broadcast_uri broadcast_uri,
|
||||
nics.isolation_uri isolation_uri,
|
||||
vpc.id vpc_id,
|
||||
vpc.uuid vpc_uuid,
|
||||
networks.uuid network_uuid,
|
||||
networks.name network_name,
|
||||
networks.traffic_type traffic_type,
|
||||
networks.guest_type guest_type,
|
||||
user_ip_address.id public_ip_id,
|
||||
user_ip_address.uuid public_ip_uuid,
|
||||
user_ip_address.public_ip_address public_ip_address,
|
||||
ssh_keypairs.keypair_name keypair_name,
|
||||
resource_tags.id tag_id,
|
||||
resource_tags.uuid tag_uuid,
|
||||
resource_tags.key tag_key,
|
||||
resource_tags.value tag_value,
|
||||
resource_tags.domain_id tag_domain_id,
|
||||
resource_tags.account_id tag_account_id,
|
||||
resource_tags.resource_id tag_resource_id,
|
||||
resource_tags.resource_uuid tag_resource_uuid,
|
||||
resource_tags.resource_type tag_resource_type,
|
||||
resource_tags.customer tag_customer,
|
||||
async_job.id job_id,
|
||||
async_job.uuid job_uuid,
|
||||
async_job.job_status job_status,
|
||||
async_job.account_id job_account_id,
|
||||
affinity_group.id affinity_group_id,
|
||||
affinity_group.uuid affinity_group_uuid,
|
||||
affinity_group.name affinity_group_name,
|
||||
affinity_group.description affinity_group_description
|
||||
from
|
||||
`cloud`.`user_vm`
|
||||
inner join
|
||||
`cloud`.`vm_instance` ON vm_instance.id = user_vm.id
|
||||
and vm_instance.removed is NULL
|
||||
inner join
|
||||
`cloud`.`account` ON vm_instance.account_id = account.id
|
||||
inner join
|
||||
`cloud`.`domain` ON vm_instance.domain_id = domain.id
|
||||
left join
|
||||
`cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id
|
||||
left join
|
||||
`cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id
|
||||
left join
|
||||
`cloud`.`projects` ON projects.project_account_id = account.id
|
||||
left join
|
||||
`cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id
|
||||
left join
|
||||
`cloud`.`data_center` ON vm_instance.data_center_id = data_center.id
|
||||
left join
|
||||
`cloud`.`host` ON vm_instance.host_id = host.id
|
||||
left join
|
||||
`cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id
|
||||
left join
|
||||
`cloud`.`vm_template` iso ON iso.id = user_vm.iso_id
|
||||
left join
|
||||
`cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id
|
||||
left join
|
||||
`cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id
|
||||
left join
|
||||
`cloud`.`volumes` ON vm_instance.id = volumes.instance_id
|
||||
left join
|
||||
`cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
|
||||
left join
|
||||
`cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id
|
||||
left join
|
||||
`cloud`.`nics` ON vm_instance.id = nics.instance_id
|
||||
left join
|
||||
`cloud`.`networks` ON nics.network_id = networks.id
|
||||
left join
|
||||
`cloud`.`vpc` ON networks.vpc_id = vpc.id
|
||||
left join
|
||||
`cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id
|
||||
left join
|
||||
`cloud`.`user_vm_details` ON user_vm_details.vm_id = vm_instance.id
|
||||
and user_vm_details.name = 'SSH.PublicKey'
|
||||
left join
|
||||
`cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = user_vm_details.value
|
||||
left join
|
||||
`cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id
|
||||
and resource_tags.resource_type = 'UserVm'
|
||||
left join
|
||||
`cloud`.`async_job` ON async_job.instance_id = vm_instance.id
|
||||
and async_job.instance_type = 'VirtualMachine'
|
||||
and async_job.job_status = 0
|
||||
left join
|
||||
`cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id;
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`affinity_group_view`;
|
||||
CREATE VIEW `cloud`.`affinity_group_view` AS
|
||||
select
|
||||
affinity_group.id id,
|
||||
affinity_group.name name,
|
||||
affinity_group.description description,
|
||||
affinity_group.uuid uuid,
|
||||
account.id account_id,
|
||||
account.uuid account_uuid,
|
||||
account.account_name account_name,
|
||||
account.type account_type,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path,
|
||||
vm_instance.id vm_id,
|
||||
vm_instance.uuid vm_uuid,
|
||||
vm_instance.name vm_name,
|
||||
vm_instance.state vm_state,
|
||||
user_vm.display_name vm_display_name
|
||||
from
|
||||
`cloud`.`affinity_group`
|
||||
inner join
|
||||
`cloud`.`account` ON affinity_group.account_id = account.id
|
||||
inner join
|
||||
`cloud`.`domain` ON affinity_group.domain_id = domain.id
|
||||
left join
|
||||
`cloud`.`affinity_group_vm_map` ON affinity_group.id = affinity_group_vm_map.affinity_group_id
|
||||
left join
|
||||
`cloud`.`vm_instance` ON vm_instance.id = affinity_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`user_vm` ON user_vm.id = vm_instance.id;
|
||||
|
||||
CREATE TABLE `cloud`.`external_cisco_vnmc_devices` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`uuid` varchar(255) UNIQUE,
|
||||
`physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which cisco vnmc device is added',
|
||||
`provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this cisco vnmc device',
|
||||
`device_name` varchar(255) NOT NULL COMMENT 'name of the cisco vnmc device',
|
||||
`host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external cisco vnmc device',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_external_cisco_vnmc_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_external_cisco_vnmc_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`external_cisco_asa1000v_devices` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`uuid` varchar(255) UNIQUE,
|
||||
`physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which cisco asa1kv device is added',
|
||||
`management_ip` varchar(255) UNIQUE NOT NULL COMMENT 'mgmt. ip of cisco asa1kv device',
|
||||
`in_port_profile` varchar(255) NOT NULL COMMENT 'inside port profile name of cisco asa1kv device',
|
||||
`cluster_id` bigint unsigned NOT NULL COMMENT 'id of the Vmware cluster to which cisco asa1kv device is attached (cisco n1kv switch)',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_external_cisco_asa1000v_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_external_cisco_asa1000v_devices__cluster_id` FOREIGN KEY (`cluster_id`) REFERENCES `cluster`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`network_asa1000v_map` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`network_id` bigint unsigned NOT NULL UNIQUE COMMENT 'id of guest network',
|
||||
`asa1000v_id` bigint unsigned NOT NULL UNIQUE COMMENT 'id of asa1000v device',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_network_asa1000v_map__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_network_asa1000v_map__asa1000v_id` FOREIGN KEY (`asa1000v_id`) REFERENCES `external_cisco_asa1000v_devices`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if public IP is associated with user VM creation by default when EIP service is enabled.' AFTER `elastic_ip_service`;
|
||||
|
||||
-- Re-enable foreign key checking, at the end of the upgrade path
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
|
||||
-- Add "default" field to account/user tables
|
||||
ALTER TABLE `cloud`.`account` ADD COLUMN `default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 if account is default';
|
||||
ALTER TABLE `cloud`.`user` ADD COLUMN `default` int(1) unsigned NOT NULL DEFAULT '0' COMMENT '1 if user is default';
|
||||
UPDATE `cloud`.`account` SET `cloud`.`account`.`default`=1 WHERE id IN (1,2);
|
||||
UPDATE `cloud`.`user` SET `cloud`.`user`.`default`=1 WHERE id IN (1,2);
|
||||
|
||||
ALTER VIEW `cloud`.`user_view` AS
|
||||
select
|
||||
user.id,
|
||||
user.uuid,
|
||||
user.username,
|
||||
user.password,
|
||||
user.firstname,
|
||||
user.lastname,
|
||||
user.email,
|
||||
user.state,
|
||||
user.api_key,
|
||||
user.secret_key,
|
||||
user.created,
|
||||
user.removed,
|
||||
user.timezone,
|
||||
user.registration_token,
|
||||
user.is_registered,
|
||||
user.incorrect_login_attempts,
|
||||
user.default,
|
||||
account.id account_id,
|
||||
account.uuid account_uuid,
|
||||
account.account_name account_name,
|
||||
account.type account_type,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path,
|
||||
async_job.id job_id,
|
||||
async_job.uuid job_uuid,
|
||||
async_job.job_status job_status,
|
||||
async_job.account_id job_account_id
|
||||
from
|
||||
`cloud`.`user`
|
||||
inner join
|
||||
`cloud`.`account` ON user.account_id = account.id
|
||||
inner join
|
||||
`cloud`.`domain` ON account.domain_id = domain.id
|
||||
left join
|
||||
`cloud`.`async_job` ON async_job.instance_id = user.id
|
||||
and async_job.instance_type = 'User'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`account_view`;
|
||||
CREATE VIEW `cloud`.`account_view` AS
|
||||
select
|
||||
|
|
@ -291,6 +640,7 @@ CREATE VIEW `cloud`.`account_view` AS
|
|||
account.removed,
|
||||
account.cleanup_needed,
|
||||
account.network_domain,
|
||||
account.default,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
|
|
@ -423,53 +773,6 @@ CREATE VIEW `cloud`.`account_view` AS
|
|||
and async_job.instance_type = 'Account'
|
||||
and async_job.job_status = 0;
|
||||
|
||||
ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `id` bigint unsigned NOT NULL UNIQUE AUTO_INCREMENT COMMENT 'id';
|
||||
ALTER TABLE `cloud`.`remote_access_vpn` ADD COLUMN `uuid` varchar(40) UNIQUE;
|
||||
|
||||
-- START: support for LXC
|
||||
|
||||
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('LXC', 'default', 50, 1);
|
||||
ALTER TABLE `cloud`.`physical_network_traffic_types` ADD COLUMN `lxc_network_label` varchar(255) DEFAULT 'cloudbr0' COMMENT 'The network name label of the physical device dedicated to this traffic on a LXC host';
|
||||
|
||||
UPDATE configuration SET value='KVM,XenServer,VMware,BareMetal,Ovm,LXC' WHERE name='hypervisor.list';
|
||||
|
||||
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
|
||||
VALUES (10, 'routing-10', 'SystemVM Template (LXC)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2', '2755de1f9ef2ce4d6f2bee2efbb4da92', 0, 'SystemVM Template (LXC)', 'QCOW2', 15, 0, 1, 'LXC');
|
||||
|
||||
-- END: support for LXC
|
||||
|
||||
CREATE TABLE `cloud`.`vm_snapshots` (
|
||||
`id` bigint(20) unsigned NOT NULL auto_increment COMMENT 'Primary Key',
|
||||
`uuid` varchar(40) NOT NULL,
|
||||
`name` varchar(255) NOT NULL,
|
||||
`display_name` varchar(255) default NULL,
|
||||
`description` varchar(255) default NULL,
|
||||
`vm_id` bigint(20) unsigned NOT NULL,
|
||||
`account_id` bigint(20) unsigned NOT NULL,
|
||||
`domain_id` bigint(20) unsigned NOT NULL,
|
||||
`vm_snapshot_type` varchar(32) default NULL,
|
||||
`state` varchar(32) NOT NULL,
|
||||
`parent` bigint unsigned default NULL,
|
||||
`current` int(1) unsigned default NULL,
|
||||
`update_count` bigint unsigned NOT NULL DEFAULT 0,
|
||||
`updated` datetime default NULL,
|
||||
`created` datetime default NULL,
|
||||
`removed` datetime default NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT UNIQUE KEY `uc_vm_snapshots_uuid` (`uuid`),
|
||||
INDEX `vm_snapshots_name` (`name`),
|
||||
INDEX `vm_snapshots_vm_id` (`vm_id`),
|
||||
INDEX `vm_snapshots_account_id` (`account_id`),
|
||||
INDEX `vm_snapshots_display_name` (`display_name`),
|
||||
INDEX `vm_snapshots_removed` (`removed`),
|
||||
INDEX `vm_snapshots_parent` (`parent`),
|
||||
CONSTRAINT `fk_vm_snapshots_vm_id__vm_instance_id` FOREIGN KEY `fk_vm_snapshots_vm_id__vm_instance_id` (`vm_id`) REFERENCES `vm_instance` (`id`),
|
||||
CONSTRAINT `fk_vm_snapshots_account_id__account_id` FOREIGN KEY `fk_vm_snapshots_account_id__account_id` (`account_id`) REFERENCES `account` (`id`),
|
||||
CONSTRAINT `fk_vm_snapshots_domain_id__domain_id` FOREIGN KEY `fk_vm_snapshots_domain_id__domain_id` (`domain_id`) REFERENCES `domain` (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `cloud`.`hypervisor_capabilities` ADD COLUMN `vm_snapshot_enabled` tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Whether VM snapshot is supported by hypervisor';
|
||||
UPDATE `cloud`.`hypervisor_capabilities` SET `vm_snapshot_enabled`=1 WHERE `hypervisor_type` in ('VMware', 'XenServer');
|
||||
|
||||
|
||||
ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `source_ip_address` varchar(40) COMMENT 'source ip address for the load balancer rule';
|
||||
|
|
@ -478,257 +781,6 @@ ALTER TABLE `cloud`.`load_balancing_rules` ADD COLUMN `scheme` varchar(40) NOT N
|
|||
UPDATE `cloud`.`load_balancing_rules` SET `scheme`='Public';
|
||||
|
||||
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`user_vm_view`;
|
||||
CREATE VIEW `cloud`.`user_vm_view` AS
|
||||
select
|
||||
vm_instance.id id,
|
||||
vm_instance.name name,
|
||||
user_vm.display_name display_name,
|
||||
user_vm.user_data user_data,
|
||||
account.id account_id,
|
||||
account.uuid account_uuid,
|
||||
account.account_name account_name,
|
||||
account.type account_type,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path,
|
||||
projects.id project_id,
|
||||
projects.uuid project_uuid,
|
||||
projects.name project_name,
|
||||
instance_group.id instance_group_id,
|
||||
instance_group.uuid instance_group_uuid,
|
||||
instance_group.name instance_group_name,
|
||||
vm_instance.uuid uuid,
|
||||
vm_instance.last_host_id last_host_id,
|
||||
vm_instance.vm_type type,
|
||||
vm_instance.vnc_password vnc_password,
|
||||
vm_instance.limit_cpu_use limit_cpu_use,
|
||||
vm_instance.created created,
|
||||
vm_instance.state state,
|
||||
vm_instance.removed removed,
|
||||
vm_instance.ha_enabled ha_enabled,
|
||||
vm_instance.hypervisor_type hypervisor_type,
|
||||
vm_instance.instance_name instance_name,
|
||||
vm_instance.guest_os_id guest_os_id,
|
||||
guest_os.uuid guest_os_uuid,
|
||||
vm_instance.pod_id pod_id,
|
||||
host_pod_ref.uuid pod_uuid,
|
||||
vm_instance.private_ip_address private_ip_address,
|
||||
vm_instance.private_mac_address private_mac_address,
|
||||
vm_instance.vm_type vm_type,
|
||||
data_center.id data_center_id,
|
||||
data_center.uuid data_center_uuid,
|
||||
data_center.name data_center_name,
|
||||
data_center.is_security_group_enabled security_group_enabled,
|
||||
host.id host_id,
|
||||
host.uuid host_uuid,
|
||||
host.name host_name,
|
||||
vm_template.id template_id,
|
||||
vm_template.uuid template_uuid,
|
||||
vm_template.name template_name,
|
||||
vm_template.display_text template_display_text,
|
||||
vm_template.enable_password password_enabled,
|
||||
iso.id iso_id,
|
||||
iso.uuid iso_uuid,
|
||||
iso.name iso_name,
|
||||
iso.display_text iso_display_text,
|
||||
service_offering.id service_offering_id,
|
||||
disk_offering.uuid service_offering_uuid,
|
||||
service_offering.cpu cpu,
|
||||
service_offering.speed speed,
|
||||
service_offering.ram_size ram_size,
|
||||
disk_offering.name service_offering_name,
|
||||
storage_pool.id pool_id,
|
||||
storage_pool.uuid pool_uuid,
|
||||
storage_pool.pool_type pool_type,
|
||||
volumes.id volume_id,
|
||||
volumes.uuid volume_uuid,
|
||||
volumes.device_id volume_device_id,
|
||||
volumes.volume_type volume_type,
|
||||
security_group.id security_group_id,
|
||||
security_group.uuid security_group_uuid,
|
||||
security_group.name security_group_name,
|
||||
security_group.description security_group_description,
|
||||
nics.id nic_id,
|
||||
nics.uuid nic_uuid,
|
||||
nics.network_id network_id,
|
||||
nics.ip4_address ip_address,
|
||||
nics.ip6_address ip6_address,
|
||||
nics.ip6_gateway ip6_gateway,
|
||||
nics.ip6_cidr ip6_cidr,
|
||||
nics.default_nic is_default_nic,
|
||||
nics.gateway gateway,
|
||||
nics.netmask netmask,
|
||||
nics.mac_address mac_address,
|
||||
nics.broadcast_uri broadcast_uri,
|
||||
nics.isolation_uri isolation_uri,
|
||||
vpc.id vpc_id,
|
||||
vpc.uuid vpc_uuid,
|
||||
networks.uuid network_uuid,
|
||||
networks.name network_name,
|
||||
networks.traffic_type traffic_type,
|
||||
networks.guest_type guest_type,
|
||||
user_ip_address.id public_ip_id,
|
||||
user_ip_address.uuid public_ip_uuid,
|
||||
user_ip_address.public_ip_address public_ip_address,
|
||||
ssh_keypairs.keypair_name keypair_name,
|
||||
resource_tags.id tag_id,
|
||||
resource_tags.uuid tag_uuid,
|
||||
resource_tags.key tag_key,
|
||||
resource_tags.value tag_value,
|
||||
resource_tags.domain_id tag_domain_id,
|
||||
resource_tags.account_id tag_account_id,
|
||||
resource_tags.resource_id tag_resource_id,
|
||||
resource_tags.resource_uuid tag_resource_uuid,
|
||||
resource_tags.resource_type tag_resource_type,
|
||||
resource_tags.customer tag_customer,
|
||||
async_job.id job_id,
|
||||
async_job.uuid job_uuid,
|
||||
async_job.job_status job_status,
|
||||
async_job.account_id job_account_id,
|
||||
affinity_group.id affinity_group_id,
|
||||
affinity_group.uuid affinity_group_uuid,
|
||||
affinity_group.name affinity_group_name,
|
||||
affinity_group.description affinity_group_description
|
||||
from
|
||||
`cloud`.`user_vm`
|
||||
inner join
|
||||
`cloud`.`vm_instance` ON vm_instance.id = user_vm.id
|
||||
and vm_instance.removed is NULL
|
||||
inner join
|
||||
`cloud`.`account` ON vm_instance.account_id = account.id
|
||||
inner join
|
||||
`cloud`.`domain` ON vm_instance.domain_id = domain.id
|
||||
left join
|
||||
`cloud`.`guest_os` ON vm_instance.guest_os_id = guest_os.id
|
||||
left join
|
||||
`cloud`.`host_pod_ref` ON vm_instance.pod_id = host_pod_ref.id
|
||||
left join
|
||||
`cloud`.`projects` ON projects.project_account_id = account.id
|
||||
left join
|
||||
`cloud`.`instance_group_vm_map` ON vm_instance.id = instance_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`instance_group` ON instance_group_vm_map.group_id = instance_group.id
|
||||
left join
|
||||
`cloud`.`data_center` ON vm_instance.data_center_id = data_center.id
|
||||
left join
|
||||
`cloud`.`host` ON vm_instance.host_id = host.id
|
||||
left join
|
||||
`cloud`.`vm_template` ON vm_instance.vm_template_id = vm_template.id
|
||||
left join
|
||||
`cloud`.`vm_template` iso ON iso.id = user_vm.iso_id
|
||||
left join
|
||||
`cloud`.`service_offering` ON vm_instance.service_offering_id = service_offering.id
|
||||
left join
|
||||
`cloud`.`disk_offering` ON vm_instance.service_offering_id = disk_offering.id
|
||||
left join
|
||||
`cloud`.`volumes` ON vm_instance.id = volumes.instance_id
|
||||
left join
|
||||
`cloud`.`storage_pool` ON volumes.pool_id = storage_pool.id
|
||||
left join
|
||||
`cloud`.`security_group_vm_map` ON vm_instance.id = security_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`security_group` ON security_group_vm_map.security_group_id = security_group.id
|
||||
left join
|
||||
`cloud`.`nics` ON vm_instance.id = nics.instance_id
|
||||
left join
|
||||
`cloud`.`networks` ON nics.network_id = networks.id
|
||||
left join
|
||||
`cloud`.`vpc` ON networks.vpc_id = vpc.id
|
||||
left join
|
||||
`cloud`.`user_ip_address` ON user_ip_address.vm_id = vm_instance.id
|
||||
left join
|
||||
`cloud`.`user_vm_details` ON user_vm_details.vm_id = vm_instance.id
|
||||
and user_vm_details.name = 'SSH.PublicKey'
|
||||
left join
|
||||
`cloud`.`ssh_keypairs` ON ssh_keypairs.public_key = user_vm_details.value
|
||||
left join
|
||||
`cloud`.`resource_tags` ON resource_tags.resource_id = vm_instance.id
|
||||
and resource_tags.resource_type = 'UserVm'
|
||||
left join
|
||||
`cloud`.`async_job` ON async_job.instance_id = vm_instance.id
|
||||
and async_job.instance_type = 'VirtualMachine'
|
||||
and async_job.job_status = 0
|
||||
left join
|
||||
`cloud`.`affinity_group_vm_map` ON vm_instance.id = affinity_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`affinity_group` ON affinity_group_vm_map.affinity_group_id = affinity_group.id;
|
||||
|
||||
DROP VIEW IF EXISTS `cloud`.`affinity_group_view`;
|
||||
CREATE VIEW `cloud`.`affinity_group_view` AS
|
||||
select
|
||||
affinity_group.id id,
|
||||
affinity_group.name name,
|
||||
affinity_group.description description,
|
||||
affinity_group.uuid uuid,
|
||||
account.id account_id,
|
||||
account.uuid account_uuid,
|
||||
account.account_name account_name,
|
||||
account.type account_type,
|
||||
domain.id domain_id,
|
||||
domain.uuid domain_uuid,
|
||||
domain.name domain_name,
|
||||
domain.path domain_path,
|
||||
vm_instance.id vm_id,
|
||||
vm_instance.uuid vm_uuid,
|
||||
vm_instance.name vm_name,
|
||||
vm_instance.state vm_state,
|
||||
user_vm.display_name vm_display_name
|
||||
from
|
||||
`cloud`.`affinity_group`
|
||||
inner join
|
||||
`cloud`.`account` ON affinity_group.account_id = account.id
|
||||
inner join
|
||||
`cloud`.`domain` ON affinity_group.domain_id = domain.id
|
||||
left join
|
||||
`cloud`.`affinity_group_vm_map` ON affinity_group.id = affinity_group_vm_map.affinity_group_id
|
||||
left join
|
||||
`cloud`.`vm_instance` ON vm_instance.id = affinity_group_vm_map.instance_id
|
||||
left join
|
||||
`cloud`.`user_vm` ON user_vm.id = vm_instance.id;
|
||||
|
||||
CREATE TABLE `cloud`.`external_cisco_vnmc_devices` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`uuid` varchar(255) UNIQUE,
|
||||
`physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which cisco vnmc device is added',
|
||||
`provider_name` varchar(255) NOT NULL COMMENT 'Service Provider name corresponding to this cisco vnmc device',
|
||||
`device_name` varchar(255) NOT NULL COMMENT 'name of the cisco vnmc device',
|
||||
`host_id` bigint unsigned NOT NULL COMMENT 'host id coresponding to the external cisco vnmc device',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_external_cisco_vnmc_devices__host_id` FOREIGN KEY (`host_id`) REFERENCES `host`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_external_cisco_vnmc_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`external_cisco_asa1000v_devices` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`uuid` varchar(255) UNIQUE,
|
||||
`physical_network_id` bigint unsigned NOT NULL COMMENT 'id of the physical network in to which cisco asa1kv device is added',
|
||||
`management_ip` varchar(255) UNIQUE NOT NULL COMMENT 'mgmt. ip of cisco asa1kv device',
|
||||
`in_port_profile` varchar(255) NOT NULL COMMENT 'inside port profile name of cisco asa1kv device',
|
||||
`cluster_id` bigint unsigned NOT NULL COMMENT 'id of the Vmware cluster to which cisco asa1kv device is attached (cisco n1kv switch)',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_external_cisco_asa1000v_devices__physical_network_id` FOREIGN KEY (`physical_network_id`) REFERENCES `physical_network`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_external_cisco_asa1000v_devices__cluster_id` FOREIGN KEY (`cluster_id`) REFERENCES `cluster`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `cloud`.`network_asa1000v_map` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`network_id` bigint unsigned NOT NULL UNIQUE COMMENT 'id of guest network',
|
||||
`asa1000v_id` bigint unsigned NOT NULL UNIQUE COMMENT 'id of asa1000v device',
|
||||
PRIMARY KEY (`id`),
|
||||
CONSTRAINT `fk_network_asa1000v_map__network_id` FOREIGN KEY (`network_id`) REFERENCES `networks`(`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `fk_network_asa1000v_map__asa1000v_id` FOREIGN KEY (`asa1000v_id`) REFERENCES `external_cisco_asa1000v_devices`(`id`) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int(1) unsigned NOT NULL DEFAULT 0 COMMENT 'true if public IP is associated with user VM creation by default when EIP service is enabled.' AFTER `elastic_ip_service`;
|
||||
|
||||
-- Re-enable foreign key checking, at the end of the upgrade path
|
||||
SET foreign_key_checks = 1;
|
||||
|
||||
|
||||
-- Add role to the domain router view
|
||||
ALTER VIEW `cloud`.`domain_router_view` AS
|
||||
select
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -110,6 +109,7 @@ class TestAccounts(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -239,6 +239,7 @@ class TestRemoveUserFromAccount(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -506,7 +507,7 @@ class TestNonRootAdminsPrivileges(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone settings
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
|
||||
cls.services['mode'] = zone.networktype
|
||||
# Create an account, domain etc
|
||||
cls.domain = Domain.create(
|
||||
cls.api_client,
|
||||
|
|
@ -852,6 +853,7 @@ class TesttemplateHierarchy(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone settings
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.services["template"]["zoneid"] = cls.zone.id
|
||||
|
||||
# Create domains, accounts and template
|
||||
|
|
@ -1000,6 +1002,7 @@ class TestAddVmToSubDomain(cloudstackTestCase):
|
|||
cls.api_client,
|
||||
cls.services,
|
||||
)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.sub_domain = Domain.create(
|
||||
cls.api_client,
|
||||
cls.services["domain"],
|
||||
|
|
@ -1145,6 +1148,7 @@ class TestUserDetails(cloudstackTestCase):
|
|||
# Get Zone, Domain etc
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls._cleanup = []
|
||||
return
|
||||
|
||||
|
|
@ -1451,6 +1455,7 @@ class TestUserLogin(cloudstackTestCase):
|
|||
# Get Zone, Domain etc
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls._cleanup = []
|
||||
return
|
||||
|
||||
|
|
@ -1615,6 +1620,7 @@ class TestDomainForceRemove(cloudstackTestCase):
|
|||
cls.api_client,
|
||||
cls.services,
|
||||
)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced',
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -94,6 +93,7 @@ class TestAllocationState(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls._cleanup = []
|
||||
return
|
||||
|
||||
|
|
|
|||
|
|
@ -101,8 +101,6 @@ class Services:
|
|||
"ostype": 'CentOS 5.3 (64-bit)',
|
||||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"mode": 'advanced',
|
||||
# Networking mode, Advanced, Basic
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -115,6 +113,7 @@ class TestSnapshots(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -422,6 +421,7 @@ class TestTemplate(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||
cls.services["templates"]["zoneid"] = cls.zone.id
|
||||
|
||||
|
|
@ -543,6 +543,7 @@ class TestNATRules(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -737,6 +738,7 @@ class TestRouters(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -863,6 +865,7 @@ class TestRouterRestart(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -992,6 +995,7 @@ class TestTemplates(cloudstackTestCase):
|
|||
# Get Zone, templates etc
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
|
|||
|
|
@ -122,8 +122,6 @@ class Services:
|
|||
# CentOS 5.3 (64-bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'basic',
|
||||
# Networking mode: Basic or Advanced
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -156,6 +154,7 @@ class TestDefaultSecurityGroupEgress(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -314,6 +313,7 @@ class TestAuthorizeIngressRule(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -471,6 +471,7 @@ class TestDefaultGroupEgress(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -671,6 +672,7 @@ class TestDefaultGroupEgressAfterDeploy(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -853,6 +855,7 @@ class TestRevokeEgressRule(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1114,6 +1117,7 @@ class TestInvalidAccountAuthroize(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1235,6 +1239,7 @@ class TestMultipleAccountsEgressRuleNeg(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1482,6 +1487,7 @@ class TestMultipleAccountsEgressRule(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1778,6 +1784,7 @@ class TestStartStopVMWithEgressRule(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1989,6 +1996,7 @@ class TestInvalidParametersForEgress(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -2171,6 +2179,7 @@ class TestEgressAfterHostMaintainance(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.pod = get_pod(
|
||||
cls.api_client,
|
||||
zoneid=cls.zone.id
|
||||
|
|
|
|||
|
|
@ -85,7 +85,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'basic'
|
||||
}
|
||||
|
||||
class TestEIP(cloudstackTestCase):
|
||||
|
|
@ -97,6 +96,7 @@ class TestEIP(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -919,6 +919,7 @@ class TestELB(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
|
|||
|
|
@ -142,7 +142,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -158,6 +157,7 @@ class TestNOVirtualRouter(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -736,6 +736,7 @@ class TestNOWithNetscaler(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -1371,6 +1372,7 @@ class TestNetworkUpgrade(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -1827,6 +1829,7 @@ class TestSharedNetworkWithoutIp(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
|
|||
|
|
@ -102,7 +102,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -117,6 +116,7 @@ class TestUserProjectCreation(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
configs = Configurations.list(
|
||||
cls.api_client,
|
||||
|
|
@ -282,6 +282,7 @@ class TestProjectCreationNegative(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
# Checking for prereqisits - global configs
|
||||
configs = Configurations.list(
|
||||
|
|
@ -427,6 +428,7 @@ class TestProjectInviteRequired(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
# Create domains, account etc.
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
|
|
@ -578,6 +580,7 @@ class TestProjectInviteRequiredTrue(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
# Create domains, account etc.
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
|
|
@ -730,6 +733,7 @@ class TestProjectInviteTimeout(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
# Create domains, account etc.
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced',
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -131,6 +130,7 @@ class TestProjectLimits(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
# Create domains, account etc.
|
||||
cls.domain = Domain.create(
|
||||
|
|
@ -481,6 +481,7 @@ class TestResourceLimitsProject(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -921,6 +922,7 @@ class TestMaxProjectNetworks(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
|
|||
|
|
@ -134,7 +134,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced',
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -149,6 +148,7 @@ class TestOfferings(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone and template
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -329,6 +329,7 @@ class TestNetwork(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone and template
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -516,6 +517,7 @@ class TestTemplates(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -745,6 +747,7 @@ class TestSnapshots(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -891,6 +894,7 @@ class TestPublicIpAddress(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1190,6 +1194,7 @@ class TestSecurityGroup(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -125,6 +124,7 @@ class TestVmUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -319,6 +319,7 @@ class TestPublicIPUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -490,6 +491,7 @@ class TestVolumeUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -674,6 +676,7 @@ class TestTemplateUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.services["server"]["zoneid"] = cls.zone.id
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -846,6 +849,7 @@ class TestISOUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.services["server"]["zoneid"] = cls.zone.id
|
||||
cls.services["iso"]["zoneid"] = cls.zone.id
|
||||
# Create Account, ISO image etc
|
||||
|
|
@ -993,6 +997,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -1175,6 +1180,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1352,6 +1358,7 @@ class TestNatRuleUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -1534,6 +1541,7 @@ class TestVpnUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
|
|||
|
|
@ -96,7 +96,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -111,6 +110,7 @@ class TestMultipleProjectCreation(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
# Create domains, account etc.
|
||||
cls.domain = get_domain(
|
||||
|
|
@ -323,6 +323,7 @@ class TestCrossDomainAccountAdd(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.domain = get_domain(
|
||||
cls.api_client,
|
||||
cls.services
|
||||
|
|
@ -456,6 +457,7 @@ class TestDeleteAccountWithProject(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.domain = get_domain(
|
||||
cls.api_client,
|
||||
cls.services
|
||||
|
|
@ -569,6 +571,7 @@ class TestDeleteDomainWithProject(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
configs = Configurations.list(
|
||||
cls.api_client,
|
||||
|
|
@ -713,6 +716,7 @@ class TestProjectOwners(cloudstackTestCase):
|
|||
cls.services
|
||||
)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
configs = Configurations.list(
|
||||
cls.api_client,
|
||||
|
|
@ -1136,6 +1140,7 @@ class TestProjectResources(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.domain = get_domain(
|
||||
cls.api_client,
|
||||
cls.services
|
||||
|
|
@ -1444,6 +1449,7 @@ class TestProjectSuspendActivate(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, domain, template etc
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.domain = get_domain(
|
||||
cls.api_client,
|
||||
cls.services
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced',
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -118,6 +117,7 @@ class TestResourceLimitsAccount(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -881,6 +881,7 @@ class TestResourceLimitsDomain(cloudstackTestCase):
|
|||
cls.services = Services().services
|
||||
# Get Zone, Domain and templates
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1338,6 +1339,7 @@ class TestMaxAccountNetworks(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
|
|||
|
|
@ -91,7 +91,6 @@ class Services:
|
|||
},
|
||||
"ostype": 'CentOS 5.3 (64-bit)',
|
||||
# Used for Get_Template : CentOS 5.3 (64 bit)
|
||||
"mode": 'advanced', # Networking mode: Advanced, basic
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -105,6 +104,7 @@ class TestRouterServices(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -592,6 +592,7 @@ class TestRouterStopCreatePF(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -803,6 +804,7 @@ class TestRouterStopCreateLB(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -1014,6 +1016,7 @@ class TestRouterStopCreateFW(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
|
|||
|
|
@ -94,8 +94,6 @@ class Services:
|
|||
# CentOS 5.3 (64-bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'basic',
|
||||
# Networking mode: Basic or Advanced
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -125,6 +123,7 @@ class TestDefaultSecurityGroup(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -397,6 +396,7 @@ class TestAuthorizeIngressRule(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -532,6 +532,7 @@ class TestRevokeIngressRule(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -690,6 +691,7 @@ class TestDhcpOnlyRouter(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -826,6 +828,7 @@ class TestdeployVMWithUserData(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -985,6 +988,7 @@ class TestDeleteSecurityGroup(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
self.domain = get_domain(self.apiclient, self.services)
|
||||
self.zone = get_zone(self.apiclient, self.services)
|
||||
self.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
self.apiclient,
|
||||
|
|
@ -1230,6 +1234,7 @@ class TestIngressRule(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
self.domain = get_domain(self.apiclient, self.services)
|
||||
self.zone = get_zone(self.apiclient, self.services)
|
||||
self.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
self.apiclient,
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced', # Networking mode: Advanced, Basic
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -134,6 +133,7 @@ class TestSnapshotRootDisk(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -356,6 +356,7 @@ class TestSnapshots(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -1190,6 +1191,7 @@ class TestCreateVMsnapshotTemplate(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1485,6 +1487,7 @@ class TestAccountSnapshotClean(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1833,6 +1836,7 @@ class TestSnapshotDetachedDisk(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
|
|
@ -2120,6 +2124,7 @@ class TestSnapshotLimit(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -2378,6 +2383,7 @@ class TestSnapshotEvents(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ class Services:
|
|||
"ostype": 'CentOS 5.3 (64-bit)',
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced', # Networking mode: Advanced, basic
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -128,6 +127,7 @@ class TestCreateTemplate(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||
|
||||
cls.service_offering = ServiceOffering.create(
|
||||
|
|
@ -283,6 +283,7 @@ class TestTemplates(cloudstackTestCase):
|
|||
# Get Zone, templates etc
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
#populate second zone id for iso copy
|
||||
cmd = listZones.listZonesCmd()
|
||||
zones = cls.api_client.listZones(cmd)
|
||||
|
|
|
|||
|
|
@ -105,7 +105,6 @@ class Services:
|
|||
# Cent OS 5.3 (64 bit)
|
||||
"sleep": 60,
|
||||
"timeout": 10,
|
||||
"mode": 'advanced'
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -118,6 +117,7 @@ class TestVmUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -301,6 +301,7 @@ class TestPublicIPUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -452,6 +453,7 @@ class TestVolumeUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -625,6 +627,7 @@ class TestTemplateUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.services["server"]["zoneid"] = cls.zone.id
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -789,6 +792,7 @@ class TestISOUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.services["server"]["zoneid"] = cls.zone.id
|
||||
cls.services["iso"]["zoneid"] = cls.zone.id
|
||||
# Create Account, ISO image etc
|
||||
|
|
@ -925,6 +929,7 @@ class TestLBRuleUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -1086,6 +1091,7 @@ class TestSnapshotUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
|
|
@ -1252,6 +1258,7 @@ class TestNatRuleUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
@ -1413,6 +1420,7 @@ class TestVpnUsage(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
cls.zone.id,
|
||||
|
|
|
|||
|
|
@ -83,6 +83,7 @@ class TestVMPasswordEnabled(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
domain = get_domain(cls.api_client, cls.services)
|
||||
zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
template = get_template(
|
||||
cls.api_client,
|
||||
zone.id,
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ class Services:
|
|||
},
|
||||
"sleep": 50,
|
||||
"ostype": 'CentOS 5.3 (64-bit)',
|
||||
"mode": 'advanced',
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -101,6 +100,7 @@ class TestAttachVolume(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -371,6 +371,7 @@ class TestAttachDetachVolume(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -616,6 +617,7 @@ class TestAttachVolumeISO(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -807,6 +809,7 @@ class TestVolumes(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"]
|
||||
|
|
@ -1046,6 +1049,7 @@ class TestDeployVmWithCustomDisk(cloudstackTestCase):
|
|||
# Get Zone, Domain and templates
|
||||
cls.domain = get_domain(cls.api_client, cls.services)
|
||||
cls.zone = get_zone(cls.api_client, cls.services)
|
||||
cls.services['mode'] = zone.networktype
|
||||
cls.disk_offering = DiskOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["disk_offering"],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,125 @@
|
|||
# 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.
|
||||
""" BVT tests for Primary Storage
|
||||
"""
|
||||
import marvin
|
||||
from marvin import cloudstackTestCase
|
||||
from marvin.cloudstackTestCase import *
|
||||
|
||||
import unittest
|
||||
import hashlib
|
||||
import random
|
||||
|
||||
|
||||
class TestUpdatePhysicalNetwork(cloudstackTestCase):
|
||||
"""
|
||||
This test updates the existing physicalnetwork with a new vlan range.
|
||||
"""
|
||||
def setUp(self):
|
||||
"""
|
||||
CloudStack internally saves its passwords in md5 form and that is how we
|
||||
specify it in the API. Python's hashlib library helps us to quickly hash
|
||||
strings as follows
|
||||
"""
|
||||
mdf = hashlib.md5()
|
||||
mdf.update('password')
|
||||
mdf_pass = mdf.hexdigest()
|
||||
|
||||
self.apiClient = self.testClient.getApiClient() #Get ourselves an API client
|
||||
|
||||
self.acct = createAccount.createAccountCmd() #The createAccount command
|
||||
self.acct.accounttype = 0 #We need a regular user. admins have accounttype=1
|
||||
self.acct.firstname = 'bharat'
|
||||
self.acct.lastname = 'kumar' #What's up doc?
|
||||
self.acct.password = mdf_pass #The md5 hashed password string
|
||||
self.acct.username = 'bharat'
|
||||
self.acct.email = 'bharat@kumar.com'
|
||||
self.acct.account = 'bharat'
|
||||
self.acct.domainid = 1 #The default ROOT domain
|
||||
self.acctResponse = self.apiClient.createAccount(self.acct)
|
||||
# using the default debug logger of the test framework
|
||||
self.debug("successfully created account: %s, user: %s, id: \
|
||||
%s"%(self.acctResponse.account.account, \
|
||||
self.acctResponse.account.username, \
|
||||
self.acctResponse.account.id))
|
||||
|
||||
def test_UpdatePhysicalNetwork(self):
|
||||
"""
|
||||
Let's start by defining the attributes of our VM that we will be
|
||||
deploying on CloudStack. We will be assuming a single zone is available
|
||||
and is configured and all templates are Ready
|
||||
|
||||
The hardcoded values are used only for brevity.
|
||||
"""
|
||||
listPhysicalNetworksCmd = listPhysicalNetworks.listPhysicalNetworksCmd()
|
||||
listPhysicalNetworksResponse = self.apiClient.listPhysicalNetworks(listPhysicalNetworksCmd)
|
||||
|
||||
self.assertNotEqual(len(listPhysicalNetworksResponse), 0, "Check if the list API \
|
||||
returns a non-empty response")
|
||||
|
||||
networkid = listPhysicalNetworksResponse[0].id
|
||||
updatePhysicalNetworkCmd = updatePhysicalNetwork.updatePhysicalNetworkCmd()
|
||||
updatePhysicalNetworkCmd.id = networkid
|
||||
updatePhysicalNetworkCmd.vlan = "4090-4091"
|
||||
updatePhysicalNetworkResponse = self.apiClient.updatePhysicalNetwork(updatePhysicalNetworkCmd)
|
||||
self.assertNotEqual((updatePhysicalNetworkResponse.len), 0, "Check if the list API \
|
||||
returns a non-empty response")
|
||||
|
||||
updatePhysicalNetworkCmd = updatePhysicalNetwork.updatePhysicalNetworkCmd()
|
||||
updatePhysicalNetworkCmd.id = networkid
|
||||
updatePhysicalNetworkCmd.vlan = "4092-4096"
|
||||
updatePhysicalNetworkResponse = self.apiClient.updatePhysicalNetwork(updatePhysicalNetworkCmd)
|
||||
self.assertNotEqual((updatePhysicalNetworkResponse.len), 0, "Check if the list API \
|
||||
returns a non-empty response")
|
||||
|
||||
vlanranges= updatePhysicalNetworkResponse.vlan
|
||||
range = ""
|
||||
vlanranges = vlanranges.split(";")
|
||||
for vlan in vlanranges:
|
||||
if (vlan == "4090-4096"):
|
||||
range = vlan
|
||||
|
||||
self.assertEqual(range, "4090-4096", "check if adding the range is successful")
|
||||
|
||||
updatePhysicalNetworkCmd = updatePhysicalNetwork.updatePhysicalNetworkCmd()
|
||||
updatePhysicalNetworkCmd.id = networkid
|
||||
updatePhysicalNetworkCmd.removevlan = "4090-4096"
|
||||
updatePhysicalNetworkResponse = self.apiClient.updatePhysicalNetwork(updatePhysicalNetworkCmd)
|
||||
self.assertNotEqual((updatePhysicalNetworkResponse.len), 0, "Check if the list API \
|
||||
returns a non-empty response")
|
||||
|
||||
vlanranges= updatePhysicalNetworkResponse.vlan
|
||||
range = ""
|
||||
vlanranges = vlanranges.split(";")
|
||||
|
||||
for vlan in vlanranges:
|
||||
if (vlan == "4090-4096"):
|
||||
range = vlan
|
||||
|
||||
|
||||
self.assertEqual(range, "", "check if removing the range is successful")
|
||||
|
||||
|
||||
def tearDown(self): # Teardown will delete the Account as well as the VM once the VM reaches "Running" state
|
||||
"""
|
||||
And finally let us cleanup the resources we created by deleting the
|
||||
account. All good unittests are atomic and rerunnable this way
|
||||
"""
|
||||
deleteAcct = deleteAccount.deleteAccountCmd()
|
||||
deleteAcct.id = self.acctResponse.account.id
|
||||
self.apiClient.deleteAccount(deleteAcct)
|
||||
|
||||
|
|
@ -56,6 +56,7 @@ dirname_to_dirname = {
|
|||
|
||||
|
||||
known_categories = {
|
||||
'Cisco' : 'External Device',
|
||||
'SystemVm': 'System VM',
|
||||
'VirtualMachine': 'Virtual Machine',
|
||||
'VM': 'Virtual Machine',
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class workThread(threading.Thread):
|
|||
|
||||
try:
|
||||
self.lock.acquire()
|
||||
result = self.connection.pollAsyncJob(job.jobId, job.responsecls).jobresult
|
||||
result = self.connection.poll(job.jobId, job.responsecls).jobresult
|
||||
except cloudstackException.cloudstackAPIException, e:
|
||||
result = str(e)
|
||||
finally:
|
||||
|
|
|
|||
|
|
@ -15,126 +15,132 @@
|
|||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import urllib2
|
||||
import requests
|
||||
import urllib
|
||||
import httplib
|
||||
import base64
|
||||
import hmac
|
||||
import hashlib
|
||||
import json
|
||||
import xml.dom.minidom
|
||||
import types
|
||||
import time
|
||||
import inspect
|
||||
import cloudstackException
|
||||
from cloudstackAPI import *
|
||||
import jsonHelper
|
||||
from requests import ConnectionError
|
||||
from requests import HTTPError
|
||||
from requests import Timeout
|
||||
from requests import RequestException
|
||||
|
||||
class cloudConnection(object):
|
||||
def __init__(self, mgtSvr, port=8096, apiKey = None, securityKey = None, asyncTimeout=3600, logging=None, protocol='http', path='/client/api'):
|
||||
def __init__(self, mgtSvr, port=8096, apiKey=None, securityKey=None, asyncTimeout=3600, logging=None,
|
||||
scheme='http', path='client/api'):
|
||||
self.apiKey = apiKey
|
||||
self.securityKey = securityKey
|
||||
self.mgtSvr = mgtSvr
|
||||
self.port = port
|
||||
self.logging = logging
|
||||
if protocol != 'http' and protocol != 'https':
|
||||
raise ValueError("Protocol must be 'http' or 'https'.")
|
||||
else:
|
||||
self.protocol=protocol
|
||||
self.path = path
|
||||
if port == 8096 or (self.apiKey == None and self.securityKey == None):
|
||||
self.auth = False
|
||||
else:
|
||||
self.auth = True
|
||||
self.retries = 5
|
||||
self.asyncTimeout = asyncTimeout
|
||||
|
||||
def close(self):
|
||||
try:
|
||||
self.connection.close()
|
||||
except:
|
||||
pass
|
||||
|
||||
self.auth = True
|
||||
if port == 8096 or \
|
||||
(self.apiKey == None and self.securityKey == None):
|
||||
self.auth = False
|
||||
if scheme not in ['http', 'https']:
|
||||
raise RequestException("Protocol must be HTTP")
|
||||
self.protocol = scheme
|
||||
self.baseurl = "%s://%s:%d/%s"%(self.protocol, self.mgtSvr, self.port, self.path)
|
||||
|
||||
def __copy__(self):
|
||||
return cloudConnection(self.mgtSvr, self.port, self.apiKey, self.securityKey, self.asyncTimeout, self.logging, self.protocol, self.path)
|
||||
|
||||
def make_request_with_auth(self, command, requests={}):
|
||||
requests["command"] = command
|
||||
requests["apiKey"] = self.apiKey
|
||||
requests["response"] = "json"
|
||||
request = zip(requests.keys(), requests.values())
|
||||
request.sort(key=lambda x: str.lower(x[0]))
|
||||
|
||||
requestUrl = "&".join(["=".join([r[0], urllib.quote_plus(str(r[1]))]) for r in request])
|
||||
hashStr = "&".join(["=".join([str.lower(r[0]), str.lower(urllib.quote_plus(str(r[1]))).replace("+", "%20")]) for r in request])
|
||||
return cloudConnection(self.mgtSvr, self.port, self.apiKey, self.securityKey, self.asyncTimeout,
|
||||
self.logging, self.protocol, self.path)
|
||||
|
||||
sig = urllib.quote_plus(base64.encodestring(hmac.new(self.securityKey, hashStr, hashlib.sha1).digest()).strip())
|
||||
requestUrl += "&signature=%s"%sig
|
||||
|
||||
try:
|
||||
self.connection = urllib2.urlopen("%s://%s:%d%s?%s"%(self.protocol, self.mgtSvr, self.port, self.path, requestUrl))
|
||||
if self.logging is not None:
|
||||
self.logging.debug("sending GET request: %s"%requestUrl)
|
||||
response = self.connection.read()
|
||||
if self.logging is not None:
|
||||
self.logging.info("got response: %s"%response)
|
||||
except IOError, e:
|
||||
if hasattr(e, 'reason'):
|
||||
if self.logging is not None:
|
||||
self.logging.critical("failed to reach %s because of %s"%(self.mgtSvr, e.reason))
|
||||
elif hasattr(e, 'code'):
|
||||
if self.logging is not None:
|
||||
self.logging.critical("server returned %d error code"%e.code)
|
||||
raise e
|
||||
except httplib.HTTPException, h:
|
||||
if self.logging is not None:
|
||||
self.logging.debug("encountered http Exception %s"%h.args)
|
||||
if self.retries > 0:
|
||||
self.retries = self.retries - 1
|
||||
self.make_request_with_auth(command, requests)
|
||||
else:
|
||||
self.retries = 5
|
||||
raise h
|
||||
else:
|
||||
return response
|
||||
|
||||
def make_request_without_auth(self, command, requests={}):
|
||||
requests["command"] = command
|
||||
requests["response"] = "json"
|
||||
requests = zip(requests.keys(), requests.values())
|
||||
requestUrl = "&".join(["=".join([request[0], urllib.quote_plus(str(request[1]))]) for request in requests])
|
||||
|
||||
self.connection = urllib2.urlopen("%s://%s:%d%s?%s"%(self.protocol, self.mgtSvr, self.port, self.path, requestUrl))
|
||||
if self.logging is not None:
|
||||
self.logging.debug("sending GET request without auth: %s"%requestUrl)
|
||||
response = self.connection.read()
|
||||
if self.logging is not None:
|
||||
self.logging.info("got response: %s"%response)
|
||||
return response
|
||||
|
||||
def pollAsyncJob(self, jobId, response):
|
||||
def poll(self, jobid, response):
|
||||
"""
|
||||
polls the completion of a given jobid
|
||||
@param jobid:
|
||||
@param response:
|
||||
@return:
|
||||
"""
|
||||
cmd = queryAsyncJobResult.queryAsyncJobResultCmd()
|
||||
cmd.jobid = jobId
|
||||
cmd.jobid = jobid
|
||||
timeout = self.asyncTimeout
|
||||
|
||||
|
||||
while timeout > 0:
|
||||
asyncResonse = self.make_request(cmd, response, True)
|
||||
|
||||
asyncResonse = self.marvin_request(cmd, response_type=response)
|
||||
|
||||
if asyncResonse.jobstatus == 2:
|
||||
raise cloudstackException.cloudstackAPIException("asyncquery", asyncResonse.jobresult)
|
||||
elif asyncResonse.jobstatus == 1:
|
||||
return asyncResonse
|
||||
|
||||
|
||||
time.sleep(5)
|
||||
if self.logging is not None:
|
||||
self.logging.debug("job: %s still processing, will timeout in %ds"%(jobId, timeout))
|
||||
self.logging.debug("job: %s still processing, will timeout in %ds"%(jobid, timeout))
|
||||
timeout = timeout - 5
|
||||
|
||||
raise cloudstackException.cloudstackAPIException("asyncquery", "Async job timeout %s"%jobId)
|
||||
|
||||
def make_request(self, cmd, response = None, raw=False):
|
||||
commandName = cmd.__class__.__name__.replace("Cmd", "")
|
||||
isAsync = "false"
|
||||
|
||||
raise cloudstackException.cloudstackAPIException("asyncquery", "Async job timeout %s"%jobid)
|
||||
|
||||
def sign(self, payload):
|
||||
"""
|
||||
signs a given request URL when the apiKey and secretKey are known
|
||||
|
||||
@param payload: dict of GET params to be signed
|
||||
@return: the signature of the payload
|
||||
"""
|
||||
params = zip(payload.keys(), payload.values())
|
||||
params.sort(key=lambda k: str.lower(k[0]))
|
||||
hashStr = "&".join(
|
||||
["=".join(
|
||||
[str.lower(r[0]), str.lower(urllib.quote_plus(str(r[1]))).replace("+", "%20")]
|
||||
) for r in params]
|
||||
)
|
||||
signature = base64.encodestring(hmac.new(self.securityKey, hashStr, hashlib.sha1).digest()).strip()
|
||||
self.logging.info("Computed Signature by Marvin: %s"%signature)
|
||||
return signature
|
||||
|
||||
def request(self, command, auth=True, payload={}, data={}):
|
||||
"""
|
||||
Makes requests on the `integration.api.port`
|
||||
@param command: cloudstack API command name eg: deployVirtualMachineCommand
|
||||
@param auth: Authentication (apikey,secretKey) => True, else False
|
||||
@param payload: GET param data composed as a dictionary of key,value pairs
|
||||
@param data: POST data as a dictionary
|
||||
@return:
|
||||
"""
|
||||
payload["command"] = command
|
||||
payload["response"] = "json"
|
||||
|
||||
if auth:
|
||||
payload["apiKey"] = self.apiKey
|
||||
signature = self.sign(payload)
|
||||
payload["signature"] = signature
|
||||
|
||||
|
||||
try:
|
||||
if data:
|
||||
response = requests.get(self.baseurl, params=payload, data=data)
|
||||
else:
|
||||
response = requests.get(self.baseurl, params=payload)
|
||||
except ConnectionError, c:
|
||||
self.logging.debug("Connection refused. Reason: %s"%(self.baseurl, c))
|
||||
raise c
|
||||
except HTTPError, h:
|
||||
self.logging.debug("Server returned error code: %s"%h)
|
||||
raise h
|
||||
except Timeout, t:
|
||||
self.logging.debug("Connection timed out with %s"%t)
|
||||
raise t
|
||||
except RequestException,r:
|
||||
self.logging.debug("Error returned by server %s"%r)
|
||||
raise r
|
||||
else:
|
||||
return response
|
||||
|
||||
def sanitize_command(self, cmd):
|
||||
"""
|
||||
Removes None values, Validates all required params are present
|
||||
@param cmd: Cmd object eg: createPhysicalNetwork
|
||||
@return:
|
||||
"""
|
||||
requests = {}
|
||||
required = []
|
||||
for attribute in dir(cmd):
|
||||
|
|
@ -145,11 +151,11 @@ class cloudConnection(object):
|
|||
required = getattr(cmd, attribute)
|
||||
else:
|
||||
requests[attribute] = getattr(cmd, attribute)
|
||||
|
||||
|
||||
cmdname = cmd.__class__.__name__.replace("Cmd", "")
|
||||
for requiredPara in required:
|
||||
if requests[requiredPara] is None:
|
||||
raise cloudstackException.cloudstackAPIException(commandName, "%s is required"%requiredPara)
|
||||
'''remove none value'''
|
||||
raise cloudstackException.cloudstackAPIException(cmdname, "%s is required"%requiredPara)
|
||||
for param, value in requests.items():
|
||||
if value is None:
|
||||
requests.pop(param)
|
||||
|
|
@ -166,28 +172,30 @@ class cloudConnection(object):
|
|||
for k,v in val.iteritems():
|
||||
requests["%s[%d].%s"%(param,i,k)] = v
|
||||
i = i + 1
|
||||
|
||||
if self.logging is not None:
|
||||
self.logging.info("sending command: %s %s"%(commandName, str(requests)))
|
||||
result = None
|
||||
return cmdname, isAsync, requests
|
||||
|
||||
def marvin_request(self, cmd, data={}, response_type=None):
|
||||
"""
|
||||
Requester for marvin command objects
|
||||
@param cmd: marvin's command from cloudstackAPI
|
||||
@param data: any data to be sent in as POST
|
||||
@param response_type: response type of the command in cmd
|
||||
@param raw:
|
||||
@return:
|
||||
"""
|
||||
cmdname, isAsync, payload = self.sanitize_command(cmd)
|
||||
self.logging.info("sending command: %s %s"%(cmdname, str(payload)))
|
||||
if self.auth:
|
||||
result = self.make_request_with_auth(commandName, requests)
|
||||
response = self.request(cmdname, auth=True, payload=payload, data=data)
|
||||
else:
|
||||
result = self.make_request_without_auth(commandName, requests)
|
||||
|
||||
if result is None:
|
||||
return None
|
||||
|
||||
result = jsonHelper.getResultObj(result, response)
|
||||
if raw or isAsync == "false":
|
||||
return result
|
||||
response = self.request(cmdname, auth=False, payload=payload, data=data)
|
||||
|
||||
self.logging.info("Request: %s Response: %s"%(response.url, response.text))
|
||||
response = jsonHelper.getResultObj(response.json, response_type)
|
||||
|
||||
if isAsync == "false":
|
||||
return response
|
||||
else:
|
||||
asynJobId = result.jobid
|
||||
result = self.pollAsyncJob(asynJobId, response)
|
||||
return result.jobresult
|
||||
|
||||
if __name__ == '__main__':
|
||||
xml = '<?xml version="1.0" encoding="ISO-8859-1"?><deployVirtualMachineResponse><virtualmachine><id>407</id><name>i-1-407-RS3</name><displayname>i-1-407-RS3</displayname><account>system</account><domainid>1</domainid><domain>ROOT</domain><created>2011-07-30T14:45:19-0700</created><state>Running</state><haenable>false</haenable><zoneid>1</zoneid><zonename>CA1</zonename><hostid>3</hostid><hostname>kvm-50-205</hostname><templateid>4</templateid><templatename>CentOS 5.5(64-bit) no GUI (KVM)</templatename><templatedisplaytext>CentOS 5.5(64-bit) no GUI (KVM)</templatedisplaytext><passwordenabled>false</passwordenabled><serviceofferingid>1</serviceofferingid><serviceofferingname>Small Instance</serviceofferingname><cpunumber>1</cpunumber><cpuspeed>500</cpuspeed><memory>512</memory><guestosid>112</guestosid><rootdeviceid>0</rootdeviceid><rootdevicetype>NetworkFilesystem</rootdevicetype><nic><id>380</id><networkid>203</networkid><netmask>255.255.255.0</netmask><gateway>65.19.181.1</gateway><ipaddress>65.19.181.110</ipaddress><isolationuri>vlan://65</isolationuri><broadcasturi>vlan://65</broadcasturi><traffictype>Guest</traffictype><type>Direct</type><isdefault>true</isdefault><macaddress>06:52:da:00:00:08</macaddress></nic><hypervisor>KVM</hypervisor></virtualmachine></deployVirtualMachineResponse>'
|
||||
conn = cloudConnection(None)
|
||||
|
||||
print conn.paraseReturnXML(xml, deployVirtualMachine.deployVirtualMachineResponse())
|
||||
asyncJobId = response.jobid
|
||||
response = self.poll(asyncJobId, response_type)
|
||||
return response.jobresult
|
||||
|
|
|
|||
|
|
@ -111,7 +111,8 @@ class cloudstackTestClient(object):
|
|||
apiKey = registerUserRes.apikey
|
||||
securityKey = registerUserRes.secretkey
|
||||
|
||||
newUserConnection = cloudstackConnection.cloudConnection(self.connection.mgtSvr, self.connection.port, apiKey, securityKey, self.connection.asyncTimeout, self.connection.logging)
|
||||
newUserConnection = cloudstackConnection.cloudConnection(self.connection.mgtSvr, self.connection.port,
|
||||
apiKey, securityKey, self.connection.asyncTimeout, self.connection.logging)
|
||||
self.userApiClient = cloudstackAPIClient.CloudStackAPIClient(newUserConnection)
|
||||
self.userApiClient.connection = newUserConnection
|
||||
return self.userApiClient
|
||||
|
|
|
|||
|
|
@ -184,9 +184,9 @@ class codeGenerator:
|
|||
body += "\n"
|
||||
|
||||
for cmdName in self.cmdsName:
|
||||
body += self.space + 'def %s(self,command):\n'%cmdName
|
||||
body += self.space + 'def %s(self, command, postdata={}):\n'%cmdName
|
||||
body += self.space + self.space + 'response = %sResponse()\n'%cmdName
|
||||
body += self.space + self.space + 'response = self.connection.make_request(command, response)\n'
|
||||
body += self.space + self.space + 'response = self.connection.marvin_request(command, data=postdata, response_type=response)\n'
|
||||
body += self.space + self.space + 'return response\n'
|
||||
body += '\n'
|
||||
|
||||
|
|
|
|||
|
|
@ -407,7 +407,6 @@ class deployDataCenters():
|
|||
logging=self.testClientLogger)
|
||||
if mgt.apiKey is None:
|
||||
apiKey, securityKey = self.registerApiKey()
|
||||
self.testClient.close()
|
||||
self.testClient = \
|
||||
cloudstackTestClient.cloudstackTestClient(mgt.mgtSvrIp, 8080, \
|
||||
apiKey, securityKey, \
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import cloudstackException
|
|||
import json
|
||||
import inspect
|
||||
from cloudstackAPI import *
|
||||
import pdb
|
||||
|
||||
class jsonLoader:
|
||||
'''The recursive class for building and representing objects with.'''
|
||||
|
|
@ -113,12 +112,8 @@ def finalizeResultObj(result, responseName, responsecls):
|
|||
return result
|
||||
else:
|
||||
return result
|
||||
|
||||
|
||||
|
||||
|
||||
def getResultObj(returnObj, responsecls=None):
|
||||
returnObj = json.loads(returnObj)
|
||||
|
||||
if len(returnObj) == 0:
|
||||
return None
|
||||
responseName = filter(lambda a: a!=u'cloudstack-version', returnObj.keys())[0]
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ setup(name="Marvin",
|
|||
license="LICENSE.txt",
|
||||
install_requires=[
|
||||
"mysql-connector-python",
|
||||
"requests",
|
||||
"paramiko",
|
||||
"nose"
|
||||
],
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@
|
|||
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "system", "global-settings", "configuration", "projects", "regions"];
|
||||
}
|
||||
else if(isDomainAdmin()) {
|
||||
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects"];
|
||||
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "domains", "events", "projects", "regions"];
|
||||
}
|
||||
else if (g_userProjectsEnabled) {
|
||||
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "projects"];
|
||||
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "projects", "regions"];
|
||||
}
|
||||
else { //normal user
|
||||
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events"];
|
||||
sections = ["dashboard", "instances", "storage", "network", "templates", "accounts", "events", "regions"];
|
||||
}
|
||||
|
||||
if (cloudStack.plugins.length) {
|
||||
|
|
|
|||
|
|
@ -246,8 +246,30 @@
|
|||
},
|
||||
description: {
|
||||
label: 'label.description'
|
||||
},
|
||||
/*
|
||||
},
|
||||
gslbdomainname: {
|
||||
label: 'GSLB Domain Name',
|
||||
validation: { required: true }
|
||||
},
|
||||
gslblbmethod: {
|
||||
label: 'Algorithm',
|
||||
select: function(args) {
|
||||
var array1 = [{id: 'roundrobin', description: 'roundrobin'}, {id: 'leastconn', description: 'leastconn'}, {id: 'proximity', description: 'proximity'}];
|
||||
args.response.success({
|
||||
data: array1
|
||||
});
|
||||
}
|
||||
},
|
||||
gslbservicetype: {
|
||||
label: 'Service Type',
|
||||
select: function(args) {
|
||||
var array1 = [{id: 'tcp', description: 'tcp'}, {id: 'udp', description: 'udp'}];
|
||||
args.response.success({
|
||||
data: array1
|
||||
});
|
||||
},
|
||||
validation: { required: true }
|
||||
},
|
||||
domainid: {
|
||||
label: 'Domain',
|
||||
select: function(args) {
|
||||
|
|
@ -293,31 +315,7 @@
|
|||
else
|
||||
return true;
|
||||
}
|
||||
},
|
||||
*/
|
||||
gslblbmethod: {
|
||||
label: 'Algorithm',
|
||||
select: function(args) {
|
||||
var array1 = [{id: 'roundrobin', description: 'roundrobin'}, {id: 'leastconn', description: 'leastconn'}, {id: 'proximity', description: 'proximity'}];
|
||||
args.response.success({
|
||||
data: array1
|
||||
});
|
||||
}
|
||||
},
|
||||
gslbdomainname: {
|
||||
label: 'GSLB Domain Name',
|
||||
validation: { required: true }
|
||||
},
|
||||
gslbservicetype: {
|
||||
label: 'Service Type',
|
||||
select: function(args) {
|
||||
var array1 = [{id: 'tcp', description: 'tcp'}, {id: 'udp', description: 'udp'}];
|
||||
args.response.success({
|
||||
data: array1
|
||||
});
|
||||
},
|
||||
validation: { required: true }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
|
|
@ -330,23 +328,22 @@
|
|||
gslbservicetype: args.data.gslbservicetype
|
||||
};
|
||||
if(args.data.description != null && args.data.description.length > 0)
|
||||
$.extend(data, { description: args.data.description });
|
||||
/*
|
||||
$.extend(data, { description: args.data.description });
|
||||
if(args.data.domainid != null && args.data.domainid.length > 0)
|
||||
$.extend(data, { domainid: args.data.domainid });
|
||||
if(args.data.account != null && args.data.account.length > 0)
|
||||
$.extend(data, { account: args.data.account });
|
||||
*/
|
||||
|
||||
$.ajax({
|
||||
url: createURL('createGlobalLoadBalancerRule'),
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var jid = json.creategloballoadbalancerruleresponse.jobid;
|
||||
var jid = json.creategloballoadbalancerruleresponse.jobid;
|
||||
args.response.success(
|
||||
{_custom:
|
||||
{jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.globalloadbalancerrule;
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.globalloadbalancer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -355,9 +352,7 @@
|
|||
});
|
||||
},
|
||||
notification: {
|
||||
poll: function(args) {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -383,9 +378,246 @@
|
|||
data: null
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
detailView: {
|
||||
name: 'GSLB details',
|
||||
viewAll: { path: 'regions.lbUnderGSLB', label: 'load balancer rules' },
|
||||
actions: {
|
||||
remove: {
|
||||
label: 'delete GSLB',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm you want to delete this GSLB';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'delete GSLB';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
var data = {
|
||||
id: args.context.GSLB[0].id
|
||||
};
|
||||
$.ajax({
|
||||
url: createURL("deleteGlobalLoadBalancerRule"),
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var jid = json.deletegloballoadbalancerruleresponse.jobid;
|
||||
args.response.success({
|
||||
_custom: {
|
||||
jobId: jid
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
}
|
||||
},
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'label.details',
|
||||
fields: [
|
||||
{
|
||||
name: { label: 'label.name' }
|
||||
},
|
||||
{
|
||||
description: { label: 'label.description' },
|
||||
gslbdomainname: { label: 'GSLB Domain Name' },
|
||||
gslblbmethod: { label: 'Algorithm' },
|
||||
gslbservicetype: { label: 'Service Type' },
|
||||
id: { label: 'ID' }
|
||||
}
|
||||
],
|
||||
dataProvider: function(args) {
|
||||
var data = {
|
||||
id: args.context.GSLB[0].id
|
||||
};
|
||||
$.ajax({
|
||||
url: createURL('listGlobalLoadBalancerRules'),
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var item = json.listgloballoadbalancerrulesresponse.globalloadbalancerrule[0];
|
||||
args.response.success({
|
||||
data: item
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
lbUnderGSLB: {
|
||||
id: 'lbUnderGSLB',
|
||||
type: 'select',
|
||||
title: 'assigned load balancer rules',
|
||||
listView: {
|
||||
section: 'lbUnderGSLB',
|
||||
id: 'lbUnderGSLB',
|
||||
label: 'assigned load balancer rules',
|
||||
fields: {
|
||||
name: { label: 'label.name' },
|
||||
publicport: { label: 'label.public.port' },
|
||||
privateport: { label: 'label.private.port' },
|
||||
algorithm: { label: 'label.algorithm' }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
var data = {
|
||||
globalloadbalancerruleid: args.context.GSLB[0].id,
|
||||
listAll: true
|
||||
};
|
||||
$.ajax({
|
||||
url: createURL('listLoadBalancerRules'),
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var items = json.listloadbalancerrulesresponse.loadbalancerrule;
|
||||
args.response.success({
|
||||
data: items
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
actions: {
|
||||
add: {
|
||||
label: 'assign load balancer rule to GSLB',
|
||||
messages: {
|
||||
confirm: function(args) {
|
||||
return 'Please confirm you want to assign load balancer rule to GSLB';
|
||||
},
|
||||
notification: function(args) {
|
||||
return 'assign load balancer rule to GSLB';
|
||||
}
|
||||
},
|
||||
createForm: {
|
||||
title: 'assign load balancer rule to GSLB',
|
||||
fields: {
|
||||
loadbalancerrule: {
|
||||
label: 'load balancer rule',
|
||||
select: function(args) {
|
||||
var data = {
|
||||
globalloadbalancerruleid: args.context.GSLB[0].id,
|
||||
listAll: true
|
||||
};
|
||||
$.ajax({
|
||||
url: createURL('listLoadBalancerRules'),
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var items = json.listloadbalancerrulesresponse.loadbalancerrule;
|
||||
args.response.success({
|
||||
data: items,
|
||||
descriptionField: 'name'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
var data = {
|
||||
id: args.context.GSLB[0].id,
|
||||
loadbalancerrulelist: args.data.loadbalancerrule
|
||||
};
|
||||
$.ajax({
|
||||
url: createURL('assignToGlobalLoadBalancerRule'),
|
||||
data: data,
|
||||
success: function(json) {
|
||||
var jid = json.assigntogloballoadbalancerruleresponse.jobid;
|
||||
args.response.success(
|
||||
{_custom:
|
||||
{jobId: jid,
|
||||
getUpdatedItem: function(json) {
|
||||
return json.queryasyncjobresultresponse.jobresult.loadbalancerrule;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
detailView: {
|
||||
name: 'load balancer rule details',
|
||||
actions: {
|
||||
remove: {
|
||||
label: 'remove load balancer rule from this GSLB',
|
||||
messages: {
|
||||
notification: function() {
|
||||
return 'remove load balancer rule from GSLB';
|
||||
},
|
||||
confirm: function() {
|
||||
return 'Please confirm you want to remove load balancer rule from GSLB';
|
||||
}
|
||||
},
|
||||
action: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('removeFromGlobalLoadBalancerRule'),
|
||||
data: {
|
||||
id: args.context.lbUnderGSLB[0].id
|
||||
},
|
||||
success: function(json) {
|
||||
var jid = json.removefromloadbalancerruleresponse.jobid;
|
||||
args.response.success({
|
||||
_custom: {
|
||||
jobId: jid
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
notification: {
|
||||
poll: pollAsyncJobResult
|
||||
}
|
||||
}
|
||||
},
|
||||
tabs: {
|
||||
details: {
|
||||
title: 'label.details',
|
||||
fields: [
|
||||
{
|
||||
name: { label: 'label.name' }
|
||||
},
|
||||
{
|
||||
publicport: { label: 'label.public.port' },
|
||||
privateport: { label: 'label.private.port' },
|
||||
algorithm: { label: 'label.algorithm' },
|
||||
publicip: { label: 'label.public.ip' },
|
||||
state: { label: 'label.state' },
|
||||
id: { label: 'label.id' },
|
||||
cidrlist: { label: 'label.cidr' },
|
||||
domain: { label: 'label.domain' },
|
||||
account: { label: 'label.account' }
|
||||
}
|
||||
],
|
||||
dataProvider: function(args) {
|
||||
$.ajax({
|
||||
url: createURL('listLoadBalancerRules'),
|
||||
data: {
|
||||
id: args.context.lbUnderGSLB[0].id
|
||||
},
|
||||
success: function(json) {
|
||||
var item = json.listloadbalancerrulesresponse.loadbalancerrule[0];
|
||||
args.response.success({
|
||||
data: item
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2410,15 +2410,13 @@
|
|||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listHosts&VirtualMachineId=" + args.context.routers[0].id),
|
||||
//url: createURL("listHosts"), //for testing only, comment it out before checking in.
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var hostObjs = json.listhostsresponse.host;
|
||||
var items = [];
|
||||
$(hostObjs).each(function() {
|
||||
//items.push({id: this.id, description: (this.name + ": " +(this.hasEnoughCapacity? "Available" : "Full"))}); //listHosts API no longer returns hasEnoughCapacity proprety
|
||||
items.push({id: this.id, description: this.name});
|
||||
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")")});
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
|
|
@ -2986,15 +2984,13 @@
|
|||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listHosts&VirtualMachineId=" + args.context.routers[0].id),
|
||||
//url: createURL("listHosts"), //for testing only, comment it out before checking in.
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var hostObjs = json.listhostsresponse.host;
|
||||
var items = [];
|
||||
$(hostObjs).each(function() {
|
||||
//items.push({id: this.id, description: (this.name + ": " +(this.hasEnoughCapacity? "Available" : "Full"))}); //listHosts API no longer returns hasEnoughCapacity proprety
|
||||
items.push({id: this.id, description: this.name});
|
||||
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")")});
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
|
|
@ -3264,6 +3260,19 @@
|
|||
label: 'label.private.interface',
|
||||
docID: 'helpNetScalerPrivateInterface'
|
||||
},
|
||||
|
||||
gslbprovider: {
|
||||
label: 'GSLB service',
|
||||
isBoolean: true,
|
||||
isChecked: true
|
||||
},
|
||||
gslbproviderpublicip: {
|
||||
label: 'GSLB service Public IP'
|
||||
},
|
||||
gslbproviderprivateip: {
|
||||
label: 'GSLB service Private IP'
|
||||
},
|
||||
|
||||
numretries: {
|
||||
label: 'label.numretries',
|
||||
defaultValue: '2',
|
||||
|
|
@ -5259,15 +5268,13 @@
|
|||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listHosts&VirtualMachineId=" + args.context.systemVMs[0].id),
|
||||
//url: createURL("listHosts"), //for testing only, comment it out before checking in.
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var hostObjs = json.listhostsresponse.host;
|
||||
var items = [];
|
||||
$(hostObjs).each(function() {
|
||||
//items.push({id: this.id, description: (this.name + ": " +(this.hasEnoughCapacity? "Available" : "Full"))}); //listHosts API no longer returns hasEnoughCapacity proprety
|
||||
items.push({id: this.id, description: this.name});
|
||||
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")")});
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
|
|
@ -5998,15 +6005,13 @@
|
|||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listHosts&VirtualMachineId=" + args.context.routers[0].id),
|
||||
//url: createURL("listHosts"), //for testing only, comment it out before checking in.
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var hostObjs = json.listhostsresponse.host;
|
||||
var items = [];
|
||||
$(hostObjs).each(function() {
|
||||
//items.push({id: this.id, description: (this.name + ": " +(this.hasEnoughCapacity? "Available" : "Full"))}); //listHosts API no longer returns hasEnoughCapacity proprety
|
||||
items.push({id: this.id, description: this.name});
|
||||
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")")});
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
|
|
@ -6460,15 +6465,13 @@
|
|||
select: function(args) {
|
||||
$.ajax({
|
||||
url: createURL("listHosts&VirtualMachineId=" + args.context.systemVMs[0].id),
|
||||
//url: createURL("listHosts"), //for testing only, comment it out before checking in.
|
||||
dataType: "json",
|
||||
async: true,
|
||||
success: function(json) {
|
||||
var hostObjs = json.listhostsresponse.host;
|
||||
var items = [];
|
||||
$(hostObjs).each(function() {
|
||||
//items.push({id: this.id, description: (this.name + ": " +(this.hasEnoughCapacity? "Available" : "Full"))}); //listHosts API no longer returns hasEnoughCapacity proprety
|
||||
items.push({id: this.id, description: this.name});
|
||||
items.push({id: this.id, description: (this.name + " (" + (this.suitableformigration? "Suitable": "Not Suitable") + ")")});
|
||||
});
|
||||
args.response.success({data: items});
|
||||
}
|
||||
|
|
@ -6644,6 +6647,19 @@
|
|||
privateinterface: {
|
||||
label: 'label.private.interface'
|
||||
},
|
||||
|
||||
gslbprovider: {
|
||||
label: 'GSLB service',
|
||||
isBoolean: true,
|
||||
isChecked: true
|
||||
},
|
||||
gslbproviderpublicip: {
|
||||
label: 'GSLB service Public IP'
|
||||
},
|
||||
gslbproviderprivateip: {
|
||||
label: 'GSLB service Private IP'
|
||||
},
|
||||
|
||||
numretries: {
|
||||
label: 'label.numretries',
|
||||
defaultValue: '2'
|
||||
|
|
@ -10708,6 +10724,12 @@
|
|||
array1.push("&username=" + todb(args.data.username));
|
||||
array1.push("&password=" + todb(args.data.password));
|
||||
array1.push("&networkdevicetype=" + todb(args.data.networkdevicetype));
|
||||
|
||||
if(apiCmd == "addNetscalerLoadBalancer") {
|
||||
array1.push("&gslbprovider=" + (args.data.gslbprovider == "on"));
|
||||
array1.push("&gslbproviderpublicip=" + todb(args.data.gslbproviderpublicip));
|
||||
array1.push("&gslbproviderprivateip=" + todb(args.data.gslbproviderprivateip));
|
||||
}
|
||||
|
||||
//construct URL starts here
|
||||
var url = [];
|
||||
|
|
|
|||
|
|
@ -653,7 +653,18 @@
|
|||
},
|
||||
privateinterface: {
|
||||
label: 'label.private.interface'
|
||||
},
|
||||
gslbprovider: {
|
||||
label: 'GSLB service',
|
||||
isBoolean: true,
|
||||
isChecked: true
|
||||
},
|
||||
gslbproviderpublicip: {
|
||||
label: 'GSLB service Public IP'
|
||||
},
|
||||
gslbproviderprivateip: {
|
||||
label: 'GSLB service Private IP'
|
||||
},
|
||||
numretries: {
|
||||
label: 'label.numretries',
|
||||
defaultValue: '2'
|
||||
|
|
@ -2593,7 +2604,10 @@
|
|||
array1.push("&physicalnetworkid=" + args.data.returnedBasicPhysicalNetwork.id);
|
||||
array1.push("&username=" + todb(args.data.basicPhysicalNetwork.username));
|
||||
array1.push("&password=" + todb(args.data.basicPhysicalNetwork.password));
|
||||
array1.push("&networkdevicetype=" + todb(args.data.basicPhysicalNetwork.networkdevicetype));
|
||||
array1.push("&networkdevicetype=" + todb(args.data.basicPhysicalNetwork.networkdevicetype));
|
||||
array1.push("&gslbprovider=" + (args.data.basicPhysicalNetwork.gslbprovider == "on"));
|
||||
array1.push("&gslbproviderpublicip=" + todb(args.data.basicPhysicalNetwork.gslbproviderpublicip));
|
||||
array1.push("&gslbproviderprivateip=" + todb(args.data.basicPhysicalNetwork.gslbproviderprivateip));
|
||||
|
||||
//construct URL starts here
|
||||
var url = [];
|
||||
|
|
|
|||
Loading…
Reference in New Issue