Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
fa3e30e
pokemon anihilation and class-javadoc
DaanHoogland May 28, 2020
41ebfd0
add ovf properties to template details
May 29, 2020
432797e
disected ova processing
May 29, 2020
39722ee
import
Jun 3, 2020
08d57ac
ovf string props hack
Jun 4, 2020
34d10ff
refactor plan in comments
Jun 5, 2020
81f16a0
trace
Jun 8, 2020
bda8848
hack to deal with: ovf property attributes in details
Jun 10, 2020
4bd8b37
PoC code for properties iso
Jun 11, 2020
3c219fc
flag for deploy as is
Jun 11, 2020
0093a3b
factor out 700 line start command and callees
Jun 12, 2020
0768d3d
execute start; init of disk info factorred out
Jun 12, 2020
43d5f2b
license
DaanHoogland Jun 15, 2020
3affec5
howto pass deploy OVA as is?
Jun 15, 2020
0e47904
logging during ingestion and guest net creation
Jun 15, 2020
80a77d3
more todos in comment
Jun 15, 2020
7ab0e7e
tested in production '{' is really needed
Jun 16, 2020
925acc9
deploy ovf without stripping networks
Jun 16, 2020
83fff23
deploy as is parameter to DB
Jun 18, 2020
9306f33
show deploy as is hack
Jun 18, 2020
f0c0ce7
extract extension
Jun 19, 2020
e70f78e
path correction
Jun 19, 2020
892c780
further disect of start
Jun 19, 2020
0fde9d9
ui strings
Jun 22, 2020
e0594cf
parse networks for later reconsiliation
Jun 24, 2020
5592b00
debug and trace on registration time template processing
Jun 24, 2020
c544cdd
logging and NPE fixes
Jun 24, 2020
021032a
template size over all disks
Jun 25, 2020
9e134d7
template details to contain json descriptions
Jun 25, 2020
16f269e
make deployasis default in API
Jun 29, 2020
4047fa6
fix deplayAsIs ui
Jun 29, 2020
f893f91
try-with-resource
Jun 29, 2020
fd3723c
details.value width
Jun 29, 2020
2233934
prevent password logging
Jun 29, 2020
cb49556
whiteline
Jun 29, 2020
4537927
deployAsIs register fixes
Jun 29, 2020
45346dd
simple test for marshalling
Jun 29, 2020
2081a7c
details to template properties
Jun 30, 2020
db9d5fe
property in detail finalised
Jul 1, 2020
e3f75cc
1st stab at integrating content libs
Jul 6, 2020
515b244
license
Jul 7, 2020
2492812
ovf props in details
Jul 7, 2020
508d47a
code in comment
Jul 7, 2020
5599a45
unused class removed
Jul 7, 2020
e1791eb
make sure deployAsIs is passed to template installation procedure
Jul 8, 2020
1b76ff9
create snapshot only when not deploy as is
Jul 8, 2020
845e2b0
explore need to copy
Jul 9, 2020
8857ee8
some code analyser complaints auto-fixed
Jul 10, 2020
318f4cf
intermediate state for copy OVA to primary
Jul 13, 2020
217775f
clone multidisk template vm
Jul 13, 2020
cf1cdb7
small cleanup for handover
Jul 14, 2020
ff50b9d
cleanup content library a.o.
Jul 14, 2020
2d2d855
Move the VM cloning out of volume orchestration and place it on the S…
nvazquez Jul 15, 2020
cc44c37
api: change map name to properties for deployVM cmd (#60)
yadvr Jul 15, 2020
48b538e
fr37: return volumeto in copycmd answer, fix start command to use def…
yadvr Jul 15, 2020
2fea952
licenses
Jul 15, 2020
91c784b
disk info in details
Jul 15, 2020
6ba43a6
multidisk as is deploy verified
Jul 15, 2020
fa8dbe3
clone before startcommand, volume TO has VM name we can use
yadvr Jul 16, 2020
0900f6d
NPE fix
yadvr Jul 16, 2020
ce2c0e8
startcommand: clone when only VM is not found and it's install as-is
yadvr Jul 16, 2020
235ecfa
fix regression in properties
Jul 16, 2020
34a03b1
deal with boolean properties
Jul 16, 2020
a61b9fc
Volume allocation refactor
nvazquez Jul 16, 2020
8d5f0a1
vmware: teardown nics for cloned deploy as-is VM
yadvr Jul 17, 2020
fb5cb78
fake root disk
Jul 17, 2020
a105d4d
Fix volume naming
nvazquez Jul 17, 2020
538ffc8
Refactor volume allocation
nvazquez Jul 17, 2020
0dded67
old ui properties rename
Jul 20, 2020
d71a814
send all details as details as well
Jul 20, 2020
dd64653
set proper value on vm
Jul 20, 2020
6a3edd1
Send capacity in GB for OVA disks
nvazquez Jul 20, 2020
d661adf
Revert sending in GB to avoid division in favour of using bytes
nvazquez Jul 20, 2020
237bb1a
comment update for status of dev work
Jul 21, 2020
2a40e85
rename method for clarification
Jul 21, 2020
3c15be3
comment change base on exception starting existing VM
Jul 21, 2020
6f3d3fb
further start method modularisation
Jul 21, 2020
d2959a3
teradown again :(
Jul 21, 2020
50d92c2
log nics to tear down
Jul 21, 2020
317b5da
Discard ISOs on volumes allocation
nvazquez Jul 21, 2020
ef79f60
Add new class to parse the hardware item section
nvazquez Jul 21, 2020
ecf8e4e
further disection of start method
Jul 22, 2020
0aca1bd
network creation refactor/cleanup
Jul 22, 2020
1d6b24c
Add parsing of virtual hardware section and deployment options
nvazquez Jul 22, 2020
2ddc8fa
Send deployment options and store them as template details
nvazquez Jul 22, 2020
300bf22
Setter fix
nvazquez Jul 23, 2020
f956df2
Filter fix for configuration hardware items
nvazquez Jul 23, 2020
c382e0b
log message format error fixed
Jul 23, 2020
4759e5d
null checks
Jul 23, 2020
a1ca741
Remove unused disks size template detail
nvazquez Jul 23, 2020
a7c46e7
Persist trimmed hardware items keys
nvazquez Jul 23, 2020
1eda6a4
Process CPU and memory configurations from OVF
nvazquez Jul 24, 2020
8a64d01
Remove spaces from hardware items
nvazquez Jul 24, 2020
32f5a8d
nic allocation refactor
Jul 24, 2020
ee214dc
factor out removal of old VM
Jul 24, 2020
9951b10
minor cleanup
Jul 28, 2020
467b5e4
Fix add diskTOs to VM spec again
nvazquez Jul 28, 2020
39bc971
Fix Vm start - disks mapping in progress
nvazquez Jul 28, 2020
2dc41d1
Fix GB size bug when registering template
nvazquez Jul 29, 2020
dc920cd
Fix volumes missing path and chain info
nvazquez Jul 30, 2020
dcf4695
Remove OVFProperty interface and deprecated VO and its related classe…
nvazquez Jul 31, 2020
b0a9f9f
Remove unused interface NetworkPrerequisite
nvazquez Jul 31, 2020
db1240c
Remove comments
nvazquez Jul 31, 2020
df2e5f4
Apply suggestions from code review
nvazquez Jul 31, 2020
c8232e8
Apply suggestions from code review
nvazquez Jul 31, 2020
2506ea0
Apply suggestions from code review
nvazquez Jul 31, 2020
e0bfb50
Remove import
nvazquez Jul 31, 2020
c2d2d1f
Fix rebase issue
nvazquez Aug 1, 2020
b560724
Minor refactors after review
nvazquez Aug 2, 2020
7e8c971
Fix clone VM and volumes destination
nvazquez Aug 4, 2020
83d7ace
Fix to ensure deploy as is volumes get allocated to the same storage …
nvazquez Aug 5, 2020
62d320e
handling deployvm API (#61)
shwstppr Aug 5, 2020
d97817b
npe fix for network map
shwstppr Aug 5, 2020
98092f1
unit test fix
shwstppr Aug 5, 2020
ebdc456
wip: vapps vm smoke test
shwstppr Aug 5, 2020
31af4fd
Register templates as non-deploy-as-is if empty field
nvazquez Aug 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
disk info in details
fix start ssvm traditionally
comments cleaned
  • Loading branch information
Daan Hoogland authored and nvazquez committed Jul 31, 2020
commit 91c784b2175c65d6705f321c3e7a8973607cf4e7
1 change: 1 addition & 0 deletions api/src/main/java/com/cloud/storage/ImageStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public interface ImageStore extends Identity, InternalIdentity {

String OVF_PROPERTY_PREFIX = "ACS-property-";
String REQUIRED_NETWORK_PREFIX = "ACS-network-";
String DISK_DEFINITION_PREFIX = "ACS-disk-";

/**
* @return name of the object store.
Expand Down
11 changes: 11 additions & 0 deletions core/src/main/java/com/cloud/agent/api/storage/DownloadAnswer.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.cloud.agent.api.Answer;
import com.cloud.agent.api.Command;
import com.cloud.agent.api.LogLevel;
import com.cloud.agent.api.to.DatadiskTO;
import com.cloud.storage.VMTemplateStorageResourceAssoc;
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
import org.apache.cloudstack.api.net.NetworkPrerequisiteTO;
Expand All @@ -44,6 +45,8 @@ public class DownloadAnswer extends Answer {
private List<OVFPropertyTO> ovfProperties;
@LogLevel(LogLevel.Log4jLevel.Off)
private List<NetworkPrerequisiteTO> networkRequirements;
@LogLevel(LogLevel.Log4jLevel.Off)
private List<DatadiskTO> disks;

public String getCheckSum() {
return checkSum;
Expand Down Expand Up @@ -169,4 +172,12 @@ public List<NetworkPrerequisiteTO> getNetworkRequirements() {
public void setNetworkRequirements(List<NetworkPrerequisiteTO> networkRequirements) {
this.networkRequirements = networkRequirements;
}

public List<DatadiskTO> getDisks() {
return disks;
}

public void setDisks(List<DatadiskTO> disks) {
this.disks = disks;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected Answer execute(CopyCommand cmd) {
DataTO destData = cmd.getDestTO();
DataStoreTO srcDataStore = srcData.getDataStore();
DataStoreTO destDataStore = destData.getDataStore();
// FR37 I should get here!

if (srcData.getObjectType() == DataObjectType.TEMPLATE &&
(srcData.getDataStore().getRole() == DataStoreRole.Image || srcData.getDataStore().getRole() == DataStoreRole.ImageCache) &&
destData.getDataStore().getRole() == DataStoreRole.Primary) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public FormatInfo process(String templatePath, ImageFormat format, String templa
setFileSystemAccessRights(templatePath);

FormatInfo info = createFormatInfo(templatePath, templateName, templateFilePath, templateFileFullPath);
// The intention is to use the ova file as is for deployment and use done processing only for

// The intention is to use the ova file as is for deployment and use processing result only for
// - property assessment and
// - reconsiliation of
// - - disks,
Expand Down Expand Up @@ -112,6 +113,9 @@ private void validateOva(String templateFileFullPath, FormatInfo info) throws In
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("Found %d disks in template %s", CollectionUtils.isNotEmpty(disks) ? disks.size() : 0, ovfFilePath));
}
if (CollectionUtils.isNotEmpty(disks)) {
info.disks = disks;
}
List<NetworkPrerequisiteTO> nets = ovfHelper.getNetPrerequisitesFromDocument(doc);
if (CollectionUtils.isNotEmpty(nets)) {
LOGGER.info("Found " + nets.size() + " prerequisite networks");
Expand All @@ -126,9 +130,6 @@ private void validateOva(String templateFileFullPath, FormatInfo info) throws In
} else if (LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("no ovf properties found in template %s", ovfFilePath));
}
// FR37 TODO if something is bad something will have been thrown above
// LOGGER.info("The ovf file " + ovfFilePath + " is invalid ", e);
// throw new InternalErrorException("OVA package has bad ovf file " + e.getMessage(), e);
}

private void setFileSystemAccessRights(String templatePath) {
Expand Down
2 changes: 2 additions & 0 deletions core/src/main/java/com/cloud/storage/template/Processor.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.List;

import com.cloud.agent.api.storage.OVFPropertyTO;
import com.cloud.agent.api.to.DatadiskTO;
import com.cloud.exception.InternalErrorException;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.utils.component.Adapter;
Expand Down Expand Up @@ -57,6 +58,7 @@ class FormatInfo {
public boolean isCorrupted;
public List<OVFPropertyTO> ovfProperties;
public List<NetworkPrerequisiteTO> networks;
public List<DatadiskTO> disks;
}

long getVirtualSize(File file) throws IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil
handlePath(vmTO.getDisks(), vm.getHypervisorType());

cmds = new Commands(Command.OnError.Stop);
// FR37 TODO decide on extra info to put in start command for deployAsIs
// FR37 TODO vmTO must contain definitions of disks to be expected for deployAsIs
Comment thread
nvazquez marked this conversation as resolved.
Outdated
cmds.addCommand(new StartCommand(vmTO, dest.getHost(), getExecuteInSequence(vm.getHypervisorType())));

vmGuru.finalizeDeployment(cmds, vmProfile, dest, ctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@
import com.cloud.vm.dao.UserVmCloneSettingDao;
import com.cloud.vm.dao.UserVmDao;

import static com.cloud.storage.resource.StorageProcessor.COPY_NOT_NEEDED_FOR_DEPLOY_AS_IS;
import static com.cloud.storage.resource.StorageProcessor.REQUEST_TEMPLATE_RELOAD;

public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrationService, Configurable {
Expand Down Expand Up @@ -1337,9 +1336,6 @@ private Pair<VolumeVO, DataStore> recreateVolume(VolumeVO vol, VirtualMachinePro
if (result.getResult().contains(REQUEST_TEMPLATE_RELOAD) && (i == 0)) {
s_logger.debug("Retry template re-deploy for vmware");
continue;
} else if (result.getResult().contains(COPY_NOT_NEEDED_FOR_DEPLOY_AS_IS)) { // FR37 can be removed again ?
s_logger.debug("template should be used from content library");
break;
} else {
s_logger.debug("Unable to create " + newVol + ":" + result.getResult());
throw new StorageUnavailableException("Unable to create " + newVol + ":" + result.getResult(), destPool.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,23 @@ private void persistNetworkRequirements(List<NetworkPrerequisiteTO> networkRequi
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("saving property %s for template %d as detail", network.getName(), templateId));
}
persistRequiredNetworkAsSetOfTemplateDetails(templateId, network);
persistRequiredNetworkAsASingleTemplateDetail(templateId, network);
}
}

private void persistRequiredNetworkAsSetOfTemplateDetails(long templateId, NetworkPrerequisiteTO network) {
private void persistDiskDefinitions(List<DatadiskTO> disks, long templateId) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("saving disk definitionsn for template %d as details", templateId));
}
for (DatadiskTO disk : disks) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("saving property %s for template %d as detail", disk.getDiskId(), templateId));
}
persistDiskDefinitionAsASingleTemplateDetail(templateId, disk);
}
}

private void persistRequiredNetworkAsASingleTemplateDetail(long templateId, NetworkPrerequisiteTO network) {
String key = network.getName();
String propKey = ImageStore.REQUIRED_NETWORK_PREFIX + key;
try {
Expand All @@ -227,6 +239,17 @@ private void persistRequiredNetworkAsSetOfTemplateDetails(long templateId, Netwo
}
}

private void persistDiskDefinitionAsASingleTemplateDetail(long templateId, DatadiskTO disk) {
String key = disk.getDiskId();
String propKey = ImageStore.DISK_DEFINITION_PREFIX + key;
try {
String propValue = gson.toJson(disk);
savePropertyAttribute(templateId, propKey, propValue);
} catch (RuntimeException re) {
LOGGER.warn("gson marshalling of disk definition object fails: " + propKey,re);
}
}

private void savePropertyAttribute(long templateId, String key, String value) {
if ( templateDetailsDao.findDetail(templateId,key) != null) {
LOGGER.debug(String.format("detail '%s' existed for template %d, deleting.", key, templateId));
Expand All @@ -250,11 +273,12 @@ protected Void createTemplateAsyncCallback(AsyncCallbackDispatcher<? extends Bas
DataStore store = obj.getDataStore();
List<OVFPropertyTO> ovfProperties = answer.getOvfProperties();
List<NetworkPrerequisiteTO> networkRequirements = answer.getNetworkRequirements();
List<DatadiskTO> disks = answer.getDisks();

TemplateDataStoreVO tmpltStoreVO = _templateStoreDao.findByStoreTemplate(store.getId(), obj.getId());
if (tmpltStoreVO != null) {
if (tmpltStoreVO.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED) {
persistExtraDetails(obj, ovfProperties, networkRequirements);
persistExtraDetails(obj, ovfProperties, networkRequirements, disks);
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Template is already in DOWNLOADED state, ignore further incoming DownloadAnswer");
}
Expand Down Expand Up @@ -294,15 +318,15 @@ protected Void createTemplateAsyncCallback(AsyncCallbackDispatcher<? extends Bas
templateDaoBuilder.setChecksum(answer.getCheckSum());
_templateDao.update(obj.getId(), templateDaoBuilder);
}
persistExtraDetails(obj, ovfProperties, networkRequirements);
persistExtraDetails(obj, ovfProperties, networkRequirements, disks);

CreateCmdResult result = new CreateCmdResult(null, null);
caller.complete(result);
}
return null;
}

private void persistExtraDetails(DataObject obj, List<OVFPropertyTO> ovfProperties, List<NetworkPrerequisiteTO> networkRequirements) {
private void persistExtraDetails(DataObject obj, List<OVFPropertyTO> ovfProperties, List<NetworkPrerequisiteTO> networkRequirements, List<DatadiskTO> disks) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("saving %d ovf properties for template '%s' as details", ovfProperties != null ? ovfProperties.size() : 0, obj.getUuid()));
}
Expand All @@ -315,6 +339,12 @@ private void persistExtraDetails(DataObject obj, List<OVFPropertyTO> ovfProperti
if (CollectionUtils.isNotEmpty(networkRequirements)) {
persistNetworkRequirements(networkRequirements, obj.getId());
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("saving %d disks definitions for template '%s' as details", disks != null ? disks.size() : 0, obj.getUuid()));
}
if (CollectionUtils.isNotEmpty(disks)) {
persistDiskDefinitions(disks, obj.getId());
}
}

protected Void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.List;
import java.util.Map;

import com.cloud.hypervisor.vmware.VmwareResourceException;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.storage.configdrive.ConfigDrive;
import org.apache.cloudstack.storage.to.TemplateObjectTO;
Expand Down Expand Up @@ -169,15 +170,17 @@ protected StartAnswer execute(StartCommand cmd) {

VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmInternalCSName);
// FR37 - this may need checking, if the first datastore is the right one - ideally it should be datastore where first disk is hosted
DatastoreMO dsRootVolumeIsOn = null; //getDatastoreThatRootDiskIsOn(dataStoresDetails, disks);
/*
if (dsRootVolumeIsOn == null) {
String msg = "Unable to locate datastore details of root volume";
LOGGER.error(msg);
// throw a more specific Exception
throw new Exception(msg);
DatastoreMO dsRootVolumeIsOn = null; //
if (! installAsIs) {
dsRootVolumeIsOn = getDatastoreThatRootDiskIsOn(dataStoresDetails, disks);

if (dsRootVolumeIsOn == null) {
String msg = "Unable to locate datastore details of root volume";
LOGGER.error(msg);
// throw a more specific Exception
throw new VmwareResourceException(msg);
}
}
*/

VirtualMachineDiskInfoBuilder diskInfoBuilder = null;
DiskControllerType systemVmScsiControllerType = DiskControllerType.lsilogic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import javax.naming.ConfigurationException;

import com.cloud.agent.api.storage.OVFPropertyTO;
import com.cloud.agent.api.to.DatadiskTO;
import com.cloud.storage.template.Processor;
import com.cloud.storage.template.S3TemplateDownloader;
import com.cloud.storage.template.TemplateDownloader;
Expand Down Expand Up @@ -128,6 +129,7 @@ private static class DownloadJob {
private final ResourceType resourceType;
private List<OVFPropertyTO> ovfProperties;
private List<NetworkPrerequisiteTO> networks;
private List<DatadiskTO> disks;

public DownloadJob(TemplateDownloader td, String jobId, long id, String tmpltName, ImageFormat format, boolean hvm, Long accountId, String descr, String cksum,
String installPathPrefix, ResourceType resourceType) {
Expand Down Expand Up @@ -238,6 +240,14 @@ public List<NetworkPrerequisiteTO> getNetworks() {
public void setNetworks(List<NetworkPrerequisiteTO> networks) {
this.networks = networks;
}

public List<DatadiskTO> getDisks() {
return disks;
}

public void setDisks(List<DatadiskTO> disks) {
this.disks = disks;
}
}

public static final Logger LOGGER = Logger.getLogger(DownloadManagerImpl.class);
Expand Down Expand Up @@ -537,6 +547,9 @@ private String postProcessAfterDownloadComplete(DownloadJob dnld, String resourc
if (CollectionUtils.isNotEmpty(info.networks)) {
dnld.setNetworks(info.networks);
}
if (CollectionUtils.isNotEmpty(info.disks)) {
dnld.setDisks(info.disks);
}
break;
}
}
Expand Down Expand Up @@ -843,6 +856,9 @@ private DownloadAnswer handleDownloadProgressCmd(SecondaryStorageResource resour
if (CollectionUtils.isNotEmpty(dj.getNetworks())) {
answer.setNetworkRequirements(dj.getNetworks());
}
if (CollectionUtils.isNotEmpty(dj.getDisks())) {
answer.setDisks(dj.getDisks());
}
jobs.remove(jobId);
return answer;
default:
Expand Down