Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss

This commit is contained in:
Likitha Shetty 2012-02-27 14:43:50 +05:30
commit 61ec79da44
75 changed files with 660 additions and 241 deletions

View File

@ -95,20 +95,22 @@ public class KVMGuestOsMapper {
s_mapper.put("Fedora 8", "Fedora 8");
s_mapper.put("Ubuntu 10.04 (32-bit)", "Ubuntu 10.04");
s_mapper.put("Ubuntu 10.04 (64-bit)", "Ubuntu 10.04");
s_mapper.put("Ubuntu 10.10 (32-bit)", "Ubuntu 10.10");
s_mapper.put("Ubuntu 10.10 (64-bit)", "Ubuntu 10.10");
s_mapper.put("Ubuntu 9.10 (32-bit)", "Ubuntu 9.10");
s_mapper.put("Ubuntu 9.10 (64-bit)", "Ubuntu 9.10");
s_mapper.put("Ubuntu 9.04 (32-bit)", "Ubuntu 9.04");
s_mapper.put("Ubuntu 9.04 (64-bit)", "Ubuntu 9.04");
s_mapper.put("Ubuntu 8.10 (32-bit)", "Ubuntu 8.10");
s_mapper.put("Ubuntu 8.10 (64-bit)", "Ubuntu 8.10");
s_mapper.put("Ubuntu 8.04 (32-bit)", "Ubuntu 8.04");
s_mapper.put("Ubuntu 8.04 (64-bit)", "Ubuntu 8.04");
s_mapper.put("Debian GNU/Linux 5.0 (32-bit)", "Debian GNU/Linux 5");
s_mapper.put("Debian GNU/Linux 5.0 (64-bit)", "Debian GNU/Linux 5");
s_mapper.put("Debian GNU/Linux 4.0 (32-bit)", "Debian GNU/Linux 4");
s_mapper.put("Debian GNU/Linux 4.0 (64-bit)", "Debian GNU/Linux 4");
s_mapper.put("Debian GNU/Linux 6.0 (64-bit)", "Debian GNU/Linux 6");
s_mapper.put("Debian GNU/Linux 6.0 (32-bit)", "Debian GNU/Linux 6");
s_mapper.put("Ubuntu 8.04 (32-bit)", "Other Linux");
s_mapper.put("Ubuntu 8.04 (64-bit)", "Other Linux");
s_mapper.put("Debian GNU/Linux 5(32-bit)", "Debian GNU/Linux 5");
s_mapper.put("Debian GNU/Linux 5(64-bit)", "Debian GNU/Linux 5");
s_mapper.put("Debian GNU/Linux 4(32-bit)", "Debian GNU/Linux 4");
s_mapper.put("Debian GNU/Linux 4(64-bit)", "Debian GNU/Linux 4");
s_mapper.put("Debian GNU/Linux 6(64-bit)", "Debian GNU/Linux 6");
s_mapper.put("Debian GNU/Linux 6(32-bit)", "Debian GNU/Linux 6");
s_mapper.put("Other 2.6x Linux (32-bit)", "Other 2.6x Linux");
s_mapper.put("Other 2.6x Linux (64-bit)", "Other 2.6x Linux");
s_mapper.put("Other Linux (32-bit)", "Other Linux");

View File

@ -3614,9 +3614,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements
return false;
}
String guestOSName = KVMGuestOsMapper.getGuestOsName(guestOS);
if (guestOSName.startsWith("Ubuntu 10.04")
|| guestOSName.startsWith("Ubuntu 9")
|| guestOSName.startsWith("Ubuntu 8.10")
if (guestOS.startsWith("Ubuntu")
|| guestOSName.startsWith("Fedora 13")
|| guestOSName.startsWith("Fedora 12")
|| guestOSName.startsWith("Fedora 11")
@ -3625,11 +3623,13 @@ public class LibvirtComputingResource extends ServerResourceBase implements
|| guestOSName.startsWith("CentOS 5.3")
|| guestOSName.startsWith("CentOS 5.4")
|| guestOSName.startsWith("CentOS 5.5")
|| guestOS.startsWith("CentOS")
|| guestOS.startsWith("Fedora")
|| guestOSName.startsWith("Red Hat Enterprise Linux 5.3")
|| guestOSName.startsWith("Red Hat Enterprise Linux 5.4")
|| guestOSName.startsWith("Red Hat Enterprise Linux 5.5")
|| guestOSName.startsWith("Red Hat Enterprise Linux 6")
|| guestOSName.startsWith("Debian GNU/Linux")
|| guestOS.startsWith("Debian GNU/Linux")
|| guestOSName.startsWith("Other PV")) {
return true;
} else {

View File

@ -34,6 +34,10 @@ public class NetworkUsageAnswer extends Answer {
this.bytesSent = bytesSent;
routerName = cmd.getDomRName();
}
public NetworkUsageAnswer(Command command, Exception e) {
super(command, e);
}
public void setBytesReceived(Long bytesReceived) {

View File

@ -331,6 +331,7 @@ public class ApiConstants {
public static final String SORT_BY = "sortby";
public static final String CHANGE_CIDR = "changecidr";
public static final String PURPOSE = "purpose";
public static final String IS_TAGGED = "istagged";
public enum HostDetails {
all, capacity, events, stats, min;

View File

@ -28,7 +28,6 @@ import com.cloud.api.BaseListCmd;
import com.cloud.api.IdentityMapper;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.NetworkOfferingResponse;
import com.cloud.offering.NetworkOffering;
@ -88,7 +87,10 @@ public class ListNetworkOfferingsCmd extends BaseListCmd {
private Boolean specifyIpRanges;
@Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="list network offerings by tags", length=4096)
private String tags;
private String tags;
@Parameter(name=ApiConstants.IS_TAGGED, type=CommandType.BOOLEAN, description="true if offering has tags specified")
private Boolean isTagged;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -154,6 +156,10 @@ public class ListNetworkOfferingsCmd extends BaseListCmd {
return tags;
}
public Boolean isTagged() {
return isTagged;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -49,7 +49,7 @@ public class ListNetworksCmd extends BaseListProjectAndAccountResourcesCmd {
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone ID of the network")
private Long zoneId;
@Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of the network")
@Parameter(name=ApiConstants.TYPE, type=CommandType.STRING, description="the type of the network. Supported values are: Isolated and Shared")
private String guestIpType;
@Parameter(name=ApiConstants.IS_SYSTEM, type=CommandType.BOOLEAN, description="true if network is system, false otherwise")

View File

@ -85,7 +85,8 @@ public class ListVMsCmd extends BaseListProjectAndAccountResourcesCmd {
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, description="the storage ID where vm's volumes belong to")
private Long storageId;
@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]" )
@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]. If no parameter is passed in, the details will be defaulted to all" )
private List<String> viewDetails;

View File

@ -40,7 +40,7 @@ import com.cloud.user.UserContext;
import com.cloud.uservm.UserVm;
import com.cloud.vm.VirtualMachine;
@Implementation(description="Attempts Migration of a user virtual machine to the host specified.", responseObject=UserVmResponse.class)
@Implementation(description="Attempts Migration of a VM to a different host or Root volume of the vm to a different storage pool", responseObject=UserVmResponse.class)
public class MigrateVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(MigrateVMCmd.class.getName());
@ -51,7 +51,7 @@ public class MigrateVMCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
@IdentityMapper(entityTableName="host")
@Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, required=false, description="destination Host ID to migrate VM to")
@Parameter(name=ApiConstants.HOST_ID, type=CommandType.LONG, required=false, description="Destination Host ID to migrate VM to. Required for live migrating a VM from host to host")
private Long hostId;
@IdentityMapper(entityTableName="vm_instance")
@ -59,7 +59,7 @@ public class MigrateVMCmd extends BaseAsyncCmd {
private Long virtualMachineId;
@IdentityMapper(entityTableName="storage_pool")
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, required=false, description="destination storage pool ID to migrate VM to")
@Parameter(name=ApiConstants.STORAGE_ID, type=CommandType.LONG, required=false, description="Destination storage pool ID to migrate VM volumes to. Required for migrating the root disk volume")
private Long storageId;
/////////////////////////////////////////////////////

View File

@ -18,6 +18,7 @@
package com.cloud.deploy;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.vm.ReservationContext;
public class DataCenterDeployment implements DeploymentPlan {
long _dcId;
@ -28,18 +29,24 @@ public class DataCenterDeployment implements DeploymentPlan {
Long _physicalNetworkId;
ExcludeList _avoids = null;
boolean _recreateDisks;
ReservationContext _context;
public DataCenterDeployment(long dataCenterId) {
this(dataCenterId, null, null, null, null, null);
}
public DataCenterDeployment(long dataCenterId, Long podId, Long clusterId, Long hostId, Long poolId, Long physicalNetworkId) {
this(dataCenterId, podId, clusterId, hostId, poolId, physicalNetworkId, null);
}
public DataCenterDeployment(long dataCenterId, Long podId, Long clusterId, Long hostId, Long poolId, Long physicalNetworkId, ReservationContext context) {
_dcId = dataCenterId;
_podId = podId;
_clusterId = clusterId;
_hostId = hostId;
_poolId = poolId;
_physicalNetworkId = physicalNetworkId;
_context = context;
}
@Override
@ -81,4 +88,10 @@ public class DataCenterDeployment implements DeploymentPlan {
public Long getPhysicalNetworkId() {
return _physicalNetworkId;
}
@Override
public ReservationContext getReservationContext() {
return _context;
}
}

View File

@ -18,6 +18,7 @@
package com.cloud.deploy;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.vm.ReservationContext;
/**
* Describes how a VM should be deployed.
@ -65,4 +66,6 @@ public interface DeploymentPlan {
public ExcludeList getAvoids();
Long getPhysicalNetworkId();
ReservationContext getReservationContext();
}

View File

@ -33,7 +33,7 @@ import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceInUseException;
import com.cloud.exception.ResourceUnavailableException;
public interface StorageService {
public interface StorageService{
/**
* Create StoragePool based on uri
*

1
build/license/eula.ja.html Executable file

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,12 @@
#new labels (begin) **********************************************************************************************
label.isolated.networks=Isolated networks
label.latest.events=Latest events
state.Enabled=Enabled
label.system.wide.capacity=System-wide capacity
label.network.service.providers=Network Service Providers
message.launch.zone=Zone is ready to launch; please proceed to the next step.
#new labels (end) ************************************************************************************************
label.add.compute.offering=Add compute offering
label.compute.offering=Compute offering
label.compute.offerings=Compute offerings
@ -19,7 +27,6 @@ label.sticky.domain=Domain
state.Allocating=Allocating
state.Migrating=Migrating
error.please.specify.physical.network.tags=Network offerings is not available until you specify tags for this physical network.
#new labels (end) ************************************************************************************************
state.Stopping=Stopping

View File

@ -1,21 +1,32 @@
#new labels (begin) **********************************************************************************************
label.sticky.tablesize=Table size
label.sticky.expire=Expires
label.sticky.cookie-name=Cookie name
label.sticky.mode=Mode
label.sticky.length=Length
label.sticky.holdtime=Hold time
label.sticky.request-learn=Request learn
label.sticky.prefix=Prefix
label.sticky.nocache=No cache
label.sticky.indirect=Indirect
label.sticky.postonly=Post only
label.sticky.domain=Domain
state.Allocating=Allocating
state.Migrating=Migrating
error.please.specify.physical.network.tags=Network offerings is not available until you specify tags for this physical network.
label.isolated.networks=Isolated networks
label.latest.events=Latest events
state.Enabled=Enabled
label.system.wide.capacity=System-wide capacity
label.network.service.providers=Network service providers
message.launch.zone=Zone is ready to launch; please proceed to the next step.
#new labels (end) ************************************************************************************************
label.add.compute.offering=コンピューティング オファリングの追加
label.compute.offering=コンピューティング オファリング
label.compute.offerings=コンピューティング オファリング
label.select.offering=オファリングの選択
label.menu.infrastructure=インフラストラクチャ
label.sticky.tablesize=テーブル サイズ
label.sticky.expire=失効
label.sticky.cookie-name=Cookie 名
label.sticky.mode=モード
label.sticky.length=長さ
label.sticky.holdtime=保持時間
label.sticky.request-learn=ラーニングの要求
label.sticky.prefix=プレフィックス
label.sticky.nocache=キャッシュなし
label.sticky.indirect=間接
label.sticky.postonly=ポストのみ
label.sticky.domain=ドメイン
state.Allocating=割り当て中
state.Migrating=移行中
error.please.specify.physical.network.tags=この物理ネットワークのタグを指定しなければ、ネットワーク オファリングは使用できません。
state.Stopping=停止しています
@ -201,7 +212,7 @@ message.disable.vpn=VPN を無効にしてもよろしいですか?
label.disable.vpn=VPN の無効化
message.enable.vpn=この IP アドレスに対する VPN アクセスを有効にしてもよろしいですか?
label.enable.vpn=VPN の有効化
message.acquire.new.ip=このネットワークのネット IP アドレスを取得してもよろしいですか?
message.acquire.new.ip=このネットワークの新しい IP アドレスを取得してもよろしいですか?
label.elastic=エラスティック
label.my.network=マイ ネットワーク
label.add.vms=VM の追加
@ -318,7 +329,7 @@ label.guest.type=ゲストの種類
label.specify.IP.ranges=IP アドレスの範囲の指定
label.conserve.mode=節約モード
label.created.by.system=システム作成
label.menu.system.service.offerings=システム サービス オファリング
label.menu.system.service.offerings=システム オファリング
label.add.system.service.offering=システム サービス オファリングの追加
label.redundant.router.capability=冗長ルーター機能
label.supported.source.NAT.type=サポートされる送信元 NAT の種類
@ -439,7 +450,7 @@ label.physical.network=物理ネットワーク
label.public.traffic=パブリック トラフィック
label.guest.traffic=ゲスト トラフィック
label.storage.traffic=ストレージ トラフィック
message.setup.physical.network.during.zone.creation=拡張ゾーンを追加するときは、1 つ以上の物理ネットワークをセットアップする必要があります。各ネットワークは管理サーバー上の 1 つの NIC に対応します。各物理ネットワークでは、組み合わせに制限がありますが、1 つ以上の種類のトラフィックを通信できます。<br/><br/>各物理ネットワークに対して<strong>トラフィックの種類をドラッグアンドドロップ</strong>してください。
message.setup.physical.network.during.zone.creation=拡張ゾーンを追加するときは、1 つ以上の物理ネットワークをセットアップする必要があります。各ネットワークはハイパーバイザー上の 1 つの NIC に対応します。各物理ネットワークでは、組み合わせに制限がありますが、1 つ以上の種類のトラフィックを通信できます。<br/><br/>各物理ネットワークに対して<strong>トラフィックの種類をドラッグ アンド ドロップ</strong>してください。
label.add.physical.network=物理ネットワークの追加
label.traffic.types=トラフィックの種類
label.management=管理
@ -1255,7 +1266,7 @@ message.add.pod=ゾーン <b><span id="add_pod_zone_name"></span></b> に新し
message.add.primary.storage=ゾーン <b><span id="zone_name"></span></b> のポッド <b><span id="pod_name"></span></b> に新しいプライマリ ストレージを追加します
message.add.primary=新しいプライマリ ストレージを追加するために、次のパラメーターを指定してください。
message.add.secondary.storage=ゾーン <b><span id="zone_name"></span></b> に新しいストレージを追加します
message.add.service.offering=新しいサービス オファリングを追加するために、次のデータを入力してください。
message.add.service.offering=新しいコンピューティング オファリングを追加するために、次のデータを入力してください。
message.add.template=新しいテンプレートを作成するために、次のデータを入力してください。
message.add.volume=新しいボリュームを追加するために、次のデータを入力してください。
message.additional.networks.desc=仮想インスタンスが接続する追加のネットワークを選択してください。

View File

@ -248,7 +248,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
protected String _name;
protected String _username;
protected Queue<String> _password=new LinkedList<String>();
protected final int _retry = 24;
protected final int _retry = 100;
protected final int _sleep = 10000;
protected long _dcId;
protected String _pod;

View File

@ -169,15 +169,20 @@ public class XenServer56Resource extends CitrixResourceBase {
}
protected NetworkUsageAnswer execute(NetworkUsageCommand cmd) {
Connection conn = getConnection();
if(cmd.getOption()!=null && cmd.getOption().equals("create") ){
String result = networkUsage(conn, cmd.getPrivateIP(), "create", null);
NetworkUsageAnswer answer = new NetworkUsageAnswer(cmd, result, 0L, 0L);
try {
Connection conn = getConnection();
if(cmd.getOption()!=null && cmd.getOption().equals("create") ){
String result = networkUsage(conn, cmd.getPrivateIP(), "create", null);
NetworkUsageAnswer answer = new NetworkUsageAnswer(cmd, result, 0L, 0L);
return answer;
}
long[] stats = getNetworkStats(conn, cmd.getPrivateIP());
NetworkUsageAnswer answer = new NetworkUsageAnswer(cmd, "", stats[0], stats[1]);
return answer;
} catch (Exception ex) {
s_logger.warn("Failed to get network usage stats due to ", ex);
return new NetworkUsageAnswer(cmd, ex);
}
long[] stats = getNetworkStats(conn, cmd.getPrivateIP());
NetworkUsageAnswer answer = new NetworkUsageAnswer(cmd, "", stats[0], stats[1]);
return answer;
}
@Override

View File

@ -667,11 +667,9 @@ public class XenServerConnectionPool {
}
PoolEmergencyResetMaster(ipAddress, mConn.getIp(), mConn.getUsername(), mConn.getPassword());
} catch (Exception e) {
String msg = "Master can not talk to Slave " + hostUuid + " IP " + ipAddress;
if (s_logger.isDebugEnabled()) {
s_logger.debug(msg);
}
throw new CloudRuntimeException(msg);
String msg = "Echo test failed on host " + hostUuid + " IP " + ipAddress;
s_logger.warn(msg, e);
throw new CloudRuntimeException(msg, e);
}
}
}

View File

@ -64,7 +64,7 @@ public class VmdkProcessor implements Processor {
File templateFile = new File(templateFileFullPath);
Script command = new Script("tar", 0, s_logger);
command.add("--no-same-owner", templateFileFullPath);
command.add("--no-same-owner");
command.add("-xf", templateFileFullPath);
command.setWorkDir(templateFile.getParent());
String result = command.execute();

View File

@ -15,6 +15,10 @@
/etc/cloud/management/web.xml
/etc/cloud/management/server-nonssl.xml
/etc/cloud/management/tomcat6-nonssl.conf
/etc/cloud/management/virtualrouter_commands.properties
/etc/cloud/management/f5bigip_commands.properties
/etc/cloud/management/junipersrx_commands.properties
/etc/cloud/management/netscalerloadbalancer_commands.properties
/etc/cloud/management/Catalina
/etc/cloud/management/Catalina/localhost
/etc/cloud/management/Catalina/localhost/client

View File

@ -75,6 +75,10 @@
<li>+ <a href="http://download.cloud.com/releases/2.2.0/CloudStack2.2.14InstallGuide.pdf">Install Guide</a></li>
<li>+ <a href="http://download.cloud.com/releases/2.2.0/CloudStack2.2.14AdminGuide.pdf">Administration Guide</a></li>
<li>+ <a href="http://download.cloud.com/releases/2.2.0/CloudStack2.2UserInterfaceCustomization.pdf">UI Customization Guide</a></li>
<li>+ <a href="http://download.cloud.com/releases/2.2.0/api_2.2.14/TOC_User.html">API documentation -- User role</a></li>
<li>+ <a href="http://download.cloud.com/releases/2.2.0/api_2.2.14/TOC_Domain_Admin.html">API documentation -- Domain Admin role</a></li>
<li>+ <a href="http://download.cloud.com/releases/2.2.0/api_2.2.14/TOC_Root_Admin.html">API documentation -- Root Admin role</a></li>
</ul>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 935 B

BIN
docs/images/EditButton.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1012 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

View File

@ -114,7 +114,7 @@ convert_primary_to_32() {
fi
if [ "$mask" != "32" ]
then
sudo ip addr add dev $ethDev $ipNoMask/32
ip_addr_add $ethDev $ipNoMask/32
fi
done
#delete primaries
@ -170,6 +170,13 @@ copy_routes_from_main() {
return 0;
}
ip_addr_add() {
local dev="$1"
local ip="$2"
local brd=`TERM=linux ipcalc $ip|grep Broadcast|awk -F' ' '{print $2}'`
sudo ip addr add dev $dev $ip broadcast $brd
}
add_routing() {
local pubIp=$1
logger -t cloud "$(basename $0):Add routing $pubIp on interface $ethDev"
@ -237,7 +244,7 @@ add_first_ip() {
local old_state=$?
convert_primary_to_32 $pubIp
sudo ip addr add dev $ethDev $pubIp
ip_addr_add $ethDev $pubIp
if [ "$mask" != "32" ] && [ "$mask" != "" ]
then
# remove if duplicat ip with 32 mask, this happens when we are promting the ip to primary
@ -301,7 +308,7 @@ add_an_ip () {
sudo ip link show $ethDev | grep "state DOWN" > /dev/null
local old_state=$?
sudo ip addr add dev $ethDev $pubIp ;
ip_addr_add $ethDev $pubIp
add_snat $1
if [ $if_keep_state -ne 1 -o $old_state -ne 0 ]
then
@ -335,7 +342,7 @@ remove_an_ip () {
if [ -n "$replaceIpMask" ]; then
sudo ip addr del dev $ethDev $replaceIpMask;
replaceIp=`echo $replaceIpMask | awk -F/ '{print $1}'`;
sudo ip addr add dev $ethDev $replaceIp/$existingMask;
ip_addr_add $ethDev $replaceIp/$existingMask
fi
result=$?
fi

Binary file not shown.

View File

@ -40,7 +40,7 @@ launch_hb.sh=..,0755,/opt/xensource/bin
vhd-util=..,0755,/opt/xensource/bin
vmopspremium=..,0755,/etc/xapi.d/plugins
InterfaceReconfigure.py=.,0755,/opt/xensource/libexec
fsimage.so=..,0755,/usr/lib/fs/ext2fs-lib
fsimage.so=.,0755,/usr/lib/fs/ext2fs-lib
create_privatetemplate_from_snapshot.sh=..,0755,/opt/xensource/bin
upgrade_snapshot.sh=..,0755,/opt/xensource/bin
cloud-clean-vlan.sh=..,0755,/opt/xensource/bin

View File

@ -50,3 +50,4 @@ bumpUpPriority.sh=../../../../network/domr/,0755,/opt/xensource/bin
getDomRVersion.sh=../../../../network/domr/,0755,/opt/xensource/bin
swift=..,0755,/opt/xensource/bin
swiftxen=..,0755,/etc/xapi.d/plugins
qemu-dm-wrapper=.,0755,/opt/xensource/libexec

View File

@ -0,0 +1,111 @@
#!/usr/bin/python
#
# Copyright (c) Citrix Systems 2007-2011
# Author: Gianni Tedesco and Dave Scott
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; version 2.1 only. with the special
# exception on linking described in file LICENSE.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
from xen.lowlevel import xs
def do_cloexec(fd):
from fcntl import fcntl, F_GETFD, F_SETFD, FD_CLOEXEC
ret = fcntl(fd, F_GETFD, FD_CLOEXEC)
if ret < 0:
return
fcntl(fd, F_SETFD, ret|FD_CLOEXEC)
def write_dm_pid(domid, pid):
store = xs.xs()
store.write('', '/local/domain/%d/qemu-pid'%domid, '%d'%pid)
def is_sdk():
try:
store = xs.xs(socket=True)
domid_as_dom0 = int(store.read('', 'domid'))
store.close()
assert domid_as_dom0 == 0
store = xs.xs(xenbus=True)
domid_on_host = int(store.read('', 'domid'))
store.close()
return domid_on_host != domid_as_dom0
except:
return False
def fake_dm(domid):
from time import sleep
from os import getpid
store = xs.xs()
store.write('', '/local/domain/%d/qemu-pid'%domid, '%d'%getpid())
store.write('', '/local/domain/%d/device-misc/dm-ready'%domid, '1')
store.write('', '/local/domain/%d/console/vnc-port'%domid, '%d'%(domid))
while True:
sleep(600)
return 0
def cleanup(domid):
from xen.lowlevel import xc
hcall = xc.xc()
print 'Unexpected termination, cleaning up...'
try:
hcall.domain_destroy(domid)
except xc.Error:
# we could have raced with another domain shutdown
pass
def enable_core_dumps():
from resource import getrlimit, RLIMIT_CORE, setrlimit
limit = 64 * 1024 * 1024
oldlimits = getrlimit(RLIMIT_CORE)
setrlimit(RLIMIT_CORE, (limit, oldlimits[1]))
return limit
def main(argv):
import os
qemu_env = os.environ
qemu_dm = '/usr/lib/xen/bin/qemu-dm'
domid = int(argv[1])
qemu_args = ['qemu-dm-%d'%domid] + argv[2:]
try:
vnc_idx = qemu_args.index("-vnc")
del qemu_args[vnc_idx: vnc_idx+2]
qemu_args.insert(vnc_idx, "0.0.0.0:1")
qemu_args.insert(vnc_idx, "-vnc")
except ValueError, IndexError:
pass
if is_sdk() is True:
return fake_dm(domid)
print "qemu-dm-wrapper in python:"
print "Using domid: %d" % domid
print "Arguments: %s" % " ".join(argv[1:])
print "everything else is from qemu-dm:"
core_dump_limit = enable_core_dumps()
print "core dump limit: %d" % core_dump_limit
write_dm_pid(domid, os.getpid())
os.dup2(1, 2)
os.execve(qemu_dm, qemu_args, qemu_env)
if __name__ == '__main__':
from sys import argv
raise SystemExit, main(argv)

View File

@ -394,7 +394,7 @@ public class ApiXmlDocWriter {
apiCommand.setRequest(request);
// Generate response
response.add(new Argument("success", "success if the logout action succeeded"));
response.add(new Argument("description", "success if the logout action succeeded"));
apiCommand.setResponse(response);
out.writeObject(apiCommand);

View File

@ -3101,6 +3101,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
// populate providers
Map<Provider, Set<Service>> providerCombinationToVerify = new HashMap<Provider, Set<Service>>();
Map<String, List<String>> svcPrv = cmd.getServiceProviders();
boolean isSrx = false;
if (svcPrv != null) {
for (String serviceStr : svcPrv.keySet()) {
Network.Service service = Network.Service.getService(serviceStr);
@ -3117,11 +3118,10 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
throw new InvalidParameterValueException("Invalid service provider: " + prvNameStr);
}
// Only VirtualRouter can be specified as a firewall provider
if (service == Service.Firewall && provider != Provider.VirtualRouter) {
throw new InvalidParameterValueException("Only Virtual router can be specified as a provider for the Firewall service");
if (provider == Provider.JuniperSRX) {
isSrx = true;
}
providers.add(provider);
Set<Service> serviceSet = null;
@ -3169,6 +3169,14 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
serviceCapabilityMap.put(Service.Lb, lbServiceCapabilityMap);
serviceCapabilityMap.put(Service.SourceNat, sourceNatServiceCapabilityMap);
serviceCapabilityMap.put(Service.StaticNat, staticNatServiceCapabilityMap);
//if Firewall service is missing, and Juniper is a provider for any other service, add Firewall service/provider combination
if (isSrx) {
s_logger.debug("Adding Firewall service with provider " + Provider.JuniperSRX.getName());
Set<Provider> firewallProvider = new HashSet<Provider>();
firewallProvider.add(Provider.JuniperSRX);
serviceProviderMap.put(Service.Firewall, firewallProvider);
}
return createNetworkOffering(userId, name, displayText, trafficType, tags, specifyVlan, availability, networkRate, serviceProviderMap, false, guestType,
false, serviceOfferingId, conserveMode, serviceCapabilityMap, specifyIpRanges);
@ -3392,6 +3400,7 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
List<String> supportedServicesStr = cmd.getSupportedServices();
Object specifyIpRanges = cmd.getSpecifyIpRanges();
String tags = cmd.getTags();
Boolean isTagged = cmd.isTagged();
if (zoneId != null) {
zone = getZone(zoneId);
@ -3486,15 +3495,35 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
}
if (tags != null) {
if (tags.isEmpty()) {
sc.addAnd("tags", SearchCriteria.Op.NULL);
sc.addAnd("tags", SearchCriteria.Op.EQ, tags);
}
if (isTagged != null) {
if (isTagged) {
sc.addAnd("tags", SearchCriteria.Op.NNULL);
} else {
sc.addAnd("tags", SearchCriteria.Op.EQ, tags);
sc.addAnd("tags", SearchCriteria.Op.NULL);
}
}
List<NetworkOfferingVO> offerings = _networkOfferingDao.search(sc, searchFilter);
Boolean sourceNatSupported = cmd.getSourceNatSupported();
List<String> pNtwkTags = new ArrayList<String>();
boolean checkForTags = false;
if (zone != null) {
List<PhysicalNetworkVO> pNtwks = _physicalNetworkDao.listByZoneAndTrafficType(zoneId, TrafficType.Guest);
if (pNtwks.size() > 1) {
checkForTags = true;
//go through tags
for (PhysicalNetworkVO pNtwk : pNtwks) {
List<String> pNtwkTag = pNtwk.getTags();
if (pNtwkTag == null || pNtwkTag.isEmpty()) {
throw new CloudRuntimeException("Tags are not defined for physical network in the zone id=" + zoneId);
}
pNtwkTags.addAll(pNtwkTag);
}
}
}
// filter by supported services
boolean listBySupportedServices = (supportedServicesStr != null && !supportedServicesStr.isEmpty() && !offerings.isEmpty());
@ -3522,7 +3551,13 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
for (NetworkOfferingVO offering : offerings) {
boolean addOffering = true;
List<Service> checkForProviders = new ArrayList<Service>();
if (checkForTags) {
if (!pNtwkTags.contains(offering.getTags())) {
continue;
}
}
if (listBySupportedServices) {
addOffering = addOffering && _networkMgr.areServicesSupportedByNetworkOffering(offering.getId(), supportedServices);
}
@ -3540,10 +3575,14 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
if (sourceNatSupported != null) {
addOffering = addOffering && (_networkMgr.areServicesSupportedByNetworkOffering(offering.getId(), Network.Service.SourceNat) == sourceNatSupported);
}
if (addOffering) {
supportedOfferings.add(offering);
}
}
return supportedOfferings;

View File

@ -69,11 +69,13 @@ import com.cloud.storage.dao.GuestOSDao;
import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.storage.dao.StoragePoolHostDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.user.AccountManager;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
import com.cloud.utils.component.Adapters;
import com.cloud.utils.component.Inject;
import com.cloud.vm.DiskProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.dao.UserVmDao;
@ -97,6 +99,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
@Inject protected ConfigurationDao _configDao;
@Inject protected StoragePoolDao _storagePoolDao;
@Inject protected CapacityDao _capacityDao;
@Inject protected AccountManager _accountMgr;
@Inject(adapter=StoragePoolAllocator.class)
protected Adapters<StoragePoolAllocator> _storagePoolAllocators;
@ -152,7 +155,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
}
//search for storage under the zone, pod, cluster of the host.
DataCenterDeployment lastPlan = new DataCenterDeployment(host.getDataCenterId(), host.getPodId(), host.getClusterId(), hostIdSpecified, plan.getPoolId(), null);
DataCenterDeployment lastPlan = new DataCenterDeployment(host.getDataCenterId(), host.getPodId(), host.getClusterId(), hostIdSpecified, plan.getPoolId(), null, plan.getReservationContext());
Pair<Map<Volume, List<StoragePool>>, List<Volume>> result = findSuitablePoolsForVolumes(vmProfile, lastPlan, avoid, HostAllocator.RETURN_UPTO_ALL);
Map<Volume, List<StoragePool>> suitableVolumeStoragePools = result.first();
@ -507,7 +510,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
s_logger.debug("Checking resources in Cluster: "+clusterId + " under Pod: "+clusterVO.getPodId());
//search for resources(hosts and storage) under this zone, pod, cluster.
DataCenterDeployment potentialPlan = new DataCenterDeployment(plan.getDataCenterId(), clusterVO.getPodId(), clusterVO.getId(), null, plan.getPoolId(), null);
DataCenterDeployment potentialPlan = new DataCenterDeployment(plan.getDataCenterId(), clusterVO.getPodId(), clusterVO.getId(), null, plan.getPoolId(), null, plan.getReservationContext());
//find suitable hosts under this cluster, need as many hosts as we get.
List<Host> suitableHosts = findSuitableHosts(vmProfile, potentialPlan, avoid, HostAllocator.RETURN_UPTO_ALL);
@ -731,16 +734,18 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
if(s_logger.isDebugEnabled()){
s_logger.debug("We need to allocate new storagepool for this volume");
}
if(!isEnabledForAllocation(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId())){
if(s_logger.isDebugEnabled()){
s_logger.debug("Cannot allocate new storagepool for this volume in this cluster, allocation state is disabled");
s_logger.debug("Cannot deploy to this specified plan, allocation state is disabled, returning.");
if(!isRootAdmin(plan.getReservationContext())){
if(!isEnabledForAllocation(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId())){
if(s_logger.isDebugEnabled()){
s_logger.debug("Cannot allocate new storagepool for this volume in this cluster, allocation state is disabled");
s_logger.debug("Cannot deploy to this specified plan, allocation state is disabled, returning.");
}
//Cannot find suitable storage pools under this cluster for this volume since allocation_state is disabled.
//- remove any suitable pools found for other volumes.
//All volumes should get suitable pools under this cluster; else we cant use this cluster.
suitableVolumeStoragePools.clear();
break;
}
//Cannot find suitable storage pools under this cluster for this volume since allocation_state is disabled.
//- remove any suitable pools found for other volumes.
//All volumes should get suitable pools under this cluster; else we cant use this cluster.
suitableVolumeStoragePools.clear();
break;
}
s_logger.debug("Calling StoragePoolAllocators to find suitable pools");
@ -798,6 +803,17 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
}
private boolean isRootAdmin(ReservationContext reservationContext) {
if(reservationContext != null){
if(reservationContext.getAccount() != null){
return _accountMgr.isRootAdmin(reservationContext.getAccount().getType());
}else{
return false;
}
}
return false;
}
@Override
public boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan,
DeployDestination dest, ExcludeList exclude) {

View File

@ -2924,7 +2924,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
List<UserVmVO> userVms = _userVmDao.listByNetworkIdAndStates(networkId);
for (UserVmVO vm : userVms) {
if (!(vm.getState() == VirtualMachine.State.Error || (vm.getState() == VirtualMachine.State.Expunging && vm.getRemoved() != null))) {
if (!(vm.getState() == VirtualMachine.State.Expunging && vm.getRemoved() != null)) {
s_logger.warn("Can't delete the network, not all user vms are expunged. Vm " + vm + " is in " + vm.getState() + " state");
return false;
}
@ -5977,20 +5977,22 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
throw new InvalidParameterValueException("Unable to find the Network Element implementing the Service Provider '" + provider.getName() + "'");
}
Set<Service> enabledServices = providersMap.get(provider);
Set<Service> enabledServices = new HashSet<Service>();
enabledServices.addAll(providersMap.get(provider));
if (enabledServices != null && !enabledServices.isEmpty()) {
if (!element.canEnableIndividualServices()) {
Set<Network.Service> requiredServices = element.getCapabilities().keySet();
Set<Service> requiredServices = new HashSet<Service>();
requiredServices.addAll(element.getCapabilities().keySet());
if (requiredServices.contains(Network.Service.Gateway)) {
requiredServices.remove(Network.Service.Gateway);
}
// Remove firewall from the list of services-to-compare
if (requiredServices.contains(Network.Service.Firewall)) {
requiredServices.remove(Network.Service.Firewall);
}
if (enabledServices.contains(Network.Service.Firewall)) {
enabledServices.remove(Network.Service.Firewall);
}

View File

@ -26,9 +26,11 @@ import com.cloud.network.PhysicalNetworkVO;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.GenericSearchBuilder;
import com.cloud.utils.db.JoinBuilder;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
import com.cloud.utils.db.SearchCriteria.Func;
import com.cloud.utils.db.SearchCriteria.Op;
@Local(value=PhysicalNetworkDao.class) @DB(txn=false)
@ -42,7 +44,6 @@ public class PhysicalNetworkDaoImpl extends GenericDaoBase<PhysicalNetworkVO, Lo
ZoneSearch = createSearchBuilder();
ZoneSearch.and("dataCenterId", ZoneSearch.entity().getDataCenterId(), Op.EQ);
ZoneSearch.done();
}
@Override

View File

@ -806,7 +806,12 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
s_logger.warn("Error while collecting network stats from router: "+router.getInstanceName()+" from host: "+router.getHostId(), e);
continue;
}
if (answer != null) {
if (!answer.getResult()) {
s_logger.warn("Error while collecting network stats from router: "+router.getInstanceName()+" from host: "+router.getHostId() + "; details: " + answer.getDetails());
continue;
}
Transaction txn = Transaction.open(Transaction.CLOUD_DB);
try {
if ((answer.getBytesReceived() == 0) && (answer.getBytesSent() == 0)) {
@ -1772,7 +1777,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
// Update router template/scripts version
final GetDomRVersionCmd command = new GetDomRVersionCmd();
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, router.getPrivateIpAddress());
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, controlNic.getIp4Address());
command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
cmds.addCommand("getDomRVersion", command);

View File

@ -633,7 +633,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
List<PortForwardingRuleVO> rules = _portForwardingDao.listForApplication(ipId);
if (rules.size() == 0) {
s_logger.debug("There are no firwall rules to apply for ip id=" + ipId);
s_logger.debug("There are no port forwarding rules to apply for ip id=" + ipId);
return true;
}
@ -646,7 +646,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
return false;
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Failed to apply firewall rules due to ", ex);
s_logger.warn("Failed to apply port forwarding rules for ip due to ", ex);
return false;
}
@ -659,7 +659,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
List<StaticNatRule> staticNatRules = new ArrayList<StaticNatRule>();
if (rules.size() == 0) {
s_logger.debug("There are no firwall rules to apply for ip id=" + sourceIpId);
s_logger.debug("There are no static nat rules to apply for ip id=" + sourceIpId);
return true;
}
@ -676,7 +676,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
return false;
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Failed to apply static nat rules due to ", ex);
s_logger.warn("Failed to apply static nat rules for ip due to ", ex);
return false;
}
@ -700,7 +700,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
return false;
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Failed to apply firewall rules due to ", ex);
s_logger.warn("Failed to apply port forwarding rules for network due to ", ex);
return false;
}
@ -730,7 +730,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
return false;
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Failed to apply firewall rules due to ", ex);
s_logger.warn("Failed to apply static nat rules for network due to ", ex);
return false;
}
@ -762,7 +762,7 @@ public class RulesManagerImpl implements RulesManager, RulesService, Manager {
return false;
}
} catch (ResourceUnavailableException ex) {
s_logger.warn("Failed to create static nat rule due to ", ex);
s_logger.warn("Failed to create static nat for network due to ", ex);
return false;
}

View File

@ -583,7 +583,10 @@ public class ConfigurationServerImpl implements ConfigurationServer {
return;
}
String already = _configDao.getValue("ssh.privatekey");
String homeDir = Script.runSimpleBashScript("echo ~");
String homeDir = Script.runSimpleBashScript("echo ~cloud");
if (homeDir == null) {
throw new CloudRuntimeException("Cannot get home directory for account: cloud");
}
if (s_logger.isInfoEnabled()) {
s_logger.info("Processing updateKeyPairs");
}

View File

@ -44,7 +44,7 @@ import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface StorageManager extends Manager {
public interface StorageManager extends StorageService, Manager {
boolean canVmRestartOnAnotherServer(long vmId);
/** Returns the absolute path of the specified ISO

View File

@ -198,7 +198,7 @@ import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDao;
@Local(value = { StorageManager.class, StorageService.class })
public class StorageManagerImpl implements StorageManager, StorageService, Manager, ClusterManagerListener {
public class StorageManagerImpl implements StorageManager, Manager, ClusterManagerListener {
private static final Logger s_logger = Logger.getLogger(StorageManagerImpl.class);
protected String _name;

View File

@ -181,6 +181,8 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
private ResourceManager _resourceMgr;
@Inject
private DomainManager _domainMgr;
@Inject
private VolumeDao _volumeDao;
String _name;
private int _totalRetries;
private int _pauseInterval;
@ -282,7 +284,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
String preSnapshotPath = null;
SnapshotVO preSnapshotVO = null;
if (preId != 0) {
if (preId != 0 && !(volume.getLastPoolId() != null && !volume.getLastPoolId().equals(volume.getPoolId()))) {
preSnapshotVO = _snapshotDao.findByIdIncludingRemoved(preId);
if (preSnapshotVO != null && preSnapshotVO.getBackupSnapshotId() != null) {
preSnapshotPath = preSnapshotVO.getPath();
@ -337,6 +339,7 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
if (volume.getLastPoolId() != null && !volume.getLastPoolId().equals(volume.getPoolId())) {
preSnapshotId = 0;
volume.setLastPoolId(volume.getPoolId());
_volumeDao.update(volume.getId(), volume);
}
snapshot = updateDBOnCreate(snapshotId, answer.getSnapshotPath(), preSnapshotId);
}
@ -700,11 +703,9 @@ public class SnapshotManagerImpl implements SnapshotManager, SnapshotService, Ma
@DB
public void postCreateSnapshot(Long volumeId, Long snapshotId, Long policyId, boolean backedUp) {
Long userId = getSnapshotUserId();
SnapshotVO snapshot = _snapshotDao.findByIdIncludingRemoved(snapshotId);
// Even if the current snapshot failed, we should schedule the next
// recurring snapshot for this policy.
SnapshotVO snapshot = _snapshotDao.findById(snapshotId);
if (snapshot.isRecursive()) {
if (snapshot != null && snapshot.isRecursive()) {
postCreateRecurringSnapshotForPolicy(userId, volumeId, snapshotId, policyId);
}
}

View File

@ -531,7 +531,7 @@ public class AccountManagerImpl implements AccountManager, AccountService, Manag
for (VolumeVO volume : volumes) {
if (!volume.getState().equals(Volume.State.Destroy)) {
try {
_storageMgr.destroyVolume(volume);
_storageMgr.deleteVolume(volume.getId());
} catch (Exception ex) {
s_logger.warn("Failed to cleanup volumes as a part of account id=" + accountId + " cleanup due to Exception: ", ex);
accountCleanupNeeded = true;

View File

@ -102,7 +102,6 @@ import com.cloud.event.UsageEventVO;
import com.cloud.event.dao.EventDao;
import com.cloud.event.dao.UsageEventDao;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ManagementServerException;
@ -137,14 +136,12 @@ import com.cloud.network.element.UserDataServiceProvider;
import com.cloud.network.lb.LoadBalancingRulesManager;
import com.cloud.network.router.VirtualNetworkApplianceManager;
import com.cloud.network.rules.FirewallManager;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.FirewallRuleVO;
import com.cloud.network.rules.PortForwardingRuleVO;
import com.cloud.network.rules.RulesManager;
import com.cloud.network.rules.dao.PortForwardingRulesDao;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityGroupManager;
import com.cloud.network.security.SecurityGroupVMMapVO;
import com.cloud.network.security.dao.SecurityGroupDao;
import com.cloud.network.security.dao.SecurityGroupVMMapDao;
import com.cloud.offering.NetworkOffering;
@ -2664,7 +2661,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
@Override
public boolean finalizeStart(VirtualMachineProfile<UserVmVO> profile, long hostId, Commands cmds, ReservationContext context) throws InsufficientAddressCapacityException{
public boolean finalizeStart(VirtualMachineProfile<UserVmVO> profile, long hostId, Commands cmds, ReservationContext context){
UserVmVO vm = profile.getVirtualMachine();
Answer[] answersToCmds = cmds.getAnswers();
@ -2728,7 +2725,12 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
}
//get system ip and create static nat rule for the vm
_rulesMgr.getSystemIpAndEnableStaticNatForVm(profile.getVirtualMachine(), false);
try {
_rulesMgr.getSystemIpAndEnableStaticNatForVm(profile.getVirtualMachine(), false);
} catch (Exception ex) {
s_logger.warn("Failed to get system ip and enable static nat for the vm " + profile.getVirtualMachine() + " due to exception ", ex);
return false;
}
return true;
}

View File

@ -20,7 +20,6 @@ package com.cloud.vm;
import com.cloud.agent.api.StopAnswer;
import com.cloud.agent.manager.Commands;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.ResourceUnavailableException;
/**
@ -56,9 +55,8 @@ public interface VirtualMachineGuru<T extends VirtualMachine> {
* @param profile virtual machine profile.
* @param dest destination it was sent to.
* @return true if deployment was fine; false if it didn't go well.
* @throws InsufficientAddressCapacityException
*/
boolean finalizeStart(VirtualMachineProfile<T> profile, long hostId, Commands cmds, ReservationContext context) throws InsufficientAddressCapacityException;
boolean finalizeStart(VirtualMachineProfile<T> profile, long hostId, Commands cmds, ReservationContext context);
boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile<T> profile);

View File

@ -619,13 +619,13 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
if (s_logger.isDebugEnabled()) {
s_logger.debug("Trying to deploy VM, vm has dcId: " + vm.getDataCenterIdToDeployIn() + " and podId: " + vm.getPodIdToDeployIn());
}
DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterIdToDeployIn(), vm.getPodIdToDeployIn(), null, null, null, null);
DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterIdToDeployIn(), vm.getPodIdToDeployIn(), null, null, null, null, ctx);
if(planToDeploy != null && planToDeploy.getDataCenterId() != 0){
if (s_logger.isDebugEnabled()) {
s_logger.debug("advanceStart: DeploymentPlan is provided, using dcId:" + planToDeploy.getDataCenterId() + ", podId: " + planToDeploy.getPodId() + ", clusterId: "
+ planToDeploy.getClusterId() + ", hostId: " + planToDeploy.getHostId() + ", poolId: " + planToDeploy.getPoolId());
}
plan = (DataCenterDeployment) planToDeploy;
plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), planToDeploy.getPoolId(), planToDeploy.getPhysicalNetworkId(), ctx);
}
HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vm.getHypervisorType());
@ -690,9 +690,9 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
+ vm, Cluster.class, clusterIdSpecified);
}
}
plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), vol.getPoolId(), null);
plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), vol.getPoolId(), null, ctx);
}else{
plan = new DataCenterDeployment(rootVolDcId, rootVolPodId, rootVolClusterId, null, vol.getPoolId(), null);
plan = new DataCenterDeployment(rootVolDcId, rootVolPodId, rootVolClusterId, null, vol.getPoolId(), null, ctx);
if (s_logger.isDebugEnabled()) {
s_logger.debug(vol + " is READY, changing deployment plan to use this pool's dcId: " + rootVolDcId + " , podId: " + rootVolPodId + " , and clusterId: " + rootVolClusterId);
}
@ -773,7 +773,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
String host_guid = startAnswer.getHost_guid();
if( host_guid != null ) {
HostVO finalHost = _resourceMgr.findHostByGuid(host_guid);
if ( finalHost == null ) {
if (finalHost == null ) {
throw new CloudRuntimeException("Host Guid " + host_guid + " doesn't exist in DB, something wrong here");
}
destHostId = finalHost.getId();
@ -788,14 +788,14 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
}
return startedVm;
} else {
canRetry = false;
if (s_logger.isDebugEnabled()) {
s_logger.info("The guru did not like the answers so stopping " + vm);
}
StopCommand cmd = new StopCommand(vm.getInstanceName());
StopAnswer answer = (StopAnswer) _agentMgr.easySend(destHostId, cmd);
if (answer == null || !answer.getResult()) {
s_logger.warn("Unable to stop " + vm + " due to " + (answer != null ? answer.getDetails() : "no answers"));
canRetry = false;
s_logger.warn("Unable to stop " + vm + " due to " + (answer != null ? answer.getDetails() : "no answers"));
_haMgr.scheduleStop(vm, destHostId, WorkType.ForceStop);
throw new ExecutionException("Unable to stop " + vm + " so we are unable to retry the start operation");
}
@ -899,7 +899,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
return false;
}
if (step == Step.Started || step == Step.Starting) {
if (step == Step.Started || step == Step.Starting || step == Step.Release) {
if (vm.getHostId() != null) {
if (!sendStop(guru, profile, force)) {
s_logger.warn("Failed to stop vm " + vm + " in " + State.Starting + " state as a part of cleanup process");
@ -1725,8 +1725,25 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
{
s_logger.info("Found vm " + vm.getInstanceName() + " in inconsistent state. " + vm.getState() + " on CS while " + (info == null ? "Stopped" : "Running") + " on agent");
info = new AgentVmInfo(vm.getInstanceName(), getVmGuru(vm), vm, State.Stopped);
vm.setState(State.Running); // set it as running and let HA take care of it
// Bug 13850- grab outstanding work item if any for this VM state so that we mark it as DONE after we change VM state, else it will remain pending
ItWorkVO work = _workDao.findByOutstandingWork(vm.getId(), vm.getState());
if (work != null) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Found an outstanding work item for this vm " + vm + " in state:" + vm.getState() + ", work id:" + work.getId());
}
}
vm.setState(State.Running); // set it as running and let HA take care of it
_vmDao.persist(vm);
if (work != null) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Updating outstanding work item to Done, id:" + work.getId());
}
work.setStep(Step.Done);
_workDao.update(work.getId(), work);
}
castedVm = info.guru.findById(vm.getId());
try {
Host host = _hostDao.findByGuid(info.getHostUuid());

View File

@ -1545,7 +1545,7 @@ INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '5.6', 50, 1);
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '5.6 FP1', 50, 1);
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '5.6 SP2', 50, 1);
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '6.0 beta', 50, 1);
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('XenServer', '6.0', 50, 1);
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', 'default', 128, 0);
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', '4.0', 128, 0);
INSERT IGNORE INTO `cloud`.`hypervisor_capabilities`(hypervisor_type, hypervisor_version, max_guests_limit, security_group_enabled) VALUES ('VMware', '4.1', 128, 0);

