Merge branch 'master' into ui-mixed-zone-management

This commit is contained in:
Brian Federle 2013-04-18 15:18:43 -07:00
commit e04430302d
43 changed files with 743 additions and 431 deletions

View File

@ -78,16 +78,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
boolean getSystem();
/**
* @return
*/
Long getVpcId();
/**
* @param vpcId
*/
void setVpcId(Long vpcId);
String getVmIp();
void setVmIp(String vmIp);
}

View File

@ -30,7 +30,4 @@ public interface PublicIpAddress extends ControlledEntity, IpAddress, Vlan, Inte
public String getNetmask();
public String getGateway();
@Override
public String getVlanTag();
}

View File

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

View File

@ -72,5 +72,7 @@ public interface User extends OwnedBy, InternalIdentity {
String getRegistrationToken();
boolean isRegistered();
boolean isDefault();
}

View File

@ -64,7 +64,6 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
private List<String> vmIdList;
public AffinityGroupResponse() {
this.vmIdList = new ArrayList<String>();
}
@Override
@ -149,6 +148,10 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
}
public void addVMId(String vmId) {
if (this.vmIdList == null) {
this.vmIdList = new ArrayList<String>();
}
this.vmIdList.add(vmId);
}

View File

@ -230,7 +230,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
for (String groupName : securityGroupNameList) {
Long groupId = _responseGenerator.getSecurityGroupId(groupName, getEntityOwnerId());
if (groupId == null) {
throw new InvalidParameterValueException("Unable to find group by name " + groupName + " for account " + getEntityOwnerId());
throw new InvalidParameterValueException("Unable to find group by name " + groupName);
} else {
securityGroupIds.add(groupId);
}
@ -344,8 +344,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
for (String groupName : affinityGroupNameList) {
Long groupId = _responseGenerator.getAffinityGroupId(groupName, getEntityOwnerId());
if (groupId == null) {
throw new InvalidParameterValueException("Unable to find group by name " + groupName
+ " for account " + getEntityOwnerId());
throw new InvalidParameterValueException("Unable to find affinity group by name " + groupName);
} else {
affinityGroupIds.add(groupId);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4112,7 +4112,7 @@ under the License.
<para>If you run into any issues during upgrades, please feel free to ask questions on users@apache.cloudstack.org or dev@apache.cloudstack.org.</para>
<section id="upgrade-from-4.0-to-4.1">
<title>Upgrade from 4.0.x to 4.1.0</title>
<para>This section will guide you from Apache CloudStack 4.0.x versions to &PRODUCT; 4.1.0.</para>
<para>This section will guide you from &PRODUCT; 4.0.x versions to &PRODUCT; 4.1.0.</para>
<para>Any steps that are hypervisor-specific will be called out with a note.</para>
<warning><title>Package Structure Changes</title>
<para>The package structure for &PRODUCT; has changed significantly since the 4.0.x releases. If you've compiled your own packages, you'll notice that the package names and the number of packages has changed. This is <emphasis>not</emphasis> a bug.</para>
@ -4125,92 +4125,6 @@ under the License.
<para>Create RPM or Debian packages (as appropriate) and a repository from the 4.1.0 source, or check the Apache CloudStack downloads page at <ulink url="http://cloudstack.apache.org/downloads.html">http://cloudstack.apache.org/downloads.html</ulink> for package repositories supplied by community members. You will need them for step <xref linkend="upgrade-deb-packages" /> or step <xref linkend="upgrade-rpm-packages" />.</para>
<para>Instructions for creating packages from the &PRODUCT; source are in the <ulink url="http://cloudstack.apache.org/docs/en-US/index.html">Installation Guide</ulink>.</para>
</listitem>
<listitem>
<note><title>For VMware Only</title>
<para>This step is only required if you are using VMware. You can safely skip this step if you are using KVM and/or Xen only.</para>
</note>
<para>In each zone that includes VMware hosts, you need to add a new system VM template. </para>
<orderedlist numeration="loweralpha">
<listitem>
<para>While running the existing 3.0.2 system, log in to the UI as root administrator.</para>
</listitem>
<listitem>
<para>In the left navigation bar, click Templates.</para>
</listitem>
<listitem>
<para>In Select view, click Templates.</para>
</listitem>
<listitem>
<para>Click Register template.</para>
<para>The Register template dialog box is displayed.</para>
</listitem>
<listitem>
<para>In the Register template dialog box, specify the following values (do not change these):</para>
<informaltable>
<tgroup cols="2" align="left" colsep="1" rowsep="1">
<colspec colwidth="1*" colname="1" colnum="1"/>
<colspec colwidth="2*" colname="2" colnum="2"/>
<thead>
<row>
<entry><para>Field</para></entry>
<entry><para>Value</para></entry>
</row>
</thead>
<tbody>
<row>
<entry><para>Name</para></entry>
<entry><para>systemvm-vmware-4.1</para></entry>
</row>
<row>
<entry><para>Description</para></entry>
<entry><para>systemvm-vmware-4.1</para></entry>
</row>
<row>
<entry><para>URL</para></entry>
<entry><para>http://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova</para></entry>
</row>
<row>
<entry><para>Zone</para></entry>
<entry><para>Choose the zone where this hypervisor is used</para></entry>
</row>
<row>
<entry><para>Hypervisor</para></entry>
<entry><para>VMware</para></entry>
</row>
<row>
<entry><para>Format</para></entry>
<entry><para>OVA</para></entry>
</row>
<row>
<entry><para>OS Type</para></entry>
<entry><para>Debian GNU/Linux 5.0 (32-bit)</para></entry>
</row>
<row>
<entry><para>Extractable</para></entry>
<entry><para>no</para></entry>
</row>
<row>
<entry><para>Password Enabled</para></entry>
<entry><para>no</para></entry>
</row>
<row>
<entry><para>Public</para></entry>
<entry><para>no</para></entry>
</row>
<row>
<entry><para>Featured</para></entry>
<entry><para>no</para></entry>
</row>
</tbody>
</tgroup>
</informaltable>
</listitem>
<listitem>
<para>Watch the screen to be sure that the template downloads successfully and enters
the READY state. Do not proceed until this is successful.</para>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>Stop your management server or servers. Run this on all management server hosts:</para>
<programlisting><prompt>#</prompt> service cloud-management stop</programlisting>
@ -4267,17 +4181,17 @@ under the License.
<listitem>
<para>Restart the agent:</para>
<programlisting language="Bash">
service cloud-agent stop
killall jsvc
service cloudstack-agent start
service cloud-agent stop
killall jsvc
service cloudstack-agent start
</programlisting>
</listitem>
<listitem>
<para>During the upgrade, <filename>log4j-cloud.xml</filename> was simply copied over, so the logs will continue to be added to <filename>/var/log/cloud/agent/agent.log</filename>. There's nothing <emphasis>wrong</emphasis> with this, but if you prefer to be consistent, you can change this by copying over the sample configuration file:</para>
<programlisting language="Bash">
cd /etc/cloudstack/agent
mv log4j-cloud.xml.dpkg-dist log4j-cloud.xml
service cloudstack-agent restart
cd /etc/cloudstack/agent
mv log4j-cloud.xml.dpkg-dist log4j-cloud.xml
service cloudstack-agent restart
</programlisting>
</listitem>
<listitem>
@ -4287,22 +4201,63 @@ under the License.
</orderedlist>
</listitem>
<listitem id="upgrade-rpm-packages">
<para>The package names have changed between 4.0 and 4.1, so upgrading the packages won't happen automatically with a <command>yum update</command></para>
<para>If you are using CentOS or RHEL, follow this procedure to upgrade your packages. If not, skip to step <xref linkend="restart-system-vms" />.</para>
<note><title>Community Packages</title>
<para>This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and yum repository, substitute your own URL for the ones used in these examples.</para>
</note>
<orderedlist id="rpmsteps">
<listitem>
<para>The first order of business will be to change the yum repository for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.)</para>
<para>Start by opening <filename>/etc/yum.repos.d/cloudstack.repo</filename> on any systems that have &PRODUCT; packages installed.</para>
<para>This file should have content similar to the following:</para>
<programlisting language="Bash">
[apache-cloudstack]
name=Apache CloudStack
baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
enabled=1
gpgcheck=0
</programlisting>
<para>If you are using the community provided package repository, change the baseurl to http://cloudstack.apt-get.eu/rhel/4.1/</para>
<para>If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository.</para>
</listitem>
<listitem id="rpm-master">
<para>Now that you have the repository configured, it's time to install the <filename>cloudstack-management</filename> package by upgrading the older <filename>cloud-client</filename> package.</para>
<programlisting language="Bash">$ sudo yum upgrade cloud-client</programlisting>
</listitem>
<listitem id="kvm-agent-rpm">
<para>For KVM hosts, you will need to upgrade the <filename>cloud-agent</filename> package, similarly installing the new version as <filename>cloudstack-agent</filename>.</para>
<programlisting language="Bash">$ sudo yum upgrade cloud-agent</programlisting>
<para>During the installation of <filename>cloudstack-agent</filename>, the RPM will copy your <filename>agent.properties</filename>, <filename>log4j-cloud.xml</filename>, and <filename>environment.properties</filename> from <filename>/etc/cloud/agent</filename> to <filename>/etc/cloudstack/agent</filename>.</para>
</listitem>
<listitem>
<para>Verify that the file <filename>/etc/cloudstack/agent/environment.properties</filename> has a line that reads:</para>
<programlisting language="Bash">paths.script=/usr/share/cloudstack-common</programlisting>
<para>If not, add the line.</para>
</listitem>
<listitem>
<para>Restart the agent:</para>
<programlisting language="Bash">
service cloud-agent stop
killall jsvc
service cloudstack-agent start
</programlisting>
</listitem>
</orderedlist>
</listitem>
<listitem id="restart-system-vms">
<para>Once you've upgraded the packages on your management servers, you'll need to restart the system VMs. Make sure port 8096 is open <!-- [FIXME, where?] --> to do this.</para>
<para>Once you've upgraded the packages on your management servers, you'll need to restart the system VMs. Make sure port 8096 is open in your local host firewall to do this.</para>
<para>There is a script that will do this for you, all you need to do is run the script and supply the IP address for your MySQL instance and your MySQL credentials:</para>
<programlisting language="Bash"><prompt>#</prompt> nohup cloudstack-sysvmadm -d <replaceable>IP address</replaceable> -u cloud -p -a &gt; sysvm.log 2&gt;&amp;1 &amp;</programlisting>
<para>You can monitor the log for progress. The process of restarting the system VMs can take an hour or more.</para>
<programlisting language="Bash"><prompt>#</prompt> tail -f sysvm.log</programlisting>
<para>The output to <filename>sysvm.log</filename> will look something like this:</para>
<programlisting language="Bash">
Stopping and starting 1 secondary storage vm(s)...
Done stopping and starting secondary storage vm(s)
Stopping and starting 1 console proxy vm(s)...
Done stopping and starting console proxy vm(s).
Stopping and starting 4 running routing vm(s)...
Done restarting router(s).
Stopping and starting 1 secondary storage vm(s)...
Done stopping and starting secondary storage vm(s)
Stopping and starting 1 console proxy vm(s)...
Done stopping and starting console proxy vm(s).
Stopping and starting 4 running routing vm(s)...
Done restarting router(s).
</programlisting>
</listitem>
<listitem>
@ -4317,15 +4272,6 @@ under the License.
<title>Upgrade from 3.0.2 to 4.1.0</title>
<para>This section will guide you from Citrix CloudStack 3.0.2 to Apache CloudStack 4.1.0. Sections that are hypervisor-specific will be called out with a note.</para>
<orderedlist>
<listitem>
<para>Ensure that you query your IP address usage records and process them or make a
backup. During the upgrade you will lose the old IP address usage records.</para>
<para>Starting in 3.0.2, the usage record format for IP addresses is the same as the rest
of the usage types. Instead of a single record with the assignment and release dates,
separate records are generated per aggregation period with start and end dates. After
upgrading, any existing IP address usage records in the old format will no longer be
available.</para>
</listitem>
<listitem>
<note>
<para>The following upgrade instructions apply only if you're using VMware hosts. If
@ -4436,23 +4382,107 @@ under the License.
the community provided yum/apt repositories to gain access to the &PRODUCT;
binaries.</para>
</listitem>
<listitem>
<para>After you have configured an appropriate yum or apt repository, you may execute the
one of the following commands as appropriate for your environment in order to upgrade
&PRODUCT;: <programlisting><prompt>#</prompt> <command>yum</command> update cloud-*</programlisting>
<programlisting><prompt>#</prompt> <command>apt-get</command> update
<prompt>#</prompt> <command>apt-get</command> upgrade cloud-*</programlisting>
</para>
<para>You will, of course, have to agree to the changes suggested by Yum or APT.</para>
<note>
<para>If the upgrade output includes a message similar to the following, then some
custom content was found in your old components.xml, and you need to merge the two
files:</para>
<programlisting>warning: /etc/cloud/management/components.xml created as /etc/cloud/management/components.xml.rpmnew </programlisting>
<para>Instructions follow in the next step.</para>
<listitem id="upgrade-deb-packages-302">
<para>If you are using Ubuntu, follow this procedure to upgrade your packages. If not, skip to step <xref linkend="upgrade-rpm-packages-302" />.</para>
<note><title>Community Packages</title>
<para>This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and APT repository, substitute your own URL for the ones used in these examples.</para>
</note>
<orderedlist id="debsteps-302">
<listitem>
<para>The first order of business will be to change the sources list for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.)</para>
<para>Start by opening <filename>/etc/apt/sources.list.d/cloudstack.list</filename> on any systems that have &PRODUCT; packages installed.</para>
<para>This file should have one line, which contains:</para>
<programlisting language="Bash">deb http://cloudstack.apt-get.eu/ubuntu precise 4.0</programlisting>
<para>We'll change it to point to the new package repository:</para>
<programlisting language="Bash">deb http://cloudstack.apt-get.eu/ubuntu precise 4.1</programlisting>
<para>If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository.</para>
</listitem>
<listitem>
<para>Now update your apt package list:</para>
<programlisting language="Bash">$ sudo apt-get update</programlisting>
</listitem>
<listitem id="deb-master-302">
<para>Now that you have the repository configured, it's time to install the <filename>cloudstack-management</filename> package. This will pull in any other dependencies you need.</para>
<programlisting language="Bash">$ sudo apt-get install cloudstack-management</programlisting>
</listitem>
<listitem id="kvm-agent-deb-302">
<para>You will need to manually install the <filename>cloudstack-agent</filename> package:</para>
<programlisting language="Bash">$ sudo apt-get install cloudstack-agent</programlisting>
<para>During the installation of <filename>cloudstack-agent</filename>, APT will copy your <filename>agent.properties</filename>, <filename>log4j-cloud.xml</filename>, and <filename>environment.properties</filename> from <filename>/etc/cloud/agent</filename> to <filename>/etc/cloudstack/agent</filename>.</para>
<para>When prompted whether you wish to keep your configuration, say Yes.</para>
</listitem>
<listitem>
<para>Verify that the file <filename>/etc/cloudstack/agent/environment.properties</filename> has a line that reads:</para>
<programlisting language="Bash">paths.script=/usr/share/cloudstack-common</programlisting>
<para>If not, add the line.</para>
</listitem>
<listitem>
<para>Restart the agent:</para>
<programlisting language="Bash">
service cloud-agent stop
killall jsvc
service cloudstack-agent start
</programlisting>
</listitem>
<listitem>
<para>During the upgrade, <filename>log4j-cloud.xml</filename> was simply copied over, so the logs will continue to be added to <filename>/var/log/cloud/agent/agent.log</filename>. There's nothing <emphasis>wrong</emphasis> with this, but if you prefer to be consistent, you can change this by copying over the sample configuration file:</para>
<programlisting language="Bash">
cd /etc/cloudstack/agent
mv log4j-cloud.xml.dpkg-dist log4j-cloud.xml
service cloudstack-agent restart
</programlisting>
</listitem>
<listitem>
<para>Once the agent is running, you can uninstall the old cloud-* packages from your system:</para>
<programlisting language="Bash">sudo dpkg --purge cloud-agent</programlisting>
</listitem>
</orderedlist>
</listitem>
<listitem>
<listitem id="upgrade-rpm-packages-302">
<para>If you are using CentOS or RHEL, follow this procedure to upgrade your packages. If not, skip to step <xref linkend="correct-components-xml-302" />.</para>
<note><title>Community Packages</title>
<para>This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and yum repository, substitute your own URL for the ones used in these examples.</para>
</note>
<orderedlist id="rpmsteps-302">
<listitem>
<para>The first order of business will be to change the yum repository for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.)</para>
<para>Start by opening <filename>/etc/yum.repos.d/cloudstack.repo</filename> on any systems that have &PRODUCT; packages installed.</para>
<para>This file should have content similar to the following:</para>
<programlisting language="Bash">
[apache-cloudstack]
name=Apache CloudStack
baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
enabled=1
gpgcheck=0
</programlisting>
<para>If you are using the community provided package repository, change the baseurl to http://cloudstack.apt-get.eu/rhel/4.1/</para>
<para>If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository.</para>
</listitem>
<listitem id="rpm-master-302">
<para>Now that you have the repository configured, it's time to install the <filename>cloudstack-management</filename> package by upgrading the older <filename>cloud-client</filename> package.</para>
<programlisting language="Bash">$ sudo yum upgrade cloud-client</programlisting>
</listitem>
<listitem id="kvm-agent-rpm-302">
<para>For KVM hosts, you will need to upgrade the <filename>cloud-agent</filename> package, similarly installing the new version as <filename>cloudstack-agent</filename>.</para>
<programlisting language="Bash">$ sudo yum upgrade cloud-agent</programlisting>
<para>During the installation of <filename>cloudstack-agent</filename>, the RPM will copy your <filename>agent.properties</filename>, <filename>log4j-cloud.xml</filename>, and <filename>environment.properties</filename> from <filename>/etc/cloud/agent</filename> to <filename>/etc/cloudstack/agent</filename>.</para>
</listitem>
<listitem>
<para>Verify that the file <filename>/etc/cloudstack/agent/environment.properties</filename> has a line that reads:</para>
<programlisting language="Bash">paths.script=/usr/share/cloudstack-common</programlisting>
<para>If not, add the line.</para>
</listitem>
<listitem>
<para>Restart the agent:</para>
<programlisting language="Bash">
service cloud-agent stop
killall jsvc
service cloudstack-agent start
</programlisting>
</listitem>
</orderedlist>
</listitem>
<listitem id="correct-components-xml-302">
<para>If you have made changes to your copy of
<filename>/etc/cloud/management/components.xml</filename> the changes will be
preserved in the upgrade. However, you need to do the following steps to place these
@ -4882,16 +4912,107 @@ under the License.
the community provided yum/apt repositories to gain access to the &PRODUCT; binaries.
</para>
</listitem>
<listitem>
<para> After you have configured an appropriate yum or apt repository, you may execute the
one of the following commands as appropriate for your environment in order to upgrade
&PRODUCT;: <programlisting><prompt>#</prompt> <command>yum</command> update cloud-*</programlisting>
<programlisting><prompt>#</prompt> <command>apt-get</command> update
<prompt>#</prompt> <command>apt-get</command> upgrade cloud-*</programlisting>
</para>
<para>You will, of course, have to agree to the changes suggested by Yum or APT.</para>
<listitem id="upgrade-deb-packages-22">
<para>If you are using Ubuntu, follow this procedure to upgrade your packages. If not, skip to step <xref linkend="upgrade-rpm-packages-22" />.</para>
<note><title>Community Packages</title>
<para>This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and APT repository, substitute your own URL for the ones used in these examples.</para>
</note>
<orderedlist id="debsteps-22">
<listitem>
<para>The first order of business will be to change the sources list for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.)</para>
<para>Start by opening <filename>/etc/apt/sources.list.d/cloudstack.list</filename> on any systems that have &PRODUCT; packages installed.</para>
<para>This file should have one line, which contains:</para>
<programlisting language="Bash">deb http://cloudstack.apt-get.eu/ubuntu precise 4.0</programlisting>
<para>We'll change it to point to the new package repository:</para>
<programlisting language="Bash">deb http://cloudstack.apt-get.eu/ubuntu precise 4.1</programlisting>
<para>If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository.</para>
</listitem>
<listitem>
<para>Now update your apt package list:</para>
<programlisting language="Bash">$ sudo apt-get update</programlisting>
</listitem>
<listitem id="deb-master-22">
<para>Now that you have the repository configured, it's time to install the <filename>cloudstack-management</filename> package. This will pull in any other dependencies you need.</para>
<programlisting language="Bash">$ sudo apt-get install cloudstack-management</programlisting>
</listitem>
<listitem id="kvm-agent-deb-22">
<para>You will need to manually install the <filename>cloudstack-agent</filename> package:</para>
<programlisting language="Bash">$ sudo apt-get install cloudstack-agent</programlisting>
<para>During the installation of <filename>cloudstack-agent</filename>, APT will copy your <filename>agent.properties</filename>, <filename>log4j-cloud.xml</filename>, and <filename>environment.properties</filename> from <filename>/etc/cloud/agent</filename> to <filename>/etc/cloudstack/agent</filename>.</para>
<para>When prompted whether you wish to keep your configuration, say Yes.</para>
</listitem>
<listitem>
<para>Verify that the file <filename>/etc/cloudstack/agent/environment.properties</filename> has a line that reads:</para>
<programlisting language="Bash">paths.script=/usr/share/cloudstack-common</programlisting>
<para>If not, add the line.</para>
</listitem>
<listitem>
<para>Restart the agent:</para>
<programlisting language="Bash">
service cloud-agent stop
killall jsvc
service cloudstack-agent start
</programlisting>
</listitem>
<listitem>
<para>During the upgrade, <filename>log4j-cloud.xml</filename> was simply copied over, so the logs will continue to be added to <filename>/var/log/cloud/agent/agent.log</filename>. There's nothing <emphasis>wrong</emphasis> with this, but if you prefer to be consistent, you can change this by copying over the sample configuration file:</para>
<programlisting language="Bash">
cd /etc/cloudstack/agent
mv log4j-cloud.xml.dpkg-dist log4j-cloud.xml
service cloudstack-agent restart
</programlisting>
</listitem>
<listitem>
<para>Once the agent is running, you can uninstall the old cloud-* packages from your system:</para>
<programlisting language="Bash">sudo dpkg --purge cloud-agent</programlisting>
</listitem>
</orderedlist>
</listitem>
<listitem>
<listitem id="upgrade-rpm-packages-22">
<para>If you are using CentOS or RHEL, follow this procedure to upgrade your packages. If not, skip to step <xref linkend="correct-components-xml-22" />.</para>
<note><title>Community Packages</title>
<para>This section assumes you're using the community supplied packages for &PRODUCT;. If you've created your own packages and yum repository, substitute your own URL for the ones used in these examples.</para>
</note>
<orderedlist id="rpmsteps-22">
<listitem>
<para>The first order of business will be to change the yum repository for each system with &PRODUCT; packages. This means all management servers, and any hosts that have the KVM agent. (No changes should be necessary for hosts that are running VMware or Xen.)</para>
<para>Start by opening <filename>/etc/yum.repos.d/cloudstack.repo</filename> on any systems that have &PRODUCT; packages installed.</para>
<para>This file should have content similar to the following:</para>
<programlisting language="Bash">
[apache-cloudstack]
name=Apache CloudStack
baseurl=http://cloudstack.apt-get.eu/rhel/4.0/
enabled=1
gpgcheck=0
</programlisting>
<para>If you are using the community provided package repository, change the baseurl to http://cloudstack.apt-get.eu/rhel/4.1/</para>
<para>If you're using your own package repository, change this line to read as appropriate for your 4.1.0 repository.</para>
</listitem>
<listitem id="rpm-master-22">
<para>Now that you have the repository configured, it's time to install the <filename>cloudstack-management</filename> package by upgrading the older <filename>cloud-client</filename> package.</para>
<programlisting language="Bash">$ sudo yum upgrade cloud-client</programlisting>
</listitem>
<listitem id="kvm-agent-rpm-22">
<para>For KVM hosts, you will need to upgrade the <filename>cloud-agent</filename> package, similarly installing the new version as <filename>cloudstack-agent</filename>.</para>
<programlisting language="Bash">$ sudo yum upgrade cloud-agent</programlisting>
<para>During the installation of <filename>cloudstack-agent</filename>, the RPM will copy your <filename>agent.properties</filename>, <filename>log4j-cloud.xml</filename>, and <filename>environment.properties</filename> from <filename>/etc/cloud/agent</filename> to <filename>/etc/cloudstack/agent</filename>.</para>
</listitem>
<listitem>
<para>Verify that the file <filename>/etc/cloudstack/agent/environment.properties</filename> has a line that reads:</para>
<programlisting language="Bash">paths.script=/usr/share/cloudstack-common</programlisting>
<para>If not, add the line.</para>
</listitem>
<listitem>
<para>Restart the agent:</para>
<programlisting language="Bash">
service cloud-agent stop
killall jsvc
service cloudstack-agent start
</programlisting>
</listitem>
</orderedlist>
</listitem>
<listitem id="correct-components-xml-22">
<para>If you have made changes to your existing copy of the file components.xml in your
previous-version CloudStack installation, the changes will be preserved in the upgrade.
However, you need to do the following steps to place these changes in a new version of

