fix template sync issue

This commit is contained in:
Edison Su 2011-06-02 20:28:46 -04:00
parent 635a1075de
commit 3cddd72c9b
2 changed files with 7 additions and 1 deletions

View File

@ -608,6 +608,7 @@ public class DownloadManagerImpl implements DownloadManager {
private List<String> listTemplates(String rootdir) {
List<String> result = new ArrayList<String>();
Script script = new Script(listTmpltScr, s_logger);
script.add("-r", rootdir);
ZfsPathParser zpp = new ZfsPathParser(rootdir);
@ -621,6 +622,11 @@ public class DownloadManagerImpl implements DownloadManager {
public Map<String, TemplateInfo> gatherTemplateInfo(String rootDir) {
Map<String, TemplateInfo> result = new HashMap<String, TemplateInfo>();
String templateDir = rootDir + File.separator + _templateDir;
if (! _storage.exists(templateDir)) {
_storage.mkdirs(templateDir);
}
List<String> publicTmplts = listTemplates(templateDir);
for (String tmplt : publicTmplts) {
String path = tmplt.substring(0, tmplt.lastIndexOf(File.separator));

View File

@ -15,7 +15,7 @@ def fix_default_db():
database.update(statement % ('http://nfs1.lab.vmops.com/templates/dummy/systemvm.ova', 'routing-8'))
database.update(statement % ('http://nfs1.lab.vmops.com/templates/dummy/builtin.vhd', 'centos53-x86_64'))
database.update(statement % ('http://nfs1.lab.vmops.com/templates/dummy/builtin.qcow2', 'centos55-x86_64'))
database.update(statement % ('http://nfs1.lab.vmops.com/templates/rightscale/RightImage_CentOS_5.4_x64_v5.6.32.qcow2.bz2', 'centos55-x86_64'))
database.update(statement % ('http://nfs1.lab.vmops.com/templates/dummy/builtin.ova', 'centos53-x64'))
statement="""UPDATE vm_template SET checksum=NULL"""
database.update(statement)