View File

@ -304,7 +304,7 @@ UPDATE `cloud_usage`.`usage_network` set agg_bytes_received = net_bytes_received
ALTER TABLE `cloud_usage`.`usage_vpn_user` ADD INDEX `i_usage_vpn_user__account_id`(`account_id`);
ALTER TABLE `cloud_usage`.`usage_vpn_user` ADD INDEX `i_usage_vpn_user__created`(`created`);
ALTER TABLE `cloud_usage`.`usage_vpn_user` ADD INDEX `i_usage_vpn_user__deleted`(`deleted`);
ALTER TABLE `cloud_usage`.`usage_ip_address` ADD COLUMN `is_elastic` smallint(1) NOT NULL default '0';
ALTER TABLE `cloud_usage`.`usage_ip_address` ADD COLUMN `is_system` smallint(1) NOT NULL default '0';
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Premium', 'DEFAULT', 'management-server', 'usage.sanity.check.interval', null, 'Interval (in days) to check sanity of usage data');
DELETE FROM `cloud`.`configuration` WHERE name='host.capacity.checker.wait';

View File

@ -17,7 +17,7 @@ class cloudConnection(object):
self.apiKey = apiKey
self.securityKey = securityKey
self.mgtSvr = mgtSvr
self.connection = httplib.HTTPConnection("%s:%d"%(mgtSvr,port))
self.connection = httplib.HTTPConnection("%s:%d"%(mgtSvr,port), timeout=180)
self.port = port
self.logging = logging
if port == 8096:
@ -139,4 +139,4 @@ 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())
print conn.paraseReturnXML(xml, deployVirtualMachine.deployVirtualMachineResponse())