View File

@ -125,7 +125,7 @@ fi
# Define other required variables
CATALINA_PID="/var/run/$NAME.pid"
BOOTSTRAP_CLASS=org.apache.catalina.startup.Bootstrap
JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar:/etc/cloudstack/management"
JSVC_CLASSPATH="/usr/share/java/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar:/etc/cloudstack/management:/usr/share/cloudstack-management/setup"
# Look for Java Secure Sockets Extension (JSSE) JARs
if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then

View File

@ -57,6 +57,6 @@ SYSCONFDIR=/etc
SYSTEMCLASSPATH=
SYSTEMJARS=
USAGECLASSPATH=
USAGELOG=/var/log/cloudstack/usage
USAGELOG=/var/log/cloudstack/usage/usage.log
USAGESYSCONFDIR=/etc/cloudstack/usage
PACKAGE=cloudstack

View File

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

16
pom.xml
View File

@ -237,6 +237,22 @@
<defaultGoal>install</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>perform</goal>
</goals>
<configuration>
<pomFileName>pom.xml</pomFileName>
</configuration>
</execution>
</executions>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>

View File

@ -379,7 +379,7 @@ public class ApiResponseHelper implements ResponseGenerator {
populateDomain(resourceLimitResponse, accountTemp.getDomainId());
}
resourceLimitResponse.setResourceType(Integer.valueOf(limit.getType().getOrdinal()).toString());
if(limit.getType() == ResourceType.primary_storage || limit.getType() == ResourceType.secondary_storage) {
if((limit.getType() == ResourceType.primary_storage || limit.getType() == ResourceType.secondary_storage) && limit.getMax() >= 0) {
resourceLimitResponse.setMax((long) Math.ceil(limit.getMax()/ResourceType.bytesToGiB));
} else {
resourceLimitResponse.setMax(limit.getMax());
@ -3664,8 +3664,13 @@ public class ApiResponseHelper implements ResponseGenerator {
response.setName(group.getName());
response.setType(group.getType());
response.setDescription(group.getDescription());
// response.setDomainId(account.)
Domain domain = ApiDBUtils.findDomainById(account.getDomainId());
if (domain != null) {
response.setDomainId(domain.getUuid());
response.setDomainName(domain.getName());
}
response.setObjectName("affinitygroup");
return response;
}

View File

@ -25,12 +25,9 @@ import java.util.Set;
import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
import org.apache.cloudstack.affinity.AffinityGroupVO;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
@ -111,7 +108,6 @@ import com.cloud.api.query.vo.UserAccountJoinVO;
import com.cloud.api.query.vo.UserVmJoinVO;
import com.cloud.api.query.vo.VolumeJoinVO;
import com.cloud.configuration.dao.ConfigurationDao;
import com.cloud.dc.DataCenterVO;
import com.cloud.domain.Domain;
import com.cloud.domain.DomainVO;
import com.cloud.domain.dao.DomainDao;
@ -124,9 +120,9 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.security.SecurityGroupVMMapVO;
import com.cloud.network.security.dao.SecurityGroupVMMapDao;
import com.cloud.org.Grouping;
import com.cloud.projects.ProjectInvitation;
import com.cloud.projects.Project.ListProjectResourcesCriteria;
import com.cloud.projects.Project;
import com.cloud.projects.Project.ListProjectResourcesCriteria;
import com.cloud.projects.ProjectInvitation;
import com.cloud.projects.ProjectManager;
import com.cloud.projects.dao.ProjectAccountDao;
import com.cloud.projects.dao.ProjectDao;
@ -142,10 +138,8 @@ import com.cloud.user.dao.AccountDao;
import com.cloud.utils.DateUtil;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
import com.cloud.utils.component.Manager;
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.db.Filter;
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;
@ -1699,6 +1693,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);
}

