Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3308b7c
setup: update the Debian 13 templates, add build-acs-image.sh
weizhouapache Oct 19, 2026
06a9466
schema: set the guest OS of the built-in Debian 13 templates to Debia…
weizhouapache Oct 20, 2026
363dea6
marvin: use the shared public tiny template in the smoke tests
weizhouapache Oct 21, 2026
5ae335c
test_snapshots: register the template in the standalone backup class …
weizhouapache Oct 21, 2026
b8ad53f
build-acs-image.sh: install nfs-common in the Debian and Ubuntu images
weizhouapache Oct 21, 2026
9729c4f
smoke tests: use the Debian 13 built-in template on all hypervisors
weizhouapache Oct 22, 2026
54d8e6e
templates.sql: update the SHA-512 checksums of the Debian 13 built-in…
weizhouapache Oct 22, 2026
da04f21
templates.sql: use the 20261021-2638 Debian 13 images for the built-i…
weizhouapache Oct 22, 2026
d823180
test_backup_recovery_nas: sync the guest after writing the marker files
weizhouapache Oct 23, 2026
4d0d651
build-acs-image.sh: add the Apache license header
weizhouapache Oct 26, 2026
fccbcbb
templates.sql: download the Debian 13 built-in templates from downloa…
weizhouapache Oct 26, 2026
a005111
Keep the template install path when a download fails without one
weizhouapache Oct 26, 2026
2a518d7
schema: deploy the built-in Debian 13 VMware template as is
weizhouapache Oct 26, 2026
fc3a97e
build-acs-image.sh: do not force PasswordAuthentication in sshd
weizhouapache Oct 26, 2026
ef01fce
schema: set the NIC and disk controller of the built-in Debian 13 VMw…
weizhouapache Oct 26, 2026
7050148
marvin: allow ssh login with password on the built-in template, use t…
weizhouapache Oct 26, 2026
075180d
templates.sql: use the rebuilt Debian 13 built-in templates (20261026…
weizhouapache Oct 27, 2026
d6d7eb0
systemvm: set the hostname without dbus if hostnamectl fails
weizhouapache Oct 27, 2026
599eb01
marvin: do not fail to deploy a VM from an ISO or as a normal user
weizhouapache Oct 27, 2026
c4e58cd
build-acs-image.sh: install xe-guest-utilities in the Debian and EL i…
weizhouapache Oct 29, 2026
29f68cb
build-acs-image.sh: run set-passwords and ssh on every boot
weizhouapache Oct 29, 2026
f1e79c4
marvin: retry attach and detach volume until the XenServer PV drivers…
weizhouapache Oct 29, 2026
d9198be
test_primary_storage: use 512 MiB service offerings
weizhouapache Oct 29, 2026
6c3e8c8
test_scale_vm: use a 4 GiB disk offering
weizhouapache Oct 29, 2026
f249002
test_scale_vm: fix the tests on the Debian 13 built-in template
weizhouapache Oct 29, 2026
c46250d
templates.sql: update the checksums of the Debian 13 built-in templates
weizhouapache Oct 29, 2026
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
Original file line number Diff line number Diff line change
Expand Up @@ -964,11 +964,6 @@ INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type,
INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type)
VALUES (8, 'routing-8', 'SystemVM Template (vSphere)', 0, now(), 'SYSTEM', 0, 32, 1, 'http://download.cloudstack.org/releases/2.2.0/systemvm.ova', '3c9d4c704af44ebd1736e1bc78cec1fa', 0, 'SystemVM Template (vSphere)', 'OVA', 15, 0, 1, 'VMware');

INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, display_text, enable_password, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable)
VALUES (4, 'centos55-x86_64', 'CentOS 5.5(64-bit) no GUI (KVM)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloudstack.org/releases/2.2.0/eec2209b-9875-3c8d-92be-c001bd8a0faf.qcow2.bz2', 'ed0e788280ff2912ea40f7f91ca7a249', 'CentOS 5.5(64-bit) no GUI (KVM)', 0, 'QCOW2', 112, 1, 1, 'KVM', 1);

INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable)
VALUES (7, 'centos53-x64', 'CentOS 5.3(64-bit) no GUI (vSphere)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloudstack.org/releases/2.2.0/CentOS5.3-x86_64.ova', 'f6f881b7f2292948d8494db837fe0f47', 0, 'CentOS 5.3(64-bit) no GUI (vSphere)', 'OVA', 12, 1, 1, 'VMware', 1);
UPDATE vm_instance SET guest_os_id=15 where vm_template_id=1;
UPDATE vm_instance SET vm_template_id=(SELECT id FROM vm_template WHERE name='systemvm-xenserver-2.2.4' AND removed IS NULL) where vm_template_id=1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,6 @@ UPDATE `cloud`.`event` e set e.domain_id = (select acc.domain_id from `cloud`.`a

update `cloud`.`vm_template` set removed=now() where id=2;

INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type, hvm, bits, account_id, url, checksum, enable_password, display_text, format, guest_os_id, featured, cross_zones, hypervisor_type, extractable)
VALUES (5, 'centos56-x86_64-xen', 'CentOS 5.6(64-bit) no GUI (XenServer)', 1, now(), 'BUILTIN', 0, 64, 1, 'http://download.cloudstack.org/templates/builtin/centos56-x86_64.vhd.bz2', '905cec879afd9c9d22ecc8036131a180', 0, 'CentOS 5.6(64-bit) no GUI (XenServer)', 'VHD', 12, 1, 1, 'XenServer', 1);

DELETE from `cloud`.`configuration` where name='firewall.rule.ui.enabled';

DELETE FROM `cloud`.`resource_limit` WHERE domain_id = 1 AND account_id IS NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ ALTER TABLE `cloud`.`volumes` ADD COLUMN `hv_ss_reserve` int(32) unsigned DEFAUL
UPDATE `cloud`.`disk_offering` SET `state`='Inactive' WHERE `removed` IS NOT NULL;
UPDATE `cloud`.`disk_offering` SET `removed`=NULL;

UPDATE `cloud`.`vm_template` SET `guest_os_id`= "142" WHERE `id` = "5";
UPDATE `cloud`.`vm_template` SET `state`='Inactive' WHERE `removed` IS NOT NULL;
UPDATE `cloud`.`vm_template` SET `state`='Active' WHERE `removed` IS NULL;
UPDATE `cloud`.`vm_template` SET `removed`=NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,21 @@ CREATE TABLE IF NOT EXISTS `cloud`.`instance_boot_group_details` (
PRIMARY KEY (`id`),
CONSTRAINT `fk_instance_boot_group_details__group_id` FOREIGN KEY (`boot_group_id`) REFERENCES `instance_boot_group` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Set the guest OS of the built-in Debian 13 templates to 'Debian GNU/Linux 12 (64-bit)', which is only added by later upgrade scripts and is not available in templates.sql
UPDATE `cloud`.`vm_template` SET `guest_os_id` = (SELECT `id` FROM `cloud`.`guest_os` WHERE `display_name` = 'Debian GNU/Linux 12 (64-bit)' AND `removed` IS NULL LIMIT 1)
WHERE `id` = 4 AND `unique_name` = 'debian13-x86_64-kvm' AND `type` = 'BUILTIN';
UPDATE `cloud`.`vm_template` SET `guest_os_id` = (SELECT `id` FROM `cloud`.`guest_os` WHERE `display_name` = 'Debian GNU/Linux 12 (64-bit)' AND `removed` IS NULL LIMIT 1)
WHERE `id` = 5 AND `unique_name` = 'debian13-x86_64-xen' AND `type` = 'BUILTIN';
UPDATE `cloud`.`vm_template` SET `guest_os_id` = (SELECT `id` FROM `cloud`.`guest_os` WHERE `display_name` = 'Debian GNU/Linux 12 (64-bit)' AND `removed` IS NULL LIMIT 1)
WHERE `id` = 7 AND `unique_name` = 'debian13-x86_64-vmware' AND `type` = 'BUILTIN';

-- Use the NIC and disk controller of the built-in Debian 13 VMware template image (vmxnet3, pvscsi), as the guest kernel has no driver for the default e1000 NIC
INSERT INTO `cloud`.`vm_template_details` (`template_id`, `name`, `value`)
SELECT `id`, 'nicAdapter', 'Vmxnet3' FROM `cloud`.`vm_template`
WHERE `id` = 7 AND `unique_name` = 'debian13-x86_64-vmware' AND `type` = 'BUILTIN'
AND NOT EXISTS (SELECT 1 FROM `cloud`.`vm_template_details` WHERE `template_id` = 7 AND `name` = 'nicAdapter');
INSERT INTO `cloud`.`vm_template_details` (`template_id`, `name`, `value`)
SELECT `id`, 'rootDiskController', 'pvscsi' FROM `cloud`.`vm_template`
WHERE `id` = 7 AND `unique_name` = 'debian13-x86_64-vmware' AND `type` = 'BUILTIN'
AND NOT EXISTS (SELECT 1 FROM `cloud`.`vm_template_details` WHERE `template_id` = 7 AND `name` = 'rootDiskController');
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
import org.apache.cloudstack.storage.endpoint.DefaultEndPointSelector;
import org.apache.cloudstack.storage.image.deployasis.DeployAsIsHelper;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

Expand Down Expand Up @@ -229,7 +230,11 @@ protected Void createTemplateAsyncCallback(AsyncCallbackDispatcher<? extends Bas
updateBuilder.setErrorString(answer.getErrorString());
updateBuilder.setJobId(answer.getJobId());
updateBuilder.setLocalDownloadPath(answer.getDownloadPath());
updateBuilder.setInstallPath(answer.getInstallPath());
if (StringUtils.isNotEmpty(answer.getInstallPath())) {
// an error answer, like a timeout, has no install path. Do not clear the install path of the entry with it,
// as the next download of the template would use no install path and go to a directory named "null".
updateBuilder.setInstallPath(answer.getInstallPath());
}
if (!VMTemplateStorageResourceAssoc.ERROR_DOWNLOAD_STATES.contains(answer.getDownloadStatus())) {
updateBuilder.setSize(answer.getTemplateSize());
updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

package org.apache.cloudstack.storage.image;

import java.util.Collections;

import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.test.util.ReflectionTestUtils;

import com.cloud.agent.api.storage.DownloadAnswer;
import com.cloud.alert.AlertManager;
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.VMTemplateZoneVO;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VMTemplateZoneDao;

@RunWith(MockitoJUnitRunner.Silent.class)
public class BaseImageStoreDriverImplTest {

@Mock
private VMTemplateDao templateDao;
@Mock
private TemplateDataStoreDao templateStoreDao;
@Mock
private VMTemplateZoneDao vmTemplateZoneDao;
@Mock
private AlertManager alertManager;
@Mock
private DataObject data;
@Mock
private DataStore store;
@Mock
private AsyncCompletionCallback<CreateCmdResult> parentCallback;
@Mock
private AsyncCallbackDispatcher<BaseImageStoreDriverImpl, DownloadAnswer> callback;
@Mock
private TemplateDataStoreVO existingRef;
@Mock
private VMTemplateZoneVO templateZone;

private BaseImageStoreDriverImpl driver;
private TemplateDataStoreVO updateBuilder;

@Before
public void setUp() {
driver = Mockito.mock(BaseImageStoreDriverImpl.class, Mockito.CALLS_REAL_METHODS);
ReflectionTestUtils.setField(driver, "logger", org.apache.logging.log4j.LogManager.getLogger(BaseImageStoreDriverImpl.class));
ReflectionTestUtils.setField(driver, "_templateDao", templateDao);
ReflectionTestUtils.setField(driver, "_templateStoreDao", templateStoreDao);
ReflectionTestUtils.setField(driver, "_vmTemplateZoneDao", vmTemplateZoneDao);
ReflectionTestUtils.setField(driver, "_alertMgr", alertManager);

Mockito.when(data.getId()).thenReturn(7L);
Mockito.when(data.getDataStore()).thenReturn(store);
Mockito.when(store.getId()).thenReturn(1L);
Mockito.when(templateDao.findById(7L)).thenReturn(Mockito.mock(VMTemplateVO.class));
Mockito.when(templateDao.createForUpdate()).thenReturn(Mockito.mock(VMTemplateVO.class));
Mockito.when(existingRef.getId()).thenReturn(3L);
Mockito.when(existingRef.getDownloadState()).thenReturn(Status.DOWNLOAD_IN_PROGRESS);
Mockito.when(templateStoreDao.findByStoreTemplate(1L, 7L)).thenReturn(existingRef);
updateBuilder = Mockito.mock(TemplateDataStoreVO.class);
Mockito.when(templateStoreDao.createForUpdate()).thenReturn(updateBuilder);
Mockito.when(templateZone.getZoneId()).thenReturn(2L);
Mockito.when(vmTemplateZoneDao.listByTemplateId(7L)).thenReturn(Collections.singletonList(templateZone));
}

private void callWith(DownloadAnswer answer) {
Mockito.when(callback.getResult()).thenReturn(answer);
BaseImageStoreDriverImpl.CreateContext<CreateCmdResult> context = driver.new CreateContext<>(parentCallback, data);
driver.createTemplateAsyncCallback(callback, context);
}

@Test
public void testErrorAnswerWithoutInstallPathKeepsInstallPath() {
DownloadAnswer answer = new DownloadAnswer("Timeout waiting for response from storage host", Status.DOWNLOAD_ERROR);

callWith(answer);

Mockito.verify(updateBuilder, Mockito.never()).setInstallPath(Mockito.any());
Mockito.verify(updateBuilder).setDownloadState(Status.DOWNLOAD_ERROR);
Mockito.verify(templateStoreDao).update(3L, updateBuilder);
}

@Test
public void testAnswerWithInstallPathSetsInstallPath() {
DownloadAnswer answer = new DownloadAnswer("job", 100, null, Status.DOWNLOADED, "/dl/path", "template/tmpl/2/7", 10L, 10L, "checksum");

callWith(answer);

Mockito.verify(updateBuilder).setInstallPath("template/tmpl/2/7");
Mockito.verify(templateStoreDao).update(3L, updateBuilder);
}
}
Loading
Loading