예제 #1
0
            ShellCmdExecutor.execCmd('cp -r %s /opt/' % import_image_script_path)
            ShellCmdExecutor.execCmd('chmod 777 /opt/import_image.sh')
            
            ShellCmdExecutor.execCmd('cp -r %s /opt/' % get_image_id_script_path)
            ShellCmdExecutor.execCmd('chmod 777 /opt/getDefaultImageID.sh')
            
            ShellCmdExecutor.execCmd('cp -r %s /opt/' % get_image_size_script_path)
            ShellCmdExecutor.execCmd('chmod 777 /opt/getDefaultImageFileSize.sh')
            
            FileUtil.replaceFileContent('/opt/import_image.sh', '<KEYSTONE_VIP>', keystone_vip)
            FileUtil.replaceFileContent('/opt/getDefaultImageID.sh', '<KEYSTONE_VIP>', keystone_vip)
            FileUtil.replaceFileContent('/opt/getDefaultImageFileSize.sh', '<KEYSTONE_VIP>', keystone_vip)
            time.sleep(1)
            
            from openstack.common.role import Role
            if Role.isGlanceRole() and GlanceHA.isMasterNode():
#             if GlanceHA.isMasterNode() :
                imported_tag = False
                retry = 1
                while retry > 0 :
                    ShellCmdExecutor.execCmd('bash /opt/import_image.sh')
                    imageFileSize, exitcode = ShellCmdExecutor.execCmd('bash /opt/getDefaultImageFileSize.sh')
                    imageID, exitcode = ShellCmdExecutor.execCmd('bash /opt/getDefaultImageID.sh')
                    importedImageSizeCmd = "ls -lt /etc/puppet/modules/glance/files/ | grep cirros | awk '{print $5}'"
                    importedImageSize, exitcode = ShellCmdExecutor.execCmd(importedImageSizeCmd)
                    imageID = imageID.strip()
                    imageFileSize = imageFileSize.strip()
                    importedImageSize = importedImageSize.strip()
                    
                    if imageFileSize == importedImageSize :
                        imported_tag = True
예제 #2
0
 
 print 'hello openstack-icehouse:glance============'
 
 print 'start time: %s' % time.ctime()
 
 INSTALL_TAG_FILE = '/opt/initGlance'
 
 if os.path.exists(INSTALL_TAG_FILE) :
     print 'glance installed####'
     print 'exit===='
     pass
 else :
     
     print 'start to install======='
     #Glance DB Schema
     if GlanceHA.isMasterNode() :
         dbSchema_init_script_path = os.path.join(OPENSTACK_CONF_FILE_TEMPLATE_DIR, 'glance', 'glance_dbschema_init.sh')
         ShellCmdExecutor.execCmd('cp -r %s /opt/' % dbSchema_init_script_path)
         ShellCmdExecutor.execCmd('bash /opt/glance_dbschema_init.sh')
         pass
     #
     Glance.sourceAdminOpenRC()
     
     Glance.start()
     #add HA
     GlanceHA.install()
     GlanceHA.configure()
     GlanceHA.start()
     
     Glance.restart()
     GlanceHA.start