Make unique name conforming with the name generated in template installation for routing template, some other minor fixes

This commit is contained in:
Kelven Yang 2010-10-15 16:35:04 -07:00
parent 121d29211e
commit 2c919c5c01
3 changed files with 6 additions and 13 deletions

View File

@ -64,6 +64,7 @@ public class SecondaryStorageDiscoverer extends DiscovererBase implements Discov
long _timeout = 2 * 60 * 1000; // 2 minutes
String _mountParent;
boolean _useServiceVM = false;
Random _random = new Random(System.currentTimeMillis());
@Inject
protected HostDao _hostDao = null;
@ -261,8 +262,6 @@ public class SecondaryStorageDiscoverer extends DiscovererBase implements Discov
VMTemplateHostVO vmTemplateHost = new VMTemplateHostVO(hostId, TemplateConstants.DEFAULT_SYSTEM_VM_DB_ID, new Date(), 100, VMTemplateStorageResourceAssoc.Status.DOWNLOADED, null, null, null, TemplateConstants.DEFAULT_SYSTEM_VM_TEMPLATE_PATH, null);
_vmTemplateHostDao.persist(vmTemplateHost);
}
}
private void associateTemplatesToZone(long hostId, long dcId){
@ -274,7 +273,7 @@ public class SecondaryStorageDiscoverer extends DiscovererBase implements Discov
List<VMTemplateVO> allTemplates = _vmTemplateDao.listAll();
for (VMTemplateVO vt: allTemplates){
if (vt.isCrossZones()){
if (vt.isCrossZones()) {
tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId());
if (tmpltZone == null) {
VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date());

View File

@ -19,7 +19,7 @@ INSERT INTO `cloud`.`vm_template` (id, unique_name, name, public, created, type,
VALUES (7, 'centos53-x64', 'centos53-x64', 1, now(), 'builtin', 0, 64, 1, 'http://nfs1.lab.vmops.com/templates/vmware/CentOS5.3-x86_64.ova.bz2', '', 0, 'centos53-x64', 'OVA', 12, 1, 1, 'VMware');
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_vmware', 'SystemVM Template (VMWare)', 0, now(), 'system', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/systemvm.ova.bz2', '9bc05e1cabb4597063957f1a3f1bfa95', 0, 'SystemVM Template VMWare', 'OVA', 15, 0, 1, 'VMware');
VALUES (8, 'routing-8', 'SystemVM Template (VMWare)', 0, now(), 'system', 0, 32, 1, 'http://nfs1.lab.vmops.com/templates/vmware/systemvm.ova.bz2', '9bc05e1cabb4597063957f1a3f1bfa95', 0, 'SystemVM Template VMWare', 'OVA', 15, 0, 1, 'VMware');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (1, 'CentOS');
INSERT INTO `cloud`.`guest_os_category` (id, name) VALUES (2, 'Debian');

View File

@ -278,7 +278,9 @@ public class Merovingian {
Ternary<Savepoint, Integer, Long> lock = _locks.get(key);
if (lock != null) {
if (lock.second() > 1) {
validLock = true;
if (lock.second() > 1) {
lock.second(lock.second() - 1);
if (s_logger.isTraceEnabled()) {
s_logger.trace("Lock: Releasing " + key + " but not in DB " + lock.second());
@ -286,14 +288,6 @@ public class Merovingian {
return false;
}
//
// set this to true only if we are really done with the DB lock. Which means, the lock count has been
// reached to zero
//
// While we are holding the DB lock, we also need to hold the memory lock as well, to lock the first gate
// and prevent others to come in and test with DB lock unnecessarily
//
validLock = true;
if (s_logger.isDebugEnabled() && !_locks.keySet().iterator().next().equals(key)) {
s_logger.trace("Lock: Releasing out of order for " + key);