View File

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

View File

@ -63,6 +63,7 @@ public class AffinityGroupJoinDaoImpl extends GenericDaoBase<AffinityGroupJoinVO
agResponse.setId(vag.getUuid());
agResponse.setName(vag.getName());
agResponse.setDescription(vag.getDescription());
agResponse.setType(vag.getType());
ApiResponseHelper.populateOwner(agResponse, vag);

View File

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

View File

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

View File

@ -36,6 +36,9 @@ public class AffinityGroupJoinVO extends BaseViewVO implements ControlledViewEnt
@Column(name="name")
private String name;
@Column(name = "type")
private String type;
@Column(name = "description")
private String description;
@ -114,6 +117,14 @@ public class AffinityGroupJoinVO extends BaseViewVO implements ControlledViewEnt
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public long getAccountId() {
return accountId;

View File

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

View File

@ -2445,10 +2445,6 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
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");
@ -2456,6 +2452,8 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService {
}
}
_physicalNetworkDao.update(id, network);
return network;
}

View File

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

View File

@ -292,7 +292,6 @@ public class IPAddressVO implements IpAddress {
return vpcId;
}
@Override
public void setVpcId(Long vpcId) {
this.vpcId = vpcId;
}
@ -302,7 +301,6 @@ public class IPAddressVO implements IpAddress {
return vmIp;
}
@Override
public void setVmIp(String vmIp) {
this.vmIp = vmIp;
}

