mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge branch 'master' of ssh://git.cloud.com/var/lib/git/cloudstack-oss
This commit is contained in:
commit
b69816814c
@ -1190,9 +1190,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
return new CreateAnswer(cmd, result);
|
return new CreateAnswer(cmd, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
LibvirtStorageVolumeDef volDef = new LibvirtStorageVolumeDef(UUID.randomUUID().toString(), tmplVol.getInfo().capacity, volFormat.QCOW2, tmplVol.getPath(), volFormat.QCOW2);
|
vol = createVolume(primaryPool, tmplVol);
|
||||||
s_logger.debug(volDef.toString());
|
|
||||||
vol = primaryPool.storageVolCreateXML(volDef.toString(), 0);
|
|
||||||
if (vol == null) {
|
if (vol == null) {
|
||||||
return new Answer(cmd, false, " Can't create storage volume on storage pool");
|
return new Answer(cmd, false, " Can't create storage volume on storage pool");
|
||||||
}
|
}
|
||||||
@ -1229,12 +1228,21 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
protected ManageSnapshotAnswer execute(final ManageSnapshotCommand cmd) {
|
protected ManageSnapshotAnswer execute(final ManageSnapshotCommand cmd) {
|
||||||
String snapshotName = cmd.getSnapshotName();
|
String snapshotName = cmd.getSnapshotName();
|
||||||
String VolPath = cmd.getVolumePath();
|
String VolPath = cmd.getVolumePath();
|
||||||
|
String snapshotPath = cmd.getSnapshotPath();
|
||||||
|
String vmName = cmd.getVmName();
|
||||||
try {
|
try {
|
||||||
StorageVol vol = getVolume(VolPath);
|
DomainInfo.DomainState state = null;
|
||||||
if (vol == null) {
|
Domain vm = null;
|
||||||
return new ManageSnapshotAnswer(cmd, false, null);
|
if (vmName != null) {
|
||||||
|
try {
|
||||||
|
vm = getDomain(cmd.getVmName());
|
||||||
|
state = vm.getInfo().state;
|
||||||
|
} catch (LibvirtException e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
Domain vm = getDomain(cmd.getVmName());
|
}
|
||||||
|
|
||||||
|
if (state == DomainInfo.DomainState.VIR_DOMAIN_RUNNING) {
|
||||||
String vmUuid = vm.getUUIDString();
|
String vmUuid = vm.getUUIDString();
|
||||||
Object[] args = new Object[] {snapshotName, vmUuid};
|
Object[] args = new Object[] {snapshotName, vmUuid};
|
||||||
String snapshot = SnapshotXML.format(args);
|
String snapshot = SnapshotXML.format(args);
|
||||||
@ -1245,6 +1253,22 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
DomainSnapshot snap = vm.snapshotLookupByName(snapshotName);
|
DomainSnapshot snap = vm.snapshotLookupByName(snapshotName);
|
||||||
snap.delete(0);
|
snap.delete(0);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/*VM is not running, create a snapshot by ourself*/
|
||||||
|
final Script command = new Script(_manageSnapshotPath, _timeout, s_logger);
|
||||||
|
if (cmd.getCommandSwitch().equalsIgnoreCase(ManageSnapshotCommand.CREATE_SNAPSHOT)) {
|
||||||
|
command.add("-c", VolPath);
|
||||||
|
} else {
|
||||||
|
command.add("-d", snapshotPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
command.add("-n", snapshotName);
|
||||||
|
String result = command.execute();
|
||||||
|
if (result != null) {
|
||||||
|
s_logger.debug("Failed to manage snapshot: " + result);
|
||||||
|
return new ManageSnapshotAnswer(cmd, false, "Failed to manage snapshot: " + result);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (LibvirtException e) {
|
} catch (LibvirtException e) {
|
||||||
s_logger.debug("Failed to manage snapshot: " + e.toString());
|
s_logger.debug("Failed to manage snapshot: " + e.toString());
|
||||||
return new ManageSnapshotAnswer(cmd, false, "Failed to manage snapshot: " + e.toString());
|
return new ManageSnapshotAnswer(cmd, false, "Failed to manage snapshot: " + e.toString());
|
||||||
@ -1260,28 +1284,52 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
String snapshotName = cmd.getSnapshotName();
|
String snapshotName = cmd.getSnapshotName();
|
||||||
String snapshotPath = cmd.getSnapshotUuid();
|
String snapshotPath = cmd.getSnapshotUuid();
|
||||||
String snapshotDestPath = null;
|
String snapshotDestPath = null;
|
||||||
|
String vmName = cmd.getVmName();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
StoragePool secondaryStoragePool = getNfsSPbyURI(_conn, new URI(secondaryStoragePoolURL));
|
StoragePool secondaryStoragePool = getNfsSPbyURI(_conn, new URI(secondaryStoragePoolURL));
|
||||||
String ssPmountPath = _mountPoint + File.separator + secondaryStoragePool.getUUIDString();
|
String ssPmountPath = _mountPoint + File.separator + secondaryStoragePool.getUUIDString();
|
||||||
snapshotDestPath = ssPmountPath + File.separator + dcId + File.separator + "snapshots" + File.separator + accountId + File.separator + volumeId;
|
snapshotDestPath = ssPmountPath + File.separator + dcId + File.separator + "snapshots" + File.separator + accountId + File.separator + volumeId;
|
||||||
final Script command = new Script(_manageSnapshotPath, _timeout, s_logger);
|
Script command = new Script(_manageSnapshotPath, _timeout, s_logger);
|
||||||
command.add("-b", snapshotPath);
|
command.add("-b", snapshotPath);
|
||||||
command.add("-n", snapshotName);
|
command.add("-n", snapshotName);
|
||||||
command.add("-p", snapshotDestPath);
|
command.add("-p", snapshotDestPath);
|
||||||
|
command.add("-t", snapshotName);
|
||||||
String result = command.execute();
|
String result = command.execute();
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
s_logger.debug("Failed to backup snaptshot: " + result);
|
s_logger.debug("Failed to backup snaptshot: " + result);
|
||||||
return new BackupSnapshotAnswer(cmd, false, result, null);
|
return new BackupSnapshotAnswer(cmd, false, result, null);
|
||||||
}
|
}
|
||||||
/*Delete the snapshot on primary*/
|
/*Delete the snapshot on primary*/
|
||||||
Domain vm = getDomain(cmd.getVmName());
|
|
||||||
|
DomainInfo.DomainState state = null;
|
||||||
|
Domain vm = null;
|
||||||
|
if (vmName != null) {
|
||||||
|
try {
|
||||||
|
vm = getDomain(cmd.getVmName());
|
||||||
|
state = vm.getInfo().state;
|
||||||
|
} catch (LibvirtException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == DomainInfo.DomainState.VIR_DOMAIN_RUNNING) {
|
||||||
String vmUuid = vm.getUUIDString();
|
String vmUuid = vm.getUUIDString();
|
||||||
Object[] args = new Object[] {snapshotName, vmUuid};
|
Object[] args = new Object[] {snapshotName, vmUuid};
|
||||||
String snapshot = SnapshotXML.format(args);
|
String snapshot = SnapshotXML.format(args);
|
||||||
s_logger.debug(snapshot);
|
s_logger.debug(snapshot);
|
||||||
DomainSnapshot snap = vm.snapshotLookupByName(snapshotName);
|
DomainSnapshot snap = vm.snapshotLookupByName(snapshotName);
|
||||||
snap.delete(0);
|
snap.delete(0);
|
||||||
|
} else {
|
||||||
|
command = new Script(_manageSnapshotPath, _timeout, s_logger);
|
||||||
|
command.add("-d", snapshotPath);
|
||||||
|
command.add("-n", snapshotName);
|
||||||
|
result = command.execute();
|
||||||
|
if (result != null) {
|
||||||
|
s_logger.debug("Failed to backup snapshot: " + result);
|
||||||
|
return new BackupSnapshotAnswer(cmd, false, "Failed to backup snapshot: " + result, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (LibvirtException e) {
|
} catch (LibvirtException e) {
|
||||||
return new BackupSnapshotAnswer(cmd, false, e.toString(), null);
|
return new BackupSnapshotAnswer(cmd, false, e.toString(), null);
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
@ -1358,6 +1406,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
secondaryPool = getNfsSPbyURI(_conn, new URI(cmd.getSecondaryStoragePoolURL()));
|
secondaryPool = getNfsSPbyURI(_conn, new URI(cmd.getSecondaryStoragePoolURL()));
|
||||||
/*TODO: assuming all the storage pools mounted under _mountPoint, the mount point should be got from pool.dumpxml*/
|
/*TODO: assuming all the storage pools mounted under _mountPoint, the mount point should be got from pool.dumpxml*/
|
||||||
String templatePath = _mountPoint + File.separator + secondaryPool.getUUIDString() + File.separator + templateInstallFolder;
|
String templatePath = _mountPoint + File.separator + secondaryPool.getUUIDString() + File.separator + templateInstallFolder;
|
||||||
|
File f = new File(templatePath);
|
||||||
|
if (!f.exists()) {
|
||||||
|
f.mkdir();
|
||||||
|
}
|
||||||
String tmplPath = templateInstallFolder + File.separator + tmplFileName;
|
String tmplPath = templateInstallFolder + File.separator + tmplFileName;
|
||||||
Script command = new Script(_createTmplPath, _timeout, s_logger);
|
Script command = new Script(_createTmplPath, _timeout, s_logger);
|
||||||
command.add("-t", templatePath);
|
command.add("-t", templatePath);
|
||||||
@ -1404,38 +1456,58 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
protected CreatePrivateTemplateAnswer execute(CreatePrivateTemplateCommand cmd) {
|
protected CreatePrivateTemplateAnswer execute(CreatePrivateTemplateCommand cmd) {
|
||||||
String secondaryStorageURL = cmd.getSecondaryStorageURL();
|
String secondaryStorageURL = cmd.getSecondaryStorageURL();
|
||||||
String snapshotUUID = cmd.getSnapshotPath();
|
|
||||||
|
|
||||||
StoragePool secondaryStorage = null;
|
StoragePool secondaryStorage = null;
|
||||||
StoragePool privateTemplStorage = null;
|
|
||||||
StorageVol privateTemplateVol = null;
|
|
||||||
StorageVol snapshotVol = null;
|
|
||||||
try {
|
try {
|
||||||
String templateFolder = cmd.getAccountId() + File.separator + cmd.getTemplateId() + File.separator;
|
String templateFolder = cmd.getAccountId() + File.separator + cmd.getTemplateId() + File.separator;
|
||||||
String templateInstallFolder = "/template/tmpl/" + templateFolder;
|
String templateInstallFolder = "/template/tmpl/" + templateFolder;
|
||||||
|
|
||||||
secondaryStorage = getNfsSPbyURI(_conn, new URI(secondaryStorageURL));
|
secondaryStorage = getNfsSPbyURI(_conn, new URI(secondaryStorageURL));
|
||||||
/*TODO: assuming all the storage pools mounted under _mountPoint, the mount point should be got from pool.dumpxml*/
|
/*TODO: assuming all the storage pools mounted under _mountPoint, the mount point should be got from pool.dumpxml*/
|
||||||
String mountPath = _mountPoint + File.separator + secondaryStorage.getUUIDString() + templateInstallFolder;
|
String tmpltPath = _mountPoint + File.separator + secondaryStorage.getUUIDString() + templateInstallFolder;
|
||||||
File mpfile = new File(mountPath);
|
File mpfile = new File(tmpltPath);
|
||||||
if (!mpfile.exists()) {
|
if (!mpfile.exists()) {
|
||||||
mpfile.mkdir();
|
mpfile.mkdir();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a SR for the secondary storage installation folder
|
Script command = new Script(_createTmplPath, _timeout, s_logger);
|
||||||
privateTemplStorage = getNfsSPbyURI(_conn, new URI(secondaryStorageURL + templateInstallFolder));
|
command.add("-f", cmd.getSnapshotPath());
|
||||||
snapshotVol = getVolume(snapshotUUID);
|
command.add("-c", cmd.getSnapshotName());
|
||||||
|
command.add("-t", tmpltPath);
|
||||||
|
command.add("-n", cmd.getUniqueName() + ".qcow2");
|
||||||
|
command.add("-s");
|
||||||
|
String result = command.execute();
|
||||||
|
|
||||||
LibvirtStorageVolumeDef vol = new LibvirtStorageVolumeDef(UUID.randomUUID().toString(), snapshotVol.getInfo().capacity, volFormat.QCOW2, null, null);
|
if (result != null) {
|
||||||
s_logger.debug(vol.toString());
|
s_logger.debug("failed to create template: " + result);
|
||||||
privateTemplateVol = copyVolume(privateTemplStorage, vol, snapshotVol);
|
return new CreatePrivateTemplateAnswer(cmd,
|
||||||
|
false,
|
||||||
|
result,
|
||||||
|
null,
|
||||||
|
0,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
|
params.put(StorageLayer.InstanceConfigKey, _storage);
|
||||||
|
Processor qcow2Processor = new QCOW2Processor();
|
||||||
|
|
||||||
|
qcow2Processor.configure("QCOW2 Processor", params);
|
||||||
|
|
||||||
|
FormatInfo info = qcow2Processor.process(tmpltPath, null, cmd.getUniqueName());
|
||||||
|
|
||||||
|
TemplateLocation loc = new TemplateLocation(_storage, tmpltPath);
|
||||||
|
loc.create(1, true, cmd.getUniqueName());
|
||||||
|
loc.addFormat(info);
|
||||||
|
loc.save();
|
||||||
|
|
||||||
return new CreatePrivateTemplateAnswer(cmd,
|
return new CreatePrivateTemplateAnswer(cmd,
|
||||||
true,
|
true,
|
||||||
null,
|
null,
|
||||||
templateInstallFolder + privateTemplateVol.getName(),
|
templateInstallFolder + cmd.getUniqueName() + ".qcow2",
|
||||||
privateTemplateVol.getInfo().capacity/1024*1024, /*in Mega unit*/
|
info.virtualSize,
|
||||||
privateTemplateVol.getName(),
|
cmd.getUniqueName(),
|
||||||
ImageFormat.QCOW2);
|
ImageFormat.QCOW2);
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
return new CreatePrivateTemplateAnswer(cmd,
|
return new CreatePrivateTemplateAnswer(cmd,
|
||||||
@ -1454,6 +1526,30 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
0,
|
0,
|
||||||
null,
|
null,
|
||||||
null);
|
null);
|
||||||
|
} catch (InternalErrorException e) {
|
||||||
|
return new CreatePrivateTemplateAnswer(cmd,
|
||||||
|
false,
|
||||||
|
e.toString(),
|
||||||
|
null,
|
||||||
|
0,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
} catch (IOException e) {
|
||||||
|
return new CreatePrivateTemplateAnswer(cmd,
|
||||||
|
false,
|
||||||
|
e.toString(),
|
||||||
|
null,
|
||||||
|
0,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
|
} catch (ConfigurationException e) {
|
||||||
|
return new CreatePrivateTemplateAnswer(cmd,
|
||||||
|
false,
|
||||||
|
e.toString(),
|
||||||
|
null,
|
||||||
|
0,
|
||||||
|
null,
|
||||||
|
null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2361,7 +2457,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
Iterator<Map.Entry<String, String>> itr = entrySet.iterator();
|
Iterator<Map.Entry<String, String>> itr = entrySet.iterator();
|
||||||
while (itr.hasNext()) {
|
while (itr.hasNext()) {
|
||||||
Map.Entry<String, String> entry = itr.next();
|
Map.Entry<String, String> entry = itr.next();
|
||||||
if (entry.getValue().equalsIgnoreCase(sourceFile)) {
|
if ((entry.getValue() != null) && (entry.getValue().equalsIgnoreCase(sourceFile))) {
|
||||||
diskDev = entry.getKey();
|
diskDev = entry.getKey();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2942,9 +3038,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getHypervisorPath() {
|
private String getHypervisorPath() {
|
||||||
File f =new File("/usr/bin/cloud-qemu-kvm");
|
File f =new File("/usr/bin/cloud-qemu-system-x86_64");
|
||||||
if (f.exists()) {
|
if (f.exists()) {
|
||||||
return "/usr/bin/cloud-qemu-kvm";
|
return "/usr/bin/cloud-qemu-system-x86_64";
|
||||||
} else {
|
} else {
|
||||||
if (_conn == null)
|
if (_conn == null)
|
||||||
return null;
|
return null;
|
||||||
@ -3098,7 +3194,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
brName = setVnetBrName(vnetId);
|
brName = setVnetBrName(vnetId);
|
||||||
String vnetDev = "vtap" + vnetId;
|
String vnetDev = "vtap" + vnetId;
|
||||||
createVnet(vnetId, _pifs.first());
|
createVnet(vnetId, _pifs.first());
|
||||||
vnetNic.defBridgeNet(brName, vnetDev, guestMac, interfaceDef.nicModel.VIRTIO);
|
vnetNic.defBridgeNet(brName, null, guestMac, interfaceDef.nicModel.VIRTIO);
|
||||||
}
|
}
|
||||||
nics.add(vnetNic);
|
nics.add(vnetNic);
|
||||||
|
|
||||||
@ -3114,7 +3210,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
brName = setVnetBrName(vnetId);
|
brName = setVnetBrName(vnetId);
|
||||||
String vnetDev = "vtap" + vnetId;
|
String vnetDev = "vtap" + vnetId;
|
||||||
createVnet(vnetId, _pifs.second());
|
createVnet(vnetId, _pifs.second());
|
||||||
pubNic.defBridgeNet(brName, vnetDev, pubMac, interfaceDef.nicModel.VIRTIO);
|
pubNic.defBridgeNet(brName, null, pubMac, interfaceDef.nicModel.VIRTIO);
|
||||||
}
|
}
|
||||||
nics.add(pubNic);
|
nics.add(pubNic);
|
||||||
return nics;
|
return nics;
|
||||||
@ -3166,7 +3262,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
String datadiskPath = tmplVol.getKey();
|
String datadiskPath = tmplVol.getKey();
|
||||||
|
|
||||||
diskDef hda = new diskDef();
|
diskDef hda = new diskDef();
|
||||||
hda.defFileBasedDisk(rootkPath, "vda", diskDef.diskBus.IDE, diskDef.diskFmtType.QCOW2);
|
hda.defFileBasedDisk(rootkPath, "hda", diskDef.diskBus.IDE, diskDef.diskFmtType.QCOW2);
|
||||||
disks.add(hda);
|
disks.add(hda);
|
||||||
|
|
||||||
diskDef hdb = new diskDef();
|
diskDef hdb = new diskDef();
|
||||||
@ -3502,6 +3598,22 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private StorageVol createVolume(StoragePool destPool, StorageVol tmplVol) throws LibvirtException {
|
||||||
|
if (isCentosHost()) {
|
||||||
|
LibvirtStorageVolumeDef volDef = new LibvirtStorageVolumeDef(UUID.randomUUID().toString(), tmplVol.getInfo().capacity, volFormat.QCOW2, null, null);
|
||||||
|
s_logger.debug(volDef.toString());
|
||||||
|
StorageVol vol = destPool.storageVolCreateXML(volDef.toString(), 0);
|
||||||
|
|
||||||
|
/*create qcow2 image based on the name*/
|
||||||
|
Script.runSimpleBashScript("qemu-img create -f qcow2 -b " + tmplVol.getPath() + " " + vol.getPath() );
|
||||||
|
return vol;
|
||||||
|
} else {
|
||||||
|
LibvirtStorageVolumeDef volDef = new LibvirtStorageVolumeDef(UUID.randomUUID().toString(), tmplVol.getInfo().capacity, volFormat.QCOW2, tmplVol.getPath(), volFormat.QCOW2);
|
||||||
|
s_logger.debug(volDef.toString());
|
||||||
|
return destPool.storageVolCreateXML(volDef.toString(), 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private StorageVol getVolume(StoragePool pool, String volKey) {
|
private StorageVol getVolume(StoragePool pool, String volKey) {
|
||||||
StorageVol vol = null;
|
StorageVol vol = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -94,6 +94,8 @@ public class LibvirtDomainXMLParser extends LibvirtXMLParser {
|
|||||||
} else if (qName.equalsIgnoreCase("disk")) {
|
} else if (qName.equalsIgnoreCase("disk")) {
|
||||||
diskMaps.put(diskDev, diskFile);
|
diskMaps.put(diskDev, diskFile);
|
||||||
_disk = false;
|
_disk = false;
|
||||||
|
diskFile = null;
|
||||||
|
diskDev = null;
|
||||||
} else if (qName.equalsIgnoreCase("description")) {
|
} else if (qName.equalsIgnoreCase("description")) {
|
||||||
_desc = false;
|
_desc = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -139,6 +139,7 @@ listSystemVms=com.cloud.api.commands.ListSystemVMsCmd;1
|
|||||||
updateConfiguration=com.cloud.api.commands.UpdateCfgCmd;1
|
updateConfiguration=com.cloud.api.commands.UpdateCfgCmd;1
|
||||||
listConfigurations=com.cloud.api.commands.ListCfgsByCmd;1
|
listConfigurations=com.cloud.api.commands.ListCfgsByCmd;1
|
||||||
addConfig=com.cloud.api.commands.AddConfigCmd;15
|
addConfig=com.cloud.api.commands.AddConfigCmd;15
|
||||||
|
listCapabilities=com.cloud.api.commands.ListCapabilitiesCmd;15
|
||||||
|
|
||||||
#### pod commands
|
#### pod commands
|
||||||
createPod=com.cloud.api.commands.CreatePodCmd;1
|
createPod=com.cloud.api.commands.CreatePodCmd;1
|
||||||
|
|||||||
@ -215,8 +215,9 @@
|
|||||||
<dao name="IP Addresses configuration server" class="com.cloud.network.dao.IPAddressDaoImpl"/>
|
<dao name="IP Addresses configuration server" class="com.cloud.network.dao.IPAddressDaoImpl"/>
|
||||||
<dao name="Datacenter IP Addresses configuration server" class="com.cloud.dc.dao.DataCenterIpAddressDaoImpl"/>
|
<dao name="Datacenter IP Addresses configuration server" class="com.cloud.dc.dao.DataCenterIpAddressDaoImpl"/>
|
||||||
<dao name="domain router" class="com.cloud.vm.dao.DomainRouterDaoImpl"/>
|
<dao name="domain router" class="com.cloud.vm.dao.DomainRouterDaoImpl"/>
|
||||||
<dao name="host zone configuration server" class="com.cloud.dc.dao.DataCenterDaoImpl">
|
<dao name="host zone configuration server" class="com.cloud.dc.dao.DataCenterDaoImpl"/>
|
||||||
</dao>
|
<dao name="Console Proxy" class="com.cloud.vm.dao.ConsoleProxyDaoImpl"/>
|
||||||
|
<dao name="Secondary Storage VM" class="com.cloud.vm.dao.SecondaryStorageVmDaoImpl"/>
|
||||||
<dao name="host pod configuration server" class="com.cloud.dc.dao.HostPodDaoImpl">
|
<dao name="host pod configuration server" class="com.cloud.dc.dao.HostPodDaoImpl">
|
||||||
</dao>
|
</dao>
|
||||||
<dao name="PodVlanMap configuration server" class="com.cloud.dc.dao.PodVlanMapDaoImpl"/>
|
<dao name="PodVlanMap configuration server" class="com.cloud.dc.dao.PodVlanMapDaoImpl"/>
|
||||||
|
|||||||
@ -2187,4 +2187,5 @@ public interface ManagementServer {
|
|||||||
|
|
||||||
boolean checkIfMaintenable(long hostId);
|
boolean checkIfMaintenable(long hostId);
|
||||||
|
|
||||||
|
Map<String, String> listCapabilities();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -80,4 +80,5 @@ public interface VMInstanceDao extends GenericDao<VMInstanceVO, Long> {
|
|||||||
List<VMInstanceVO> listByHostIdTypes(long hostid, VirtualMachine.Type... types);
|
List<VMInstanceVO> listByHostIdTypes(long hostid, VirtualMachine.Type... types);
|
||||||
|
|
||||||
List<VMInstanceVO> listUpByHostIdTypes(long hostid, VirtualMachine.Type... types);
|
List<VMInstanceVO> listUpByHostIdTypes(long hostid, VirtualMachine.Type... types);
|
||||||
|
List<VMInstanceVO> listByZoneIdAndType(long zoneId, VirtualMachine.Type type);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,6 +51,7 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
|||||||
protected final SearchBuilder<VMInstanceVO> HostSearch;
|
protected final SearchBuilder<VMInstanceVO> HostSearch;
|
||||||
protected final SearchBuilder<VMInstanceVO> LastHostSearch;
|
protected final SearchBuilder<VMInstanceVO> LastHostSearch;
|
||||||
protected final SearchBuilder<VMInstanceVO> ZoneSearch;
|
protected final SearchBuilder<VMInstanceVO> ZoneSearch;
|
||||||
|
protected final SearchBuilder<VMInstanceVO> ZoneVmTypeSearch;
|
||||||
protected final SearchBuilder<VMInstanceVO> ZoneTemplateNonExpungedSearch;
|
protected final SearchBuilder<VMInstanceVO> ZoneTemplateNonExpungedSearch;
|
||||||
protected final SearchBuilder<VMInstanceVO> NameLikeSearch;
|
protected final SearchBuilder<VMInstanceVO> NameLikeSearch;
|
||||||
protected final SearchBuilder<VMInstanceVO> StateChangeSearch;
|
protected final SearchBuilder<VMInstanceVO> StateChangeSearch;
|
||||||
@ -80,6 +81,11 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
|||||||
ZoneSearch.and("zone", ZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
ZoneSearch.and("zone", ZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||||
ZoneSearch.done();
|
ZoneSearch.done();
|
||||||
|
|
||||||
|
ZoneVmTypeSearch = createSearchBuilder();
|
||||||
|
ZoneVmTypeSearch.and("zone", ZoneVmTypeSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||||
|
ZoneVmTypeSearch.and("type", ZoneVmTypeSearch.entity().getType(), SearchCriteria.Op.EQ);
|
||||||
|
ZoneVmTypeSearch.done();
|
||||||
|
|
||||||
ZoneTemplateNonExpungedSearch = createSearchBuilder();
|
ZoneTemplateNonExpungedSearch = createSearchBuilder();
|
||||||
ZoneTemplateNonExpungedSearch.and("zone", ZoneTemplateNonExpungedSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
ZoneTemplateNonExpungedSearch.and("zone", ZoneTemplateNonExpungedSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||||
ZoneTemplateNonExpungedSearch.and("template", ZoneTemplateNonExpungedSearch.entity().getTemplateId(), SearchCriteria.Op.EQ);
|
ZoneTemplateNonExpungedSearch.and("template", ZoneTemplateNonExpungedSearch.entity().getTemplateId(), SearchCriteria.Op.EQ);
|
||||||
@ -193,6 +199,15 @@ public class VMInstanceDaoImpl extends GenericDaoBase<VMInstanceVO, Long> implem
|
|||||||
return listActiveBy(sc);
|
return listActiveBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VMInstanceVO> listByZoneIdAndType(long zoneId, VirtualMachine.Type type) {
|
||||||
|
SearchCriteria<VMInstanceVO> sc = ZoneVmTypeSearch.create();
|
||||||
|
sc.setParameters("zone", zoneId);
|
||||||
|
sc.setParameters("type", type.toString());
|
||||||
|
return listActiveBy(sc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<VMInstanceVO> listNonExpungedByZoneAndTemplate(long zoneId, long templateId) {
|
public List<VMInstanceVO> listNonExpungedByZoneAndTemplate(long zoneId, long templateId) {
|
||||||
SearchCriteria<VMInstanceVO> sc = ZoneTemplateNonExpungedSearch.create();
|
SearchCriteria<VMInstanceVO> sc = ZoneTemplateNonExpungedSearch.create();
|
||||||
|
|||||||
136
python/bindir/cloud-web-ipallocator.in
Executable file
136
python/bindir/cloud-web-ipallocator.in
Executable file
@ -0,0 +1,136 @@
|
|||||||
|
#! /usr/bin/python
|
||||||
|
import web
|
||||||
|
import socket, struct
|
||||||
|
import cloud_utils
|
||||||
|
from cloud_utils import Command
|
||||||
|
urls = ("/ipallocator", "ipallocator")
|
||||||
|
app = web.application(urls, globals())
|
||||||
|
|
||||||
|
augtool = Command("augtool")
|
||||||
|
service = Command("service")
|
||||||
|
class dhcp:
|
||||||
|
_instance = None
|
||||||
|
def __init__(self):
|
||||||
|
self.availIP=[]
|
||||||
|
self.router=None
|
||||||
|
self.netmask=None
|
||||||
|
self.initialized=False
|
||||||
|
|
||||||
|
options = augtool.match("/files/etc/dnsmasq.conf/dhcp-option").stdout.strip()
|
||||||
|
for option in options.splitlines():
|
||||||
|
if option.find("option:router") != -1:
|
||||||
|
self.router = option.split("=")[1].strip().split(",")[1]
|
||||||
|
print self.router
|
||||||
|
|
||||||
|
dhcp_range = augtool.get("/files/etc/dnsmasq.conf/dhcp-range").stdout.strip()
|
||||||
|
dhcp_start = dhcp_range.split("=")[1].strip().split(",")[0]
|
||||||
|
dhcp_end = dhcp_range.split("=")[1].strip().split(",")[1]
|
||||||
|
self.netmask = dhcp_range.split("=")[1].strip().split(",")[2]
|
||||||
|
print dhcp_start, dhcp_end, self.netmask
|
||||||
|
|
||||||
|
start_ip_num = self.ipToNum(dhcp_start);
|
||||||
|
end_ip_num = self.ipToNum(dhcp_end)
|
||||||
|
print start_ip_num, end_ip_num
|
||||||
|
|
||||||
|
for ip in range(start_ip_num, end_ip_num + 1):
|
||||||
|
self.availIP.append(ip)
|
||||||
|
print self.availIP[0], self.availIP[len(self.availIP) - 1]
|
||||||
|
|
||||||
|
#load the ip already allocated
|
||||||
|
self.reloadAllocatedIP()
|
||||||
|
|
||||||
|
def ipToNum(self, ip):
|
||||||
|
return struct.unpack("!I", socket.inet_aton(ip))[0]
|
||||||
|
|
||||||
|
def numToIp(self, num):
|
||||||
|
return socket.inet_ntoa(struct.pack('!I', num))
|
||||||
|
|
||||||
|
def getFreeIP(self):
|
||||||
|
if len(self.availIP) > 0:
|
||||||
|
ip = self.numToIp(self.availIP[0])
|
||||||
|
self.availIP.remove(self.availIP[0])
|
||||||
|
return ip
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def getNetmask(self):
|
||||||
|
return self.netmask
|
||||||
|
|
||||||
|
def getRouter(self):
|
||||||
|
return self.router
|
||||||
|
|
||||||
|
def getInstance():
|
||||||
|
if not dhcp._instance:
|
||||||
|
dhcp._instance = dhcp()
|
||||||
|
return dhcp._instance
|
||||||
|
getInstance = staticmethod(getInstance)
|
||||||
|
|
||||||
|
def reloadAllocatedIP(self):
|
||||||
|
dhcp_hosts = augtool.match("/files/etc/dnsmasq.conf/dhcp-host").stdout.strip().splitlines()
|
||||||
|
|
||||||
|
for host in dhcp_hosts:
|
||||||
|
if host.find("dhcp-host") != -1:
|
||||||
|
allocatedIP = self.ipToNum(host.split("=")[1].strip().split(",")[1])
|
||||||
|
if allocatedIP in self.availIP:
|
||||||
|
self.availIP.remove(allocatedIP)
|
||||||
|
|
||||||
|
def allocateIP(self, mac):
|
||||||
|
newIP = self.getFreeIP()
|
||||||
|
dhcp_host = augtool.match("/files/etc/dnsmasq.conf/dhcp-host").stdout.strip()
|
||||||
|
cnt = len(dhcp_host.splitlines()) + 1
|
||||||
|
script = """set %s %s
|
||||||
|
save"""%("/files/etc/dnsmasq.conf/dhcp-host[" + str(cnt) + "]", str(mac) + "," + newIP)
|
||||||
|
augtool < script
|
||||||
|
#reset dnsmasq
|
||||||
|
service("dnsmasq", "restart", stdout=None, stderr=None)
|
||||||
|
return newIP
|
||||||
|
|
||||||
|
def releaseIP(self, ip):
|
||||||
|
dhcp_host = augtool.match("/files/etc/dnsmasq.conf/dhcp-host").stdout.strip()
|
||||||
|
path = None
|
||||||
|
for host in dhcp_host.splitlines():
|
||||||
|
if host.find(ip) != -1:
|
||||||
|
path = host.split("=")[0].strip()
|
||||||
|
|
||||||
|
if path == None:
|
||||||
|
print "Can't find " + str(ip) + " in conf file"
|
||||||
|
return None
|
||||||
|
|
||||||
|
print path
|
||||||
|
script = """rm %s
|
||||||
|
save"""%(path)
|
||||||
|
augtool < script
|
||||||
|
|
||||||
|
#reset dnsmasq
|
||||||
|
service("dnsmasq", "restart", stdout=None, stderr=None)
|
||||||
|
|
||||||
|
class ipallocator:
|
||||||
|
def GET(self):
|
||||||
|
try:
|
||||||
|
user_data = web.input()
|
||||||
|
command = user_data.command
|
||||||
|
print "Processing: " + command
|
||||||
|
|
||||||
|
dhcpInit = dhcp.getInstance()
|
||||||
|
|
||||||
|
if command == "getIpAddr":
|
||||||
|
mac = user_data.mac
|
||||||
|
zone_id = user_data.dc
|
||||||
|
pod_id = user_data.pod
|
||||||
|
print mac, zone_id, pod_id
|
||||||
|
freeIP = dhcpInit.allocateIP(mac)
|
||||||
|
if not freeIP:
|
||||||
|
return "0,0,0"
|
||||||
|
print "Find an available IP: " + freeIP
|
||||||
|
|
||||||
|
return freeIP + "," + dhcpInit.getNetmask() + "," + dhcpInit.getRouter()
|
||||||
|
elif command == "releaseIpAddr":
|
||||||
|
ip = user_data.ip
|
||||||
|
zone_id = user_data.dc
|
||||||
|
pod_id = user_data.pod
|
||||||
|
dhcpInit.releaseIP(ip)
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run()
|
||||||
@ -80,6 +80,20 @@ create_from_file() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
create_from_snapshot() {
|
||||||
|
local tmpltImg=$1
|
||||||
|
local snapshotName=$2
|
||||||
|
local tmpltfs=$3
|
||||||
|
local tmpltname=$4
|
||||||
|
|
||||||
|
cloud-qemu-img convert -f qcow2 -O qcow2 -s $snapshotName $tmpltImg /$tmpltfs/$tmpltname >& /dev/null
|
||||||
|
if [ $? -gt 0 ]
|
||||||
|
then
|
||||||
|
printf "Failed to create template /$tmplfs/$tmpltname from snapshot $snapshotName on disk $tmpltImg "
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
tflag=
|
tflag=
|
||||||
nflag=
|
nflag=
|
||||||
fflag=
|
fflag=
|
||||||
@ -89,8 +103,9 @@ hvm=false
|
|||||||
cleanup=false
|
cleanup=false
|
||||||
dflag=
|
dflag=
|
||||||
cflag=
|
cflag=
|
||||||
|
snapshotName=
|
||||||
|
|
||||||
while getopts 'uht:n:f:s:c:d:' OPTION
|
while getopts 'uht:n:f:sc:d:' OPTION
|
||||||
do
|
do
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
t) tflag=1
|
t) tflag=1
|
||||||
@ -103,10 +118,10 @@ do
|
|||||||
tmpltimg="$OPTARG"
|
tmpltimg="$OPTARG"
|
||||||
;;
|
;;
|
||||||
s) sflag=1
|
s) sflag=1
|
||||||
volsize="$OPTARG"
|
sflag=1
|
||||||
;;
|
;;
|
||||||
c) cflag=1
|
c) cflag=1
|
||||||
cksum="$OPTARG"
|
snapshotName="$OPTARG"
|
||||||
;;
|
;;
|
||||||
d) dflag=1
|
d) dflag=1
|
||||||
descr="$OPTARG"
|
descr="$OPTARG"
|
||||||
@ -119,12 +134,6 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ "$tflag$nflag$fflag" != "111" ]
|
|
||||||
then
|
|
||||||
usage
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d /$tmpltfs ]
|
if [ ! -d /$tmpltfs ]
|
||||||
then
|
then
|
||||||
@ -148,7 +157,12 @@ then
|
|||||||
printf "failed to uncompress $tmpltimg\n"
|
printf "failed to uncompress $tmpltimg\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$sflag" == "1" ]
|
||||||
|
then
|
||||||
|
create_from_snapshot $tmpltimg $snapshotName $tmpltfs $tmpltname
|
||||||
|
else
|
||||||
create_from_file $tmpltfs $tmpltimg $tmpltname
|
create_from_file $tmpltfs $tmpltimg $tmpltname
|
||||||
|
fi
|
||||||
|
|
||||||
touch /$tmpltfs/template.properties
|
touch /$tmpltfs/template.properties
|
||||||
echo -n "" > /$tmpltfs/template.properties
|
echo -n "" > /$tmpltfs/template.properties
|
||||||
|
|||||||
@ -16,13 +16,20 @@ create_snapshot() {
|
|||||||
local snapshotname=$2
|
local snapshotname=$2
|
||||||
local failed=0
|
local failed=0
|
||||||
|
|
||||||
qemu-img snapshot -c $snapshotname $disk
|
if [ ! -f $disk ]
|
||||||
|
then
|
||||||
|
failed=1
|
||||||
|
printf "No disk $disk exist\n" >&2
|
||||||
|
return $failed
|
||||||
|
fi
|
||||||
|
|
||||||
|
cloud-qemu-img snapshot -c $snapshotname $disk
|
||||||
|
|
||||||
if [ $? -gt 0 ]
|
if [ $? -gt 0 ]
|
||||||
then
|
then
|
||||||
failed=1
|
failed=2
|
||||||
printf "***Failed to create snapshot $snapshotname for path $disk\n" >&2
|
printf "***Failed to create snapshot $snapshotname for path $disk\n" >&2
|
||||||
qemu-img snapshot -d $snapshotname $disk
|
cloud-qemu-img snapshot -d $snapshotname $disk
|
||||||
|
|
||||||
if [ $? -gt 0 ]
|
if [ $? -gt 0 ]
|
||||||
then
|
then
|
||||||
@ -34,19 +41,22 @@ create_snapshot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy_snapshot() {
|
destroy_snapshot() {
|
||||||
local backupSnapDir=$1
|
local disk=$1
|
||||||
local snapshotname=$2
|
local snapshotname=$2
|
||||||
local failed=0
|
local failed=0
|
||||||
|
|
||||||
if [ -f $backupSnapDir/$snapshotname ]
|
if [ ! -f $disk ]
|
||||||
then
|
then
|
||||||
rm -f $backupSnapDir/$snapshotname
|
failed=1
|
||||||
|
printf "No disk $disk exist\n" >&2
|
||||||
|
return $failed
|
||||||
|
fi
|
||||||
|
|
||||||
|
cloud-qemu-img snapshot -d $snapshotname $disk
|
||||||
if [ $? -gt 0 ]
|
if [ $? -gt 0 ]
|
||||||
then
|
then
|
||||||
printf "***Failed to delete snapshot $snapshotname for path $backupSnapDir\n" >&2
|
failed=2
|
||||||
failed=1
|
printf "Failed to delete snapshot $snapshotname for path $disk\n" >&2
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $failed
|
return $failed
|
||||||
@ -71,6 +81,7 @@ backup_snapshot() {
|
|||||||
local disk=$1
|
local disk=$1
|
||||||
local snapshotname=$2
|
local snapshotname=$2
|
||||||
local destPath=$3
|
local destPath=$3
|
||||||
|
local destName=$4
|
||||||
|
|
||||||
if [ ! -d $destPath ]
|
if [ ! -d $destPath ]
|
||||||
then
|
then
|
||||||
@ -90,7 +101,7 @@ backup_snapshot() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cloud-qemu-img convert -f qcow2 -O qcow2 -s $snapshotname $disk $destPath/$snapshotname >& /dev/null
|
cloud-qemu-img convert -f qcow2 -O qcow2 -s $snapshotname $disk $destPath/$destName >& /dev/null
|
||||||
if [ $? -gt 0 ]
|
if [ $? -gt 0 ]
|
||||||
then
|
then
|
||||||
printf "Failed to backup $snapshotname for disk $disk to $destPath" >&2
|
printf "Failed to backup $snapshotname for disk $disk to $destPath" >&2
|
||||||
@ -107,8 +118,9 @@ bflag=
|
|||||||
nflag=
|
nflag=
|
||||||
pathval=
|
pathval=
|
||||||
snapshot=
|
snapshot=
|
||||||
|
tmplName=
|
||||||
|
|
||||||
while getopts 'c:d:r:n:b:p:' OPTION
|
while getopts 'c:d:r:n:b:p:t:' OPTION
|
||||||
do
|
do
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
c) cflag=1
|
c) cflag=1
|
||||||
@ -128,6 +140,8 @@ do
|
|||||||
;;
|
;;
|
||||||
p) destPath="$OPTARG"
|
p) destPath="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
t) tmplName="$OPTARG"
|
||||||
|
;;
|
||||||
?) usage
|
?) usage
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -144,7 +158,7 @@ then
|
|||||||
exit $?
|
exit $?
|
||||||
elif [ "$bflag" == "1" ]
|
elif [ "$bflag" == "1" ]
|
||||||
then
|
then
|
||||||
backup_snapshot $pathval $snapshot $destPath
|
backup_snapshot $pathval $snapshot $destPath $tmplName
|
||||||
exit $?
|
exit $?
|
||||||
elif [ "$rflag" == "1" ]
|
elif [ "$rflag" == "1" ]
|
||||||
then
|
then
|
||||||
|
|||||||
@ -174,4 +174,4 @@ done
|
|||||||
#install_cloud_agent $dflag
|
#install_cloud_agent $dflag
|
||||||
#install_cloud_consoleP $dflag
|
#install_cloud_consoleP $dflag
|
||||||
cloud_agent_setup $host $zone $pod $guid
|
cloud_agent_setup $host $zone $pod $guid
|
||||||
cloud_consoleP_setup $host $zone $pod
|
#cloud_consoleP_setup $host $zone $pod
|
||||||
|
|||||||
@ -130,7 +130,6 @@ public class ListAccountsCmd extends BaseCmd{
|
|||||||
for (AccountVO accountO : accounts) {
|
for (AccountVO accountO : accounts) {
|
||||||
boolean accountIsAdmin = (accountO.getType() == Account.ACCOUNT_TYPE_ADMIN);
|
boolean accountIsAdmin = (accountO.getType() == Account.ACCOUNT_TYPE_ADMIN);
|
||||||
|
|
||||||
if ((accountO.getRemoved() == null)&&(accountO.getId() != 1)) {
|
|
||||||
List<Pair<String, Object>> accountData = new ArrayList<Pair<String, Object>>();
|
List<Pair<String, Object>> accountData = new ArrayList<Pair<String, Object>>();
|
||||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.valueOf(accountO.getId()).toString()));
|
accountData.add(new Pair<String, Object>(BaseCmd.Properties.ID.getName(), Long.valueOf(accountO.getId()).toString()));
|
||||||
accountData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), accountO.getAccountName()));
|
accountData.add(new Pair<String, Object>(BaseCmd.Properties.NAME.getName(), accountO.getAccountName()));
|
||||||
@ -233,7 +232,6 @@ public class ListAccountsCmd extends BaseCmd{
|
|||||||
|
|
||||||
aTag[i++] = accountData;
|
aTag[i++] = accountData;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Pair<String, Object> accountTag = new Pair<String, Object>("account", aTag);
|
Pair<String, Object> accountTag = new Pair<String, Object>("account", aTag);
|
||||||
accountTags.add(accountTag);
|
accountTags.add(accountTag);
|
||||||
return accountTags;
|
return accountTags;
|
||||||
|
|||||||
58
server/src/com/cloud/api/commands/ListCapabilitiesCmd.java
Normal file
58
server/src/com/cloud/api/commands/ListCapabilitiesCmd.java
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* 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.api.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import com.cloud.api.BaseCmd;
|
||||||
|
import com.cloud.utils.Pair;
|
||||||
|
|
||||||
|
public class ListCapabilitiesCmd extends BaseCmd {
|
||||||
|
public static final Logger s_logger = Logger.getLogger(ListCapabilitiesCmd.class.getName());
|
||||||
|
|
||||||
|
private static final String s_name = "listcapabilitiesresponse";
|
||||||
|
private static final List<Pair<Enum, Boolean>> s_properties = new ArrayList<Pair<Enum, Boolean>>();
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return s_name;
|
||||||
|
}
|
||||||
|
public List<Pair<Enum, Boolean>> getProperties() {
|
||||||
|
return s_properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Pair<String, Object>> execute(Map<String, Object> params) {
|
||||||
|
|
||||||
|
Map<String, String> capabilities = null;
|
||||||
|
capabilities = getManagementServer().listCapabilities();
|
||||||
|
|
||||||
|
Iterator<String> iterator = capabilities.keySet().iterator();
|
||||||
|
List<Pair<String, Object>> capabilityPair = new ArrayList<Pair<String, Object>>();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
String capability = iterator.next();
|
||||||
|
capabilityPair.add(new Pair<String, Object>(capability, capabilities.get(capability)));
|
||||||
|
}
|
||||||
|
return capabilityPair;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -146,6 +146,7 @@ public enum Config {
|
|||||||
DirectAttachNetworkExternalAPIURL("Advanced", ManagementServer.class, String.class, "direct.attach.network.externalIpAllocator.url", null, "Direct-attach VMs using external DHCP server (API url)", null),
|
DirectAttachNetworkExternalAPIURL("Advanced", ManagementServer.class, String.class, "direct.attach.network.externalIpAllocator.url", null, "Direct-attach VMs using external DHCP server (API url)", null),
|
||||||
DirectAttachUntaggedVlanEnabled("Advanced", ManagementServer.class, String.class, "direct.attach.untagged.vlan.enabled", "false", "Indicate whether the system supports direct-attached untagged vlan", "true,false"),
|
DirectAttachUntaggedVlanEnabled("Advanced", ManagementServer.class, String.class, "direct.attach.untagged.vlan.enabled", "false", "Indicate whether the system supports direct-attached untagged vlan", "true,false"),
|
||||||
CheckPodCIDRs("Advanced", ManagementServer.class, String.class, "check.pod.cidrs", "true", "If true, different pods must belong to different CIDR subnets.", "true,false"),
|
CheckPodCIDRs("Advanced", ManagementServer.class, String.class, "check.pod.cidrs", "true", "If true, different pods must belong to different CIDR subnets.", "true,false"),
|
||||||
|
MD5Hashed("Advanced", ManagementServer.class, Boolean.class, "security.password.md5hashed", "true", "If set to false password is sent in clear text or else md5hashed", null),
|
||||||
|
|
||||||
// XenServer
|
// XenServer
|
||||||
VmAllocationAlgorithm("Advanced", ManagementServer.class, String.class, "vm.allocation.algorithm", "random", "If 'random', hosts within a pod will be randomly considered for VM/volume allocation. If 'firstfit', they will be considered on a first-fit basis.", null),
|
VmAllocationAlgorithm("Advanced", ManagementServer.class, String.class, "vm.allocation.algorithm", "random", "If 'random', hosts within a pod will be randomly considered for VM/volume allocation. If 'firstfit', they will be considered on a first-fit basis.", null),
|
||||||
|
|||||||
@ -57,6 +57,7 @@ import com.cloud.offering.NetworkOffering.GuestIpType;
|
|||||||
import com.cloud.service.ServiceOfferingVO;
|
import com.cloud.service.ServiceOfferingVO;
|
||||||
import com.cloud.service.dao.ServiceOfferingDao;
|
import com.cloud.service.dao.ServiceOfferingDao;
|
||||||
import com.cloud.storage.DiskOfferingVO;
|
import com.cloud.storage.DiskOfferingVO;
|
||||||
|
import com.cloud.storage.SecondaryStorage;
|
||||||
import com.cloud.storage.dao.DiskOfferingDao;
|
import com.cloud.storage.dao.DiskOfferingDao;
|
||||||
import com.cloud.user.AccountVO;
|
import com.cloud.user.AccountVO;
|
||||||
import com.cloud.user.UserVO;
|
import com.cloud.user.UserVO;
|
||||||
@ -66,9 +67,14 @@ import com.cloud.utils.component.Inject;
|
|||||||
import com.cloud.utils.db.DB;
|
import com.cloud.utils.db.DB;
|
||||||
import com.cloud.utils.db.Transaction;
|
import com.cloud.utils.db.Transaction;
|
||||||
import com.cloud.utils.net.NetUtils;
|
import com.cloud.utils.net.NetUtils;
|
||||||
|
import com.cloud.vm.ConsoleProxyVO;
|
||||||
import com.cloud.vm.DomainRouterVO;
|
import com.cloud.vm.DomainRouterVO;
|
||||||
|
import com.cloud.vm.SecondaryStorageVmVO;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
import com.cloud.vm.dao.ConsoleProxyDao;
|
||||||
import com.cloud.vm.dao.DomainRouterDao;
|
import com.cloud.vm.dao.DomainRouterDao;
|
||||||
|
import com.cloud.vm.dao.SecondaryStorageVmDao;
|
||||||
import com.cloud.vm.dao.VMInstanceDao;
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
|
||||||
@Local(value={ConfigurationManager.class})
|
@Local(value={ConfigurationManager.class})
|
||||||
@ -91,6 +97,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
@Inject AccountDao _accountDao;
|
@Inject AccountDao _accountDao;
|
||||||
@Inject EventDao _eventDao;
|
@Inject EventDao _eventDao;
|
||||||
@Inject UserDao _userDao;
|
@Inject UserDao _userDao;
|
||||||
|
@Inject ConsoleProxyDao _consoleDao;
|
||||||
|
@Inject SecondaryStorageVmDao _secStorageDao;
|
||||||
public boolean _premium;
|
public boolean _premium;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -665,13 +673,6 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
throw new InvalidParameterValueException("A zone with ID: " + zoneId + " does not exist.");
|
throw new InvalidParameterValueException("A zone with ID: " + zoneId + " does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If DNS values are being changed, make sure there are no VMs in this zone
|
|
||||||
if (dns1 != null || dns2 != null || internalDns1 != null || internalDns2 != null) {
|
|
||||||
if (zoneHasVMs(zoneId)) {
|
|
||||||
throw new InternalErrorException("The zone is not editable because there are VMs in the zone.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the Vnet range is being changed, make sure there are no allocated VNets
|
// If the Vnet range is being changed, make sure there are no allocated VNets
|
||||||
if (vnetRange != null) {
|
if (vnetRange != null) {
|
||||||
if (zoneHasAllocatedVnets(zoneId)) {
|
if (zoneHasAllocatedVnets(zoneId)) {
|
||||||
@ -679,22 +680,6 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//To modify a zone, we need to make sure there are no domr's associated with it
|
|
||||||
//1. List all the domain router objs
|
|
||||||
//2. Check if any of these has the current data center associated
|
|
||||||
//3. If yes, throw exception
|
|
||||||
//4, If no, edit
|
|
||||||
List<DomainRouterVO> allDomainRoutersAvailable = _domrDao.listAll();
|
|
||||||
|
|
||||||
for(DomainRouterVO domR : allDomainRoutersAvailable)
|
|
||||||
{
|
|
||||||
if(domR.getDataCenterId() == zoneId)
|
|
||||||
{
|
|
||||||
throw new InternalErrorException("The zone is not editable because there are domR's associated with the zone.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//5. Reached here, hence editable
|
|
||||||
|
|
||||||
DataCenterVO zone = _zoneDao.findById(zoneId);
|
DataCenterVO zone = _zoneDao.findById(zoneId);
|
||||||
String oldZoneName = zone.getName();
|
String oldZoneName = zone.getName();
|
||||||
@ -703,6 +688,12 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
newZoneName = oldZoneName;
|
newZoneName = oldZoneName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean dnsUpdate = false;
|
||||||
|
|
||||||
|
if(dns1 != null || dns2 != null){
|
||||||
|
dnsUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (dns1 == null) {
|
if (dns1 == null) {
|
||||||
dns1 = zone.getDns1();
|
dns1 = zone.getDns1();
|
||||||
}
|
}
|
||||||
@ -742,6 +733,48 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
|||||||
_zoneDao.addVnet(zone.getId(), begin, end);
|
_zoneDao.addVnet(zone.getId(), begin, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(dnsUpdate){
|
||||||
|
|
||||||
|
//Update dns for domRs in zone
|
||||||
|
|
||||||
|
List<DomainRouterVO> DomainRouters = _domrDao.listByDataCenter(zoneId);
|
||||||
|
|
||||||
|
for(DomainRouterVO domR : DomainRouters)
|
||||||
|
{
|
||||||
|
domR.setDns1(dns1);
|
||||||
|
domR.setDns2(dns2);
|
||||||
|
_domrDao.update(domR.getId(), domR);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update dns for console proxies in zone
|
||||||
|
List<VMInstanceVO> ConsoleProxies = _vmInstanceDao.listByZoneIdAndType(zoneId, VirtualMachine.Type.ConsoleProxy);
|
||||||
|
|
||||||
|
for(VMInstanceVO consoleVm : ConsoleProxies)
|
||||||
|
{
|
||||||
|
ConsoleProxyVO proxy = _consoleDao.findById(consoleVm.getId());
|
||||||
|
if( proxy!= null ){
|
||||||
|
proxy.setDns1(dns1);
|
||||||
|
proxy.setDns2(dns2);
|
||||||
|
_consoleDao.update(proxy.getId(), proxy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update dns for secondary storage Vms in zone
|
||||||
|
List<VMInstanceVO> storageVms = _vmInstanceDao.listByZoneIdAndType(zoneId, VirtualMachine.Type.SecondaryStorageVm);
|
||||||
|
|
||||||
|
for(VMInstanceVO storageVm : storageVms)
|
||||||
|
{
|
||||||
|
SecondaryStorageVmVO secStorageVm = _secStorageDao.findById(storageVm.getId());
|
||||||
|
if( secStorageVm!= null ){
|
||||||
|
secStorageVm.setDns1(dns1);
|
||||||
|
secStorageVm.setDns2(dns2);
|
||||||
|
_secStorageDao.update(secStorageVm.getId(), secStorageVm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
saveConfigurationEvent(userId, null, EventTypes.EVENT_ZONE_EDIT, "Successfully edited zone with name: " + zone.getName() + ".", "dcId=" + zone.getId(), "dns1=" + dns1, "dns2=" + dns2, "internalDns1=" + internalDns1, "internalDns2=" + internalDns2, "vnetRange=" + vnetRange, "guestCidr=" + guestCidr);
|
saveConfigurationEvent(userId, null, EventTypes.EVENT_ZONE_EDIT, "Successfully edited zone with name: " + zone.getName() + ".", "dcId=" + zone.getId(), "dns1=" + dns1, "dns2=" + dns2, "internalDns1=" + internalDns1, "internalDns2=" + internalDns2, "vnetRange=" + vnetRange, "guestCidr=" + guestCidr);
|
||||||
|
|
||||||
return zone;
|
return zone;
|
||||||
|
|||||||
@ -4402,6 +4402,7 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
SearchBuilder<AccountVO> sb = _accountDao.createSearchBuilder();
|
SearchBuilder<AccountVO> sb = _accountDao.createSearchBuilder();
|
||||||
sb.and("accountName", sb.entity().getAccountName(), SearchCriteria.Op.LIKE);
|
sb.and("accountName", sb.entity().getAccountName(), SearchCriteria.Op.LIKE);
|
||||||
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
|
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
|
||||||
|
sb.and("nid", sb.entity().getId(), SearchCriteria.Op.NEQ);
|
||||||
sb.and("type", sb.entity().getType(), SearchCriteria.Op.EQ);
|
sb.and("type", sb.entity().getType(), SearchCriteria.Op.EQ);
|
||||||
sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
|
sb.and("state", sb.entity().getState(), SearchCriteria.Op.EQ);
|
||||||
sb.and("needsCleanup", sb.entity().getNeedsCleanup(), SearchCriteria.Op.EQ);
|
sb.and("needsCleanup", sb.entity().getNeedsCleanup(), SearchCriteria.Op.EQ);
|
||||||
@ -4433,6 +4434,9 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
|
|
||||||
// I want to join on user_vm.domain_id = domain.id where domain.path like 'foo%'
|
// I want to join on user_vm.domain_id = domain.id where domain.path like 'foo%'
|
||||||
sc.setJoinParameters("domainSearch", "path", domain.getPath() + "%");
|
sc.setJoinParameters("domainSearch", "path", domain.getPath() + "%");
|
||||||
|
sc.setParameters("nid", 1L);
|
||||||
|
} else {
|
||||||
|
sc.setParameters("nid", 1L);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
@ -8590,6 +8594,26 @@ public class ManagementServerImpl implements ManagementServer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> listCapabilities() {
|
||||||
|
Map<String, String> capabilities = new HashMap<String, String>();
|
||||||
|
|
||||||
|
String networkGroupsEnabled = _configs.get("direct.attach.network.groups.enabled");
|
||||||
|
if(networkGroupsEnabled == null)
|
||||||
|
networkGroupsEnabled = "false";
|
||||||
|
|
||||||
|
capabilities.put("networkGroupsEnabled", networkGroupsEnabled);
|
||||||
|
|
||||||
|
final Class<?> c = this.getClass();
|
||||||
|
String fullVersion = c.getPackage().getImplementationVersion();
|
||||||
|
String version = "unknown";
|
||||||
|
if(fullVersion.length() > 0){
|
||||||
|
version = fullVersion.substring(0,fullVersion.lastIndexOf("."));
|
||||||
|
}
|
||||||
|
capabilities.put("cloudStackVersion", version);
|
||||||
|
return capabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -939,10 +939,12 @@ public class StorageManagerImpl implements StorageManager {
|
|||||||
if (vmId != null) {
|
if (vmId != null) {
|
||||||
VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
|
VMInstanceVO vmInstance = _vmInstanceDao.findById(vmId);
|
||||||
if (vmInstance != null) {
|
if (vmInstance != null) {
|
||||||
return vmInstance.getHostId();
|
Long hostId = vmInstance.getHostId();
|
||||||
|
if (hostId != null && !avoidHosts.contains(vmInstance.getHostId()))
|
||||||
|
return hostId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
/*Can't find the vm where host resides on(vm is destroyed? or volume is detached from vm), randomly choose a host to send the cmd */
|
||||||
}
|
}
|
||||||
List<StoragePoolHostVO> poolHosts = _poolHostDao.listByHostStatus(poolVO.getId(), Status.Up);
|
List<StoragePoolHostVO> poolHosts = _poolHostDao.listByHostStatus(poolVO.getId(), Status.Up);
|
||||||
Collections.shuffle(poolHosts);
|
Collections.shuffle(poolHosts);
|
||||||
|
|||||||
@ -287,7 +287,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
}
|
}
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
|
||||||
VolumeVO volume = _volsDao.findById(volumeId);
|
VolumeVO volume = _volsDao.lock(volumeId, true);
|
||||||
|
|
||||||
if (!shouldRunSnapshot(userId, volume, policyIds)) {
|
if (!shouldRunSnapshot(userId, volume, policyIds)) {
|
||||||
// A null snapshot is interpreted as snapshot creation failed which is what we want to indicate
|
// A null snapshot is interpreted as snapshot creation failed which is what we want to indicate
|
||||||
@ -477,7 +477,7 @@ public class SnapshotManagerImpl implements SnapshotManager {
|
|||||||
_snapshotDao.update(snapshot.getId(), snapshot);
|
_snapshotDao.update(snapshot.getId(), snapshot);
|
||||||
|
|
||||||
long volumeId = snapshot.getVolumeId();
|
long volumeId = snapshot.getVolumeId();
|
||||||
VolumeVO volume = _volsDao.findById(volumeId);
|
VolumeVO volume = _volsDao.lock(volumeId, true);
|
||||||
|
|
||||||
String primaryStoragePoolNameLabel = _storageMgr.getPrimaryStorageNameLabel(volume);
|
String primaryStoragePoolNameLabel = _storageMgr.getPrimaryStorageNameLabel(volume);
|
||||||
Long dcId = volume.getDataCenterId();
|
Long dcId = volume.getDataCenterId();
|
||||||
|
|||||||
@ -686,6 +686,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean started = false;
|
boolean started = false;
|
||||||
|
|
||||||
Transaction txn = Transaction.currentTxn();
|
Transaction txn = Transaction.currentTxn();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@ -736,6 +737,11 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
VolumeVO vol = rootVols.get(0);
|
VolumeVO vol = rootVols.get(0);
|
||||||
|
|
||||||
List<VolumeVO> vols = _volsDao.findCreatedByInstance(vm.getId());
|
List<VolumeVO> vols = _volsDao.findCreatedByInstance(vm.getId());
|
||||||
|
List<VolumeVO> vos = new ArrayList<VolumeVO>();
|
||||||
|
/*compete with take snapshot*/
|
||||||
|
for (VolumeVO userVmVol : vols) {
|
||||||
|
vos.add(_volsDao.lock(userVmVol.getId(), true));
|
||||||
|
}
|
||||||
|
|
||||||
Answer answer = null;
|
Answer answer = null;
|
||||||
int retry = _retry;
|
int retry = _retry;
|
||||||
@ -2215,7 +2221,7 @@ public class UserVmManagerImpl implements UserVmManager {
|
|||||||
@Override @DB
|
@Override @DB
|
||||||
public SnapshotVO createTemplateSnapshot(long userId, long volumeId) {
|
public SnapshotVO createTemplateSnapshot(long userId, long volumeId) {
|
||||||
SnapshotVO createdSnapshot = null;
|
SnapshotVO createdSnapshot = null;
|
||||||
VolumeVO volume = _volsDao.findById(volumeId);
|
VolumeVO volume = _volsDao.lock(volumeId, true);
|
||||||
|
|
||||||
Long id = null;
|
Long id = null;
|
||||||
|
|
||||||
|
|||||||
17
ui/index.html → ui/index.jsp
Normal file → Executable file
17
ui/index.html → ui/index.jsp
Normal file → Executable file
@ -1,3 +1,9 @@
|
|||||||
|
<%@ page import="java.util.Date" %>
|
||||||
|
|
||||||
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
@ -5,11 +11,10 @@
|
|||||||
<meta http-equiv='cache-control' content='no-cache'>
|
<meta http-equiv='cache-control' content='no-cache'>
|
||||||
<meta http-equiv='expires' content='0'>
|
<meta http-equiv='expires' content='0'>
|
||||||
<meta http-equiv='pragma' content='no-cache'>
|
<meta http-equiv='pragma' content='no-cache'>
|
||||||
<meta name="version" content="@VERSION@" />
|
<meta name="version" content="1.9.1.13" />
|
||||||
|
|
||||||
<title>cloud.com - User Console</title>
|
<title>cloud.com - User Console</title>
|
||||||
|
|
||||||
|
|
||||||
<!-- Style Sheet -->
|
<!-- Style Sheet -->
|
||||||
<link rel= "stylesheet" href="css/main.css" type="text/css" />
|
<link rel= "stylesheet" href="css/main.css" type="text/css" />
|
||||||
<link rel= "stylesheet" href="css/jquery-ui-1.8.2.custom.css" type="text/css" />
|
<link rel= "stylesheet" href="css/jquery-ui-1.8.2.custom.css" type="text/css" />
|
||||||
@ -38,12 +43,12 @@
|
|||||||
<script type="text/javascript" src="scripts/jquery.md5.js"></script>
|
<script type="text/javascript" src="scripts/jquery.md5.js"></script>
|
||||||
|
|
||||||
<!-- Callback script for Single Signon -->
|
<!-- Callback script for Single Signon -->
|
||||||
<script type="text/javascript" src="scripts/cloud.core.callbacks.js"></script>
|
<script type="text/javascript" src="scripts/cloud.core.callbacks.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<!-- cloud.com scripts -->
|
<!-- cloud.com scripts -->
|
||||||
<script type="text/javascript" src="scripts/cloud.logger.js"></script>
|
<script type="text/javascript" src="scripts/cloud.logger.js?t=<%=milliseconds%>"></script>
|
||||||
<script type="text/javascript" src="scripts/cloud.core.js"></script>
|
<script type="text/javascript" src="scripts/cloud.core.js?t=<%=milliseconds%>"></script>
|
||||||
<script type="text/javascript" src="scripts/cloud.core.init.js"></script>
|
<script type="text/javascript" src="scripts/cloud.core.init.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
|
||||||
6
ui/content/tab_accounts.html → ui/jsp/tab_accounts.jsp
Normal file → Executable file
6
ui/content/tab_accounts.html → ui/jsp/tab_accounts.jsp
Normal file → Executable file
@ -1,4 +1,8 @@
|
|||||||
<script type="text/javascript" src="scripts/cloud.core.accounts.js"></script>
|
<%@ page import="java.util.Date" %>
|
||||||
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.accounts.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<!-- Accounts -->
|
<!-- Accounts -->
|
||||||
<div class="maincontent" style="display:block;" id="submenu_content_account">
|
<div class="maincontent" style="display:block;" id="submenu_content_account">
|
||||||
6
ui/content/tab_configuration.html → ui/jsp/tab_configuration.jsp
Normal file → Executable file
6
ui/content/tab_configuration.html → ui/jsp/tab_configuration.jsp
Normal file → Executable file
@ -1,4 +1,8 @@
|
|||||||
<script type="text/javascript" src="scripts/cloud.core.configuration.js"></script>
|
<%@ page import="java.util.Date" %>
|
||||||
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.configuration.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<!-- Content Panel -->
|
<!-- Content Panel -->
|
||||||
<!-- Submenu -->
|
<!-- Submenu -->
|
||||||
0
ui/content/tab_dashboard.html → ui/jsp/tab_dashboard.jsp
Normal file → Executable file
0
ui/content/tab_dashboard.html → ui/jsp/tab_dashboard.jsp
Normal file → Executable file
7
ui/jsp/tab_domains.jsp
Normal file → Executable file
7
ui/jsp/tab_domains.jsp
Normal file → Executable file
@ -1,5 +1,8 @@
|
|||||||
|
<%@ page import="java.util.Date" %>
|
||||||
<script type="text/javascript" src="scripts/cloud.core.domains.js"></script>
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.domains.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<!-- Content Panel -->
|
<!-- Content Panel -->
|
||||||
<div class="maincontent" style="display:block;" id="submenu_content_domains">
|
<div class="maincontent" style="display:block;" id="submenu_content_domains">
|
||||||
|
|||||||
6
ui/content/tab_events.html → ui/jsp/tab_events.jsp
Normal file → Executable file
6
ui/content/tab_events.html → ui/jsp/tab_events.jsp
Normal file → Executable file
@ -1,4 +1,8 @@
|
|||||||
<script type="text/javascript" src="scripts/cloud.core.events.js"></script>
|
<%@ page import="java.util.Date" %>
|
||||||
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.events.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<!-- Content Panel -->
|
<!-- Content Panel -->
|
||||||
<!-- Submenus -->
|
<!-- Submenus -->
|
||||||
6
ui/content/tab_hosts.html → ui/jsp/tab_hosts.jsp
Normal file → Executable file
6
ui/content/tab_hosts.html → ui/jsp/tab_hosts.jsp
Normal file → Executable file
@ -1,4 +1,8 @@
|
|||||||
<script type="text/javascript" src="scripts/cloud.core.hosts.js"></script>
|
<%@ page import="java.util.Date" %>
|
||||||
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.hosts.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<div class="maincontent" id="submenu_content_routing" style="display:block">
|
<div class="maincontent" id="submenu_content_routing" style="display:block">
|
||||||
<div id="maincontent_title">
|
<div id="maincontent_title">
|
||||||
9
ui/content/tab_instances.html → ui/jsp/tab_instances.jsp
Normal file → Executable file
9
ui/content/tab_instances.html → ui/jsp/tab_instances.jsp
Normal file → Executable file
@ -1,4 +1,8 @@
|
|||||||
<script type="text/javascript" src="scripts/cloud.core.instances.js"></script>
|
<%@ page import="java.util.Date" %>
|
||||||
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.instances.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<!-- Content Panel -->
|
<!-- Content Panel -->
|
||||||
<!-- Submenu -->
|
<!-- Submenu -->
|
||||||
@ -704,8 +708,7 @@
|
|||||||
<h2>
|
<h2>
|
||||||
<strong>Step 3:</strong> Optional</h2>
|
<strong>Step 3:</strong> Optional</h2>
|
||||||
<p>
|
<p>
|
||||||
To create a new instance, please first select a zone you wish to have your virtual
|
You can choose to name and group your virtual machine for easy identification. You can also choose additional data storage. (These options can be added at any time.) </p>
|
||||||
instance hosted on.</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="rev_wizmid_contentbox">
|
<div class="rev_wizmid_contentbox">
|
||||||
<div class="rev_tempsearchpanel">
|
<div class="rev_tempsearchpanel">
|
||||||
6
ui/content/tab_networking.html → ui/jsp/tab_networking.jsp
Normal file → Executable file
6
ui/content/tab_networking.html → ui/jsp/tab_networking.jsp
Normal file → Executable file
@ -1,4 +1,8 @@
|
|||||||
<script type="text/javascript" src="scripts/cloud.core.network.js"></script>
|
<%@ page import="java.util.Date" %>
|
||||||
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.network.js?t=<%=milliseconds%>"></script>
|
||||||
<!-- Content Panel -->
|
<!-- Content Panel -->
|
||||||
<!-- Submenus -->
|
<!-- Submenus -->
|
||||||
<div class="submenu_links">
|
<div class="submenu_links">
|
||||||
6
ui/content/tab_storage.html → ui/jsp/tab_storage.jsp
Normal file → Executable file
6
ui/content/tab_storage.html → ui/jsp/tab_storage.jsp
Normal file → Executable file
@ -1,4 +1,8 @@
|
|||||||
<script type="text/javascript" src="scripts/cloud.core.storage.js"></script>
|
<%@ page import="java.util.Date" %>
|
||||||
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.storage.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<div class="submenu_links">
|
<div class="submenu_links">
|
||||||
<div class="submenu_links_on" id="submenu_pool">
|
<div class="submenu_links_on" id="submenu_pool">
|
||||||
6
ui/content/tab_templates.html → ui/jsp/tab_templates.jsp
Normal file → Executable file
6
ui/content/tab_templates.html → ui/jsp/tab_templates.jsp
Normal file → Executable file
@ -1,4 +1,8 @@
|
|||||||
<script type="text/javascript" src="scripts/cloud.core.templates.js"></script>
|
<%@ page import="java.util.Date" %>
|
||||||
|
<%
|
||||||
|
long milliseconds = new Date().getTime();
|
||||||
|
%>
|
||||||
|
<script type="text/javascript" src="scripts/cloud.core.templates.js?t=<%=milliseconds%>"></script>
|
||||||
|
|
||||||
<div class="submenu_links">
|
<div class="submenu_links">
|
||||||
<div class="submenu_links_on" id="submenu_template">Template</div>
|
<div class="submenu_links_on" id="submenu_template">Template</div>
|
||||||
@ -1244,7 +1244,7 @@ function showConfigurationTab() {
|
|||||||
|
|
||||||
dialogEditService.find("#service_name").text(svcName);
|
dialogEditService.find("#service_name").text(svcName);
|
||||||
dialogEditService.find("#edit_service_name").val(svcName);
|
dialogEditService.find("#edit_service_name").val(svcName);
|
||||||
dialogEditService.find("#edit_service_display").val(template.find("#service_display").text());
|
dialogEditService.find("#edit_service_display").val(template.find("#service_displaytext").text());
|
||||||
dialogEditService.find("#edit_service_offerha").val(toBooleanValue(template.find("#service_offerha").text()));
|
dialogEditService.find("#edit_service_offerha").val(toBooleanValue(template.find("#service_offerha").text()));
|
||||||
|
|
||||||
dialogEditService
|
dialogEditService
|
||||||
@ -1260,9 +1260,9 @@ function showConfigurationTab() {
|
|||||||
|
|
||||||
var moreCriteria = [];
|
var moreCriteria = [];
|
||||||
var name = trim(thisDialog.find("#edit_service_name").val());
|
var name = trim(thisDialog.find("#edit_service_name").val());
|
||||||
moreCriteria.push("&name="+encodeURIComponent(name));
|
moreCriteria.push("&name="+encodeURIComponent(escape(name)));
|
||||||
var displaytext = trim(thisDialog.find("#edit_service_display").val());
|
var displaytext = trim(thisDialog.find("#edit_service_display").val());
|
||||||
moreCriteria.push("&displayText="+encodeURIComponent(displaytext));
|
moreCriteria.push("&displayText="+encodeURIComponent(escape(displaytext)));
|
||||||
var offerha = trim(thisDialog.find("#edit_service_offerha").val());
|
var offerha = trim(thisDialog.find("#edit_service_offerha").val());
|
||||||
moreCriteria.push("&offerha="+offerha);
|
moreCriteria.push("&offerha="+offerha);
|
||||||
|
|
||||||
@ -1316,17 +1316,17 @@ function showConfigurationTab() {
|
|||||||
function serviceJSONToTemplate(json, template) {
|
function serviceJSONToTemplate(json, template) {
|
||||||
template.attr("id", "service_"+json.id);
|
template.attr("id", "service_"+json.id);
|
||||||
(index++ % 2 == 0)? template.addClass("smallrow_even"): template.addClass("smallrow_odd");
|
(index++ % 2 == 0)? template.addClass("smallrow_even"): template.addClass("smallrow_odd");
|
||||||
template.data("svcId", json.id).data("svcName", sanitizeXSS(json.name));
|
template.data("svcId", json.id).data("svcName", sanitizeXSS(unescape(json.name)));
|
||||||
|
|
||||||
template.find("#service_id").text(json.id);
|
template.find("#service_id").text(json.id);
|
||||||
template.find("#service_name").text(json.name);
|
template.find("#service_name").text(unescape(json.name));
|
||||||
template.find("#service_displaytext").text(json.displaytext);
|
template.find("#service_displaytext").text(unescape(json.displaytext));
|
||||||
template.find("#service_storagetype").text(json.storagetype);
|
template.find("#service_storagetype").text(json.storagetype);
|
||||||
template.find("#service_cpu").text(json.cpunumber + " x " + convertHz(json.cpuspeed));
|
template.find("#service_cpu").text(json.cpunumber + " x " + convertHz(json.cpuspeed));
|
||||||
template.find("#service_memory").text(convertBytes(parseInt(json.memory)*1024*1024));
|
template.find("#service_memory").text(convertBytes(parseInt(json.memory)*1024*1024));
|
||||||
template.find("#service_offerha").text(toBooleanText(json.offerha));
|
template.find("#service_offerha").text(toBooleanText(json.offerha));
|
||||||
template.find("#service_networktype").text(toNetworkType(json.usevirtualnetwork));
|
template.find("#service_networktype").text(toNetworkType(json.usevirtualnetwork));
|
||||||
template.find("#service_tags").text(json.tags);
|
template.find("#service_tags").text(unescape(json.tags));
|
||||||
|
|
||||||
setDateField(json.created, template.find("#service_created"));
|
setDateField(json.created, template.find("#service_created"));
|
||||||
}
|
}
|
||||||
@ -1454,10 +1454,10 @@ function showConfigurationTab() {
|
|||||||
|
|
||||||
var array1 = [];
|
var array1 = [];
|
||||||
var name = trim(thisDialog.find("#add_service_name").val());
|
var name = trim(thisDialog.find("#add_service_name").val());
|
||||||
array1.push("&name="+encodeURIComponent(name));
|
array1.push("&name="+encodeURIComponent(escape(name)));
|
||||||
|
|
||||||
var display = trim(thisDialog.find("#add_service_display").val());
|
var display = trim(thisDialog.find("#add_service_display").val());
|
||||||
array1.push("&displayText="+encodeURIComponent(display));
|
array1.push("&displayText="+encodeURIComponent(escape(display)));
|
||||||
|
|
||||||
var storagetype = trim(thisDialog.find("#add_service_storagetype").val());
|
var storagetype = trim(thisDialog.find("#add_service_storagetype").val());
|
||||||
array1.push("&storageType="+storagetype);
|
array1.push("&storageType="+storagetype);
|
||||||
@ -1480,7 +1480,7 @@ function showConfigurationTab() {
|
|||||||
|
|
||||||
var tags = trim(thisDialog.find("#add_service_tags").val());
|
var tags = trim(thisDialog.find("#add_service_tags").val());
|
||||||
if(tags != null && tags.length > 0)
|
if(tags != null && tags.length > 0)
|
||||||
array1.push("&tags="+encodeURIComponent(tags));
|
array1.push("&tags="+encodeURIComponent(escape(tags)));
|
||||||
|
|
||||||
thisDialog.dialog("close");
|
thisDialog.dialog("close");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -1544,17 +1544,17 @@ function showConfigurationTab() {
|
|||||||
|
|
||||||
var array1 = [];
|
var array1 = [];
|
||||||
var name = trim(thisDialog.find("#add_disk_name").val());
|
var name = trim(thisDialog.find("#add_disk_name").val());
|
||||||
array1.push("&name="+encodeURIComponent(name));
|
array1.push("&name="+encodeURIComponent(escape(name)));
|
||||||
|
|
||||||
var description = trim(thisDialog.find("#add_disk_description").val());
|
var description = trim(thisDialog.find("#add_disk_description").val());
|
||||||
array1.push("&displaytext="+encodeURIComponent(description));
|
array1.push("&displaytext="+encodeURIComponent(escape(description)));
|
||||||
|
|
||||||
var disksize = trim(thisDialog.find("#add_disk_disksize").val());
|
var disksize = trim(thisDialog.find("#add_disk_disksize").val());
|
||||||
array1.push("&disksize="+disksize);
|
array1.push("&disksize="+disksize);
|
||||||
|
|
||||||
var tags = trim(thisDialog.find("#add_disk_tags").val());
|
var tags = trim(thisDialog.find("#add_disk_tags").val());
|
||||||
if(tags != null && tags.length > 0)
|
if(tags != null && tags.length > 0)
|
||||||
array1.push("&tags="+encodeURIComponent(tags));
|
array1.push("&tags="+encodeURIComponent(escape(tags)));
|
||||||
|
|
||||||
thisDialog.dialog("close");
|
thisDialog.dialog("close");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -1649,7 +1649,7 @@ function showConfigurationTab() {
|
|||||||
var dialogBox = $(this);
|
var dialogBox = $(this);
|
||||||
dialogBox.dialog("close");
|
dialogBox.dialog("close");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=updateDiskOffering&name="+encodeURIComponent(name)+"&displayText="+encodeURIComponent(display)+"&id="+diskId+"&response=json"),
|
data: createURL("command=updateDiskOffering&name="+encodeURIComponent(escape(name))+"&displayText="+encodeURIComponent(escape(display))+"&id="+diskId+"&response=json"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
template.find("#disk_description").text(display);
|
template.find("#disk_description").text(display);
|
||||||
@ -1699,15 +1699,14 @@ function showConfigurationTab() {
|
|||||||
} else {
|
} else {
|
||||||
template.addClass("smallrow_odd");
|
template.addClass("smallrow_odd");
|
||||||
}
|
}
|
||||||
template.data("diskId", json.id).data("diskName", sanitizeXSS(json.name));
|
template.data("diskId", json.id).data("diskName", sanitizeXSS(unescape(json.name)));
|
||||||
|
|
||||||
template.find("#disk_id").text(json.id);
|
template.find("#disk_id").text(json.id);
|
||||||
template.find("#disk_name").text(json.name);
|
template.find("#disk_name").text(unescape(json.name));
|
||||||
template.find("#disk_description").text(json.displaytext);
|
template.find("#disk_description").text(unescape(json.displaytext));
|
||||||
template.find("#disk_disksize").text(convertBytes(json.disksize));
|
template.find("#disk_disksize").text(convertBytes(json.disksize));
|
||||||
template.find("#disk_tags").text(json.tags);
|
template.find("#disk_tags").text(unescape(json.tags));
|
||||||
template.find("#disk_domain").text(json.domain);
|
template.find("#disk_domain").text(unescape(json.domain));
|
||||||
template.find("#disk_ismirrored").text(json.ismirrored);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function listDiskOfferings() {
|
function listDiskOfferings() {
|
||||||
|
|||||||
@ -66,7 +66,7 @@ function showDomainsTab() {
|
|||||||
|
|
||||||
function drawTree(id, level, container) {
|
function drawTree(id, level, container) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: "command=listDomainChildren&id="+id+"&response=json&pageSize=-1",
|
data: createURL("command=listDomainChildren&id="+id+"&response=json&pageSize=-1"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
async: false,
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
@ -321,7 +321,7 @@ function showDomainsTab() {
|
|||||||
rightPanelSearchResult.show();
|
rightPanelSearchResult.show();
|
||||||
var keyword = searchInput.val();
|
var keyword = searchInput.val();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: "command=listDomains&keyword="+keyword+"&response=json&pageSize=-1", //pageSize=-1 will return all items (no limitation)
|
data: createURL("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) {
|
||||||
@ -350,7 +350,7 @@ function showDomainsTab() {
|
|||||||
function drawRootNode(rootDomainId) {
|
function drawRootNode(rootDomainId) {
|
||||||
treeContentBox.empty();
|
treeContentBox.empty();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: "command=listDomains&id="+rootDomainId+"&response=json&pageSize=-1", //pageSize=-1 will return all items (no limitation)
|
data: createURL("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) {
|
||||||
|
|||||||
@ -569,7 +569,7 @@ function showHostsTab() {
|
|||||||
} else if (state == "Maintenance") {
|
} else if (state == "Maintenance") {
|
||||||
template.find(".grid_links").find("#host_action_reconnect_container, #host_action_enable_maint_container").hide();
|
template.find(".grid_links").find("#host_action_reconnect_container, #host_action_enable_maint_container").hide();
|
||||||
} else if (state == "Disconnected") {
|
} else if (state == "Disconnected") {
|
||||||
template.find(".grid_links").find("#host_action_reconnect_container, #host_action_enable_maint_container, #host_action_cancel_maint_container, #host_action_remove_container").hide();
|
template.find(".grid_links").find("#host_action_reconnect_container, #host_action_enable_maint_container, #host_action_cancel_maint_container").hide();
|
||||||
} else {
|
} else {
|
||||||
alert("Unsupported Host State: " + state);
|
alert("Unsupported Host State: " + state);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,7 +29,7 @@ $(document).ready(function() {
|
|||||||
mainContainer = $("#maincontentarea");
|
mainContainer = $("#maincontentarea");
|
||||||
|
|
||||||
// Tab Links, dashboard is the initial active tab
|
// Tab Links, dashboard is the initial active tab
|
||||||
mainContainer.load("content/tab_dashboard.html");
|
mainContainer.load("jsp/tab_dashboard.jsp");
|
||||||
|
|
||||||
// Default AJAX Setup
|
// Default AJAX Setup
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
@ -285,31 +285,31 @@ $(document).ready(function() {
|
|||||||
if (tabId == "menutab_dashboard_user" || tabId == "menutab_dashboard_root" || tabId == "menutab_dashboard_domain") {
|
if (tabId == "menutab_dashboard_user" || tabId == "menutab_dashboard_root" || tabId == "menutab_dashboard_domain") {
|
||||||
showDashboardTab();
|
showDashboardTab();
|
||||||
} else if (tabId == "menutab_vm") {
|
} else if (tabId == "menutab_vm") {
|
||||||
mainContainer.load("content/tab_instances.html", function() {
|
mainContainer.load("jsp/tab_instances.jsp", function() {
|
||||||
showInstancesTab(tab.data("domainId"), tab.data("account"));
|
showInstancesTab(tab.data("domainId"), tab.data("account"));
|
||||||
});
|
});
|
||||||
} else if (tabId == "menutab_networking") {
|
} else if (tabId == "menutab_networking") {
|
||||||
mainContainer.load("content/tab_networking.html", function() {
|
mainContainer.load("jsp/tab_networking.jsp", function() {
|
||||||
showNetworkingTab(tab.data("domainId"), tab.data("account"));
|
showNetworkingTab(tab.data("domainId"), tab.data("account"));
|
||||||
});
|
});
|
||||||
} else if (tabId == "menutab_templates") {
|
} else if (tabId == "menutab_templates") {
|
||||||
mainContainer.load("content/tab_templates.html", function() {
|
mainContainer.load("jsp/tab_templates.jsp", function() {
|
||||||
showTemplatesTab();
|
showTemplatesTab();
|
||||||
});
|
});
|
||||||
} else if (tabId == "menutab_events") {
|
} else if (tabId == "menutab_events") {
|
||||||
mainContainer.load("content/tab_events.html", function() {
|
mainContainer.load("jsp/tab_events.jsp", function() {
|
||||||
showEventsTab(tab.data("showEvents"));
|
showEventsTab(tab.data("showEvents"));
|
||||||
});
|
});
|
||||||
} else if (tabId == "menutab_hosts") {
|
} else if (tabId == "menutab_hosts") {
|
||||||
mainContainer.load("content/tab_hosts.html", function() {
|
mainContainer.load("jsp/tab_hosts.jsp", function() {
|
||||||
showHostsTab();
|
showHostsTab();
|
||||||
});
|
});
|
||||||
} else if (tabId == "menutab_storage") {
|
} else if (tabId == "menutab_storage") {
|
||||||
mainContainer.load("content/tab_storage.html", function() {
|
mainContainer.load("jsp/tab_storage.jsp", function() {
|
||||||
showStorageTab(tab.data("domainId"), tab.data("targetTab"));
|
showStorageTab(tab.data("domainId"), tab.data("targetTab"));
|
||||||
});
|
});
|
||||||
} else if (tabId == "menutab_accounts") {
|
} else if (tabId == "menutab_accounts") {
|
||||||
mainContainer.load("content/tab_accounts.html", function() {
|
mainContainer.load("jsp/tab_accounts.jsp", function() {
|
||||||
showAccountsTab(tab.data("domainId"));
|
showAccountsTab(tab.data("domainId"));
|
||||||
});
|
});
|
||||||
} else if (tabId == "menutab_domain") {
|
} else if (tabId == "menutab_domain") {
|
||||||
@ -317,7 +317,7 @@ $(document).ready(function() {
|
|||||||
showDomainsTab();
|
showDomainsTab();
|
||||||
});
|
});
|
||||||
} else if (tabId == "menutab_configuration") {
|
} else if (tabId == "menutab_configuration") {
|
||||||
mainContainer.load("content/tab_configuration.html", function() {
|
mainContainer.load("jsp/tab_configuration.jsp", function() {
|
||||||
showConfigurationTab();
|
showConfigurationTab();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -342,7 +342,7 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
// Dashboard Tab
|
// Dashboard Tab
|
||||||
function showDashboardTab() {
|
function showDashboardTab() {
|
||||||
mainContainer.load("content/tab_dashboard.html", function() {
|
mainContainer.load("jsp/tab_dashboard.jsp", function() {
|
||||||
$(".header_topright #header_username").text($.cookie("username"));
|
$(".header_topright #header_username").text($.cookie("username"));
|
||||||
|
|
||||||
if (isAdmin()) {
|
if (isAdmin()) {
|
||||||
|
|||||||
@ -576,7 +576,7 @@ function showInstancesTab(p_domainId, p_account) {
|
|||||||
|
|
||||||
if (offerings != null && offerings.length > 0) {
|
if (offerings != null && offerings.length > 0) {
|
||||||
for (var i = 0; i < offerings.length; i++) {
|
for (var i = 0; i < offerings.length; i++) {
|
||||||
var option = $("<option value='" + offerings[i].id + "'>" + sanitizeXSS(offerings[i].displaytext) + "</option>").data("name", offerings[i].name);
|
var option = $("<option value='" + offerings[i].id + "'>" + sanitizeXSS(unescape(offerings[i].displaytext)) + "</option>").data("name", sanitizeXSS(unescape(offerings[i].name)));
|
||||||
offeringSelect.append(option);
|
offeringSelect.append(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -611,7 +611,7 @@ function showInstancesTab(p_domainId, p_account) {
|
|||||||
vmInstance.find(".row_loading").show();
|
vmInstance.find(".row_loading").show();
|
||||||
vmInstance.find(".loadingmessage_container .loadingmessage_top p").html("Your virtual instance has been upgraded. Please restart your virtual instance for the new service offering to take effect.");
|
vmInstance.find(".loadingmessage_container .loadingmessage_top p").html("Your virtual instance has been upgraded. Please restart your virtual instance for the new service offering to take effect.");
|
||||||
vmInstance.find(".loadingmessage_container").fadeIn("slow");
|
vmInstance.find(".loadingmessage_container").fadeIn("slow");
|
||||||
vmInstance.find("#vm_service").html("<strong>Service:</strong> " + sanitizeXSS(result.virtualmachine[0].serviceofferingname));
|
vmInstance.find("#vm_service").html("<strong>Service:</strong> " + sanitizeXSS(unescape(result.virtualmachine[0].serviceofferingname)));
|
||||||
if (result.virtualmachine[0].haenable =='true') {
|
if (result.virtualmachine[0].haenable =='true') {
|
||||||
vmInstance.find("#vm_ha").html("<strong>HA:</strong> Enabled");
|
vmInstance.find("#vm_ha").html("<strong>HA:</strong> Enabled");
|
||||||
vmInstance.find("#vm_action_ha").text("Disable HA");
|
vmInstance.find("#vm_action_ha").text("Disable HA");
|
||||||
@ -1109,7 +1109,7 @@ function showInstancesTab(p_domainId, p_account) {
|
|||||||
instanceTemplate.find("#vm_ip_address").html("<strong>IP Address:</strong> " + instanceJSON.ipaddress);
|
instanceTemplate.find("#vm_ip_address").html("<strong>IP Address:</strong> " + instanceJSON.ipaddress);
|
||||||
instanceTemplate.find("#vm_zone").html("<strong>Zone:</strong> " + sanitizeXSS(instanceJSON.zonename));
|
instanceTemplate.find("#vm_zone").html("<strong>Zone:</strong> " + sanitizeXSS(instanceJSON.zonename));
|
||||||
instanceTemplate.find("#vm_template").html("<strong>Template:</strong> " + sanitizeXSS(instanceJSON.templatename));
|
instanceTemplate.find("#vm_template").html("<strong>Template:</strong> " + sanitizeXSS(instanceJSON.templatename));
|
||||||
instanceTemplate.find("#vm_service").html("<strong>Service:</strong> " + sanitizeXSS(instanceJSON.serviceofferingname));
|
instanceTemplate.find("#vm_service").html("<strong>Service:</strong> " + sanitizeXSS(unescape(instanceJSON.serviceofferingname)));
|
||||||
if (instanceJSON.haenable =='true') {
|
if (instanceJSON.haenable =='true') {
|
||||||
instanceTemplate.find("#vm_ha").html("<strong>HA:</strong> Enabled");
|
instanceTemplate.find("#vm_ha").html("<strong>HA:</strong> Enabled");
|
||||||
instanceTemplate.find("#vm_action_ha").text("Disable HA");
|
instanceTemplate.find("#vm_action_ha").text("Disable HA");
|
||||||
@ -1277,7 +1277,7 @@ function showInstancesTab(p_domainId, p_account) {
|
|||||||
continue;
|
continue;
|
||||||
var checked = "checked";
|
var checked = "checked";
|
||||||
if (first == false) checked = "";
|
if (first == false) checked = "";
|
||||||
var listItem = $("<li><input class='radio' type='radio' name='service' id='service' value='"+offerings[i].id+"'" + checked + "/><label style='width:500px;font-size:11px;' for='service'>"+sanitizeXSS(offerings[i].displaytext)+"</label></li>");
|
var listItem = $("<li><input class='radio' type='radio' name='service' id='service' value='"+offerings[i].id+"'" + checked + "/><label style='width:500px;font-size:11px;' for='service'>"+sanitizeXSS(unescape(offerings[i].displaytext))+"</label></li>");
|
||||||
$("#wizard_service_offering").append(listItem);
|
$("#wizard_service_offering").append(listItem);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
@ -1306,14 +1306,14 @@ function showInstancesTab(p_domainId, p_account) {
|
|||||||
var html =
|
var html =
|
||||||
"<li>"
|
"<li>"
|
||||||
+"<input class='radio' type='radio' name='rootdisk' id='rootdisk' value='"+offerings[i].id+"'" + ((i==0)?"checked":"") + "/>"
|
+"<input class='radio' type='radio' name='rootdisk' id='rootdisk' value='"+offerings[i].id+"'" + ((i==0)?"checked":"") + "/>"
|
||||||
+"<label style='width:500px;font-size:11px;' for='disk'>"+sanitizeXSS(offerings[i].displaytext)+"</label>"
|
+"<label style='width:500px;font-size:11px;' for='disk'>"+sanitizeXSS(unescape(offerings[i].displaytext))+"</label>"
|
||||||
+"</li>";
|
+"</li>";
|
||||||
$("#wizard_root_disk_offering").append(html);
|
$("#wizard_root_disk_offering").append(html);
|
||||||
|
|
||||||
var html2 =
|
var html2 =
|
||||||
"<li>"
|
"<li>"
|
||||||
+"<input class='radio' type='radio' name='datadisk' id='datadisk' value='"+offerings[i].id+"'" + "/>"
|
+"<input class='radio' type='radio' name='datadisk' id='datadisk' value='"+offerings[i].id+"'" + "/>"
|
||||||
+"<label style='width:500px;font-size:11px;' for='disk'>"+sanitizeXSS(offerings[i].displaytext)+"</label>"
|
+"<label style='width:500px;font-size:11px;' for='disk'>"+sanitizeXSS(unescape(offerings[i].displaytext))+"</label>"
|
||||||
+"</li>";
|
+"</li>";
|
||||||
$("#wizard_data_disk_offering").append(html2);
|
$("#wizard_data_disk_offering").append(html2);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user