-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Update System VM template Guest OS version #11291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -64,11 +64,14 @@ | |||||||
| import com.cloud.dc.dao.DataCenterDaoImpl; | ||||||||
| import com.cloud.hypervisor.Hypervisor; | ||||||||
| import com.cloud.storage.DataStoreRole; | ||||||||
| import com.cloud.storage.GuestOSVO; | ||||||||
| import com.cloud.storage.Storage; | ||||||||
| import com.cloud.storage.Storage.ImageFormat; | ||||||||
| import com.cloud.storage.VMTemplateStorageResourceAssoc; | ||||||||
| import com.cloud.storage.VMTemplateVO; | ||||||||
| import com.cloud.storage.VMTemplateZoneVO; | ||||||||
| import com.cloud.storage.dao.GuestOSDao; | ||||||||
| import com.cloud.storage.dao.GuestOSDaoImpl; | ||||||||
| import com.cloud.storage.dao.VMTemplateDao; | ||||||||
| import com.cloud.storage.dao.VMTemplateDaoImpl; | ||||||||
| import com.cloud.storage.dao.VMTemplateZoneDao; | ||||||||
|
|
@@ -102,15 +105,14 @@ public class SystemVmTemplateRegistration { | |||||||
| private static final String PARTIAL_TEMPLATE_FOLDER = String.format("/template/tmpl/%d/", Account.ACCOUNT_ID_SYSTEM); | ||||||||
| private static final String storageScriptsDir = "scripts/storage/secondary"; | ||||||||
| private static final Integer OTHER_LINUX_ID = 99; | ||||||||
| private static final Integer LINUX_5_ID = 15; | ||||||||
| private static Integer LINUX_12_ID = 363; | ||||||||
| private static final Integer LINUX_7_ID = 183; | ||||||||
| private static final Integer SCRIPT_TIMEOUT = 1800000; | ||||||||
| private static final Integer LOCK_WAIT_TIMEOUT = 1200; | ||||||||
| protected static final List<CPU.CPUArch> DOWNLOADABLE_TEMPLATE_ARCH_TYPES = Arrays.asList( | ||||||||
| CPU.CPUArch.arm64 | ||||||||
| ); | ||||||||
|
|
||||||||
|
|
||||||||
| public static String CS_MAJOR_VERSION = null; | ||||||||
| public static String CS_TINY_VERSION = null; | ||||||||
|
|
||||||||
|
|
@@ -132,6 +134,8 @@ public class SystemVmTemplateRegistration { | |||||||
| ClusterDao clusterDao; | ||||||||
| @Inject | ||||||||
| ConfigurationDao configurationDao; | ||||||||
| @Inject | ||||||||
| private GuestOSDao guestOSDao; | ||||||||
|
|
||||||||
| private String systemVmTemplateVersion; | ||||||||
|
|
||||||||
|
|
@@ -147,6 +151,7 @@ public SystemVmTemplateRegistration() { | |||||||
| imageStoreDetailsDao = new ImageStoreDetailsDaoImpl(); | ||||||||
| clusterDao = new ClusterDaoImpl(); | ||||||||
| configurationDao = new ConfigurationDaoImpl(); | ||||||||
| guestOSDao = new GuestOSDaoImpl(); | ||||||||
| tempDownloadDir = new File(System.getProperty("java.io.tmpdir")); | ||||||||
| } | ||||||||
|
|
||||||||
|
|
@@ -331,13 +336,13 @@ public void setUpdated(Date updated) { | |||||||
| } | ||||||||
| }; | ||||||||
|
|
||||||||
| public static final Map<Hypervisor.HypervisorType, Integer> hypervisorGuestOsMap = new HashMap<Hypervisor.HypervisorType, Integer>() { | ||||||||
| public static Map<Hypervisor.HypervisorType, Integer> hypervisorGuestOsMap = new HashMap<Hypervisor.HypervisorType, Integer>() { | ||||||||
| { | ||||||||
| put(Hypervisor.HypervisorType.KVM, LINUX_5_ID); | ||||||||
| put(Hypervisor.HypervisorType.KVM, LINUX_12_ID); | ||||||||
| put(Hypervisor.HypervisorType.XenServer, OTHER_LINUX_ID); | ||||||||
| put(Hypervisor.HypervisorType.VMware, OTHER_LINUX_ID); | ||||||||
| put(Hypervisor.HypervisorType.Hyperv, LINUX_5_ID); | ||||||||
| put(Hypervisor.HypervisorType.LXC, LINUX_5_ID); | ||||||||
| put(Hypervisor.HypervisorType.Hyperv, LINUX_12_ID); | ||||||||
| put(Hypervisor.HypervisorType.LXC, LINUX_12_ID); | ||||||||
| put(Hypervisor.HypervisorType.Ovm3, LINUX_7_ID); | ||||||||
| } | ||||||||
| }; | ||||||||
|
|
@@ -595,6 +600,18 @@ public void updateSystemVMEntries(Long templateId, Hypervisor.HypervisorType hyp | |||||||
| vmInstanceDao.updateSystemVmTemplateId(templateId, hypervisorType); | ||||||||
| } | ||||||||
|
|
||||||||
| public void updateSystemVmTemplateGuestOsId() { | ||||||||
| String systemVmGuestOsName = "Debian GNU/Linux 12 (64-bit)"; | ||||||||
| GuestOSVO guestOS = guestOSDao.findOneByDisplayName(systemVmGuestOsName); | ||||||||
| if (guestOS != null) { | ||||||||
| LOGGER.debug("Updating SystemVM Template Guest OS [{}] id", systemVmGuestOsName); | ||||||||
| SystemVmTemplateRegistration.LINUX_12_ID = Math.toIntExact(guestOS.getId()); | ||||||||
| hypervisorGuestOsMap.put(Hypervisor.HypervisorType.KVM, LINUX_12_ID); | ||||||||
| hypervisorGuestOsMap.put(Hypervisor.HypervisorType.Hyperv, LINUX_12_ID); | ||||||||
| hypervisorGuestOsMap.put(Hypervisor.HypervisorType.LXC, LINUX_12_ID); | ||||||||
| } | ||||||||
| } | ||||||||
|
|
||||||||
| public void updateConfigurationParams(Map<String, String> configParams) { | ||||||||
| for (Map.Entry<String, String> config : configParams.entrySet()) { | ||||||||
| boolean updated = configurationDao.update(config.getKey(), config.getValue()); | ||||||||
|
|
@@ -731,6 +748,7 @@ public void registerTemplateForNonExistingEntries(Hypervisor.HypervisorType hype | |||||||
| Long templateId = null; | ||||||||
| try { | ||||||||
| MetadataTemplateDetails templateDetails = getMetadataTemplateDetails(hypervisor, arch); | ||||||||
| updateSystemVmTemplateGuestOsId(); | ||||||||
|
||||||||
| update `cloud`.`guest_os` set display_name = 'Debian GNU/Linux 5.0 (32-bit)' where id=15; |
cloudstack/engine/schema/src/main/resources/META-INF/db/schema-21to22.sql
Lines 962 to 963 in 4aed972
| 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 (3, 'routing-3', 'SystemVM Template (KVM)', 0, now(), 'SYSTEM', 0, 64, 1, 'http://download.cloudstack.org/releases/2.2.0/systemvm.qcow2.bz2', 'ec463e677054f280f152fcc264255d2f', 0, 'SystemVM Template (KVM)', 'QCOW2', 15, 0, 1, 'KVM'); |
mysql> SELECT * FROM cloud.guest_os WHERE display_name = 'Debian GNU/Linux 12 (64-bit)';
+-----+-------------+------+--------------------------------------+------------------------------+---------------------+---------+-----------------+---------+
| id | category_id | name | uuid | display_name | created | removed | is_user_defined | display |
+-----+-------------+------+--------------------------------------+------------------------------+---------------------+---------+-----------------+---------+
| 363 | 2 | NULL | 565d58aa-ade8-468d-a829-036e73f11961 | Debian GNU/Linux 12 (64-bit) | 2025-07-28 15:13:07 | NULL | 0 | 1 |
+-----+-------------+------+--------------------------------------+------------------------------+---------------------+---------+-----------------+---------+
1 row in set (0.00 sec)
Uh oh!
There was an error while loading. Please reload this page.