From 7eb61b705a5a1dbda4a254f62f9925e6cf18694b Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Thu, 26 Aug 2010 16:47:16 -0700 Subject: [PATCH] Allow NetworkManagerImpl and SecondaryStorageImpl to tolerate missing of system vm template at startup --- server/src/com/cloud/network/NetworkManagerImpl.java | 4 +++- .../storage/secondary/SecondaryStorageManagerImpl.java | 2 +- setup/db/templates.vmware.sql | 6 ------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/server/src/com/cloud/network/NetworkManagerImpl.java b/server/src/com/cloud/network/NetworkManagerImpl.java index dcc995448c2..35664556c3d 100644 --- a/server/src/com/cloud/network/NetworkManagerImpl.java +++ b/server/src/com/cloud/network/NetworkManagerImpl.java @@ -1830,7 +1830,9 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager _offering = _serviceOfferingDao.persistSystemServiceOffering(_offering); _template = _templateDao.findById(_routerTemplateId); if (_template == null) { - throw new ConfigurationException("Unable to find the template for the router: " + _routerTemplateId); + s_logger.error("Unable to find system vm template."); + + // throw new ConfigurationException("Unable to find the template for the router: " + _routerTemplateId); } _publicNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmPublicNetwork, TrafficType.Public, null); diff --git a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java index 3f3fd1d7a5f..f516b16419c 100644 --- a/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java +++ b/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java @@ -1370,7 +1370,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V _serviceOffering.setUniqueName("Cloud.com-SecondaryStorage"); _serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering); _template = _templateDao.findConsoleProxyTemplate(); - if (_template == null) { + if (_template == null && _useServiceVM) { throw new ConfigurationException("Unable to find the template for secondary storage vm VMs"); } diff --git a/setup/db/templates.vmware.sql b/setup/db/templates.vmware.sql index 53080bc6277..4ba86696071 100644 --- a/setup/db/templates.vmware.sql +++ b/setup/db/templates.vmware.sql @@ -1,9 +1,3 @@ -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) - VALUES (1, 'routing', 'SystemVM Template', 0, now(), 'ext3', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/vmware/dummydomr.tar.bz2', '54c578d2c02759de4a9a8be7bd533df1', 0, 'SystemVM Template', 'VMDK', 47, 0, 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) - VALUES (2, 'fedora11-x86', 'Fedora11-x86', 1, now(), 'ext3', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/fedora11-x86.tar.bz2', '7957ff05cae838689eb53c7600b2fbe4', 0, 'Fedora 11 x86', 'VMDK', 47, 1, 1); - INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'Windows'); INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (2, 'Linux'); INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (3, 'Novell Netware');