View File

@ -876,8 +876,8 @@ public class VirtualRouterElement extends AdapterBase implements VirtualRouterEl
if (publicNetwork) {
routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);
} else {
Long podId = dest.getPod().getId();
if (isPodBased) {
Long podId = dest.getPod().getId();
routers = _routerDao.listByNetworkAndPodAndRole(network.getId(), podId, Role.VIRTUAL_ROUTER);
} else {
routers = _routerDao.listByNetworkAndRole(network.getId(), Role.VIRTUAL_ROUTER);

View File

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

View File

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

View File

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

View File

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

View File

@ -107,7 +107,7 @@ public class AffinityGroupVO implements AffinityGroup {
@Override
public String toString() {
StringBuilder buf = new StringBuilder("AffinityGroup[");
buf.append(id).append("|").append(name).append("|").append(type).append("]");
buf.append(uuid).append("]");
return buf.toString();
}

View File

@ -279,148 +279,7 @@ 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');
DROP VIEW IF EXISTS `cloud`.`account_view`;
CREATE VIEW `cloud`.`account_view` AS
select
account.id,
account.uuid,
account.account_name,
account.type,
account.state,
account.removed,
account.cleanup_needed,
account.network_domain,
domain.id domain_id,
domain.uuid domain_uuid,
domain.name domain_name,
domain.path domain_path,
data_center.id data_center_id,
data_center.uuid data_center_uuid,
data_center.name data_center_name,
account_netstats_view.bytesReceived,
account_netstats_view.bytesSent,
vmlimit.max vmLimit,
vmcount.count vmTotal,
runningvm.vmcount runningVms,
stoppedvm.vmcount stoppedVms,
iplimit.max ipLimit,
ipcount.count ipTotal,
free_ip_view.free_ip ipFree,
volumelimit.max volumeLimit,
volumecount.count volumeTotal,
snapshotlimit.max snapshotLimit,
snapshotcount.count snapshotTotal,
templatelimit.max templateLimit,
templatecount.count templateTotal,
vpclimit.max vpcLimit,
vpccount.count vpcTotal,
projectlimit.max projectLimit,
projectcount.count projectTotal,
networklimit.max networkLimit,
networkcount.count networkTotal,
cpulimit.max cpuLimit,
cpucount.count cpuTotal,
memorylimit.max memoryLimit,
memorycount.count memoryTotal,
primary_storage_limit.max primaryStorageLimit,
primary_storage_count.count primaryStorageTotal,
secondary_storage_limit.max secondaryStorageLimit,
secondary_storage_count.count secondaryStorageTotal,
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`.`free_ip_view`,
`cloud`.`account`
inner join
`cloud`.`domain` ON account.domain_id = domain.id
left join
`cloud`.`data_center` ON account.default_zone_id = data_center.id
left join
`cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id
left join
`cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id
and vmlimit.type = 'user_vm'
left join
`cloud`.`resource_count` vmcount ON account.id = vmcount.account_id
and vmcount.type = 'user_vm'
left join
`cloud`.`account_vmstats_view` runningvm ON account.id = runningvm.account_id
and runningvm.state = 'Running'
left join
`cloud`.`account_vmstats_view` stoppedvm ON account.id = stoppedvm.account_id
and stoppedvm.state = 'Stopped'
left join
`cloud`.`resource_limit` iplimit ON account.id = iplimit.account_id
and iplimit.type = 'public_ip'
left join
`cloud`.`resource_count` ipcount ON account.id = ipcount.account_id
and ipcount.type = 'public_ip'
left join
`cloud`.`resource_limit` volumelimit ON account.id = volumelimit.account_id
and volumelimit.type = 'volume'
left join
`cloud`.`resource_count` volumecount ON account.id = volumecount.account_id
and volumecount.type = 'volume'
left join
`cloud`.`resource_limit` snapshotlimit ON account.id = snapshotlimit.account_id
and snapshotlimit.type = 'snapshot'
left join
`cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id
and snapshotcount.type = 'snapshot'
left join
`cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id
and templatelimit.type = 'template'
left join
`cloud`.`resource_count` templatecount ON account.id = templatecount.account_id
and templatecount.type = 'template'
left join
`cloud`.`resource_limit` vpclimit ON account.id = vpclimit.account_id
and vpclimit.type = 'vpc'
left join
`cloud`.`resource_count` vpccount ON account.id = vpccount.account_id
and vpccount.type = 'vpc'
left join
`cloud`.`resource_limit` projectlimit ON account.id = projectlimit.account_id
and projectlimit.type = 'project'
left join
`cloud`.`resource_count` projectcount ON account.id = projectcount.account_id
and projectcount.type = 'project'
left join
`cloud`.`resource_limit` networklimit ON account.id = networklimit.account_id
and networklimit.type = 'network'
left join
`cloud`.`resource_count` networkcount ON account.id = networkcount.account_id
and networkcount.type = 'network'
left join
`cloud`.`resource_limit` cpulimit ON account.id = cpulimit.account_id
and cpulimit.type = 'cpu'
left join
`cloud`.`resource_count` cpucount ON account.id = cpucount.account_id
and cpucount.type = 'cpu'
left join
`cloud`.`resource_limit` memorylimit ON account.id = memorylimit.account_id
and memorylimit.type = 'memory'
left join
`cloud`.`resource_count` memorycount ON account.id = memorycount.account_id
and memorycount.type = 'memory'
left join
`cloud`.`resource_limit` primary_storage_limit ON account.id = primary_storage_limit.account_id
and primary_storage_limit.type = 'primary_storage'
left join
`cloud`.`resource_count` primary_storage_count ON account.id = primary_storage_count.account_id
and primary_storage_count.type = 'primary_storage'
left join
`cloud`.`resource_limit` secondary_storage_limit ON account.id = secondary_storage_limit.account_id
and secondary_storage_limit.type = 'secondary_storage'
left join
`cloud`.`resource_count` secondary_storage_count ON account.id = secondary_storage_count.account_id
and secondary_storage_count.type = 'secondary_storage'
left join
`cloud`.`async_job` ON async_job.instance_id = account.id
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;
@ -653,6 +512,7 @@ CREATE VIEW `cloud`.`affinity_group_view` AS
select
affinity_group.id id,
affinity_group.name name,
affinity_group.type type,
affinity_group.description description,
affinity_group.uuid uuid,
account.id account_id,
@ -720,3 +580,196 @@ ALTER TABLE `cloud`.`network_offerings` ADD COLUMN `eip_associate_public_ip` int
-- 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
account.id,
account.uuid,
account.account_name,
account.type,
account.state,
account.removed,
account.cleanup_needed,
account.network_domain,
account.default,
domain.id domain_id,
domain.uuid domain_uuid,
domain.name domain_name,
domain.path domain_path,
data_center.id data_center_id,
data_center.uuid data_center_uuid,
data_center.name data_center_name,
account_netstats_view.bytesReceived,
account_netstats_view.bytesSent,
vmlimit.max vmLimit,
vmcount.count vmTotal,
runningvm.vmcount runningVms,
stoppedvm.vmcount stoppedVms,
iplimit.max ipLimit,
ipcount.count ipTotal,
free_ip_view.free_ip ipFree,
volumelimit.max volumeLimit,
volumecount.count volumeTotal,
snapshotlimit.max snapshotLimit,
snapshotcount.count snapshotTotal,
templatelimit.max templateLimit,
templatecount.count templateTotal,
vpclimit.max vpcLimit,
vpccount.count vpcTotal,
projectlimit.max projectLimit,
projectcount.count projectTotal,
networklimit.max networkLimit,
networkcount.count networkTotal,
cpulimit.max cpuLimit,
cpucount.count cpuTotal,
memorylimit.max memoryLimit,
memorycount.count memoryTotal,
primary_storage_limit.max primaryStorageLimit,
primary_storage_count.count primaryStorageTotal,
secondary_storage_limit.max secondaryStorageLimit,
secondary_storage_count.count secondaryStorageTotal,
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`.`free_ip_view`,
`cloud`.`account`
inner join
`cloud`.`domain` ON account.domain_id = domain.id
left join
`cloud`.`data_center` ON account.default_zone_id = data_center.id
left join
`cloud`.`account_netstats_view` ON account.id = account_netstats_view.account_id
left join
`cloud`.`resource_limit` vmlimit ON account.id = vmlimit.account_id
and vmlimit.type = 'user_vm'
left join
`cloud`.`resource_count` vmcount ON account.id = vmcount.account_id
and vmcount.type = 'user_vm'
left join
`cloud`.`account_vmstats_view` runningvm ON account.id = runningvm.account_id
and runningvm.state = 'Running'
left join
`cloud`.`account_vmstats_view` stoppedvm ON account.id = stoppedvm.account_id
and stoppedvm.state = 'Stopped'
left join
`cloud`.`resource_limit` iplimit ON account.id = iplimit.account_id
and iplimit.type = 'public_ip'
left join
`cloud`.`resource_count` ipcount ON account.id = ipcount.account_id
and ipcount.type = 'public_ip'
left join
`cloud`.`resource_limit` volumelimit ON account.id = volumelimit.account_id
and volumelimit.type = 'volume'
left join
`cloud`.`resource_count` volumecount ON account.id = volumecount.account_id
and volumecount.type = 'volume'
left join
`cloud`.`resource_limit` snapshotlimit ON account.id = snapshotlimit.account_id
and snapshotlimit.type = 'snapshot'
left join
`cloud`.`resource_count` snapshotcount ON account.id = snapshotcount.account_id
and snapshotcount.type = 'snapshot'
left join
`cloud`.`resource_limit` templatelimit ON account.id = templatelimit.account_id
and templatelimit.type = 'template'
left join
`cloud`.`resource_count` templatecount ON account.id = templatecount.account_id
and templatecount.type = 'template'
left join
`cloud`.`resource_limit` vpclimit ON account.id = vpclimit.account_id
and vpclimit.type = 'vpc'
left join
`cloud`.`resource_count` vpccount ON account.id = vpccount.account_id
and vpccount.type = 'vpc'
left join
`cloud`.`resource_limit` projectlimit ON account.id = projectlimit.account_id
and projectlimit.type = 'project'
left join
`cloud`.`resource_count` projectcount ON account.id = projectcount.account_id
and projectcount.type = 'project'
left join
`cloud`.`resource_limit` networklimit ON account.id = networklimit.account_id
and networklimit.type = 'network'
left join
`cloud`.`resource_count` networkcount ON account.id = networkcount.account_id
and networkcount.type = 'network'
left join
`cloud`.`resource_limit` cpulimit ON account.id = cpulimit.account_id
and cpulimit.type = 'cpu'
left join
`cloud`.`resource_count` cpucount ON account.id = cpucount.account_id
and cpucount.type = 'cpu'
left join
`cloud`.`resource_limit` memorylimit ON account.id = memorylimit.account_id
and memorylimit.type = 'memory'
left join
`cloud`.`resource_count` memorycount ON account.id = memorycount.account_id
and memorycount.type = 'memory'
left join
`cloud`.`resource_limit` primary_storage_limit ON account.id = primary_storage_limit.account_id
and primary_storage_limit.type = 'primary_storage'
left join
`cloud`.`resource_count` primary_storage_count ON account.id = primary_storage_count.account_id
and primary_storage_count.type = 'primary_storage'
left join
`cloud`.`resource_limit` secondary_storage_limit ON account.id = secondary_storage_limit.account_id
and secondary_storage_limit.type = 'secondary_storage'
left join
`cloud`.`resource_count` secondary_storage_count ON account.id = secondary_storage_count.account_id
and secondary_storage_count.type = 'secondary_storage'
left join
`cloud`.`async_job` ON async_job.instance_id = account.id
and async_job.instance_type = 'Account'
and async_job.job_status = 0;

View File

@ -49,7 +49,7 @@ class Services:
"endip": "10.102.197.73",
"zoneid": "1",
"podid": "",
"vlan": "101",
"vlan": "4444",
}
class TesDedicatePublicIPRange(cloudstackTestCase):

View File

@ -17,7 +17,7 @@
# under the License.
version='TESTBUILD'
sourcedir=~/incubator-cloudstack/
sourcedir=~/cloudstack/
outputdir=~/cs-asf-build/
branch='master'
tag='no'

View File

@ -5,9 +5,9 @@
# 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
@ -22,16 +22,20 @@ import hmac
import hashlib
import time
import cloudstackException
from cloudstackAPI import *
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,
scheme='http', path='client/api'):
""" Connections to make API calls to the cloudstack management server
"""
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
@ -42,16 +46,18 @@ class cloudConnection(object):
self.asyncTimeout = asyncTimeout
self.auth = True
if port == 8096 or \
(self.apiKey == None and self.securityKey == None):
(self.apiKey is None and self.securityKey is 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)
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)
return cloudConnection(self.mgtSvr, self.port, self.apiKey,
self.securityKey, self.asyncTimeout,
self.logging, self.protocol, self.path)
def poll(self, jobid, response):
"""
@ -68,16 +74,19 @@ class cloudConnection(object):
asyncResonse = self.marvin_request(cmd, response_type=response)
if asyncResonse.jobstatus == 2:
raise cloudstackException.cloudstackAPIException("asyncquery", asyncResonse.jobresult)
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)
raise cloudstackException.cloudstackAPIException(
"asyncquery", "Async job timeout %s" % jobid)
def sign(self, payload):
"""
@ -90,19 +99,26 @@ class cloudConnection(object):
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")]
[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)
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
Makes requests using auth or over integration port
@param command: cloudstack API command name
eg: deployVirtualMachineCommand
@param auth: Authentication (apikey,secretKey) => True
else False for integration.api.port
@param payload: GET param data composed as a dictionary
of key,value pairs
@param data: POST data as a dictionary
@return:
"""
@ -114,23 +130,24 @@ class cloudConnection(object):
signature = self.sign(payload)
payload["signature"] = signature
try:
if data:
response = requests.get(self.baseurl, params=payload, data=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))
self.logging.debug("Connection refused. Reason: %s" %
(self.baseurl, c))
raise c
except HTTPError, h:
self.logging.debug("Server returned error code: %s"%h)
self.logging.debug("Server returned error code: %s" % h)
raise h
except Timeout, t:
self.logging.debug("Connection timed out with %s"%t)
self.logging.debug("Connection timed out with %s" % t)
raise t
except RequestException,r:
self.logging.debug("Error returned by server %s"%r)
except RequestException, r:
self.logging.debug("Error returned by server %s" % r)
raise r
else:
return response
@ -144,7 +161,8 @@ class cloudConnection(object):
requests = {}
required = []
for attribute in dir(cmd):
if attribute != "__doc__" and attribute != "__init__" and attribute != "__module__":
if attribute != "__doc__" and attribute != "__init__" and \
attribute != "__module__":
if attribute == "isAsync":
isAsync = getattr(cmd, attribute)
elif attribute == "required":
@ -155,7 +173,8 @@ class cloudConnection(object):
cmdname = cmd.__class__.__name__.replace("Cmd", "")
for requiredPara in required:
if requests[requiredPara] is None:
raise cloudstackException.cloudstackAPIException(cmdname, "%s is required"%requiredPara)
raise cloudstackException.cloudstackAPIException(
cmdname, "%s is required" % requiredPara)
for param, value in requests.items():
if value is None:
requests.pop(param)
@ -169,8 +188,8 @@ class cloudConnection(object):
requests.pop(param)
i = 0
for val in value:
for k,v in val.iteritems():
requests["%s[%d].%s"%(param,i,k)] = v
for k, v in val.iteritems():
requests["%s[%d].%s" % (param, i, k)] = v
i = i + 1
return cmdname, isAsync, requests
@ -184,14 +203,17 @@ class cloudConnection(object):
@return:
"""
cmdname, isAsync, payload = self.sanitize_command(cmd)
self.logging.info("sending command: %s %s"%(cmdname, str(payload)))
self.logging.info("sending command: %s %s" % (cmdname, str(payload)))
if self.auth:
response = self.request(cmdname, auth=True, payload=payload, data=data)
response = self.request(
cmdname, auth=True, payload=payload, data=data)
else:
response = self.request(cmdname, auth=False, payload=payload, data=data)
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)
self.logging.info("Request: %s Response: %s" %
(response.url, response.text))
response = jsonHelper.getResultObj(response.json(), response_type)
if isAsync == "false":
return response

