mirror of https://github.com/apache/cloudstack.git
Template size,
1. the size in template_pool_ref now is physical size. 2. template in storage pool is implemented as snapshot, fix x3 issue 3. fix x4 issue
This commit is contained in:
parent
6e14742666
commit
fea31133a3
|
|
@ -1699,6 +1699,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
|
||||
/* Does the template exist in primary storage pool? If yes, no copy */
|
||||
VDI vmtmpltvdi = null;
|
||||
VDI snapshotvdi = null;
|
||||
|
||||
Set<VDI> vdis = VDI.getByNameLabel(conn, "Template " + cmd.getName());
|
||||
|
||||
|
|
@ -1731,19 +1732,21 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
|||
return new DownloadAnswer(null, 0, msg, com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR, "", "", 0);
|
||||
}
|
||||
vmtmpltvdi = cloudVDIcopy(tmpltvdi, poolsr);
|
||||
|
||||
vmtmpltvdi.setNameLabel(conn, "Template " + cmd.getName());
|
||||
snapshotvdi = vmtmpltvdi.snapshot(conn, new HashMap<String, String>());
|
||||
vmtmpltvdi.destroy(conn);
|
||||
snapshotvdi.setNameLabel(conn, "Template " + cmd.getName());
|
||||
// vmtmpltvdi.setNameDescription(conn, cmd.getDescription());
|
||||
uuid = vmtmpltvdi.getUuid(conn);
|
||||
uuid = snapshotvdi.getUuid(conn);
|
||||
vmtmpltvdi = snapshotvdi;
|
||||
|
||||
} else
|
||||
uuid = vmtmpltvdi.getUuid(conn);
|
||||
|
||||
// Determine the size of the template
|
||||
long createdSize = vmtmpltvdi.getVirtualSize(conn);
|
||||
long phySize = vmtmpltvdi.getPhysicalUtilisation(conn);
|
||||
|
||||
DownloadAnswer answer = new DownloadAnswer(null, 100, cmd, com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED, uuid, uuid);
|
||||
answer.setTemplateSize(createdSize);
|
||||
answer.setTemplateSize(phySize);
|
||||
|
||||
return answer;
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ secstorage_svcs() {
|
|||
|
||||
|
||||
cp ${path}/etc/sysconfig/iptables-secstorage ${path}/etc/sysconfig/iptables
|
||||
cp /usr/sbin/vhd-util /usr/sbin
|
||||
cp /usr/sbin/vhd-util ${path}/usr/sbin
|
||||
mkdir -p ${path}/var/log/cloud
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -596,6 +596,8 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory {
|
|||
AgentAttache attache = _agents.get(hostId);
|
||||
handleDisconnect(attache, Status.Event.Remove, false);
|
||||
_hostDao.remove(secStorageHost.getId());
|
||||
/*Disconnected agent needs special handling here*/
|
||||
secStorageHost.setGuid(null);
|
||||
txn.commit();
|
||||
return true;
|
||||
}catch (Throwable t) {
|
||||
|
|
|
|||
|
|
@ -609,7 +609,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
|||
event.setType(EventTypes.EVENT_ROUTER_CREATE);
|
||||
|
||||
if (!found) {
|
||||
event.setDescription("failed to create Domain Router : " + router.getName());
|
||||
event.setDescription("failed to create Domain Router : " + name);
|
||||
event.setLevel(EventVO.LEVEL_ERROR);
|
||||
_eventDao.persist(event);
|
||||
throw new ExecutionException("Unable to create DomainRouter");
|
||||
|
|
|
|||
|
|
@ -789,7 +789,7 @@ public class StorageManagerImpl implements StorageManager {
|
|||
|
||||
if (dataVol != null) {
|
||||
StoragePoolVO pool = _storagePoolDao.findById(rootCreated.getPoolId());
|
||||
dataCreated = createVolume(dataVol, vm, template, dc, pod, pool.getClusterId(), offering, diskOffering, avoids);
|
||||
dataCreated = createVolume(dataVol, vm, null, dc, pod, pool.getClusterId(), offering, diskOffering, avoids);
|
||||
if (dataCreated == null) {
|
||||
throw new CloudRuntimeException("Unable to create " + dataVol);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
|
|||
if (!poolIsCorrectType(dskCh, pool, vm, offering)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// check the used size against the total size, skip this host if it's greater than the configured
|
||||
// capacity check "storage.capacity.threshold"
|
||||
if (sc != null) {
|
||||
|
|
@ -179,35 +179,20 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
|
|||
|
||||
for (VMTemplateStoragePoolVO templatePoolVO : templatePoolVOs) {
|
||||
VMTemplateVO templateInPool = _templateDao.findById(templatePoolVO.getTemplateId());
|
||||
int templateSizeMultiplier = 2;
|
||||
|
||||
if ((template != null) && !tmpinstalled && (templateInPool.getId() == template.getId())) {
|
||||
tmpinstalled = true;
|
||||
templateSizeMultiplier = 3;
|
||||
}
|
||||
|
||||
s_logger.debug("For template: " + templateInPool.getName() + ", using template size multiplier: " + templateSizeMultiplier);
|
||||
|
||||
long templateSize = templatePoolVO.getTemplateSize();
|
||||
totalAllocatedSize += templateSizeMultiplier * (templateSize + _extraBytesPerVolume);
|
||||
totalAllocatedSize += templateSize + _extraBytesPerVolume;
|
||||
}
|
||||
|
||||
if ((template != null) && !tmpinstalled) {
|
||||
// If the template that was passed into this allocator is not installed in the storage pool,
|
||||
// add 3 * (template size on secondary storage) to the running total
|
||||
HostVO secondaryStorageHost = _storageMgr.getSecondaryStorageHost(pool.getDataCenterId());
|
||||
if (secondaryStorageHost == null) {
|
||||
return false;
|
||||
} else {
|
||||
VMTemplateHostVO templateHostVO = _templateHostDao.findByHostTemplate(secondaryStorageHost.getId(), template.getId());
|
||||
if (templateHostVO == null) {
|
||||
return false;
|
||||
} else {
|
||||
s_logger.debug("For template: " + template.getName() + ", using template size multiplier: " + 3);
|
||||
long templateSize = templateHostVO.getSize();
|
||||
totalAllocatedSize += 3 * (templateSize + _extraBytesPerVolume);
|
||||
}
|
||||
}
|
||||
if (template != null && !tmpinstalled ) {
|
||||
// If the template that was passed into this allocator is not installed in the storage pool
|
||||
// should add template size
|
||||
// dskCh.getSize() should be template virtualsize
|
||||
totalAllocatedSize += dskCh.getSize() + _extraBytesPerVolume;
|
||||
}
|
||||
|
||||
long askingSize = dskCh.getSize();
|
||||
|
|
|
|||
Loading…
Reference in New Issue