View File

@ -3381,8 +3381,10 @@ Dialogs*/
}
.dashboard.admin .dashboard-container .stats ul li .name {
width: 135px;
width: 178px;
float: left;
font-size: 11px;
font-weight: bold;
margin: 15px 15px 0 0;
}
@ -3946,7 +3948,7 @@ Dialogs*/
}
.system-chart.dashboard.admin .dashboard-container .stats .chart {
width: 286px;
width: 242px;
}
/** Compute*/
@ -5373,6 +5375,24 @@ label.error {
margin: 23px 0 0px 6px;
}
.multi-wizard.zone-wizard .review .main-desc.pre-setup {
width: 100%;
font-size: 18px;
color: #2C4159;
background: url(../images/icons.png) no-repeat 104px -224px;
padding: 2px 0 1px;
text-align: center;
/*+placement:shift 0px 153px;*/
position: relative;
left: 0px;
top: 153px;
/*+text-shadow:0px 1px #FFFFFF;*/
-moz-text-shadow: 0px 1px #FFFFFF;
-webkit-text-shadow: 0px 1px #FFFFFF;
-o-text-shadow: 0px 1px #FFFFFF;
text-shadow: 0px 1px #FFFFFF;
}
.multi-wizard.zone-wizard .info-desc {
font-size: 11px;
float: left;
@ -6796,7 +6816,7 @@ div.panel.ui-dialog div.list-view div.fixed-header {
.recurring-snapshots .ui-tabs ul li a {
width: 76px;
text-indent: 28px;
margin: 0 32px 0 0;
margin: 0 14px 0 0;
padding: 8px 0 5px;
background: url(../images/sprites.png) no-repeat -521px -540px;
border: none;
@ -7357,7 +7377,7 @@ div.panel.ui-dialog div.list-view div.fixed-header {
position: relative;
left: 0px;
top: -10px;
margin-right: 10px;
margin-right: 9px;
}
#header div.view-switcher.alt {
@ -7368,9 +7388,9 @@ div.panel.ui-dialog div.list-view div.fixed-header {
float: left;
/*[empty]display:;*/
width: 126px;
padding: 12px 0 0;
padding: 13px 0 0;
margin: 0;
text-indent: 21px;
text-indent: 17px;
position: relative;
/*+text-shadow:0px -1px 1px #2D2D2D;*/
-moz-text-shadow: 0px -1px 1px #2D2D2D;

34
ui/css/cloudstack3.ja.css Normal file
View File

@ -0,0 +1,34 @@
/*[fmt]1C20-1C0D-E*/
#header div.view-switcher {
font-size: 9px;
}
.dashboard.admin .dashboard-container .stats ul li .name {
font-size: 10px;
}
.dashboard.admin .dashboard-container .stats ul li .percentage {
float: left;
font-size: 15px;
font-weight: bold;
margin: 13px 0 0;
/*+text-shadow:0px -2px 1px #FFFFFF;*/
-moz-text-shadow: 0px -2px 1px #FFFFFF;
-webkit-text-shadow: 0px -2px 1px #FFFFFF;
-o-text-shadow: 0px -2px 1px #FFFFFF;
text-shadow: 0px -2px 1px #FFFFFF;
}
.dashboard.admin .dashboard-container .stats ul li .value .content {
font-size: 10px;
}
div.toolbar div.filters label {
font-size: 9px;
}
div.toolbar div.filters select {
width: 82px;
font-size: 11px;
}

View File

@ -14,6 +14,9 @@
<title>CloudStack</title>
<link type="text/css" rel="stylesheet" href="lib/reset.css"/>
<link type="text/css" rel="stylesheet" href="css/cloudstack3.css" />
<c:if test="${!empty cookie.lang && cookie.lang.value != 'en'}">
<link type="text/css" rel="stylesheet" href="css/cloudstack3.${cookie.lang.value}.css" />
</c:if>
<!--[if IE 7]>
<link type="text/css" rel="stylesheet" href="css/cloudstack3-ie7.css" />
@ -269,7 +272,7 @@
<div class="secondary-input hide-if-unselected">
<input type="radio" name="defaultNetwork" value="new-network" />
<div class="name"><fmt:message key="label.default"/></div></div>
<div class="name"><fmt:message key="label.default"/></div>
</div>
</div>
</div>
@ -720,7 +723,7 @@
<!-- Step 5: Launch -->
<div class="review" zone-wizard-step-id="launch">
<div class="main-desc"><fmt:message key="label.launch.zone"/></div>
<div class="main-desc pre-setup"><fmt:message key="message.launch.zone"/></div>
<div class="main-desc launch" style="display:none;">
<fmt:message key="message.please.wait.while.zone.is.being.created"/>
</div>
@ -940,7 +943,7 @@
<!-- Host dashboard -->
<div class="system-dashboard">
<div class="head">
<span<fmt:message key="label.hosts"/></span>
<span><fmt:message key="label.hosts"/></span>
<div class="view-more"><span><fmt:message key="label.view.more"/></span></div>
</div>
<ul class="status_box good">
@ -1175,20 +1178,20 @@
<!-- User dashboard-->
<div class="dashboard user">
<div class="vm-status">
<div class="title"><span>Virtual Machines</span></div>
<div class="title"><span><fmt:message key="label.virtual.machines"/></span></div>
<div class="content">
<ul>
<li class="running">
<div class="name">Running VMs</div>
<div class="name"><fmt:message key="label.running.vms"/></div>
<div class="value" data-item="runningInstances"></div>
</li>
<li class="stopped">
<div class="name">Stopped VMs</div>
<div class="name"><fmt:message key="label.stopped.vms"/></div>
<div class="value" data-item="stoppedInstances"></div>
</li>
<li class="total">
<div class="name">Total VMs</div>
<div class="name"><fmt:message key="label.total.vms"/></div>
<div class="value" data-item="totalInstances"></div>
</li>
</ul>
@ -1201,7 +1204,7 @@
<table>
<thead>
<tr>
<th>Latest events <div class="button view-all events">view all</div></th>
<th><fmt:message key="label.latest.events"/> <div class="button view-all events"><fmt:message key="label.view.all"/></div></th>
</tr>
</thead>
</table>
@ -1218,7 +1221,7 @@
<table>
<thead>
<tr>
<th>Network <div class="button view-all network">view all</div></th>
<th><fmt:message key="label.network"/> <div class="button view-all network"><fmt:message key="label.view.all"/></div></th>
</tr>
</thead>
</table>
@ -1226,13 +1229,13 @@
<tbody>
<tr>
<td>
<div class="desc"><span>Owned isolated networks:</span></div>
<div class="desc"><span><fmt:message key="label.isolated.networks"/>:</span></div>
<div class="value"><span data-item="netTotal"></span></div>
</td>
</tr>
<tr class="odd">
<td>
<div class="desc"><span>Owned public IP addresses:</span></div>
<div class="desc"><span><fmt:message key="label.public.ips"/>:</span></div>
<div class="value"><span data-item="ipTotal"></span></div>
</td>
</tr>
@ -1614,6 +1617,13 @@
<script language="javascript">
dictionary = {
'label.latest.events': '<fmt:message key="label.latest.events"/>',
'state.Enabled': '<fmt:message key="state.Enabled"/>',
'label.system.wide.capacity': '<fmt:message key="label.system.wide.capacity"/>',
'label.management': '<fmt:message key="label.management"/>',
'label.guest': '<fmt:message key="label.guest"/>',
'label.network.service.providers': '<fmt:message key="label.network.service.providers"/>',
'message.launch.zone': '<fmt:message key="message.launch.zone"/>',
'label.compute.offering': '<fmt:message key="label.compute.offering"/>',
'label.add.compute.offering': '<fmt:message key="label.add.compute.offering"/>',
'label.compute.offerings': '<fmt:message key="label.compute.offerings"/>',
@ -2439,7 +2449,7 @@ dictionary = {
'label.none': '<fmt:message key="label.none" />',
'label.not.found': '<fmt:message key="label.not.found" />',
'label.num.cpu.cores': '<fmt:message key="label.num.cpu.cores" />',
'label.numretries ': '<fmt:message key="label.numretries " />',
'label.numretries': '<fmt:message key="label.numretries" />',
'label.offer.ha': '<fmt:message key="label.offer.ha" />',
'label.optional': '<fmt:message key="label.optional" />',
'label.os.preference': '<fmt:message key="label.os.preference" />',

View File

@ -99,11 +99,11 @@ if(a.pageY-this.offset.click.top<g[1])h=g[1]+this.offset.click.top;if(a.pageX-th
b.grid[0])*b.grid[0]:this.originalPageX;e=g?!(e-this.offset.click.left<g[0]||e-this.offset.click.left>g[2])?e:!(e-this.offset.click.left<g[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<
526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,
c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.14"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var h=d.data(this,"sortable");if(h&&!h.options.disabled){c.sortables.push({instance:h,shouldRevert:h.options.revert});
h.refreshPositions();h._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=
h.refreshPositions();h._trigger("activate",a,e)}})},stop:function(a,b){alert($(this).data("draggable"));var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=
false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",true);
this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;
c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&
this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=
this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){if( $(this).data("draggable") ){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=
a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!=
"x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<
c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-

View File

@ -964,12 +964,19 @@
],
dataProvider: function(args) {
args.response.success(
{
actionFilter: userActionfilter,
data:args.context.users[0]
$.ajax({
url: createURL('listUsers'),
data: {
id: args.context.users[0].id,
listAll: true
},
success: function(json) {
args.response.success({
actionFilter: userActionfilter,
data: json.listusersresponse.user[0]
});
}
);
});
}
}
}

View File

@ -313,7 +313,7 @@
// EULA check
$.ajax({
url: 'eula.html',
url: 'eula.' + $.cookie('lang') + '.html',
dataType: 'html',
success: function(html) {
cloudStack.uiCustom.login($.extend(loginArgs, { eula: html, hasLogo: true }));

View File

@ -1,6 +1,6 @@
(function($, cloudStack) {
var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, featuredIsoObjs, communityIsoObjs, myIsoObjs, serviceOfferingObjs, diskOfferingObjs, networkOfferingObjs;
var zoneObjs, hypervisorObjs, featuredTemplateObjs, communityTemplateObjs, myTemplateObjs, featuredIsoObjs, communityIsoObjs, myIsoObjs, serviceOfferingObjs, diskOfferingObjs, networkOfferingObjs, physicalNetworkObjs;
var selectedZoneObj, selectedTemplateObj, selectedHypervisor, selectedDiskOfferingObj;
var step5ContainerType = 'nothing-to-select'; //'nothing-to-select', 'select-network', 'select-security-group'
@ -160,8 +160,7 @@
featuredisos: featuredIsoObjs,
communityisos: communityIsoObjs,
myisos: myIsoObjs //???
//isos: isoObjs
myisos: myIsoObjs
},
hypervisors: hypervisorObjs
}
@ -306,15 +305,22 @@
}
});
var apiCmd = "listNetworkOfferings&guestiptype=Isolated&supportedServices=sourceNat&state=Enabled&specifyvlan=false&zoneid=" + args.currentData.zoneid ;
var array1 = [];
var guestTrafficTypeTotal = 0;
$.ajax({
url: createURL("listNetworkOfferings&guestiptype=Isolated&supportedServices=sourceNat&state=Enabled"), //get the network offering for isolated network with sourceNat
url: createURL(apiCmd + array1.join("")), //get the network offering for isolated network with sourceNat
dataType: "json",
async: false,
success: function(json) {
networkOfferingObjs = json.listnetworkofferingsresponse.networkoffering;
}
});
//get network offerings (end) ***
args.response.success({
type: 'select-network',
data: {

View File

@ -177,9 +177,10 @@
networkOfferingId: {
label: 'label.network.offering',
validation: { required: true },
select: function(args) {
dependsOn: 'zoneId',
select: function(args) {
$.ajax({
url: createURL('listNetworkOfferings'),
url: createURL('listNetworkOfferings&zoneid=' + args.zoneId),
data: {
type: 'Isolated',
supportedServices: 'SourceNat',
@ -1225,7 +1226,9 @@
}
});
ipChangeNotice();
if (args._custom.$detailView.is(':visible')) {
ipChangeNotice();
}
}
}
},
@ -1254,7 +1257,11 @@
return ['enableStaticNAT'];
};
},
onComplete: ipChangeNotice
onComplete: function(args, _custom) {
if (_custom.$detailView.is(':visible')) {
ipChangeNotice();
}
}
}
});
},

