mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
Conflicts: api/src/com/cloud/hypervisor/Hypervisor.java build/build-cloud.xml
This commit is contained in:
commit
08ae56d360
2
.gitignore
vendored
2
.gitignore
vendored
@ -14,3 +14,5 @@ dist/
|
|||||||
*.bak
|
*.bak
|
||||||
cloud-*.tar.bz2
|
cloud-*.tar.bz2
|
||||||
*.log
|
*.log
|
||||||
|
*.pyc
|
||||||
|
build.number
|
||||||
|
|||||||
@ -24,7 +24,8 @@ public class Hypervisor {
|
|||||||
Xen,
|
Xen,
|
||||||
XenServer,
|
XenServer,
|
||||||
KVM,
|
KVM,
|
||||||
VMware;
|
VmWare,
|
||||||
|
VirtualBox,
|
||||||
|
Parralels;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ import com.cloud.user.OwnedBy;
|
|||||||
|
|
||||||
|
|
||||||
public interface Volume extends PartOf, OwnedBy, BasedOn {
|
public interface Volume extends PartOf, OwnedBy, BasedOn {
|
||||||
enum VolumeType {UNKNOWN, ROOT, SWAP, DATADISK};
|
enum VolumeType {UNKNOWN, ROOT, SWAP, DATADISK, ISO};
|
||||||
|
|
||||||
enum MirrorState {NOT_MIRRORED, ACTIVE, DEFUNCT};
|
enum MirrorState {NOT_MIRRORED, ACTIVE, DEFUNCT};
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ import com.cloud.storage.Storage.FileSystem;
|
|||||||
|
|
||||||
public interface VirtualMachineTemplate {
|
public interface VirtualMachineTemplate {
|
||||||
|
|
||||||
public static enum BootloaderType { PyGrub, HVM, External };
|
public static enum BootloaderType { PyGrub, HVM, External, CD };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return id.
|
* @return id.
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import com.cloud.utils.component.Adapter;
|
|||||||
public interface NetworkConcierge extends Adapter {
|
public interface NetworkConcierge extends Adapter {
|
||||||
String getUniqueName();
|
String getUniqueName();
|
||||||
|
|
||||||
Pair<String, NetworkTO> reserve(long vmId, NetworkCharacteristics ch) throws InsufficientVirtualNetworkCapcityException;
|
Pair<String, String> reserve(long vmId, NetworkCharacteristics ch) throws InsufficientVirtualNetworkCapcityException;
|
||||||
|
|
||||||
boolean release(String uniqueName, String uniqueId);
|
boolean release(String uniqueName, String uniqueId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,7 +101,7 @@
|
|||||||
<property name="console-viewer.dist.dir" location="${dist.dir}/console-viewer" />
|
<property name="console-viewer.dist.dir" location="${dist.dir}/console-viewer" />
|
||||||
|
|
||||||
<property name="tools.dir" location="${base.dir}/tools" />
|
<property name="tools.dir" location="${base.dir}/tools" />
|
||||||
<!-- <property name="antcontrib.dir" location="${tools.dir}/tools/ant/apache-ant-1.8.0/lib" />-->
|
<!-- <property name="antcontrib.dir" location="${tools.dir}/tools/ant/apache-ant-1.8.0/lib" />-->
|
||||||
<property name="deploy.dir" location="${build.dir}/deploy" />
|
<property name="deploy.dir" location="${build.dir}/deploy" />
|
||||||
<property name="production.dir" location="${deploy.dir}/production" />
|
<property name="production.dir" location="${deploy.dir}/production" />
|
||||||
<property name="meld.home" location="/usr/local/bin" />
|
<property name="meld.home" location="/usr/local/bin" />
|
||||||
@ -137,7 +137,7 @@
|
|||||||
|
|
||||||
<path id="src.classpath">
|
<path id="src.classpath">
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<path id="thirdparty.classpath">
|
<path id="thirdparty.classpath">
|
||||||
<filelist files="${thirdparty.classpath}" />
|
<filelist files="${thirdparty.classpath}" />
|
||||||
<fileset dir="${thirdparty.dir}" erroronmissingdir="false">
|
<fileset dir="${thirdparty.dir}" erroronmissingdir="false">
|
||||||
@ -176,7 +176,7 @@
|
|||||||
<target name="compile-api" depends="-init, compile-utils" description="Compile the utilities jar that is shared.">
|
<target name="compile-api" depends="-init, compile-utils" description="Compile the utilities jar that is shared.">
|
||||||
<compile-java jar.name="${api.jar}" top.dir="${api.dir}" classpath="api.classpath" />
|
<compile-java jar.name="${api.jar}" top.dir="${api.dir}" classpath="api.classpath" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<path id="core.classpath">
|
<path id="core.classpath">
|
||||||
<path refid="thirdparty.classpath" />
|
<path refid="thirdparty.classpath" />
|
||||||
<path refid="dist.classpath" />
|
<path refid="dist.classpath" />
|
||||||
@ -223,7 +223,6 @@
|
|||||||
<include name="**/*.html" />
|
<include name="**/*.html" />
|
||||||
<include name="**/*.js"/>
|
<include name="**/*.js"/>
|
||||||
<include name="**/*.jsp"/>
|
<include name="**/*.jsp"/>
|
||||||
<include name="**/*.properties"/>
|
|
||||||
<exclude name="**/.classpath" />
|
<exclude name="**/.classpath" />
|
||||||
<exclude name="**/.project" />
|
<exclude name="**/.project" />
|
||||||
</fileset>
|
</fileset>
|
||||||
@ -237,11 +236,15 @@
|
|||||||
<exclude name="**/*.html" />
|
<exclude name="**/*.html" />
|
||||||
<exclude name="**/*.js"/>
|
<exclude name="**/*.js"/>
|
||||||
<exclude name="**/*.jsp"/>
|
<exclude name="**/*.jsp"/>
|
||||||
<exclude name="**/*.properties"/>
|
|
||||||
<exclude name="**/.classpath" />
|
<exclude name="**/.classpath" />
|
||||||
<exclude name="**/.project" />
|
<exclude name="**/.project" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
<copy todir="${client.target.dir}">
|
||||||
|
<fileset dir="${client.dir}/WEB-INF/classes">
|
||||||
|
<include name="**/*.properties"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="build-server" depends="compile-server">
|
<target name="build-server" depends="compile-server">
|
||||||
@ -252,46 +255,41 @@
|
|||||||
<copy todir="${server.dist.dir}/lib">
|
<copy todir="${server.dist.dir}/lib">
|
||||||
<fileset dir="${thirdparty.dir}">
|
<fileset dir="${thirdparty.dir}">
|
||||||
<include name="mysql-connector-java-5.1.7-bin.jar" />
|
<include name="mysql-connector-java-5.1.7-bin.jar" />
|
||||||
<include name="cglib-nodep-2.2.jar" />
|
<include name="cglib-nodep-2.2.jar" />
|
||||||
<include name="gson-1.3.jar" />
|
<include name="gson-1.3.jar" />
|
||||||
<include name="log4j-1.2.15.jar" />
|
<include name="log4j-1.2.15.jar" />
|
||||||
<include name="apache-log4j-extras-1.0.jar" />
|
<include name="apache-log4j-extras-1.0.jar" />
|
||||||
<include name="ehcache-1.5.0.jar" />
|
<include name="ehcache-1.5.0.jar" />
|
||||||
<include name="commons-logging-1.1.1.jar" />
|
<include name="commons-logging-1.1.1.jar" />
|
||||||
<include name="commons-dbcp-1.2.2.jar" />
|
<include name="commons-dbcp-1.2.2.jar" />
|
||||||
<include name="commons-pool-1.4.jar" />
|
<include name="commons-pool-1.4.jar" />
|
||||||
<include name="backport-util-concurrent-3.0.jar" />
|
<include name="backport-util-concurrent-3.0.jar" />
|
||||||
<include name="httpcore-4.0.jar" />
|
<include name="httpcore-4.0.jar" />
|
||||||
<include name="commons-httpclient-3.1.jar" />
|
<include name="commons-httpclient-3.1.jar" />
|
||||||
<include name="commons-codec-1.4.jar" />
|
<include name="commons-codec-1.4.jar" />
|
||||||
<include name="commons-discovery.jar" />
|
<include name="email.jar" />
|
||||||
<include name="email.jar" />
|
<include name="xmlrpc-client-3.1.3.jar" />
|
||||||
<include name="xmlrpc-client-3.1.3.jar" />
|
<include name="xmlrpc-common-3.1.3.jar" />
|
||||||
<include name="xmlrpc-common-3.1.3.jar" />
|
<include name="xenserver-5.5.0-1.jar" />
|
||||||
<include name="xenserver-5.5.0-1.jar" />
|
<include name="ws-commons-util-1.0.2.jar" />
|
||||||
<include name="ws-commons-util-1.0.2.jar" />
|
<include name="trilead-ssh2-build213.jar" />
|
||||||
<include name="trilead-ssh2-build213.jar" />
|
<include name="vmware-apputils.jar" />
|
||||||
|
<include name="vmware-vim.jar" />
|
||||||
|
<include name="vmware-vim25.jar" />
|
||||||
|
<include name="vmware-lib-activation.jar" />
|
||||||
|
<include name="vmware-lib-axis.jar" />
|
||||||
|
<include name="vmware-lib-jaxen-core.jar" />
|
||||||
|
<include name="vmware-lib-jaxen-jdom.jar" />
|
||||||
|
<include name="vmware-lib-jaxrpc.jar" />
|
||||||
|
<include name="vmware-lib-jdom.jar" />
|
||||||
|
<include name="vmware-lib-mailapi.jar" />
|
||||||
|
<include name="vmware-lib-saxpath.jar" />
|
||||||
|
<include name="vmware-lib-smtp.jar" />
|
||||||
|
<include name="vmware-lib-wbem.jar" />
|
||||||
|
<include name="vmware-lib-xalan.jar" />
|
||||||
|
<include name="vmware-lib-xerces.jar" />
|
||||||
|
<include name="vmware-lib-xml-apis.jar" />
|
||||||
</fileset>
|
</fileset>
|
||||||
<fileset dir="${thirdparty.dir}/vmware">
|
|
||||||
<include name="apputils.jar" />
|
|
||||||
<include name="vim.jar" />
|
|
||||||
<include name="vim25.jar" />
|
|
||||||
</fileset>
|
|
||||||
<fileset dir="${thirdparty.dir}/vmware/lib">
|
|
||||||
<include name="activation.jar" />
|
|
||||||
<include name="axis.jar" />
|
|
||||||
<include name="jaxen-core.jar" />
|
|
||||||
<include name="jaxen-jdom.jar" />
|
|
||||||
<include name="jaxrpc.jar" />
|
|
||||||
<include name="jdom.jar" />
|
|
||||||
<include name="mailapi.jar" />
|
|
||||||
<include name="saxpath.jar" />
|
|
||||||
<include name="smtp.jar" />
|
|
||||||
<include name="wbem.jar" />
|
|
||||||
<include name="xalan.jar" />
|
|
||||||
<include name="xerces.jar" />
|
|
||||||
<include name="xml-apis.jar" />
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<copy overwrite="true" todir="${server.dist.dir}/conf">
|
<copy overwrite="true" todir="${server.dist.dir}/conf">
|
||||||
@ -305,12 +303,12 @@
|
|||||||
</filterreader>
|
</filterreader>
|
||||||
</filterchain>
|
</filterchain>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<copy overwrite="true" todir="${server.dist.dir}/conf">
|
<copy overwrite="true" todir="${server.dist.dir}/conf">
|
||||||
<fileset dir="${server.dir}/src/com/cloud/migration">
|
<fileset dir="${server.dir}/src/com/cloud/migration">
|
||||||
<include name="*.xml" />
|
<include name="*.xml" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<path id="console-common.classpath">
|
<path id="console-common.classpath">
|
||||||
@ -344,7 +342,7 @@
|
|||||||
<fileset dir="${thirdparty.dir}">
|
<fileset dir="${thirdparty.dir}">
|
||||||
<include name="log4j-1.2.15.jar" />
|
<include name="log4j-1.2.15.jar" />
|
||||||
<include name="apache-log4j-extras-1.0.jar" />
|
<include name="apache-log4j-extras-1.0.jar" />
|
||||||
<include name="gson-1.3.jar" />
|
<include name="gson-1.3.jar" />
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
@ -518,20 +516,20 @@
|
|||||||
<chmod file="${dist.dir}/deploy-agent.sh" perm="uog+xr" />
|
<chmod file="${dist.dir}/deploy-agent.sh" perm="uog+xr" />
|
||||||
<chmod file="${dist.dir}/deploy-server.sh" perm="uog+xr" />
|
<chmod file="${dist.dir}/deploy-server.sh" perm="uog+xr" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<target name="build-kvm-domr-patch" depends="-init">
|
<target name="build-kvm-domr-patch" depends="-init">
|
||||||
<tar destfile="${dist.dir}/patch.tar">
|
<tar destfile="${dist.dir}/patch.tar">
|
||||||
<tarfileset dir="${base.dir}/patches/kvm" filemode="755">
|
<tarfileset dir="${base.dir}/patches/kvm" filemode="755">
|
||||||
<include name="**/*"/>
|
<include name="**/*"/>
|
||||||
<exclude name="**/.classpath" />
|
<exclude name="**/.classpath" />
|
||||||
<exclude name="**/.project" />
|
<exclude name="**/.project" />
|
||||||
</tarfileset>
|
</tarfileset>
|
||||||
<tarfileset dir="${base.dir}/patches/shared" filemode="755">
|
<tarfileset dir="${base.dir}/patches/shared" filemode="755">
|
||||||
<include name="**/*"/>
|
<include name="**/*"/>
|
||||||
<exclude name="**/.classpath" />
|
<exclude name="**/.classpath" />
|
||||||
<exclude name="**/.project" />
|
<exclude name="**/.project" />
|
||||||
</tarfileset>
|
</tarfileset>
|
||||||
</tar>
|
</tar>
|
||||||
<gzip destfile="${dist.dir}/patch.tgz" src="${dist.dir}/patch.tar"/>
|
<gzip destfile="${dist.dir}/patch.tgz" src="${dist.dir}/patch.tar"/>
|
||||||
<delete file="${dist.dir}/patch.tar"/>
|
<delete file="${dist.dir}/patch.tar"/>
|
||||||
@ -563,8 +561,8 @@
|
|||||||
<!-- set build.number property, stored in eponymous file -->
|
<!-- set build.number property, stored in eponymous file -->
|
||||||
<buildnumber file="${build.dir}/build.number" />
|
<buildnumber file="${build.dir}/build.number" />
|
||||||
<condition property="impl.version" value="${version}.${manual.build.number}" else="${version}.${utc.build.timestamp}">
|
<condition property="impl.version" value="${version}.${manual.build.number}" else="${version}.${utc.build.timestamp}">
|
||||||
<isset property="manual.build.number"/>
|
<isset property="manual.build.number"/>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
<echo message="Build number is ${impl.version}" />
|
<echo message="Build number is ${impl.version}" />
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
|
||||||
#Thu Aug 19 09:21:10 PDT 2010
|
|
||||||
build.number=65
|
|
||||||
@ -135,7 +135,7 @@
|
|||||||
<exclude name="**/*.properties" />
|
<exclude name="**/*.properties" />
|
||||||
</fileset>
|
</fileset>
|
||||||
<classes dir="${client.target.dir}">
|
<classes dir="${client.target.dir}">
|
||||||
<include name="**/resources/*.properties" />
|
<include name="**/resources/*.properties" />
|
||||||
</classes>
|
</classes>
|
||||||
<lib dir="${jar.dir}">
|
<lib dir="${jar.dir}">
|
||||||
<include name="cloud-*.jar" />
|
<include name="cloud-*.jar" />
|
||||||
|
|||||||
@ -125,7 +125,7 @@ except IndexError: e("The first argument must be the license file to use")
|
|||||||
|
|
||||||
if options.all:
|
if options.all:
|
||||||
if len(args) != 0: e("IP addresses cannot be specified if -a is specified")
|
if len(args) != 0: e("IP addresses cannot be specified if -a is specified")
|
||||||
config = cloud_utils.read_properties(cfg)
|
config = read_properties(cfg)
|
||||||
creds = getknownhosts(config["db.cloud.host"],config["db.cloud.username"],config["db.cloud.password"])
|
creds = getknownhosts(config["db.cloud.host"],config["db.cloud.username"],config["db.cloud.password"])
|
||||||
hosts = creds.keys()
|
hosts = creds.keys()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -232,6 +232,9 @@ Requires: %{name}-daemonize
|
|||||||
Requires: /sbin/service
|
Requires: /sbin/service
|
||||||
Requires: /sbin/chkconfig
|
Requires: /sbin/chkconfig
|
||||||
Requires: kvm
|
Requires: kvm
|
||||||
|
%if 0%{?fedora} >= 13
|
||||||
|
Requires: cloud-qemu-system-x86
|
||||||
|
%endif
|
||||||
Requires: libcgroup
|
Requires: libcgroup
|
||||||
Requires: /usr/bin/uuidgen
|
Requires: /usr/bin/uuidgen
|
||||||
Requires: augeas >= 0.7.1
|
Requires: augeas >= 0.7.1
|
||||||
|
|||||||
21
core/src/com/cloud/agent/api/Start2Answer.java
Normal file
21
core/src/com/cloud/agent/api/Start2Answer.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.agent.api;
|
||||||
|
|
||||||
|
public class Start2Answer extends Answer {
|
||||||
|
protected Start2Answer() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Start2Answer(Start2Command cmd, String msg) {
|
||||||
|
super(cmd, false, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Start2Answer(Start2Command cmd, Exception e) {
|
||||||
|
super(cmd, false, e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Start2Answer(Start2Command cmd) {
|
||||||
|
super(cmd, true, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
62
core/src/com/cloud/agent/api/Start2Command.java
Normal file
62
core/src/com/cloud/agent/api/Start2Command.java
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.agent.api;
|
||||||
|
|
||||||
|
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||||
|
|
||||||
|
public class Start2Command extends Command {
|
||||||
|
VirtualMachineTO vm;
|
||||||
|
|
||||||
|
public VirtualMachineTO getVirtualMachine() {
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
long id;
|
||||||
|
String guestIpAddress;
|
||||||
|
String gateway;
|
||||||
|
int ramSize;
|
||||||
|
String imagePath;
|
||||||
|
String guestNetworkId;
|
||||||
|
String guestMacAddress;
|
||||||
|
String vncPassword;
|
||||||
|
String externalVlan;
|
||||||
|
String externalMacAddress;
|
||||||
|
int utilization;
|
||||||
|
int cpuWeight;
|
||||||
|
int cpu;
|
||||||
|
int networkRateMbps;
|
||||||
|
int networkRateMulticastMbps;
|
||||||
|
String hostName;
|
||||||
|
String arch;
|
||||||
|
String isoPath;
|
||||||
|
boolean bootFromISO;
|
||||||
|
String guestOSDescription;
|
||||||
|
|
||||||
|
---->console proxy
|
||||||
|
private ConsoleProxyVO proxy;
|
||||||
|
private int proxyCmdPort;
|
||||||
|
private String vncPort;
|
||||||
|
private String urlPort;
|
||||||
|
private String mgmt_host;
|
||||||
|
private int mgmt_port;
|
||||||
|
private boolean sslEnabled;
|
||||||
|
|
||||||
|
----->abstract
|
||||||
|
protected String vmName;
|
||||||
|
protected String storageHosts[] = new String[2];
|
||||||
|
protected List<VolumeVO> volumes;
|
||||||
|
protected boolean mirroredVols = false;
|
||||||
|
protected BootloaderType bootloader = BootloaderType.PyGrub;
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean executeInSequence() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Start2Command() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,7 +18,6 @@
|
|||||||
package com.cloud.agent.api.to;
|
package com.cloud.agent.api.to;
|
||||||
|
|
||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
import com.cloud.vm.NetworkTO;
|
|
||||||
|
|
||||||
public class HostTO {
|
public class HostTO {
|
||||||
private String guid;
|
private String guid;
|
||||||
|
|||||||
@ -15,7 +15,10 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.cloud.vm;
|
package com.cloud.agent.api.to;
|
||||||
|
|
||||||
|
import com.cloud.network.Network.BroadcastDomainType;
|
||||||
|
import com.cloud.network.Network.TrafficType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transfer object to transfer network settings.
|
* Transfer object to transfer network settings.
|
||||||
@ -28,11 +31,65 @@ public class NetworkTO {
|
|||||||
private String mac;
|
private String mac;
|
||||||
private String dns1;
|
private String dns1;
|
||||||
private String dns2;
|
private String dns2;
|
||||||
private String vlan;
|
private Long vlan;
|
||||||
|
private BroadcastDomainType broadcastType;
|
||||||
|
private TrafficType type;
|
||||||
|
|
||||||
protected NetworkTO() {
|
public NetworkTO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUuid() {
|
||||||
|
return uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUuid(String uuid) {
|
||||||
|
this.uuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getVlan() {
|
||||||
|
return vlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVlan(Long vlan) {
|
||||||
|
this.vlan = vlan;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BroadcastDomainType getBroadcastType() {
|
||||||
|
return broadcastType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBroadcastType(BroadcastDomainType broadcastType) {
|
||||||
|
this.broadcastType = broadcastType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIp(String ip) {
|
||||||
|
this.ip = ip;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNetmask(String netmask) {
|
||||||
|
this.netmask = netmask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGateway(String gateway) {
|
||||||
|
this.gateway = gateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMac(String mac) {
|
||||||
|
this.mac = mac;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDns1(String dns1) {
|
||||||
|
this.dns1 = dns1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDns2(String dns2) {
|
||||||
|
this.dns2 = dns2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(TrafficType type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This constructor is usually for hosts where the other information are not important.
|
* This constructor is usually for hosts where the other information are not important.
|
||||||
*
|
*
|
||||||
@ -56,7 +113,7 @@ public class NetworkTO {
|
|||||||
* @param dns1
|
* @param dns1
|
||||||
* @param dns2
|
* @param dns2
|
||||||
*/
|
*/
|
||||||
public NetworkTO(String ip, String vlan, String netmask, String mac, String gateway, String dns1, String dns2) {
|
public NetworkTO(String ip, Long vlan, String netmask, String mac, String gateway, String dns1, String dns2) {
|
||||||
this.ip = ip;
|
this.ip = ip;
|
||||||
this.netmask = netmask;
|
this.netmask = netmask;
|
||||||
this.mac = mac;
|
this.mac = mac;
|
||||||
@ -89,4 +146,8 @@ public class NetworkTO {
|
|||||||
public String getDns2() {
|
public String getDns2() {
|
||||||
return dns2;
|
return dns2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TrafficType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
36
core/src/com/cloud/agent/api/to/NicTO.java
Normal file
36
core/src/com/cloud/agent/api/to/NicTO.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.agent.api.to;
|
||||||
|
|
||||||
|
public class NicTO extends NetworkTO {
|
||||||
|
int deviceId;
|
||||||
|
Integer controlPort;
|
||||||
|
Integer networkRateMbps;
|
||||||
|
Integer networkRateMulticastMbps;
|
||||||
|
|
||||||
|
public NicTO() {
|
||||||
|
super();
|
||||||
|
controlPort = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(int deviceId) {
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getControlPort() {
|
||||||
|
return controlPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNetworkRateMbps() {
|
||||||
|
return networkRateMbps;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getNetworkRateMulticastMbps() {
|
||||||
|
return networkRateMulticastMbps;
|
||||||
|
}
|
||||||
|
}
|
||||||
173
core/src/com/cloud/agent/api/to/VirtualMachineTO.java
Normal file
173
core/src/com/cloud/agent/api/to/VirtualMachineTO.java
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under the GNU General Public License v3 or later.
|
||||||
|
*
|
||||||
|
* It is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||||
|
* 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.agent.api.to;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||||
|
import com.cloud.vm.VirtualMachine.Type;
|
||||||
|
|
||||||
|
public class VirtualMachineTO {
|
||||||
|
private long id;
|
||||||
|
private String name;
|
||||||
|
private BootloaderType bootloader;
|
||||||
|
Type type;
|
||||||
|
int cpus;
|
||||||
|
Integer weight;
|
||||||
|
Integer utilization;
|
||||||
|
long minRam;
|
||||||
|
long maxRam;
|
||||||
|
String hostName;
|
||||||
|
String arch;
|
||||||
|
String os;
|
||||||
|
String bootArgs;
|
||||||
|
String[] bootupScripts;
|
||||||
|
boolean rebootOnCrash;
|
||||||
|
|
||||||
|
VolumeTO[] disks;
|
||||||
|
NicTO[] nics;
|
||||||
|
|
||||||
|
public VirtualMachineTO() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Type getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BootloaderType getBootloader() {
|
||||||
|
return bootloader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBootloader(BootloaderType bootloader) {
|
||||||
|
this.bootloader = bootloader;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCpus() {
|
||||||
|
return cpus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCpus(int cpus) {
|
||||||
|
this.cpus = cpus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getWeight() {
|
||||||
|
return weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeight(Integer weight) {
|
||||||
|
this.weight = weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUtilization() {
|
||||||
|
return utilization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUtiliziation(Integer utilization) {
|
||||||
|
this.utilization = utilization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMinRam() {
|
||||||
|
return minRam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRam(long minRam, long maxRam) {
|
||||||
|
this.minRam = minRam;
|
||||||
|
this.maxRam = maxRam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getMaxRam() {
|
||||||
|
return maxRam;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHostName() {
|
||||||
|
return hostName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHostName(String hostName) {
|
||||||
|
this.hostName = hostName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArch() {
|
||||||
|
return arch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArch(String arch) {
|
||||||
|
this.arch = arch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOs() {
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOs(String os) {
|
||||||
|
this.os = os;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBootArgs() {
|
||||||
|
return bootArgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBootArgs(Map<String, String> bootParams) {
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
for (Map.Entry<String, String> entry : bootParams.entrySet()) {
|
||||||
|
buf.append(" ").append(entry.getKey()).append("=").append(entry.getValue());
|
||||||
|
}
|
||||||
|
bootArgs = buf.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getBootupScripts() {
|
||||||
|
return bootupScripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBootupScripts(String[] bootupScripts) {
|
||||||
|
this.bootupScripts = bootupScripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public VolumeTO[] getDisks() {
|
||||||
|
return disks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisks(VolumeTO[] disks) {
|
||||||
|
this.disks = disks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NicTO[] getNetworks() {
|
||||||
|
return nics;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNics(NicTO[] nics) {
|
||||||
|
this.nics = nics;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,40 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under the GNU General Public License v3 or later.
|
|
||||||
*
|
|
||||||
* It is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
||||||
* 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 General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package com.cloud.agent.api.to;
|
|
||||||
|
|
||||||
import com.cloud.vm.NetworkTO;
|
|
||||||
import com.cloud.vm.VMInstanceVO;
|
|
||||||
|
|
||||||
public class VmTO {
|
|
||||||
private long id;
|
|
||||||
private String name;
|
|
||||||
NetworkTO[] networks;
|
|
||||||
|
|
||||||
public VmTO() {
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Preferrably NetworkTO is constructed inside the TO objects.
|
|
||||||
// But we're press for time so I'm going to let the conversion
|
|
||||||
// happen outside.
|
|
||||||
public VmTO(VMInstanceVO instance, NetworkTO[] networks) {
|
|
||||||
id = instance.getId();
|
|
||||||
name = instance.getName();
|
|
||||||
this.networks = networks;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -18,12 +18,11 @@
|
|||||||
package com.cloud.agent.api.to;
|
package com.cloud.agent.api.to;
|
||||||
|
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.Storage.StorageResourceType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.VMTemplateStoragePoolVO;
|
import com.cloud.storage.VMTemplateStoragePoolVO;
|
||||||
import com.cloud.storage.Volume;
|
import com.cloud.storage.Volume;
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.storage.VolumeVO;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
|
||||||
|
|
||||||
|
|
||||||
public class VolumeTO {
|
public class VolumeTO {
|
||||||
@ -39,6 +38,7 @@ public class VolumeTO {
|
|||||||
private Storage.StorageResourceType resourceType;
|
private Storage.StorageResourceType resourceType;
|
||||||
private StoragePoolType storagePoolType;
|
private StoragePoolType storagePoolType;
|
||||||
private long poolId;
|
private long poolId;
|
||||||
|
private int deviceId;
|
||||||
|
|
||||||
public VolumeTO(long id, Volume.VolumeType type, Storage.StorageResourceType resourceType, StoragePoolType poolType, String name, String mountPoint, String path, long size) {
|
public VolumeTO(long id, Volume.VolumeType type, Storage.StorageResourceType resourceType, StoragePoolType poolType, String name, String mountPoint, String path, long size) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -70,6 +70,10 @@ public class VolumeTO {
|
|||||||
this.storagePoolType = pool.getPoolType();
|
this.storagePoolType = pool.getPoolType();
|
||||||
this.mountPoint = pool.getPath();
|
this.mountPoint = pool.getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDeviceId() {
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
public Storage.StorageResourceType getResourceType() {
|
public Storage.StorageResourceType getResourceType() {
|
||||||
return resourceType;
|
return resourceType;
|
||||||
|
|||||||
@ -1,54 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* This software is licensed under the GNU General Public License v3 or later.
|
|
||||||
*
|
|
||||||
* It is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
||||||
* 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 General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.cloud.consoleproxy;
|
|
||||||
|
|
||||||
import com.cloud.agent.api.AgentControlAnswer;
|
|
||||||
import com.cloud.agent.api.ConsoleAccessAuthenticationCommand;
|
|
||||||
import com.cloud.agent.api.ConsoleProxyLoadReportCommand;
|
|
||||||
import com.cloud.agent.api.StartupCommand;
|
|
||||||
import com.cloud.host.HostVO;
|
|
||||||
import com.cloud.host.Status;
|
|
||||||
import com.cloud.utils.component.Manager;
|
|
||||||
import com.cloud.vm.ConsoleProxyVO;
|
|
||||||
|
|
||||||
public interface ConsoleProxyManager extends Manager {
|
|
||||||
public static final int DEFAULT_PROXY_CAPACITY = 50;
|
|
||||||
public static final int DEFAULT_STANDBY_CAPACITY = 10;
|
|
||||||
public static final int DEFAULT_PROXY_VM_RAMSIZE = 1024; // 1G
|
|
||||||
|
|
||||||
public static final int DEFAULT_PROXY_CMD_PORT = 8001;
|
|
||||||
public static final int DEFAULT_PROXY_VNC_PORT = 0;
|
|
||||||
public static final int DEFAULT_PROXY_URL_PORT = 80;
|
|
||||||
public static final int DEFAULT_PROXY_SESSION_TIMEOUT = 300000; // 5 minutes
|
|
||||||
|
|
||||||
public static final String ALERT_SUBJECT = "proxy-alert";
|
|
||||||
|
|
||||||
public ConsoleProxyVO assignProxy(long dataCenterId, long userVmId);
|
|
||||||
|
|
||||||
public ConsoleProxyVO startProxy(long proxyVmId, long startEventId);
|
|
||||||
public boolean stopProxy(long proxyVmId, long startEventId);
|
|
||||||
public boolean rebootProxy(long proxyVmId, long startEventId);
|
|
||||||
public boolean destroyProxy(long proxyVmId, long startEventId);
|
|
||||||
|
|
||||||
public void onLoadReport(ConsoleProxyLoadReportCommand cmd);
|
|
||||||
public AgentControlAnswer onConsoleAccessAuthentication(ConsoleAccessAuthenticationCommand cmd);
|
|
||||||
|
|
||||||
public void onAgentConnect(HostVO host, StartupCommand cmd);
|
|
||||||
public void onAgentDisconnect(long agentId, Status state);
|
|
||||||
}
|
|
||||||
@ -104,6 +104,8 @@ import com.cloud.agent.api.RebootCommand;
|
|||||||
import com.cloud.agent.api.RebootRouterCommand;
|
import com.cloud.agent.api.RebootRouterCommand;
|
||||||
import com.cloud.agent.api.SetupAnswer;
|
import com.cloud.agent.api.SetupAnswer;
|
||||||
import com.cloud.agent.api.SetupCommand;
|
import com.cloud.agent.api.SetupCommand;
|
||||||
|
import com.cloud.agent.api.Start2Answer;
|
||||||
|
import com.cloud.agent.api.Start2Command;
|
||||||
import com.cloud.agent.api.StartAnswer;
|
import com.cloud.agent.api.StartAnswer;
|
||||||
import com.cloud.agent.api.StartCommand;
|
import com.cloud.agent.api.StartCommand;
|
||||||
import com.cloud.agent.api.StartConsoleProxyAnswer;
|
import com.cloud.agent.api.StartConsoleProxyAnswer;
|
||||||
@ -141,22 +143,26 @@ import com.cloud.agent.api.storage.DownloadAnswer;
|
|||||||
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
|
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
|
||||||
import com.cloud.agent.api.storage.ShareAnswer;
|
import com.cloud.agent.api.storage.ShareAnswer;
|
||||||
import com.cloud.agent.api.storage.ShareCommand;
|
import com.cloud.agent.api.storage.ShareCommand;
|
||||||
|
import com.cloud.agent.api.to.NicTO;
|
||||||
import com.cloud.agent.api.to.StoragePoolTO;
|
import com.cloud.agent.api.to.StoragePoolTO;
|
||||||
|
import com.cloud.agent.api.to.VirtualMachineTO;
|
||||||
import com.cloud.agent.api.to.VolumeTO;
|
import com.cloud.agent.api.to.VolumeTO;
|
||||||
import com.cloud.exception.InternalErrorException;
|
import com.cloud.exception.InternalErrorException;
|
||||||
import com.cloud.host.Host.Type;
|
import com.cloud.host.Host.Type;
|
||||||
import com.cloud.hypervisor.Hypervisor;
|
import com.cloud.hypervisor.Hypervisor;
|
||||||
|
import com.cloud.network.Network.BroadcastDomainType;
|
||||||
|
import com.cloud.network.Network.TrafficType;
|
||||||
import com.cloud.resource.ServerResource;
|
import com.cloud.resource.ServerResource;
|
||||||
import com.cloud.storage.Storage;
|
import com.cloud.storage.Storage;
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.Storage.StorageResourceType;
|
|
||||||
import com.cloud.storage.StorageLayer;
|
import com.cloud.storage.StorageLayer;
|
||||||
import com.cloud.storage.StoragePoolVO;
|
import com.cloud.storage.StoragePoolVO;
|
||||||
import com.cloud.storage.Volume.VolumeType;
|
import com.cloud.storage.Volume.VolumeType;
|
||||||
import com.cloud.storage.VolumeVO;
|
import com.cloud.storage.VolumeVO;
|
||||||
import com.cloud.storage.resource.StoragePoolResource;
|
import com.cloud.storage.resource.StoragePoolResource;
|
||||||
import com.cloud.storage.template.TemplateInfo;
|
import com.cloud.storage.template.TemplateInfo;
|
||||||
|
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
|
||||||
import com.cloud.utils.NumbersUtil;
|
import com.cloud.utils.NumbersUtil;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.Ternary;
|
import com.cloud.utils.Ternary;
|
||||||
@ -169,6 +175,7 @@ import com.cloud.vm.DiskCharacteristics;
|
|||||||
import com.cloud.vm.DomainRouter;
|
import com.cloud.vm.DomainRouter;
|
||||||
import com.cloud.vm.SecondaryStorageVmVO;
|
import com.cloud.vm.SecondaryStorageVmVO;
|
||||||
import com.cloud.vm.State;
|
import com.cloud.vm.State;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
import com.cloud.vm.VirtualMachineName;
|
import com.cloud.vm.VirtualMachineName;
|
||||||
import com.trilead.ssh2.SCPClient;
|
import com.trilead.ssh2.SCPClient;
|
||||||
import com.xensource.xenapi.APIVersion;
|
import com.xensource.xenapi.APIVersion;
|
||||||
@ -683,10 +690,377 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
return execute((ModifySshKeysCommand) cmd);
|
return execute((ModifySshKeysCommand) cmd);
|
||||||
} else if (cmd instanceof PoolEjectCommand) {
|
} else if (cmd instanceof PoolEjectCommand) {
|
||||||
return execute((PoolEjectCommand) cmd);
|
return execute((PoolEjectCommand) cmd);
|
||||||
|
} else if (cmd instanceof Start2Command) {
|
||||||
|
return execute((Start2Command)cmd);
|
||||||
} else {
|
} else {
|
||||||
return Answer.createUnsupportedCommandAnswer(cmd);
|
return Answer.createUnsupportedCommandAnswer(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Pair<Network, String> getNetworkForTraffic(Connection conn, TrafficType type) throws XenAPIException, XmlRpcException {
|
||||||
|
if (type == TrafficType.Guest) {
|
||||||
|
return new Pair<Network, String>(Network.getByUuid(conn, _host.guestNetwork), _host.guestPif);
|
||||||
|
} else if (type == TrafficType.LinkLocal) {
|
||||||
|
return new Pair<Network, String>(Network.getByUuid(conn, _host.linkLocalNetwork), null);
|
||||||
|
} else if (type == TrafficType.Management) {
|
||||||
|
return new Pair<Network, String>(Network.getByUuid(conn, _host.privateNetwork), _host.privatePif);
|
||||||
|
} else if (type == TrafficType.Public) {
|
||||||
|
return new Pair<Network, String>(Network.getByUuid(conn, _host.publicNetwork), _host.publicPif);
|
||||||
|
} else if (type == TrafficType.Storage) {
|
||||||
|
return new Pair<Network, String>(Network.getByUuid(conn, _host.storageNetwork1), _host.storagePif1);
|
||||||
|
} else if (type == TrafficType.Vpn) {
|
||||||
|
return new Pair<Network, String>(Network.getByUuid(conn, _host.publicNetwork), _host.publicPif);
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new CloudRuntimeException("Unsupported network type: " + type);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VIF createVif(Connection conn, String vmName, VM vm, NicTO nic) throws XmlRpcException, XenAPIException {
|
||||||
|
VIF.Record vifr = new VIF.Record();
|
||||||
|
vifr.VM = vm;
|
||||||
|
vifr.device = Integer.toString(nic.getDeviceId());
|
||||||
|
vifr.MAC = nic.getMac();
|
||||||
|
|
||||||
|
Pair<Network, String> network = getNetworkForTraffic(conn, nic.getType());
|
||||||
|
if (nic.getBroadcastType() == BroadcastDomainType.Vlan) {
|
||||||
|
vifr.network = enableVlanNetwork(conn, nic.getVlan(), network.first(), network.second());
|
||||||
|
} else {
|
||||||
|
vifr.network = network.first();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nic.getNetworkRateMbps() != null) {
|
||||||
|
vifr.qosAlgorithmType = "ratelimit";
|
||||||
|
vifr.qosAlgorithmParams = new HashMap<String, String>();
|
||||||
|
vifr.qosAlgorithmParams.put("kbps", Integer.toString(nic.getNetworkRateMbps() * 1000));
|
||||||
|
}
|
||||||
|
|
||||||
|
VIF vif = VIF.create(conn, vifr);
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
vifr = vif.getRecord(conn);
|
||||||
|
s_logger.debug("Created a vif " + vifr.uuid + " on " + nic.getDeviceId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return vif;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VDI mount(Connection conn, String vmName, VolumeTO volume) throws XmlRpcException, XenAPIException {
|
||||||
|
if (volume.getType() == VolumeType.ISO) {
|
||||||
|
String isopath = volume.getPath();
|
||||||
|
int index = isopath.lastIndexOf("/");
|
||||||
|
|
||||||
|
String mountpoint = isopath.substring(0, index);
|
||||||
|
URI uri;
|
||||||
|
try {
|
||||||
|
uri = new URI(mountpoint);
|
||||||
|
} catch (URISyntaxException e) {
|
||||||
|
throw new CloudRuntimeException("Incorrect uri " + mountpoint, e);
|
||||||
|
}
|
||||||
|
SR isoSr = createIsoSRbyURI(uri, vmName, false);
|
||||||
|
|
||||||
|
String isoname = isopath.substring(index + 1);
|
||||||
|
|
||||||
|
VDI isoVdi = getVDIbyLocationandSR(isoname, isoSr);
|
||||||
|
|
||||||
|
if (isoVdi == null) {
|
||||||
|
throw new CloudRuntimeException("Unable to find ISO " + volume.getPath());
|
||||||
|
}
|
||||||
|
return isoVdi;
|
||||||
|
} else {
|
||||||
|
return VDI.getByUuid(conn, volume.getPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected VBD createVbd(Connection conn, String vmName, VM vm, VolumeTO volume, boolean patch) throws XmlRpcException, XenAPIException {
|
||||||
|
VolumeType type = volume.getType();
|
||||||
|
|
||||||
|
VDI vdi = mount(conn, vmName, volume);
|
||||||
|
|
||||||
|
if (patch) {
|
||||||
|
if (!patchSystemVm(vdi, vmName)) {
|
||||||
|
throw new CloudRuntimeException("Unable to patch system vm");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VBD.Record vbdr = new VBD.Record();
|
||||||
|
vbdr.VM = vm;
|
||||||
|
vbdr.VDI = vdi;
|
||||||
|
if (type == VolumeType.ROOT) {
|
||||||
|
vbdr.bootable = true;
|
||||||
|
}
|
||||||
|
vbdr.userdevice = Long.toString(volume.getDeviceId());
|
||||||
|
if (volume.getType() == VolumeType.ISO) {
|
||||||
|
vbdr.mode = Types.VbdMode.RO;
|
||||||
|
vbdr.type = Types.VbdType.CD;
|
||||||
|
} else {
|
||||||
|
vbdr.mode = Types.VbdMode.RW;
|
||||||
|
vbdr.type = Types.VbdType.DISK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VBD vbd = VBD.create(conn, vbdr);
|
||||||
|
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("VBD " + vbd.getUuid(conn) + " created for " + volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
return vbd;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Pair<VM, String> createVmFromTemplate(Connection conn, VirtualMachineTO vmSpec, Host host) throws XenAPIException, XmlRpcException {
|
||||||
|
String guestOsTypeName = getGuestOsType(vmSpec.getOs());
|
||||||
|
Set<VM> templates = VM.getByNameLabel(conn, guestOsTypeName);
|
||||||
|
assert templates.size() == 1 : "Should only have 1 template but found " + templates.size();
|
||||||
|
VM template = templates.iterator().next();
|
||||||
|
|
||||||
|
VM vm = template.createClone(conn, vmSpec.getName());
|
||||||
|
vm.setAffinity(conn, host);
|
||||||
|
|
||||||
|
VM.Record vmr = vm.getRecord(conn);
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Created VM " + vmr.uuid + " for " + vmSpec.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Console console : vmr.consoles) {
|
||||||
|
console.destroy(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
vm.setIsATemplate(conn, false);
|
||||||
|
vm.removeFromOtherConfig(conn, "disks");
|
||||||
|
vm.setNameLabel(conn, vmSpec.getName());
|
||||||
|
setMemory(conn, vm, vmSpec.getMinRam());
|
||||||
|
vm.setVCPUsAtStartup(conn, (long)vmSpec.getCpus());
|
||||||
|
vm.setVCPUsMax(conn, (long)vmSpec.getCpus());
|
||||||
|
vm.setVCPUsNumberLive(conn, (long)vmSpec.getCpus());
|
||||||
|
|
||||||
|
Map<String, String> vcpuParams = new HashMap<String, String>();
|
||||||
|
|
||||||
|
if (vmSpec.getWeight() != null) {
|
||||||
|
vcpuParams.put("weight", Integer.toString(vmSpec.getWeight()));
|
||||||
|
}
|
||||||
|
if (vmSpec.getUtilization() != null) {
|
||||||
|
vcpuParams.put("cap", Integer.toString(vmSpec.getUtilization()));
|
||||||
|
}
|
||||||
|
if (vcpuParams.size() > 0) {
|
||||||
|
vm.setVCPUsParams(conn, vcpuParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
vm.setActionsAfterCrash(conn, Types.OnCrashBehaviour.DESTROY);
|
||||||
|
vm.setActionsAfterShutdown(conn, Types.OnNormalExit.DESTROY);
|
||||||
|
|
||||||
|
String bootArgs = vmSpec.getBootArgs();
|
||||||
|
if (bootArgs != null && bootArgs.length() > 0) {
|
||||||
|
String pvargs = vm.getPVArgs(conn);
|
||||||
|
pvargs = pvargs + vmSpec.getBootArgs();
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("PV args are " + pvargs);
|
||||||
|
}
|
||||||
|
vm.setPVArgs(conn, pvargs);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(guestOsTypeName.startsWith("Windows") || guestOsTypeName.startsWith("Citrix") || guestOsTypeName.startsWith("Other"))) {
|
||||||
|
if (vmSpec.getBootloader() == BootloaderType.CD) {
|
||||||
|
vm.setPVBootloader(conn, "eliloader");
|
||||||
|
vm.addToOtherConfig(conn, "install-repository", "cdrom");
|
||||||
|
} else if (vmSpec.getBootloader() == BootloaderType.PyGrub ){
|
||||||
|
vm.setPVBootloader(conn, "pygrub");
|
||||||
|
} else {
|
||||||
|
vm.destroy(conn);
|
||||||
|
throw new CloudRuntimeException("Unable to handle boot loader type: " + vmSpec.getBootloader());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Pair<VM, String>(vm, vmr.uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String handleVmStartFailure(String vmName, VM vm, String message, Throwable th) {
|
||||||
|
String msg = "Unable to start " + vmName + " due to " + message;
|
||||||
|
s_logger.warn(msg, th);
|
||||||
|
|
||||||
|
if (vm == null) {
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
Connection conn = getConnection();
|
||||||
|
try {
|
||||||
|
VM.Record vmr = vm.getRecord(conn);
|
||||||
|
if (vmr.powerState == VmPowerState.RUNNING) {
|
||||||
|
try {
|
||||||
|
vm.hardShutdown(conn);
|
||||||
|
} catch (Exception e) {
|
||||||
|
s_logger.warn("VM hardshutdown failed due to ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (vm.getPowerState(conn) == VmPowerState.HALTED) {
|
||||||
|
try {
|
||||||
|
vm.destroy(conn);
|
||||||
|
} catch (Exception e) {
|
||||||
|
s_logger.warn("VM destroy failed due to ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (VBD vbd : vmr.VBDs) {
|
||||||
|
try {
|
||||||
|
vbd.unplug(conn);
|
||||||
|
vbd.destroy(conn);
|
||||||
|
} catch (Exception e) {
|
||||||
|
s_logger.warn("Unable to clean up VBD due to ", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (VIF vif : vmr.VIFs) {
|
||||||
|
try {
|
||||||
|
vif.unplug(conn);
|
||||||
|
vif.destroy(conn);
|
||||||
|
} catch (Exception e) {
|
||||||
|
s_logger.warn("Unable to cleanup VIF", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
s_logger.warn("VM getRecord failed due to ", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Start2Answer execute(Start2Command cmd) {
|
||||||
|
VirtualMachineTO vmSpec = cmd.getVirtualMachine();
|
||||||
|
String vmName = vmSpec.getName();
|
||||||
|
|
||||||
|
Connection conn = getConnection();
|
||||||
|
State state = State.Stopped;
|
||||||
|
VM vm = null;
|
||||||
|
try {
|
||||||
|
Host host = Host.getByUuid(conn, _host.uuid);
|
||||||
|
synchronized (_vms) {
|
||||||
|
_vms.put(vmName, State.Starting);
|
||||||
|
}
|
||||||
|
|
||||||
|
Pair<VM, String> v = createVmFromTemplate(conn, vmSpec, host);
|
||||||
|
vm = v.first();
|
||||||
|
String vmUuid = v.second();
|
||||||
|
|
||||||
|
for (VolumeTO disk : vmSpec.getDisks()) {
|
||||||
|
createVbd(conn, vmName, vm, disk, disk.getType() == VolumeType.ROOT && vmSpec.getType() != VirtualMachine.Type.User);
|
||||||
|
}
|
||||||
|
|
||||||
|
NicTO controlNic = null;
|
||||||
|
for (NicTO nic : vmSpec.getNetworks()) {
|
||||||
|
if (nic.getControlPort() != null) {
|
||||||
|
controlNic = nic;
|
||||||
|
}
|
||||||
|
createVif(conn, vmName, vm, nic);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
VBD.Record vbdr = new VBD.Record();
|
||||||
|
Ternary<SR, VDI, VolumeVO> mount = mounts.get(0);
|
||||||
|
vbdr.VM = vm;
|
||||||
|
vbdr.VDI = mount.second();
|
||||||
|
vbdr.bootable = !bootFromISO;
|
||||||
|
vbdr.userdevice = "0";
|
||||||
|
vbdr.mode = Types.VbdMode.RW;
|
||||||
|
vbdr.type = Types.VbdType.DISK;
|
||||||
|
VBD.create(conn, vbdr);
|
||||||
|
|
||||||
|
for (int i = 1; i < mounts.size(); i++) {
|
||||||
|
mount = mounts.get(i);
|
||||||
|
// vdi.setNameLabel(conn, cmd.getVmName() + "-DATA");
|
||||||
|
vbdr.VM = vm;
|
||||||
|
vbdr.VDI = mount.second();
|
||||||
|
vbdr.bootable = false;
|
||||||
|
vbdr.userdevice = Long.toString(mount.third().getDeviceId());
|
||||||
|
vbdr.mode = Types.VbdMode.RW;
|
||||||
|
vbdr.type = Types.VbdType.DISK;
|
||||||
|
vbdr.unpluggable = true;
|
||||||
|
VBD.create(conn, vbdr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
VBD.Record cdromVBDR = new VBD.Record();
|
||||||
|
cdromVBDR.VM = vm;
|
||||||
|
cdromVBDR.empty = true;
|
||||||
|
cdromVBDR.bootable = bootFromISO;
|
||||||
|
cdromVBDR.userdevice = "3";
|
||||||
|
cdromVBDR.mode = Types.VbdMode.RO;
|
||||||
|
cdromVBDR.type = Types.VbdType.CD;
|
||||||
|
VBD cdromVBD = VBD.create(conn, cdromVBDR);
|
||||||
|
|
||||||
|
String isopath = cmd.getISOPath();
|
||||||
|
if (isopath != null) {
|
||||||
|
int index = isopath.lastIndexOf("/");
|
||||||
|
|
||||||
|
String mountpoint = isopath.substring(0, index);
|
||||||
|
URI uri = new URI(mountpoint);
|
||||||
|
isosr = createIsoSRbyURI(uri, cmd.getVmName(), false);
|
||||||
|
|
||||||
|
String isoname = isopath.substring(index + 1);
|
||||||
|
|
||||||
|
VDI isovdi = getVDIbyLocationandSR(isoname, isosr);
|
||||||
|
|
||||||
|
if (isovdi == null) {
|
||||||
|
String msg = " can not find ISO " + cmd.getISOPath();
|
||||||
|
s_logger.warn(msg);
|
||||||
|
return new StartAnswer(cmd, msg);
|
||||||
|
} else {
|
||||||
|
cdromVBD.insert(conn, isovdi);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
vm.startOn(conn, host, false, true);
|
||||||
|
|
||||||
|
if (_canBridgeFirewall) {
|
||||||
|
String result = null;
|
||||||
|
if (vmSpec.getType() != VirtualMachine.Type.User) {
|
||||||
|
result = callHostPlugin("vmops", "default_network_rules_systemvm", "vmName", vmName);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result == null || result.isEmpty() || !Boolean.parseBoolean(result)) {
|
||||||
|
s_logger.warn("Failed to program default network rules for " + vmName);
|
||||||
|
} else {
|
||||||
|
s_logger.info("Programmed default network rules for " + vmName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (controlNic != null) {
|
||||||
|
String privateIp = controlNic.getIp();
|
||||||
|
int cmdPort = controlNic.getControlPort();
|
||||||
|
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Ping command port, " + privateIp + ":" + cmdPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
String result = connect(vmName, privateIp, cmdPort);
|
||||||
|
if (result != null) {
|
||||||
|
throw new CloudRuntimeException("Can not ping System vm " + vmName + "due to:" + result);
|
||||||
|
}
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Ping command port succeeded for vm " + vmName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
state = State.Running;
|
||||||
|
return new Start2Answer(cmd);
|
||||||
|
} catch (XmlRpcException e) {
|
||||||
|
String msg = handleVmStartFailure(vmName, vm, "", e);
|
||||||
|
return new Start2Answer(cmd, msg);
|
||||||
|
} catch (XenAPIException e) {
|
||||||
|
String msg = handleVmStartFailure(vmName, vm, "", e);
|
||||||
|
return new Start2Answer(cmd, msg);
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = handleVmStartFailure(vmName, vm, "", e);
|
||||||
|
return new Start2Answer(cmd, msg);
|
||||||
|
} finally {
|
||||||
|
synchronized (_vms) {
|
||||||
|
if (state != State.Stopped) {
|
||||||
|
_vms.put(vmName, state);
|
||||||
|
} else {
|
||||||
|
_vms.remove(vmName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected Answer execute(ModifySshKeysCommand cmd) {
|
protected Answer execute(ModifySshKeysCommand cmd) {
|
||||||
String publickey = cmd.getPubKey();
|
String publickey = cmd.getPubKey();
|
||||||
@ -1695,6 +2069,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public DownloadAnswer execute(final PrimaryStorageDownloadCommand cmd) {
|
public DownloadAnswer execute(final PrimaryStorageDownloadCommand cmd) {
|
||||||
SR tmpltsr = null;
|
SR tmpltsr = null;
|
||||||
String tmplturl = cmd.getUrl();
|
String tmplturl = cmd.getUrl();
|
||||||
@ -3292,6 +3667,45 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected synchronized Network getNetworkByName(Connection conn, String name, boolean lookForPif) throws XenAPIException, XmlRpcException {
|
||||||
|
Network found = null;
|
||||||
|
Set<Network> networks = Network.getByNameLabel(conn, name);
|
||||||
|
if (networks.size() == 1) {
|
||||||
|
found = networks.iterator().next();
|
||||||
|
} else if (networks.size() > 1) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Found more than one network with the name " + name);
|
||||||
|
}
|
||||||
|
for (Network network : networks) {
|
||||||
|
if (!lookForPif) {
|
||||||
|
found = network;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Network.Record netr = network.getRecord(conn);
|
||||||
|
s_logger.debug("Checking network " + netr.uuid);
|
||||||
|
if (netr.PIFs.size() == 0) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Network " + netr.uuid + " has no pifs so skipping that.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (PIF pif : netr.PIFs) {
|
||||||
|
PIF.Record pifr = pif.getRecord(conn);
|
||||||
|
if (_host.uuid.equals(pifr.host.getUuid(conn))) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Network " + netr.uuid + " has a pif " + pifr.uuid + " for our host ");
|
||||||
|
}
|
||||||
|
found = network;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
protected Network enableVlanNetwork(long tag, String networkUuid, String pifUuid) throws XenAPIException, XmlRpcException {
|
protected Network enableVlanNetwork(long tag, String networkUuid, String pifUuid) throws XenAPIException, XmlRpcException {
|
||||||
// In XenServer, vlan is added by
|
// In XenServer, vlan is added by
|
||||||
// 1. creating a network.
|
// 1. creating a network.
|
||||||
@ -3344,6 +3758,60 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
return vlanNetwork;
|
return vlanNetwork;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Network enableVlanNetwork(Connection conn, long tag, Network network, String pifUuid) throws XenAPIException, XmlRpcException {
|
||||||
|
// In XenServer, vlan is added by
|
||||||
|
// 1. creating a network.
|
||||||
|
// 2. creating a vlan associating network with the pif.
|
||||||
|
// We always create
|
||||||
|
// 1. a network with VLAN[vlan id in decimal]
|
||||||
|
// 2. a vlan associating the network created with the pif to private
|
||||||
|
// network.
|
||||||
|
|
||||||
|
Network vlanNetwork = null;
|
||||||
|
String name = "VLAN" + Long.toString(tag);
|
||||||
|
|
||||||
|
vlanNetwork = getNetworkByName(conn, name, true);
|
||||||
|
if (vlanNetwork == null) { // Can't find it, then create it.
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Creating VLAN network for " + tag + " on host " + _host.ip);
|
||||||
|
}
|
||||||
|
Network.Record nwr = new Network.Record();
|
||||||
|
nwr.nameLabel = name;
|
||||||
|
nwr.bridge = name;
|
||||||
|
vlanNetwork = Network.create(conn, nwr);
|
||||||
|
}
|
||||||
|
|
||||||
|
PIF nPif = PIF.getByUuid(conn, pifUuid);
|
||||||
|
PIF.Record nPifr = nPif.getRecord(conn);
|
||||||
|
|
||||||
|
Network.Record vlanNetworkr = vlanNetwork.getRecord(conn);
|
||||||
|
if (vlanNetworkr.PIFs != null) {
|
||||||
|
for (PIF pif : vlanNetworkr.PIFs) {
|
||||||
|
PIF.Record pifr = pif.getRecord(conn);
|
||||||
|
if (pifr.device.equals(nPifr.device) && pifr.host.equals(nPifr.host)) {
|
||||||
|
pif.plug(conn);
|
||||||
|
return vlanNetwork;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Creating VLAN " + tag + " on host " + _host.ip + " on device " + nPifr.device);
|
||||||
|
}
|
||||||
|
VLAN vlan = VLAN.create(conn, nPif, tag, vlanNetwork);
|
||||||
|
VLAN.Record vlanr = vlan.getRecord(conn);
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("VLAN is created for " + tag + ". The uuid is " + vlanr.uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
PIF untaggedPif = vlanr.untaggedPIF;
|
||||||
|
if (!untaggedPif.getCurrentlyAttached(conn)) {
|
||||||
|
untaggedPif.plug(conn);
|
||||||
|
}
|
||||||
|
|
||||||
|
return vlanNetwork;
|
||||||
|
}
|
||||||
|
|
||||||
protected void disableVlanNetwork(Network network) throws InternalErrorException {
|
protected void disableVlanNetwork(Network network) throws InternalErrorException {
|
||||||
try {
|
try {
|
||||||
Connection conn = getConnection();
|
Connection conn = getConnection();
|
||||||
@ -4264,6 +4732,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CreateAnswer execute(CreateCommand cmd) {
|
public CreateAnswer execute(CreateCommand cmd) {
|
||||||
StoragePoolTO pool = cmd.getPool();
|
StoragePoolTO pool = cmd.getPool();
|
||||||
DiskCharacteristics dskch = cmd.getDiskCharacteristics();
|
DiskCharacteristics dskch = cmd.getDiskCharacteristics();
|
||||||
@ -4763,6 +5232,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Answer execute(DestroyCommand cmd) {
|
public Answer execute(DestroyCommand cmd) {
|
||||||
VolumeTO vol = cmd.getVolume();
|
VolumeTO vol = cmd.getVolume();
|
||||||
|
|
||||||
@ -4806,6 +5276,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
return new Answer(cmd, true, "Success");
|
return new Answer(cmd, true, "Success");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ShareAnswer execute(final ShareCommand cmd) {
|
public ShareAnswer execute(final ShareCommand cmd) {
|
||||||
if (!cmd.isShare()) {
|
if (!cmd.isShare()) {
|
||||||
SR sr = getISOSRbyVmName(cmd.getVmName());
|
SR sr = getISOSRbyVmName(cmd.getVmName());
|
||||||
@ -4825,6 +5296,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
return new ShareAnswer(cmd, new HashMap<String, Integer>());
|
return new ShareAnswer(cmd, new HashMap<String, Integer>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CopyVolumeAnswer execute(final CopyVolumeCommand cmd) {
|
public CopyVolumeAnswer execute(final CopyVolumeCommand cmd) {
|
||||||
String volumeUUID = cmd.getVolumePath();
|
String volumeUUID = cmd.getVolumePath();
|
||||||
StoragePoolVO pool = cmd.getPool();
|
StoragePoolVO pool = cmd.getPool();
|
||||||
@ -6077,10 +6549,12 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||||||
_agentControl = agentControl;
|
_agentControl = agentControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean IsRemoteAgent() {
|
public boolean IsRemoteAgent() {
|
||||||
return _isRemoteAgent;
|
return _isRemoteAgent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setRemoteAgent(boolean remote) {
|
public void setRemoteAgent(boolean remote) {
|
||||||
_isRemoteAgent = remote;
|
_isRemoteAgent = remote;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -793,6 +793,35 @@ public class TestVMWare {
|
|||||||
VirtualNicManagerNetConfig[] netConfigs = (VirtualNicManagerNetConfig[])cb.getServiceUtil3().getDynamicProperty(morHost, "config.virtualNicManagerInfo.netConfig");
|
VirtualNicManagerNetConfig[] netConfigs = (VirtualNicManagerNetConfig[])cb.getServiceUtil3().getDynamicProperty(morHost, "config.virtualNicManagerInfo.netConfig");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void getHostVMs() throws Exception {
|
||||||
|
ManagedObjectReference morHost = new ManagedObjectReference();
|
||||||
|
morHost.setType("HostSystem");
|
||||||
|
morHost.set_value("host-48");
|
||||||
|
|
||||||
|
PropertySpec pSpec = new PropertySpec();
|
||||||
|
pSpec.setType("VirtualMachine");
|
||||||
|
pSpec.setPathSet(new String[] { "name", "runtime.powerState", "config.template" });
|
||||||
|
|
||||||
|
TraversalSpec host2VmTraversal = new TraversalSpec();
|
||||||
|
host2VmTraversal.setType("HostSystem");
|
||||||
|
host2VmTraversal.setPath("vm");
|
||||||
|
host2VmTraversal.setName("host2VmTraversal");
|
||||||
|
|
||||||
|
ObjectSpec oSpec = new ObjectSpec();
|
||||||
|
oSpec.setObj(morHost);
|
||||||
|
oSpec.setSkip(Boolean.TRUE);
|
||||||
|
oSpec.setSelectSet(new SelectionSpec[] { host2VmTraversal });
|
||||||
|
|
||||||
|
PropertyFilterSpec pfSpec = new PropertyFilterSpec();
|
||||||
|
pfSpec.setPropSet(new PropertySpec[] { pSpec });
|
||||||
|
pfSpec.setObjectSet(new ObjectSpec[] { oSpec });
|
||||||
|
|
||||||
|
ObjectContent[] ocs = cb.getServiceConnection3().getService().retrieveProperties(
|
||||||
|
cb.getServiceConnection3().getServiceContent().getPropertyCollector(),
|
||||||
|
new PropertyFilterSpec[] { pfSpec });
|
||||||
|
this.printContent(ocs);
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
setupLog4j();
|
setupLog4j();
|
||||||
TestVMWare client = new TestVMWare();
|
TestVMWare client = new TestVMWare();
|
||||||
@ -819,7 +848,8 @@ public class TestVMWare {
|
|||||||
// client.addNicToNetwork();
|
// client.addNicToNetwork();
|
||||||
|
|
||||||
// client.createDatacenter();
|
// client.createDatacenter();
|
||||||
client.getPropertyWithPath();
|
// client.getPropertyWithPath();
|
||||||
|
client.getHostVMs();
|
||||||
|
|
||||||
cb.disConnect();
|
cb.disConnect();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Binary file not shown.
@ -89,7 +89,13 @@ public class ListDomainChildrenCmd extends BaseCmd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Criteria c = new Criteria("id", Boolean.TRUE, startIndex, Long.valueOf(pageSizeNum));
|
//temporary solution at API level. We need a permanent solution for all "listXXXXXXX & pageSize = -1" in the future.
|
||||||
|
Criteria c;
|
||||||
|
if(pageSizeNum != -1)
|
||||||
|
c = new Criteria("id", Boolean.TRUE, startIndex, Long.valueOf(pageSizeNum));
|
||||||
|
else
|
||||||
|
c = new Criteria("id", Boolean.TRUE, null, null);
|
||||||
|
|
||||||
|
|
||||||
if (keyword != null) {
|
if (keyword != null) {
|
||||||
c.addCriteria(Criteria.KEYWORD, keyword);
|
c.addCriteria(Criteria.KEYWORD, keyword);
|
||||||
|
|||||||
@ -85,7 +85,13 @@ public class ListDomainsCmd extends BaseCmd {
|
|||||||
startIndex = Long.valueOf(pageSizeNum * (pageNum-1));
|
startIndex = Long.valueOf(pageSizeNum * (pageNum-1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Criteria c = new Criteria("id", Boolean.TRUE, startIndex, Long.valueOf(pageSizeNum));
|
|
||||||
|
//temporary solution at API level. We need a permanent solution for all "listXXXXXXX & pageSize = -1" in the future.
|
||||||
|
Criteria c;
|
||||||
|
if(pageSizeNum != -1)
|
||||||
|
c = new Criteria("id", Boolean.TRUE, startIndex, Long.valueOf(pageSizeNum));
|
||||||
|
else
|
||||||
|
c = new Criteria("id", Boolean.TRUE, null, null);
|
||||||
|
|
||||||
if (keyword != null) {
|
if (keyword != null) {
|
||||||
c.addCriteria(Criteria.KEYWORD, keyword);
|
c.addCriteria(Criteria.KEYWORD, keyword);
|
||||||
|
|||||||
@ -145,7 +145,7 @@ public class CreatePrivateTemplateExecutor extends VolumeOperationExecutor {
|
|||||||
jobStatus = AsyncJobResult.STATUS_SUCCEEDED;
|
jobStatus = AsyncJobResult.STATUS_SUCCEEDED;
|
||||||
resultCode = 0;
|
resultCode = 0;
|
||||||
details = null;
|
details = null;
|
||||||
String eventParams = "id="+template.getId()+"\nname=" + template.getName() +"\nsize="+volume.getSize();
|
String eventParams = "id="+template.getId()+"\nname=" + template.getName() +"\nsize="+volume.getSize()+ "\ndcId="+volume.getDataCenterId();
|
||||||
managerServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_TEMPLATE_CREATE, "Successfully created Template " +param.getName(), eventParams ,param.getEventId());
|
managerServer.saveEvent(param.getUserId(), param.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_TEMPLATE_CREATE, "Successfully created Template " +param.getName(), eventParams ,param.getEventId());
|
||||||
resultObject = composeResultObject(template, templateHostRef, volume.getDataCenterId());
|
resultObject = composeResultObject(template, templateHostRef, volume.getDataCenterId());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.cloud.consoleproxy;
|
package com.cloud.consoleproxy;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ejb.Local;
|
import javax.ejb.Local;
|
||||||
@ -45,316 +45,274 @@ import com.cloud.ha.HighAvailabilityManager;
|
|||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
import com.cloud.host.Status;
|
import com.cloud.host.Status;
|
||||||
import com.cloud.host.dao.HostDao;
|
import com.cloud.host.dao.HostDao;
|
||||||
|
import com.cloud.info.ConsoleProxyInfo;
|
||||||
import com.cloud.utils.NumbersUtil;
|
import com.cloud.utils.NumbersUtil;
|
||||||
import com.cloud.utils.component.ComponentLocator;
|
import com.cloud.utils.component.ComponentLocator;
|
||||||
|
import com.cloud.utils.component.Inject;
|
||||||
import com.cloud.vm.ConsoleProxyVO;
|
import com.cloud.vm.ConsoleProxyVO;
|
||||||
import com.cloud.vm.UserVmVO;
|
import com.cloud.vm.UserVmVO;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
|
import com.cloud.vm.VirtualMachine.Type;
|
||||||
import com.cloud.vm.VirtualMachineManager;
|
import com.cloud.vm.VirtualMachineManager;
|
||||||
import com.cloud.vm.VirtualMachineName;
|
import com.cloud.vm.VirtualMachineName;
|
||||||
import com.cloud.vm.VirtualMachine.Type;
|
|
||||||
import com.cloud.vm.dao.UserVmDao;
|
import com.cloud.vm.dao.UserVmDao;
|
||||||
import com.cloud.vm.dao.VMInstanceDao;
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
|
||||||
@Local(value={ConsoleProxyManager.class})
|
@Local(value = { ConsoleProxyManager.class })
|
||||||
public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, VirtualMachineManager<ConsoleProxyVO> {
|
public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, VirtualMachineManager<ConsoleProxyVO>, AgentHook {
|
||||||
private static final Logger s_logger = Logger.getLogger(AgentBasedConsoleProxyManager.class);
|
private static final Logger s_logger = Logger.getLogger(AgentBasedConsoleProxyManager.class);
|
||||||
|
|
||||||
private String _name;
|
private String _name;
|
||||||
protected HostDao _hostDao;
|
@Inject
|
||||||
protected UserVmDao _userVmDao;
|
protected HostDao _hostDao;
|
||||||
private String _instance;
|
@Inject
|
||||||
private VMInstanceDao _instanceDao;
|
protected UserVmDao _userVmDao;
|
||||||
private ConsoleProxyListener _listener;
|
private String _instance;
|
||||||
|
@Inject
|
||||||
protected int _consoleProxyUrlPort = ConsoleProxyManager.DEFAULT_PROXY_URL_PORT;
|
private VMInstanceDao _instanceDao;
|
||||||
protected boolean _sslEnabled = false;
|
private ConsoleProxyListener _listener;
|
||||||
AgentManager _agentMgr;
|
|
||||||
|
protected int _consoleProxyUrlPort = ConsoleProxyManager.DEFAULT_PROXY_URL_PORT;
|
||||||
public int getVncPort(VMInstanceVO vm) {
|
protected int _consoleProxyPort = ConsoleProxyManager.DEFAULT_PROXY_VNC_PORT;
|
||||||
if (vm.getHostId() == null) {
|
protected boolean _sslEnabled = false;
|
||||||
return -1;
|
@Inject
|
||||||
}
|
AgentManager _agentMgr;
|
||||||
GetVncPortAnswer answer = (GetVncPortAnswer)_agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getName()));
|
|
||||||
return answer == null ? -1 : answer.getPort();
|
public int getVncPort(VMInstanceVO vm) {
|
||||||
}
|
if (vm.getHostId() == null) {
|
||||||
|
return -1;
|
||||||
@Override
|
}
|
||||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
GetVncPortAnswer answer = (GetVncPortAnswer) _agentMgr.easySend(vm.getHostId(), new GetVncPortCommand(vm.getId(), vm.getName()));
|
||||||
|
return answer == null ? -1 : answer.getPort();
|
||||||
if(s_logger.isInfoEnabled())
|
}
|
||||||
s_logger.info("Start configuring AgentBasedConsoleProxyManager");
|
|
||||||
|
@Override
|
||||||
_name = name;
|
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||||
|
|
||||||
ComponentLocator locator = ComponentLocator.getCurrentLocator();
|
if (s_logger.isInfoEnabled())
|
||||||
ConfigurationDao configDao = locator.getDao(ConfigurationDao.class);
|
s_logger.info("Start configuring AgentBasedConsoleProxyManager");
|
||||||
if (configDao == null) {
|
|
||||||
throw new ConfigurationException(
|
_name = name;
|
||||||
"Unable to get the configuration dao.");
|
|
||||||
}
|
ComponentLocator locator = ComponentLocator.getCurrentLocator();
|
||||||
|
ConfigurationDao configDao = locator.getDao(ConfigurationDao.class);
|
||||||
Map<String, String> configs = configDao.getConfiguration(
|
if (configDao == null) {
|
||||||
"management-server", params);
|
throw new ConfigurationException("Unable to get the configuration dao.");
|
||||||
String value = configs.get("consoleproxy.url.port");
|
}
|
||||||
if (value != null)
|
|
||||||
_consoleProxyUrlPort = NumbersUtil.parseInt(value, ConsoleProxyManager.DEFAULT_PROXY_URL_PORT);
|
Map<String, String> configs = configDao.getConfiguration("management-server", params);
|
||||||
|
String value = configs.get("consoleproxy.url.port");
|
||||||
_hostDao = locator.getDao(HostDao.class);
|
if (value != null)
|
||||||
if (_hostDao == null) {
|
_consoleProxyUrlPort = NumbersUtil.parseInt(value, ConsoleProxyManager.DEFAULT_PROXY_URL_PORT);
|
||||||
throw new ConfigurationException("Unable to get "
|
|
||||||
+ HostDao.class.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
_instanceDao = locator.getDao(VMInstanceDao.class);
|
|
||||||
if (_instanceDao == null)
|
|
||||||
throw new ConfigurationException("Unable to get " + VMInstanceDao.class.getName());
|
|
||||||
|
|
||||||
_userVmDao = locator.getDao(UserVmDao.class);
|
|
||||||
if (_userVmDao == null)
|
|
||||||
throw new ConfigurationException("Unable to get " + UserVmDao.class.getName());
|
|
||||||
|
|
||||||
_agentMgr = locator.getManager(AgentManager.class);
|
|
||||||
if (_agentMgr == null)
|
|
||||||
throw new ConfigurationException("Unable to get " + AgentManager.class.getName());
|
|
||||||
|
|
||||||
value = configs.get("consoleproxy.sslEnabled");
|
|
||||||
if(value != null && value.equalsIgnoreCase("true"))
|
|
||||||
_sslEnabled = true;
|
|
||||||
|
|
||||||
_instance = configs.get("instance.name");
|
|
||||||
|
|
||||||
_listener = new ConsoleProxyListener(this);
|
|
||||||
_agentMgr.registerForHostEvents(_listener, true, true, false);
|
|
||||||
|
|
||||||
HighAvailabilityManager haMgr = locator.getManager(HighAvailabilityManager.class);
|
|
||||||
haMgr.registerHandler(Type.ConsoleProxy, this);
|
|
||||||
|
|
||||||
if(s_logger.isInfoEnabled())
|
|
||||||
s_logger.info("AgentBasedConsoleProxyManager has been configured. SSL enabled: " + _sslEnabled);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean start() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean stop() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
HostVO findHost(VMInstanceVO vm) {
|
|
||||||
return _hostDao.findById(vm.getHostId());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ConsoleProxyVO allocateProxy(HostVO host, long dataCenterId) {
|
|
||||||
// only private IP, public IP, host id have meaningful values, rest of all are place-holder values
|
|
||||||
String publicIp = host.getPublicIpAddress();
|
|
||||||
if(publicIp == null) {
|
|
||||||
if(s_logger.isDebugEnabled())
|
|
||||||
s_logger.debug("Host " + host.getName() + "/" + host.getPrivateIpAddress() +
|
|
||||||
" does not have public interface, we will return its private IP for cosole proxy.");
|
|
||||||
publicIp = host.getPrivateIpAddress();
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME: Removed State.Running does this affect the console proxy?
|
value = configs.get("consoleproxy.port");
|
||||||
return new ConsoleProxyVO(1l, "EmbeddedProxy", null, null, null,
|
if (value != null)
|
||||||
"02:02:02:02:02:02",
|
_consoleProxyPort = NumbersUtil.parseInt(value, ConsoleProxyManager.DEFAULT_PROXY_VNC_PORT);
|
||||||
host.getPrivateIpAddress(),
|
|
||||||
"255.255.255.0",
|
value = configs.get("consoleproxy.sslEnabled");
|
||||||
1l,
|
if (value != null && value.equalsIgnoreCase("true"))
|
||||||
1l,
|
_sslEnabled = true;
|
||||||
"03:03:03:03:03:03",
|
|
||||||
publicIp,
|
_instance = configs.get("instance.name");
|
||||||
"255.255.255.0",
|
|
||||||
null,
|
_listener = new ConsoleProxyListener(this);
|
||||||
"untagged",
|
_agentMgr.registerForHostEvents(_listener, true, true, false);
|
||||||
1l,
|
|
||||||
dataCenterId,
|
HighAvailabilityManager haMgr = locator.getManager(HighAvailabilityManager.class);
|
||||||
"0.0.0.0",
|
haMgr.registerHandler(Type.ConsoleProxy, this);
|
||||||
host.getId(),
|
|
||||||
"dns1",
|
if (s_logger.isInfoEnabled())
|
||||||
"dn2",
|
s_logger.info("AgentBasedConsoleProxyManager has been configured. SSL enabled: " + _sslEnabled);
|
||||||
"domain",
|
return true;
|
||||||
0,
|
}
|
||||||
0);
|
|
||||||
}
|
@Override
|
||||||
|
public boolean start() {
|
||||||
@Override
|
return true;
|
||||||
public ConsoleProxyVO assignProxy(long dataCenterId, long userVmId) {
|
}
|
||||||
UserVmVO userVm = _userVmDao.findById(userVmId);
|
|
||||||
if (userVm == null) {
|
@Override
|
||||||
s_logger.warn("User VM " + userVmId
|
public boolean stop() {
|
||||||
+ " no longer exists, return a null proxy for user vm:"
|
return true;
|
||||||
+ userVmId);
|
}
|
||||||
return null;
|
|
||||||
}
|
HostVO findHost(VMInstanceVO vm) {
|
||||||
|
return _hostDao.findById(vm.getHostId());
|
||||||
HostVO host = findHost(userVm);
|
}
|
||||||
if(host != null) {
|
|
||||||
if(s_logger.isDebugEnabled())
|
@Override
|
||||||
s_logger.debug("Assign embedded console proxy running at " + host.getName() + " to user vm " + userVmId + " with public IP " + host.getPublicIpAddress());
|
public ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId) {
|
||||||
|
UserVmVO userVm = _userVmDao.findById(userVmId);
|
||||||
// only private IP, public IP, host id have meaningful values, rest of all are place-holder values
|
if (userVm == null) {
|
||||||
String publicIp = host.getPublicIpAddress();
|
s_logger.warn("User VM " + userVmId + " no longer exists, return a null proxy for user vm:" + userVmId);
|
||||||
if(publicIp == null) {
|
return null;
|
||||||
if(s_logger.isDebugEnabled())
|
}
|
||||||
s_logger.debug("Host " + host.getName() + "/" + host.getPrivateIpAddress() +
|
|
||||||
" does not have public interface, we will return its private IP for cosole proxy.");
|
HostVO host = findHost(userVm);
|
||||||
publicIp = host.getPrivateIpAddress();
|
if (host != null) {
|
||||||
}
|
if (s_logger.isDebugEnabled())
|
||||||
|
s_logger.debug("Assign embedded console proxy running at " + host.getName() + " to user vm " + userVmId + " with public IP "
|
||||||
ConsoleProxyVO proxy = allocateProxy(host, dataCenterId);
|
+ host.getPublicIpAddress());
|
||||||
|
|
||||||
if(host.getProxyPort() != null && host.getProxyPort().intValue() > 0)
|
// only private IP, public IP, host id have meaningful values, rest
|
||||||
proxy.setPort(host.getProxyPort().intValue());
|
// of all are place-holder values
|
||||||
else
|
String publicIp = host.getPublicIpAddress();
|
||||||
proxy.setPort(_consoleProxyUrlPort);
|
if (publicIp == null) {
|
||||||
|
if (s_logger.isDebugEnabled())
|
||||||
proxy.setSslEnabled(_sslEnabled);
|
s_logger.debug("Host " + host.getName() + "/" + host.getPrivateIpAddress()
|
||||||
return proxy;
|
+ " does not have public interface, we will return its private IP for cosole proxy.");
|
||||||
} else {
|
publicIp = host.getPrivateIpAddress();
|
||||||
s_logger.warn("Host that VM is running is no longer available, console access to VM " + userVmId + " will be temporarily unavailable.");
|
}
|
||||||
}
|
|
||||||
return null;
|
int urlPort = _consoleProxyUrlPort;
|
||||||
}
|
|
||||||
|
if (host.getProxyPort() != null && host.getProxyPort().intValue() > 0)
|
||||||
@Override
|
urlPort = host.getProxyPort().intValue();
|
||||||
public void onLoadReport(ConsoleProxyLoadReportCommand cmd) {
|
|
||||||
}
|
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort);
|
||||||
|
} else {
|
||||||
@Override
|
s_logger.warn("Host that VM is running is no longer available, console access to VM " + userVmId + " will be temporarily unavailable.");
|
||||||
public AgentControlAnswer onConsoleAccessAuthentication(ConsoleAccessAuthenticationCommand cmd) {
|
}
|
||||||
long vmId = 0;
|
return null;
|
||||||
|
}
|
||||||
if(cmd.getVmId() != null && cmd.getVmId().isEmpty()) {
|
|
||||||
if(s_logger.isTraceEnabled())
|
@Override
|
||||||
s_logger.trace("Invalid vm id sent from proxy(happens when proxy session has terminated)");
|
public void onLoadReport(ConsoleProxyLoadReportCommand cmd) {
|
||||||
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
try {
|
public AgentControlAnswer onConsoleAccessAuthentication(ConsoleAccessAuthenticationCommand cmd) {
|
||||||
vmId = Long.parseLong(cmd.getVmId());
|
long vmId = 0;
|
||||||
} catch(NumberFormatException e) {
|
|
||||||
s_logger.error("Invalid vm id " + cmd.getVmId() + " sent from console access authentication", e);
|
if (cmd.getVmId() != null && cmd.getVmId().isEmpty()) {
|
||||||
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
if (s_logger.isTraceEnabled())
|
||||||
}
|
s_logger.trace("Invalid vm id sent from proxy(happens when proxy session has terminated)");
|
||||||
|
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
||||||
// TODO authentication channel between console proxy VM and management server needs to be secured,
|
}
|
||||||
// the data is now being sent through private network, but this is apparently not enough
|
|
||||||
VMInstanceVO vm = _instanceDao.findById(vmId);
|
try {
|
||||||
if(vm == null) {
|
vmId = Long.parseLong(cmd.getVmId());
|
||||||
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
} catch (NumberFormatException e) {
|
||||||
}
|
s_logger.error("Invalid vm id " + cmd.getVmId() + " sent from console access authentication", e);
|
||||||
|
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
||||||
if(vm.getHostId() == null) {
|
}
|
||||||
s_logger.warn("VM " + vmId + " lost host info, failed authentication request");
|
|
||||||
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
// TODO authentication channel between console proxy VM and management
|
||||||
}
|
// server needs to be secured,
|
||||||
|
// the data is now being sent through private network, but this is
|
||||||
HostVO host = _hostDao.findById(vm.getHostId());
|
// apparently not enough
|
||||||
if(host == null) {
|
VMInstanceVO vm = _instanceDao.findById(vmId);
|
||||||
s_logger.warn("VM " + vmId + "'s host does not exist, fail authentication request");
|
if (vm == null) {
|
||||||
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
String sid = cmd.getSid();
|
if (vm.getHostId() == null) {
|
||||||
if(sid == null || !sid.equals(vm.getVncPassword())) {
|
s_logger.warn("VM " + vmId + " lost host info, failed authentication request");
|
||||||
s_logger.warn("sid " + sid + " in url does not match stored sid " + vm.getVncPassword());
|
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
||||||
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
}
|
||||||
}
|
|
||||||
|
HostVO host = _hostDao.findById(vm.getHostId());
|
||||||
return new ConsoleAccessAuthenticationAnswer(cmd, true);
|
if (host == null) {
|
||||||
|
s_logger.warn("VM " + vmId + "'s host does not exist, fail authentication request");
|
||||||
|
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
String sid = cmd.getSid();
|
||||||
|
if (sid == null || !sid.equals(vm.getVncPassword())) {
|
||||||
|
s_logger.warn("sid " + sid + " in url does not match stored sid " + vm.getVncPassword());
|
||||||
|
return new ConsoleAccessAuthenticationAnswer(cmd, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ConsoleAccessAuthenticationAnswer(cmd, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAgentConnect(HostVO host, StartupCommand cmd) {
|
public void onAgentConnect(HostVO host, StartupCommand cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAgentDisconnect(long agentId, Status state) {
|
public void onAgentDisconnect(long agentId, Status state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConsoleProxyVO startProxy(long proxyVmId, long startEventId) {
|
public ConsoleProxyVO startProxy(long proxyVmId, long startEventId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean destroyProxy(long proxyVmId, long startEventId) {
|
public boolean destroyProxy(long proxyVmId, long startEventId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean rebootProxy(long proxyVmId, long startEventId) {
|
public boolean rebootProxy(long proxyVmId, long startEventId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean stopProxy(long proxyVmId, long startEventId) {
|
public boolean stopProxy(long proxyVmId, long startEventId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return _name;
|
return _name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Command cleanup(ConsoleProxyVO vm, String vmName) {
|
public Command cleanup(ConsoleProxyVO vm, String vmName) {
|
||||||
return new StopCommand(vm, vmName, null);
|
return new StopCommand(vm, vmName, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean completeMigration(ConsoleProxyVO vm, HostVO host) throws AgentUnavailableException, OperationTimedoutException {
|
public boolean completeMigration(ConsoleProxyVO vm, HostVO host) throws AgentUnavailableException, OperationTimedoutException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeStartCommand(ConsoleProxyVO vm) {
|
public void completeStartCommand(ConsoleProxyVO vm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void completeStopCommand(ConsoleProxyVO vm) {
|
public void completeStopCommand(ConsoleProxyVO vm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long convertToId(String vmName) {
|
public Long convertToId(String vmName) {
|
||||||
if (!VirtualMachineName.isValidConsoleProxyName(vmName, _instance)) {
|
if (!VirtualMachineName.isValidConsoleProxyName(vmName, _instance)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return VirtualMachineName.getConsoleProxyId(vmName);
|
return VirtualMachineName.getConsoleProxyId(vmName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean destroy(ConsoleProxyVO vm) throws AgentUnavailableException {
|
public boolean destroy(ConsoleProxyVO vm) throws AgentUnavailableException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConsoleProxyVO get(long id) {
|
public ConsoleProxyVO get(long id) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean migrate(ConsoleProxyVO vm, HostVO host) throws AgentUnavailableException, OperationTimedoutException {
|
public boolean migrate(ConsoleProxyVO vm, HostVO host) throws AgentUnavailableException, OperationTimedoutException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HostVO prepareForMigration(ConsoleProxyVO vm) throws InsufficientCapacityException, StorageUnavailableException {
|
public HostVO prepareForMigration(ConsoleProxyVO vm) throws InsufficientCapacityException, StorageUnavailableException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConsoleProxyVO start(long vmId, long startEventId) throws InsufficientCapacityException, StorageUnavailableException, ConcurrentOperationException {
|
public ConsoleProxyVO start(long vmId, long startEventId) throws InsufficientCapacityException, StorageUnavailableException,
|
||||||
return null;
|
ConcurrentOperationException {
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public boolean stop(ConsoleProxyVO vm, long startEventId) throws AgentUnavailableException {
|
@Override
|
||||||
return false;
|
public boolean stop(ConsoleProxyVO vm, long startEventId) throws AgentUnavailableException {
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import org.apache.log4j.Logger;
|
|||||||
|
|
||||||
import com.cloud.host.Host;
|
import com.cloud.host.Host;
|
||||||
import com.cloud.host.HostVO;
|
import com.cloud.host.HostVO;
|
||||||
import com.cloud.vm.ConsoleProxyVO;
|
import com.cloud.info.ConsoleProxyInfo;
|
||||||
import com.cloud.vm.UserVmVO;
|
import com.cloud.vm.UserVmVO;
|
||||||
|
|
||||||
@Local(value={ConsoleProxyManager.class})
|
@Local(value={ConsoleProxyManager.class})
|
||||||
@ -35,7 +35,7 @@ AgentBasedConsoleProxyManager {
|
|||||||
private static final Logger s_logger = Logger.getLogger(AgentBasedStandaloneConsoleProxyManager.class);
|
private static final Logger s_logger = Logger.getLogger(AgentBasedStandaloneConsoleProxyManager.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConsoleProxyVO assignProxy(long dataCenterId, long userVmId) {
|
public ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId) {
|
||||||
UserVmVO userVm = _userVmDao.findById(userVmId);
|
UserVmVO userVm = _userVmDao.findById(userVmId);
|
||||||
if (userVm == null) {
|
if (userVm == null) {
|
||||||
s_logger.warn("User VM " + userVmId
|
s_logger.warn("User VM " + userVmId
|
||||||
@ -81,15 +81,11 @@ AgentBasedConsoleProxyManager {
|
|||||||
publicIp = allocatedHost.getPrivateIpAddress();
|
publicIp = allocatedHost.getPrivateIpAddress();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConsoleProxyVO proxy = allocateProxy(allocatedHost, dataCenterId);
|
int urlPort = _consoleProxyUrlPort;
|
||||||
|
if(allocatedHost.getProxyPort() != null && allocatedHost.getProxyPort().intValue() > 0)
|
||||||
if(allocatedHost.getProxyPort() != null && allocatedHost.getProxyPort().intValue() > 0)
|
urlPort = allocatedHost.getProxyPort().intValue();
|
||||||
proxy.setPort(allocatedHost.getProxyPort().intValue());
|
|
||||||
else
|
return new ConsoleProxyInfo(_sslEnabled, publicIp, _consoleProxyPort, urlPort);
|
||||||
proxy.setPort(_consoleProxyUrlPort);
|
|
||||||
|
|
||||||
proxy.setSslEnabled(_sslEnabled);
|
|
||||||
return proxy;
|
|
||||||
} else {
|
} else {
|
||||||
s_logger.warn("Host that VM is running is no longer available, console access to VM " + userVmId + " will be temporarily unavailable.");
|
s_logger.warn("Host that VM is running is no longer available, console access to VM " + userVmId + " will be temporarily unavailable.");
|
||||||
}
|
}
|
||||||
|
|||||||
19
server/src/com/cloud/consoleproxy/AgentHook.java
Normal file
19
server/src/com/cloud/consoleproxy/AgentHook.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.cloud.consoleproxy;
|
||||||
|
|
||||||
|
import com.cloud.agent.api.AgentControlAnswer;
|
||||||
|
import com.cloud.agent.api.ConsoleAccessAuthenticationCommand;
|
||||||
|
import com.cloud.agent.api.ConsoleProxyLoadReportCommand;
|
||||||
|
import com.cloud.agent.api.StartupCommand;
|
||||||
|
import com.cloud.host.HostVO;
|
||||||
|
import com.cloud.host.Status;
|
||||||
|
|
||||||
|
public interface AgentHook {
|
||||||
|
void onLoadReport(ConsoleProxyLoadReportCommand cmd);
|
||||||
|
AgentControlAnswer onConsoleAccessAuthentication(ConsoleAccessAuthenticationCommand cmd);
|
||||||
|
void onAgentConnect(HostVO host, StartupCommand cmd);
|
||||||
|
|
||||||
|
public void onAgentDisconnect(long agentId, Status state);
|
||||||
|
}
|
||||||
@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.cloud.consoleproxy;
|
package com.cloud.consoleproxy;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.agent.Listener;
|
import com.cloud.agent.Listener;
|
||||||
@ -33,13 +32,13 @@ import com.cloud.host.Status;
|
|||||||
|
|
||||||
public class ConsoleProxyListener implements Listener {
|
public class ConsoleProxyListener implements Listener {
|
||||||
private final static Logger s_logger = Logger.getLogger(ConsoleProxyListener.class);
|
private final static Logger s_logger = Logger.getLogger(ConsoleProxyListener.class);
|
||||||
|
|
||||||
ConsoleProxyManager _proxyMgr = null;
|
|
||||||
|
|
||||||
public ConsoleProxyListener(ConsoleProxyManager proxyMgr) {
|
AgentHook _proxyMgr = null;
|
||||||
|
|
||||||
|
public ConsoleProxyListener(AgentHook proxyMgr) {
|
||||||
_proxyMgr = proxyMgr;
|
_proxyMgr = proxyMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRecurring() {
|
public boolean isRecurring() {
|
||||||
return true;
|
return true;
|
||||||
@ -47,46 +46,46 @@ public class ConsoleProxyListener implements Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean processAnswer(long agentId, long seq, Answer[] answers) {
|
public boolean processAnswer(long agentId, long seq, Answer[] answers) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean processCommand(long agentId, long seq, Command[] commands) {
|
public boolean processCommand(long agentId, long seq, Command[] commands) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) {
|
public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) {
|
||||||
if(cmd instanceof ConsoleProxyLoadReportCommand) {
|
if (cmd instanceof ConsoleProxyLoadReportCommand) {
|
||||||
_proxyMgr.onLoadReport((ConsoleProxyLoadReportCommand)cmd);
|
_proxyMgr.onLoadReport((ConsoleProxyLoadReportCommand) cmd);
|
||||||
|
|
||||||
// return dummy answer
|
// return dummy answer
|
||||||
return new AgentControlAnswer(cmd);
|
return new AgentControlAnswer(cmd);
|
||||||
} else if(cmd instanceof ConsoleAccessAuthenticationCommand) {
|
} else if (cmd instanceof ConsoleAccessAuthenticationCommand) {
|
||||||
return _proxyMgr.onConsoleAccessAuthentication((ConsoleAccessAuthenticationCommand)cmd);
|
return _proxyMgr.onConsoleAccessAuthentication((ConsoleAccessAuthenticationCommand) cmd);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean processConnect(HostVO host, StartupCommand cmd) {
|
public boolean processConnect(HostVO host, StartupCommand cmd) {
|
||||||
_proxyMgr.onAgentConnect(host, cmd);
|
_proxyMgr.onAgentConnect(host, cmd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean processDisconnect(long agentId, Status state) {
|
public boolean processDisconnect(long agentId, Status state) {
|
||||||
_proxyMgr.onAgentDisconnect(agentId, state);
|
_proxyMgr.onAgentDisconnect(agentId, state);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean processTimeout(long agentId, long seq) {
|
public boolean processTimeout(long agentId, long seq) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTimeout() {
|
public int getTimeout() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
46
server/src/com/cloud/consoleproxy/ConsoleProxyManager.java
Normal file
46
server/src/com/cloud/consoleproxy/ConsoleProxyManager.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* This software is licensed under the GNU General Public License v3 or later.
|
||||||
|
*
|
||||||
|
* It is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or any later version.
|
||||||
|
* 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.cloud.consoleproxy;
|
||||||
|
|
||||||
|
import com.cloud.info.ConsoleProxyInfo;
|
||||||
|
import com.cloud.utils.component.Manager;
|
||||||
|
import com.cloud.vm.ConsoleProxyVO;
|
||||||
|
|
||||||
|
public interface ConsoleProxyManager extends Manager {
|
||||||
|
public static final int DEFAULT_PROXY_CAPACITY = 50;
|
||||||
|
public static final int DEFAULT_STANDBY_CAPACITY = 10;
|
||||||
|
public static final int DEFAULT_PROXY_VM_RAMSIZE = 1024; // 1G
|
||||||
|
|
||||||
|
public static final int DEFAULT_PROXY_CMD_PORT = 8001;
|
||||||
|
public static final int DEFAULT_PROXY_VNC_PORT = 0;
|
||||||
|
public static final int DEFAULT_PROXY_URL_PORT = 80;
|
||||||
|
public static final int DEFAULT_PROXY_SESSION_TIMEOUT = 300000; // 5 minutes
|
||||||
|
|
||||||
|
public static final String ALERT_SUBJECT = "proxy-alert";
|
||||||
|
|
||||||
|
public ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId);
|
||||||
|
|
||||||
|
public ConsoleProxyVO startProxy(long proxyVmId, long startEventId);
|
||||||
|
|
||||||
|
public boolean stopProxy(long proxyVmId, long startEventId);
|
||||||
|
|
||||||
|
public boolean rebootProxy(long proxyVmId, long startEventId);
|
||||||
|
|
||||||
|
public boolean destroyProxy(long proxyVmId, long startEventId);
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -24,8 +24,9 @@ import javax.ejb.Local;
|
|||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
import com.cloud.configuration.dao.ConfigurationDao;
|
import com.cloud.configuration.dao.ConfigurationDao;
|
||||||
import com.cloud.host.HostVO;
|
|
||||||
import com.cloud.host.Host.Type;
|
import com.cloud.host.Host.Type;
|
||||||
|
import com.cloud.host.HostVO;
|
||||||
|
import com.cloud.info.ConsoleProxyInfo;
|
||||||
import com.cloud.utils.component.ComponentLocator;
|
import com.cloud.utils.component.ComponentLocator;
|
||||||
import com.cloud.utils.component.Inject;
|
import com.cloud.utils.component.Inject;
|
||||||
import com.cloud.vm.ConsoleProxyVO;
|
import com.cloud.vm.ConsoleProxyVO;
|
||||||
@ -46,31 +47,8 @@ public class StaticConsoleProxyManager extends AgentBasedConsoleProxyManager imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConsoleProxyVO assignProxy(long dataCenterId, long userVmId) {
|
public ConsoleProxyInfo assignProxy(long dataCenterId, long userVmId) {
|
||||||
ConsoleProxyVO proxy = new ConsoleProxyVO(1l, "EmbeddedProxy", null, null, null,
|
return new ConsoleProxyInfo(false, _ip, _consoleProxyPort, _consoleProxyUrlPort);
|
||||||
"02:02:02:02:02:02",
|
|
||||||
"127.0.0.1",
|
|
||||||
"255.255.255.0",
|
|
||||||
1l,
|
|
||||||
1l,
|
|
||||||
"03:03:03:03:03:03",
|
|
||||||
_ip,
|
|
||||||
"255.255.255.0",
|
|
||||||
null,
|
|
||||||
"untagged",
|
|
||||||
1l,
|
|
||||||
dataCenterId,
|
|
||||||
"0.0.0.0",
|
|
||||||
0L,
|
|
||||||
"dns1",
|
|
||||||
"dn2",
|
|
||||||
"domain",
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
|
|
||||||
proxy.setPort(_consoleProxyUrlPort);
|
|
||||||
proxy.setSslEnabled(false);
|
|
||||||
return proxy;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -351,9 +351,6 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
private final Map<String, String> _configs;
|
private final Map<String, String> _configs;
|
||||||
|
|
||||||
private String _domain;
|
private String _domain;
|
||||||
private int _consoleProxyPort = ConsoleProxyManager.DEFAULT_PROXY_VNC_PORT;
|
|
||||||
// private int _consoleProxyUrlPort =
|
|
||||||
// ConsoleProxyManager.DEFAULT_PROXY_URL_PORT;
|
|
||||||
|
|
||||||
private final int _routerRamSize;
|
private final int _routerRamSize;
|
||||||
private final int _proxyRamSize;
|
private final int _proxyRamSize;
|
||||||
@ -447,16 +444,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
_domain = "." + _domain;
|
_domain = "." + _domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
String value = _configs.get("consoleproxy.port");
|
String value = _configs.get("account.cleanup.interval");
|
||||||
if (value != null)
|
|
||||||
_consoleProxyPort = NumbersUtil.parseInt(value, ConsoleProxyManager.DEFAULT_PROXY_VNC_PORT);
|
|
||||||
|
|
||||||
// value = _configs.get("consoleproxy.url.port");
|
|
||||||
// if(value != null)
|
|
||||||
// _consoleProxyUrlPort = NumbersUtil.parseInt(value,
|
|
||||||
// ConsoleProxyManager.DEFAULT_PROXY_URL_PORT);
|
|
||||||
|
|
||||||
value = _configs.get("account.cleanup.interval");
|
|
||||||
int cleanup = NumbersUtil.parseInt(value, 60 * 60 * 24); // 1 hour.
|
int cleanup = NumbersUtil.parseInt(value, 60 * 60 * 24); // 1 hour.
|
||||||
|
|
||||||
// Parse the max number of UserVMs and public IPs from server-setup.xml,
|
// Parse the max number of UserVMs and public IPs from server-setup.xml,
|
||||||
@ -771,6 +759,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public User getUser(long userId, boolean active) {
|
public User getUser(long userId, boolean active) {
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Retrieiving user with id: " + userId + " and active = " + active);
|
s_logger.debug("Retrieiving user with id: " + userId + " and active = " + active);
|
||||||
@ -1240,6 +1229,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
/*
|
/*
|
||||||
* Save event after starting execution of an async job
|
* Save event after starting execution of an async job
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Long saveStartedEvent(Long userId, Long accountId, String type, String description, long startEventId) {
|
public Long saveStartedEvent(Long userId, Long accountId, String type, String description, long startEventId) {
|
||||||
EventVO event = new EventVO();
|
EventVO event = new EventVO();
|
||||||
event.setUserId(userId);
|
event.setUserId(userId);
|
||||||
@ -2874,6 +2864,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _hostDao.findById(hostId);
|
return _hostDao.findById(hostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateHost(long hostId, long guestOSCategoryId) throws InvalidParameterValueException {
|
public void updateHost(long hostId, long guestOSCategoryId) throws InvalidParameterValueException {
|
||||||
// Verify that the guest OS Category exists
|
// Verify that the guest OS Category exists
|
||||||
if (guestOSCategoryId > 0) {
|
if (guestOSCategoryId > 0) {
|
||||||
@ -2885,6 +2876,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
_agentMgr.updateHost(hostId, guestOSCategoryId);
|
_agentMgr.updateHost(hostId, guestOSCategoryId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean deleteHost(long hostId) {
|
public boolean deleteHost(long hostId) {
|
||||||
return _agentMgr.deleteHost(hostId);
|
return _agentMgr.deleteHost(hostId);
|
||||||
}
|
}
|
||||||
@ -5950,6 +5942,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _asyncMgr.submitAsyncJob(job);
|
return _asyncMgr.submitAsyncJob(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void deleteRule(long ruleId, long userId, long accountId) throws InvalidParameterValueException, PermissionDeniedException, InternalErrorException {
|
public void deleteRule(long ruleId, long userId, long accountId) throws InvalidParameterValueException, PermissionDeniedException, InternalErrorException {
|
||||||
Exception e = null;
|
Exception e = null;
|
||||||
try {
|
try {
|
||||||
@ -6006,6 +5999,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long deleteRuleAsync(long id, long userId, long accountId) {
|
public long deleteRuleAsync(long id, long userId, long accountId) {
|
||||||
DeleteRuleParam param = new DeleteRuleParam(id, userId, accountId);
|
DeleteRuleParam param = new DeleteRuleParam(id, userId, accountId);
|
||||||
Gson gson = GsonHelper.getBuilder().create();
|
Gson gson = GsonHelper.getBuilder().create();
|
||||||
@ -6019,10 +6013,12 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _asyncMgr.submitAsyncJob(job);
|
return _asyncMgr.submitAsyncJob(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<VMTemplateVO> listAllTemplates() {
|
public List<VMTemplateVO> listAllTemplates() {
|
||||||
return _templateDao.listAll();
|
return _templateDao.listAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<GuestOSVO> listGuestOSByCriteria(Criteria c)
|
public List<GuestOSVO> listGuestOSByCriteria(Criteria c)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -6047,6 +6043,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _guestOSDao.search(sc, searchFilter);
|
return _guestOSDao.search(sc, searchFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<GuestOSCategoryVO> listGuestOSCategoriesByCriteria(Criteria c)
|
public List<GuestOSCategoryVO> listGuestOSCategoriesByCriteria(Criteria c)
|
||||||
{
|
{
|
||||||
Filter searchFilter = new Filter(GuestOSCategoryVO.class, c.getOrderBy(), c.getAscending(), c.getOffset(), c.getLimit());
|
Filter searchFilter = new Filter(GuestOSCategoryVO.class, c.getOrderBy(), c.getAscending(), c.getOffset(), c.getLimit());
|
||||||
@ -6064,34 +6061,37 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _guestOSCategoryDao.search(sc, searchFilter);
|
return _guestOSCategoryDao.search(sc, searchFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getConfigurationValue(String name) {
|
public String getConfigurationValue(String name) {
|
||||||
return _configDao.getValue(name);
|
return _configDao.getValue(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ConsoleProxyInfo getConsoleProxy(long dataCenterId, long userVmId) {
|
public ConsoleProxyInfo getConsoleProxy(long dataCenterId, long userVmId) {
|
||||||
ConsoleProxyVO proxy = _consoleProxyMgr.assignProxy(dataCenterId, userVmId);
|
return _consoleProxyMgr.assignProxy(dataCenterId, userVmId);
|
||||||
if (proxy == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return new ConsoleProxyInfo(proxy.isSslEnabled(), proxy.getPublicIpAddress(), _consoleProxyPort, proxy.getPort());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ConsoleProxyVO startConsoleProxy(long instanceId, long startEventId) throws InternalErrorException {
|
public ConsoleProxyVO startConsoleProxy(long instanceId, long startEventId) throws InternalErrorException {
|
||||||
return _consoleProxyMgr.startProxy(instanceId, startEventId);
|
return _consoleProxyMgr.startProxy(instanceId, startEventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean stopConsoleProxy(long instanceId, long startEventId) {
|
public boolean stopConsoleProxy(long instanceId, long startEventId) {
|
||||||
return _consoleProxyMgr.stopProxy(instanceId, startEventId);
|
return _consoleProxyMgr.stopProxy(instanceId, startEventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean rebootConsoleProxy(long instanceId, long startEventId) {
|
public boolean rebootConsoleProxy(long instanceId, long startEventId) {
|
||||||
return _consoleProxyMgr.rebootProxy(instanceId, startEventId);
|
return _consoleProxyMgr.rebootProxy(instanceId, startEventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean destroyConsoleProxy(long instanceId, long startEventId) {
|
public boolean destroyConsoleProxy(long instanceId, long startEventId) {
|
||||||
return _consoleProxyMgr.destroyProxy(instanceId, startEventId);
|
return _consoleProxyMgr.destroyProxy(instanceId, startEventId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long startConsoleProxyAsync(long instanceId) {
|
public long startConsoleProxyAsync(long instanceId) {
|
||||||
long eventId = saveScheduledEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_PROXY_START, "starting console proxy with Id: "+instanceId);
|
long eventId = saveScheduledEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_PROXY_START, "starting console proxy with Id: "+instanceId);
|
||||||
VMOperationParam param = new VMOperationParam(0, instanceId, null, eventId);
|
VMOperationParam param = new VMOperationParam(0, instanceId, null, eventId);
|
||||||
@ -6106,6 +6106,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _asyncMgr.submitAsyncJob(job, true);
|
return _asyncMgr.submitAsyncJob(job, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long stopConsoleProxyAsync(long instanceId) {
|
public long stopConsoleProxyAsync(long instanceId) {
|
||||||
long eventId = saveScheduledEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_PROXY_STOP, "stopping console proxy with Id: "+instanceId);
|
long eventId = saveScheduledEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_PROXY_STOP, "stopping console proxy with Id: "+instanceId);
|
||||||
VMOperationParam param = new VMOperationParam(0, instanceId, null, eventId);
|
VMOperationParam param = new VMOperationParam(0, instanceId, null, eventId);
|
||||||
@ -6122,6 +6123,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _asyncMgr.submitAsyncJob(job, true);
|
return _asyncMgr.submitAsyncJob(job, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long rebootConsoleProxyAsync(long instanceId) {
|
public long rebootConsoleProxyAsync(long instanceId) {
|
||||||
long eventId = saveScheduledEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_PROXY_REBOOT, "rebooting console proxy with Id: "+instanceId);
|
long eventId = saveScheduledEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_PROXY_REBOOT, "rebooting console proxy with Id: "+instanceId);
|
||||||
VMOperationParam param = new VMOperationParam(0, instanceId, null, eventId);
|
VMOperationParam param = new VMOperationParam(0, instanceId, null, eventId);
|
||||||
@ -6138,6 +6140,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _asyncMgr.submitAsyncJob(job, true);
|
return _asyncMgr.submitAsyncJob(job, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long destroyConsoleProxyAsync(long instanceId) {
|
public long destroyConsoleProxyAsync(long instanceId) {
|
||||||
long eventId = saveScheduledEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_PROXY_DESTROY, "destroying console proxy with Id: "+instanceId);
|
long eventId = saveScheduledEvent(User.UID_SYSTEM, Account.ACCOUNT_ID_SYSTEM, EventTypes.EVENT_PROXY_DESTROY, "destroying console proxy with Id: "+instanceId);
|
||||||
VMOperationParam param = new VMOperationParam(0, instanceId, null, eventId);
|
VMOperationParam param = new VMOperationParam(0, instanceId, null, eventId);
|
||||||
@ -6152,6 +6155,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _asyncMgr.submitAsyncJob(job);
|
return _asyncMgr.submitAsyncJob(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getConsoleAccessUrlRoot(long vmId) {
|
public String getConsoleAccessUrlRoot(long vmId) {
|
||||||
VMInstanceVO vm = this.findVMInstanceById(vmId);
|
VMInstanceVO vm = this.findVMInstanceById(vmId);
|
||||||
if (vm != null) {
|
if (vm != null) {
|
||||||
@ -6162,6 +6166,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getVncPort(VirtualMachine vm) {
|
public int getVncPort(VirtualMachine vm) {
|
||||||
if (vm.getHostId() == null) {
|
if (vm.getHostId() == null) {
|
||||||
s_logger.warn("VM " + vm.getName() + " does not have host, return -1 for its VNC port");
|
s_logger.warn("VM " + vm.getName() + " does not have host, return -1 for its VNC port");
|
||||||
@ -6180,10 +6185,12 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ConsoleProxyVO findConsoleProxyById(long instanceId) {
|
public ConsoleProxyVO findConsoleProxyById(long instanceId) {
|
||||||
return _consoleProxyDao.findById(instanceId);
|
return _consoleProxyDao.findById(instanceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<? extends Domain> searchForDomains(Criteria c) {
|
public List<? extends Domain> searchForDomains(Criteria c) {
|
||||||
Filter searchFilter = new Filter(DomainVO.class, c.getOrderBy(), c.getAscending(), c.getOffset(), c.getLimit());
|
Filter searchFilter = new Filter(DomainVO.class, c.getOrderBy(), c.getAscending(), c.getOffset(), c.getLimit());
|
||||||
Long domainId = (Long) c.getCriteria(Criteria.ID);
|
Long domainId = (Long) c.getCriteria(Criteria.ID);
|
||||||
@ -6223,6 +6230,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _domainDao.search(sc, searchFilter);
|
return _domainDao.search(sc, searchFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List<? extends Domain> searchForDomainChildren(Criteria c) {
|
public List<? extends Domain> searchForDomainChildren(Criteria c) {
|
||||||
Filter searchFilter = new Filter(DomainVO.class, c.getOrderBy(), c.getAscending(), c.getOffset(), c.getLimit());
|
Filter searchFilter = new Filter(DomainVO.class, c.getOrderBy(), c.getAscending(), c.getOffset(), c.getLimit());
|
||||||
Long domainId = (Long) c.getCriteria(Criteria.ID);
|
Long domainId = (Long) c.getCriteria(Criteria.ID);
|
||||||
@ -6354,6 +6362,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return success && deleteDomainSuccess;
|
return success && deleteDomainSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateDomain(Long domainId, String domainName) {
|
public void updateDomain(Long domainId, String domainName) {
|
||||||
SearchCriteria<DomainVO> sc = _domainDao.createSearchCriteria();
|
SearchCriteria<DomainVO> sc = _domainDao.createSearchCriteria();
|
||||||
sc.addAnd("name", SearchCriteria.Op.EQ, domainName);
|
sc.addAnd("name", SearchCriteria.Op.EQ, domainName);
|
||||||
@ -6368,6 +6377,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Long findDomainIdByAccountId(Long accountId) {
|
public Long findDomainIdByAccountId(Long accountId) {
|
||||||
if (accountId == null) {
|
if (accountId == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -6381,6 +6391,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public DomainVO findDomainIdById(Long domainId) {
|
public DomainVO findDomainIdById(Long domainId) {
|
||||||
return _domainDao.findById(domainId);
|
return _domainDao.findById(domainId);
|
||||||
}
|
}
|
||||||
@ -6447,6 +6458,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _capacityDao.search(sc, searchFilter);
|
return _capacityDao.search(sc, searchFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getMemoryUsagebyHost(Long hostId) {
|
public long getMemoryUsagebyHost(Long hostId) {
|
||||||
long mem = 0;
|
long mem = 0;
|
||||||
List<VMInstanceVO> vms = _vmInstanceDao.listUpByHostIdTypes(hostId, VirtualMachine.Type.DomainRouter);
|
List<VMInstanceVO> vms = _vmInstanceDao.listUpByHostIdTypes(hostId, VirtualMachine.Type.DomainRouter);
|
||||||
@ -8266,6 +8278,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ArrayList<String> getCloudIdentifierResponse(long userId)
|
public ArrayList<String> getCloudIdentifierResponse(long userId)
|
||||||
{
|
{
|
||||||
Criteria c = new Criteria ();
|
Criteria c = new Criteria ();
|
||||||
@ -8477,12 +8490,14 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return _configMgr.addConfig(category, instance, component, name, value, description);
|
return _configMgr.addConfig(category, instance, component, name, value, description);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean preparePrimaryStorageForMaintenance(long primaryStorageId, long userId) {
|
@Override
|
||||||
|
public boolean preparePrimaryStorageForMaintenance(long primaryStorageId, long userId) {
|
||||||
return _storageMgr.preparePrimaryStorageForMaintenance(primaryStorageId, userId);
|
return _storageMgr.preparePrimaryStorageForMaintenance(primaryStorageId, userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long preparePrimaryStorageForMaintenanceAsync(long primaryStorageId) throws InvalidParameterValueException
|
@Override
|
||||||
|
public long preparePrimaryStorageForMaintenanceAsync(long primaryStorageId) throws InvalidParameterValueException
|
||||||
{
|
{
|
||||||
StoragePoolVO primaryStorage = _poolDao.findById(primaryStorageId);
|
StoragePoolVO primaryStorage = _poolDao.findById(primaryStorageId);
|
||||||
|
|
||||||
@ -8512,12 +8527,14 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean cancelPrimaryStorageMaintenance(long primaryStorageId, long userId)
|
public boolean cancelPrimaryStorageMaintenance(long primaryStorageId, long userId)
|
||||||
{
|
{
|
||||||
return _storageMgr.cancelPrimaryStorageForMaintenance(primaryStorageId, userId);
|
return _storageMgr.cancelPrimaryStorageForMaintenance(primaryStorageId, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long cancelPrimaryStorageMaintenanceAsync(long primaryStorageId) throws InvalidParameterValueException
|
@Override
|
||||||
|
public long cancelPrimaryStorageMaintenanceAsync(long primaryStorageId) throws InvalidParameterValueException
|
||||||
{
|
{
|
||||||
StoragePoolVO primaryStorage = _poolDao.findById(primaryStorageId);
|
StoragePoolVO primaryStorage = _poolDao.findById(primaryStorageId);
|
||||||
|
|
||||||
|
|||||||
@ -32,12 +32,12 @@ import com.cloud.user.AccountVO;
|
|||||||
public interface VmManager {
|
public interface VmManager {
|
||||||
|
|
||||||
VMInstanceVO allocate(VMInstanceVO vm,
|
VMInstanceVO allocate(VMInstanceVO vm,
|
||||||
ServiceOfferingVO serviceOffering,
|
ServiceOfferingVO serviceOffering,
|
||||||
Long rootSize,
|
Long rootSize,
|
||||||
List<NetworkOfferingVO> networkOfferings,
|
List<NetworkOfferingVO> networkOfferings,
|
||||||
Map<DiskOfferingVO, Long> diskOfferings,
|
Map<DiskOfferingVO, Long> diskOfferings,
|
||||||
DataCenterVO dc,
|
DataCenterVO dc,
|
||||||
AccountVO owner);
|
AccountVO owner);
|
||||||
|
|
||||||
VMInstanceVO allocate(VMInstanceVO vm,
|
VMInstanceVO allocate(VMInstanceVO vm,
|
||||||
ServiceOfferingVO serviceOffering,
|
ServiceOfferingVO serviceOffering,
|
||||||
|
|||||||
@ -77,6 +77,14 @@ DROP TABLE IF EXISTS `cloud`.`nics`;
|
|||||||
DROP TABLE IF EXISTS `cloud`.`network_profiles`;
|
DROP TABLE IF EXISTS `cloud`.`network_profiles`;
|
||||||
DROP TABLE IF EXISTS `cloud`.`network_offerings`;
|
DROP TABLE IF EXISTS `cloud`.`network_offerings`;
|
||||||
DROP TABLE IF EXISTS `cloud`.`host_master`;
|
DROP TABLE IF EXISTS `cloud`.`host_master`;
|
||||||
|
DROP TABLE IF EXISTS `cloud`.`hypervisor_properties`;
|
||||||
|
|
||||||
|
CREATE TABLE `cloud`.`hypervsior_properties` (
|
||||||
|
`hypervisor` varchar(32) NOT NULL UNIQUE COMMENT 'hypervisor type',
|
||||||
|
`max_storage_devices` int(10) NOT NULL COMMENT 'maximum number of storage devices',
|
||||||
|
`cdrom_device` int(10) NOT NULL COMMENT 'device id reserved for cdrom',
|
||||||
|
`max_network_devices` int(10) NOT NULL COMMENT 'maximum number of network devices'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
CREATE TABLE `cloud`.`network_profiles` (
|
CREATE TABLE `cloud`.`network_profiles` (
|
||||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||||
|
|||||||
@ -611,7 +611,7 @@
|
|||||||
<div class="grid_headertitles">
|
<div class="grid_headertitles">
|
||||||
Name</div>
|
Name</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_genheader_cell" style="width: 10%;">
|
<div class="grid_genheader_cell" style="width: 15%;">
|
||||||
<div class="grid_headertitles">
|
<div class="grid_headertitles">
|
||||||
Type</div>
|
Type</div>
|
||||||
</div>
|
</div>
|
||||||
@ -631,7 +631,7 @@
|
|||||||
<div class="grid_headertitles">
|
<div class="grid_headertitles">
|
||||||
Size</div>
|
Size</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_genheader_cell" style="width: 7%;">
|
<div class="grid_genheader_cell" style="width: 5%;">
|
||||||
<div class="grid_headertitles">
|
<div class="grid_headertitles">
|
||||||
State</div>
|
State</div>
|
||||||
</div>
|
</div>
|
||||||
@ -703,7 +703,7 @@
|
|||||||
<div class="netgrid_celltitles" id="volume_name">
|
<div class="netgrid_celltitles" id="volume_name">
|
||||||
Name</div>
|
Name</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_smallgenrow_cell" style="width: 10%;">
|
<div class="grid_smallgenrow_cell" style="width: 15%;">
|
||||||
<div class="netgrid_celltitles" id="volume_type">
|
<div class="netgrid_celltitles" id="volume_type">
|
||||||
Type</div>
|
Type</div>
|
||||||
</div>
|
</div>
|
||||||
@ -723,7 +723,7 @@
|
|||||||
<div class="netgrid_celltitles" id="volume_size">
|
<div class="netgrid_celltitles" id="volume_size">
|
||||||
size</div>
|
size</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_smallgenrow_cell" style="width: 7%;">
|
<div class="grid_smallgenrow_cell" style="width: 5%;">
|
||||||
<div class="netgrid_celltitles" id="volume_state">
|
<div class="netgrid_celltitles" id="volume_state">
|
||||||
state</div>
|
state</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -65,8 +65,8 @@ function showDomainsTab() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function drawTree(id, level, container) {
|
function drawTree(id, level, container) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=listDomainChildren&id="+id+"&response=json"),
|
data: "command=listDomainChildren&id="+id+"&response=json&pageSize=-1",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
@ -320,8 +320,8 @@ function showDomainsTab() {
|
|||||||
rightPanelDetailContent.hide();
|
rightPanelDetailContent.hide();
|
||||||
rightPanelSearchResult.show();
|
rightPanelSearchResult.show();
|
||||||
var keyword = searchInput.val();
|
var keyword = searchInput.val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=listDomains&keyword="+keyword+"&response=json"+maxPageSize),
|
data: "command=listDomains&keyword="+keyword+"&response=json&pageSize=-1", //pageSize=-1 will return all items (no limitation)
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
@ -349,8 +349,8 @@ function showDomainsTab() {
|
|||||||
//draw root node
|
//draw root node
|
||||||
function drawRootNode(rootDomainId) {
|
function drawRootNode(rootDomainId) {
|
||||||
treeContentBox.empty();
|
treeContentBox.empty();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=listDomains&id="+rootDomainId+"&response=json"),
|
data: "command=listDomains&id="+rootDomainId+"&response=json&pageSize=-1", //pageSize=-1 will return all items (no limitation)
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
|
|||||||
@ -232,10 +232,13 @@ conf.env.USAGECLASSPATH = pathsep.join(usageclasspath)
|
|||||||
# 1. source directories (without including the JARs)
|
# 1. source directories (without including the JARs)
|
||||||
# JARs are not included because in case of parallel compilation (IOW, all the time), javac picks up half-written JARs and die
|
# JARs are not included because in case of parallel compilation (IOW, all the time), javac picks up half-written JARs and die
|
||||||
compilecp = []# list(srcdirs)
|
compilecp = []# list(srcdirs)
|
||||||
# 2.a) the thirdparty/ directory in the source if on Windows / Mac
|
|
||||||
# 2.b) the deps/ directory in the source if on Linux
|
# 2.b) the deps/ directory in the source if on Linux
|
||||||
if conf.env.DISTRO in ["Windows","Mac"]: compilecp+= _glob(_join("cloudstack-proprietary","thirdparty","*.jar"))
|
# 2.a) the thirdparty/ directory if available
|
||||||
else: compilecp+= _glob(_join("deps","*.jar"))
|
if conf.env.DISTRO in ["Windows","Mac"]:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
compilecp+= _glob(_join("deps","*.jar"))
|
||||||
|
compilecp+= _glob(_join("cloudstack-proprietary","thirdparty","*.jar"))
|
||||||
# 3. the system classpath (system-installed JARs)
|
# 3. the system classpath (system-installed JARs)
|
||||||
compilecp+= [ conf.env.SYSTEMCLASSPATH ]
|
compilecp+= [ conf.env.SYSTEMCLASSPATH ]
|
||||||
compilecp+= _glob(_join(conf.env.TOMCATHOME,'bin',"*.jar"))
|
compilecp+= _glob(_join(conf.env.TOMCATHOME,'bin',"*.jar"))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user