private boolean createConfigDriveIso(VirtualMachineProfile profile, DeployDestination dest) throws ResourceUnavailableException {
final DataStore dataStore = findDataStore(profile, dest);
final Long agentId = findAgentId(profile, dest, dataStore);
if (agentId == null || dataStore == null) {
throw new ResourceUnavailableException("Config drive iso creation failed, agent or datastore not available",
ConfigDriveNetworkElement.class, 0L);
}
LOG.debug("Creating config drive ISO for vm: " + profile.getInstanceName());
final String isoFileName = ConfigDrive.configIsoFileName(profile.getInstanceName());
final String isoPath = ConfigDrive.createConfigDrivePath(profile.getInstanceName());
final String isoData = ConfigDriveBuilder.buildConfigDrive(profile.getVmData(), isoFileName, profile.getConfigDriveLabel());
final HandleConfigDriveIsoCommand configDriveIsoCommand = new HandleConfigDriveIsoCommand(isoPath, isoData, dataStore.getTO(), true);
final Answer answer = agentManager.easySend(agentId, configDriveIsoCommand);
if (!answer.getResult()) {
throw new ResourceUnavailableException(String.format("Config drive iso creation failed, details: %s",
answer.getDetails()), ConfigDriveNetworkElement.class, 0L);
}
addConfigDriveDisk(profile, dataStore);
return true;
}