View File

@ -41,7 +41,7 @@ var pollAsyncJobResult = function(args) {
return; //Job has not completed
}
else {
if (result.jobstatus == 1) { // Succeeded
if (result.jobstatus == 1) { // Succeeded
if(args._custom.getUpdatedItem != null && args._custom.getActionFilter != null) {
args.complete({
data: args._custom.getUpdatedItem(json),
@ -64,7 +64,7 @@ var pollAsyncJobResult = function(args) {
}
if (args._custom.onComplete) {
args._custom.onComplete(json);
args._custom.onComplete(json, args._custom);
}
}
else if (result.jobstatus == 2) { // Failed

View File

@ -1163,7 +1163,7 @@
allowedActions.push("recurringSnapshot");
}
if(jsonObj.state != "Allocated") {
if(jsonObj.hypervisor != "Ovm" && jsonObj.vmstate == "Stopped") {
if(jsonObj.vmstate == "Stopped") {
allowedActions.push("downloadVolume");
}
}

View File

@ -1045,14 +1045,25 @@
networkOfferingId: {
label: 'label.network.offering',
dependsOn: 'scope',
select: function(args) {
select: function(args) {
$.ajax({
url: createURL('listPhysicalNetworks'),
data: {
id: args.context.physicalNetworks[0].id
},
async: false,
success: function(json) {
args.context.physicalNetworks[0] = json.listphysicalnetworksresponse.physicalnetwork[0];
}
});
var apiCmd = "listNetworkOfferings&state=Enabled&zoneid=" + selectedZoneObj.id;
var array1 = [];
var array1 = [];
if(physicalNetworkObjs.length > 1) { //multiple physical networks
var guestTrafficTypeTotal = 0;
for(var i = 0; i < physicalNetworkObjs.length; i++) {
if(guestTrafficTypeTotal > 1)
if(guestTrafficTypeTotal > 1) //as long as guestTrafficTypeTotal > 1, break for loop, don't need to continue to count. It doesn't matter whether guestTrafficTypeTotal is 2 or 3 or 4 or 5 or more. We only care whether guestTrafficTypeTotal is greater than 1.
break;
$.ajax({
url: createURL("listTrafficTypes&physicalnetworkid=" + physicalNetworkObjs[i].id),
@ -1069,7 +1080,7 @@
}
});
}
if(guestTrafficTypeTotal > 1) {
if(args.context.physicalNetworks[0].tags != null && args.context.physicalNetworks[0].tags.length > 0) {
array1.push("&tags=" + args.context.physicalNetworks[0].tags);
@ -3435,7 +3446,8 @@
indicator: {
'Running': 'on',
'Stopped': 'off',
'Error': 'off'
'Error': 'off',
'Destroyed': 'off'
}
}
},
@ -3578,7 +3590,7 @@
}
},
'delete': {
destroy: {
label: 'label.action.destroy.systemvm',
messages: {
confirm: function(args) {
@ -3597,13 +3609,10 @@
var jid = json.destroysystemvmresponse.jobid;
args.response.success({
_custom: {
jobId: jid,
getUpdatedItem: function(json) {
//return {}; //nothing in this systemVM needs to be updated, in fact, this whole systemVM has being destroyed
getUpdatedItem: function() {
return { state: 'Destroyed' };
},
getActionFilter: function() {
return systemvmActionfilter;
}
jobId: jid
}
});
}
@ -4399,7 +4408,7 @@
validation: { required: true }
},
reservedSystemGateway: {
label: 'reserved.system.gateway',
label: 'label.reserved.system.gateway',
validation: { required: true }
},
reservedSystemNetmask: {
@ -6312,7 +6321,18 @@
section: 'seconary-storage',
fields: {
name: { label: 'label.name' },
created: { label: 'label.created', converter: cloudStack.converters.toLocalDate }
created: { label: 'label.created', converter: cloudStack.converters.toLocalDate },
resourcestate: {
label: 'label.state',
indicator: {
'Enabled': 'on',
'Disabled': 'off',
'Destroyed': 'off'
},
converter: function(str) {
return 'state.' + str;
}
}
},
dataProvider: function(args) {
@ -6401,7 +6421,7 @@
detailView: {
name: 'Secondary storage details',
actions: {
'delete': {
destroy: {
label: 'label.action.delete.secondary.storage' ,
messages: {
confirm: function(args) {
@ -6417,12 +6437,12 @@
dataType: "json",
async: true,
success: function(json) {
args.response.success({data:{}});
args.response.success();
}
});
},
notification: {
poll: function(args) { args.complete(); }
poll: function(args) { args.complete({ data: { resourcestate: 'Destroyed' } }); }
}
}
@ -7249,7 +7269,7 @@
var secondarystorageActionfilter = function(args) {
var jsonObj = args.context.item;
var allowedActions = [];
allowedActions.push("delete");
allowedActions.push("destroy");
return allowedActions;
}
@ -7296,17 +7316,17 @@
if (jsonObj.state == 'Running') {
allowedActions.push("stop");
allowedActions.push("restart");
allowedActions.push("delete"); //destroy
allowedActions.push("destroy"); //destroy
allowedActions.push("viewConsole");
if (isAdmin())
allowedActions.push("migrate");
}
else if (jsonObj.state == 'Stopped') {
allowedActions.push("start");
allowedActions.push("delete"); //destroy
allowedActions.push("destroy"); //destroy
}
else if (jsonObj.state == 'Error') {
allowedActions.push("delete"); //destroy
allowedActions.push("destroy"); //destroy
}
return allowedActions;
}

View File

@ -144,13 +144,15 @@
if ($(this).hasClass('network')) $('#navigation li.network').click();
else {
$browser.cloudBrowser('addPanel', {
title: 'Alerts',
title: $dashboard.hasClass('admin') ? 'Alerts' : 'Events',
maximizeIfSelected: true,
complete: function($newPanel) {
$newPanel.listView({
$browser: $browser,
context: cloudStack.context,
listView: cloudStack.sections.events.sections.alerts.listView
listView: $dashboard.hasClass('admin') ?
cloudStack.sections.events.sections.alerts.listView :
cloudStack.sections.events.sections.events.listView // Users cannot see events
});
}
});

View File

@ -581,6 +581,11 @@
$nextButton.addClass('final');
}
// Hide previous button on first step
var $previousButton = $wizard.find('.button.previous');
if (index == 1) $previousButton.hide();
else $previousButton.show();
// Update progress bar
var $targetProgress = $progress.removeClass('active').filter(function() {
return $(this).index() <= targetIndex;

View File

@ -89,6 +89,12 @@
$.cookie('lang', $(this).val());
document.location.reload();
});
// Set default language
if (!$.cookie('lang')) {
$.cookie('lang', 'en');
}
$languageSelect.val($.cookie('lang'));
};
})(jQuery, cloudStack);

View File

@ -186,36 +186,37 @@
var trafficTypes = {
'public': {
label: 'Public',
label: _l('label.public'),
configure: {
action: actions.trafficTypeDetails('public', targetContext)
}
},
'guest': {
label: 'Guest',
label: _l('label.guest'),
configure: {
action: actions.trafficTypeDetails('guest', targetContext)
}
},
'management': {
label: 'Management',
label: _l('label.management'),
configure: {
action: actions.trafficTypeDetails('management', targetContext)
}
},
'storage': {
label: 'Storage',
label: _l('label.storage'),
configure: {
action: actions.trafficTypeDetails('storage', targetContext)
}
},
'providers': {
label: 'Network Service Providers',
label: _l('label.network.service.providers'),
ignoreChart: true,
dependsOn: 'guest',
configure: {
action: actions.providerListView(targetContext)
}
@ -227,14 +228,24 @@
});
// Make traffic type elems
$.each(trafficTypes, function(id, trafficType) {
if ($.inArray(id, validTrafficTypes) == -1 && !trafficType.ignoreChart) return true;
$.each(trafficTypes, function(id, trafficType) {
if ($.inArray(id, validTrafficTypes) == -1) { //if it is not a valid traffic type
if(trafficType.dependsOn != null && trafficType.dependsOn.length > 0) { //if it has dependsOn
if($.inArray(trafficType.dependsOn, validTrafficTypes) == -1) { //if its dependsOn is not a valid traffic type, either
return true; //skip this item
}
//else, if its dependsOn is a valid traffic type, continue to Make list item (e.g. providers.dependsOn is 'guest')
}
else {
return true; //if it doesn't have dependsOn, skip this item
}
}
// Make list item
var $li = $('<li>').addClass(id);
var $label = $('<span>').addClass('label').html(trafficType.label);
var $configureButton = viewAllButton($.extend(trafficType.configure, {
label: 'Configure',
label: _l('label.configure'),
title: trafficType.label,
$browser: $browser,
targetContext: targetContext
@ -244,7 +255,8 @@
$li.appendTo($trafficTypes);
// Make chart
if (trafficType.ignoreChart) return true;
if (trafficType.ignoreChart)
return true;
var $targetChartItem = $('<div>').addClass('network-chart-item').addClass(id);
$targetChartItem.appendTo($networkChart);
@ -313,19 +325,19 @@
var $stats = $('<div>').addClass('stats');
var $container = $('<div>').addClass('dashboard-container head');
var $top = $('<div>').addClass('top');
var $title = $('<div>').addClass('title').append($('<span>').html('System-wide capacity'));
var $title = $('<div>').addClass('title').append($('<span>').html(_l('label.system.wide.capacity')));
var chartItems = {
// The keys are based on the internal type ID associated with each capacity
0: { name: 'Memory' },
0: { name: _l('label.memory') },
1: { name: 'CPU' },
2: { name: 'Storage' },
3: { name: 'Allocated Storage' },
6: { name: 'Secondary Storage' },
9: { name: 'Local Storage' },
4: { name: 'Public IP' },
5: { name: 'Private IP' },
8: { name: 'Direct Public IP' },
2: { name: _l('label.storage') },
3: { name: _l('label.primary.allocated') },
6: { name: _l('label.secondary.storage') },
9: { name: _l('label.local.storage') },
4: { name: _l('label.public.ip') },
5: { name: _l('label.private.ip') },
8: { name: _l('label.direct.ips') },
7: { name: 'VLAN' }
};

View File

@ -82,9 +82,11 @@
if (customAction && !noAdd) {
customAction({
context: context,
$detailView: $detailView,
complete: function(args) {
// Set loading appearance
var $loading = $('<div>').addClass('loading-overlay');
$detailView.prepend($loading);
args = args ? args : {};
@ -92,20 +94,23 @@
var $item = args.$item;
notification.desc = messages.notification(args.messageArgs);
notification._custom = args._custom;
notification._custom = $.extend(args._custom ? args._custom : {}, {
$detailView: $detailView
});
cloudStack.ui.notifications.add(
notification,
// Success
function(args) {
$loading.remove();
if (!$detailView.is(':visible')) return;
$loading.remove();
replaceListViewItem($detailView, args.data);
if (!noRefresh) {
updateTabContent(args.data);
}
replaceListViewItem($detailView, args.data);
},
{},
@ -131,7 +136,9 @@
response: {
success: function(args) {
args = args ? args : {};
notification._custom = args._custom;
notification._custom = $.extend(args._custom ? args._custom : {}, {
$detailView: $detailView
});
if (additional && additional.success) additional.success(args);

View File

@ -1219,7 +1219,8 @@
},
listViewData.actions,
{
context: $listView.data('view-args').context
context: $listView.data('view-args').context,
reorder: listViewData.reorder
}
);
};

View File

@ -93,17 +93,18 @@
if ($target.is('li .name')) {
$treeView.find('li .name').removeClass('selected');
$target.addClass('selected');
var $panel = $browser.cloudBrowser('addPanel', {
$browser.cloudBrowser('addPanel', {
title: $target.html(),
data: '',
parent: $treeView.closest('div.panel')
parent: $treeView.closest('div.panel'),
complete: function($panel) {
$panel.detailView($.extend(treeViewArgs.detailView, {
id: $li.data('tree-view-item-id'),
$browser: $browser,
context: { domains: [ $li.data('tree-view-item-obj') ] }
}));
}
});
$panel.detailView($.extend(treeViewArgs.detailView, {
id: $li.data('tree-view-item-id'),
$browser: $browser,
context: { domains: [ $li.data('tree-view-item-obj') ] }
}));
}
return true;

View File

@ -161,6 +161,7 @@
},
addPrimaryStorage: function(args) {
var item;
$.ajax({
url: createURL("listConfigurations&name=" + todb("use.local.storage")),
dataType: 'json',
@ -178,7 +179,7 @@
}
});
if(item == null || item.value == "false")
if(item == null || item.value == null || item.value.length == 0 || item.value == "false")
configurationUseLocalStorage = false;
else
configurationUseLocalStorage = true;

View File

@ -47,6 +47,8 @@ public class Script implements Callable<String> {
public static final String ERR_EXECUTE = "execute.error";
public static final String ERR_TIMEOUT = "timeout";
private int _defaultTimeout = 3600 * 1000; /* 1 hour */
private volatile boolean _isTimeOut = false;
private boolean _passwordCommand = false;
@ -64,6 +66,10 @@ public class Script implements Callable<String> {
_command = new ArrayList<String>();
_command.add(command);
_timeout = timeout;
if (_timeout == 0) {
/* always using default timeout 1 hour to avoid thread hang */
_timeout = _defaultTimeout;
}
_process = null;
_logger = logger != null ? logger : s_logger;
}
@ -193,32 +199,42 @@ public class Script implements Callable<String> {
s_executors.execute(task);
}
try {
if (_process.waitFor() == 0) {
_logger.debug("Execution is successful.");
while (true) {
try {
if (_process.waitFor() == 0) {
_logger.debug("Execution is successful.");
return interpreter.drain() ? task.getResult() : interpreter.interpret(ir);
}
} catch (InterruptedException e) {
TimedOutLogger log = new TimedOutLogger(_process);
Task timedoutTask = new Task(log, ir);
return interpreter.drain() ? task.getResult() : interpreter.interpret(ir);
} else {
break;
}
} catch (InterruptedException e) {
if (!_isTimeOut) {
/* This is not timeout, we are interrupted by others, continue */
_logger.debug("We are interrupted but it's not a timeout, just continue");
continue;
}
TimedOutLogger log = new TimedOutLogger(_process);
Task timedoutTask = new Task(log, ir);
timedoutTask.run();
if (!_passwordCommand) {
_logger.warn("Timed out: " + buildCommandLine(command) + ". Output is: " + timedoutTask.getResult());
} else {
_logger.warn("Timed out: " + buildCommandLine(command));
}
timedoutTask.run();
if (!_passwordCommand) {
_logger.warn("Timed out: " + buildCommandLine(command) + ". Output is: " + timedoutTask.getResult());
} else {
_logger.warn("Timed out: " + buildCommandLine(command));
}
return ERR_TIMEOUT;
} finally {
if (future != null) {
future.cancel(false);
}
Thread.interrupted();
}
return ERR_TIMEOUT;
} finally {
if (future != null) {
future.cancel(false);
}
Thread.interrupted();
}
}
_logger.debug("Exit value is " + _process.exitValue());
_logger.debug("Exit value is " + _process.exitValue());
BufferedReader reader = new BufferedReader(new InputStreamReader(_process.getInputStream()), 128);
@ -264,6 +280,7 @@ public class Script implements Callable<String> {
_logger.trace("Script ran within the alloted time");
} catch (IllegalThreadStateException e) {
_logger.warn("Interrupting script.");
_isTimeOut = true;
_thread.interrupt();
}
return null;