View File

@ -4400,6 +4400,17 @@ Dialogs*/
display: block;
clear: both;
font-size: 11px;
float: left;
height: 10px;
max-width: 287px;
margin-top: 1px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dashboard.admin .dashboard-container.sub.alerts ul li p br {
display: none;
}
/*** User*/

View File

@ -1682,9 +1682,10 @@ under the License.
<script type="text/javascript" src="scripts/ui-custom/projectSelect.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/ui-custom/zoneFilter.js?t=<%=now%>"></script>
<!-- Plugins -->
<script type="text/javascript" src="scripts/ui-custom/plugins.js?t=<%=now%>"></script>
<!-- Plugin/module API -->
<script type="text/javascript" src="scripts/ui-custom/pluginListing.js?t=<%=now%>"></script>
<script type="text/javascript" src="plugins/plugins.js?t=<%=now%>"></script>
<script type="text/javascript" src="modules/modules.js?t=<%=now%>"></script>
<script type="text/javascript" src="scripts/plugins.js?t=<%=now%>"></script>
</body>
</html>

20
ui/modules/modules.js Normal file
View File

@ -0,0 +1,20 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
(function($, cloudStack) {
cloudStack.modules = [
];
}(jQuery, cloudStack));

View File

@ -15,6 +15,10 @@
// specific language governing permissions and limitations
// under the License.
(function($, cloudStack, require) {
if (!cloudStack.pluginAPI) {
cloudStack.pluginAPI = {};
}
var loadCSS = function(path) {
var $link = $('<link>');
@ -27,50 +31,69 @@
$('head').append($link);
};
var pluginAPI = {
pollAsyncJob: pollAsyncJobResult,
apiCall: function(command, args) {
$.ajax({
url: createURL(command),
data: args.data,
success: args.success,
error: function(json) {
args.error(parseXMLHttpResponse(json));
}
})
},
addSection: function(section) {
cloudStack.sections[section.id] = $.extend(section, {
customIcon: 'plugins/' + section.id + '/icon.png'
});
},
extend: function(obj) {
$.extend(true, cloudStack, obj);
$.extend(cloudStack.pluginAPI, {
ui: {
pollAsyncJob: pollAsyncJobResult,
apiCall: function(command, args) {
$.ajax({
url: createURL(command),
data: args.data,
success: args.success,
error: function(json) {
args.error(parseXMLHttpResponse(json));
}
});
},
addSection: function(section) {
cloudStack.sections[section.id] = $.extend(section, {
customIcon: 'plugins/' + section.id + '/icon.png'
});
},
extend: function(obj) {
$.extend(true, cloudStack, obj);
}
}
};
});
cloudStack.sections.plugins = {
title: 'label.plugins',
show: cloudStack.uiCustom.plugins
show: cloudStack.uiCustom.pluginListing
};
// Load plugins
$(cloudStack.plugins).map(function(index, pluginID) {
var basePath = 'plugins/' + pluginID + '/';
var pluginJS = basePath + pluginID + '.js';
var configJS = basePath + 'config.js';
var pluginCSS = basePath + pluginID + '.css';
// Load
$(['modules', 'plugins']).each(function() {
var type = this;
var paths = $(cloudStack[type]).map(function(index, id) {
return type + '/' + id + '/' + id;
}).toArray();
require([pluginJS], function() {
require([configJS]);
loadCSS(pluginCSS);
// Load modules
require(
paths,
function() {
$(cloudStack[type]).map(function(index, id) {
var basePath = type + '/' + id + '/';
var css = basePath + id + '.css';
var configJS = type == 'plugins' ? basePath + 'config' : null;
// Execute plugin
cloudStack.plugins[pluginID]({
ui: pluginAPI
});
});
if (configJS) {
// Load config metadata
require([configJS]);
}
// Load CSS
// Execute module
cloudStack[type][id](
$.extend(true, {}, cloudStack.pluginAPI, {
pluginAPI: {
extend: function(api) {
cloudStack.pluginAPI[id] = api;
}
}
})
);
loadCSS(css);
});
}
);
});
}(jQuery, cloudStack, require));

View File

@ -95,7 +95,7 @@
}
};
cloudStack.uiCustom.plugins = function() {
cloudStack.uiCustom.pluginListing = function() {
var plugins = cloudStack.plugins;
return elems.pluginListing({

View File

@ -3053,7 +3053,7 @@
args.data.returnedGuestNetwork.returnedVlanIpRange = json.createvlaniprangeresponse.vlan;
//when hypervisor is BareMetal (begin)
if(args.data.cluster.hypervisor == "BareMetal") {
if(args.data.zone.hypervisor == "BareMetal") {
alert('Zone creation is completed. Please refresh this page.');
}
else {