반응형
일반적으로 노바의 로그는 /var/log/nova/nova-xxx.log 형태로 남는다.

/etc/nova/nova.conf 에 보면 logdir=/var/log/nova 로 되어 있어서 해당 디렉토리에 서비스 모듈명의 이름으로 로그가 남는데 이는 프로세스별로 로그를 만드는 것이다.

만약 사용자 정의의 로그를 만들고 싶으면 다음과 같이 수정한다.

# vi /usr/lib/pymodules/python2.6/nova/log.py

def setup():
...
    reset()
    _ask_setup_log()   // 추가
...
askLogger = logging.getLogger('nova.ask')
def _ask_setup_log():

    if FLAGS.logdir:

        logname = '%s.log' % (os.path.join(FLAGS.logdir, 'nova-ask'),)

        global askLogger

        askLogger = logging.getLogger('nova.ask')

        askLogger.propagate = 0

        askHandler = WatchedFileHandler(logname)

        askHandler.setFormatter(_formatter)

        askLogger.addHandler(askHandler)

 
# vi /usr/lib/pymodules/python2.6/nova/scheduler/chance.py

...
from nova import log as logging
...

    logging.askLogger.debug('********* %s, %s *************', context, topic)


이와 같이 수정하면 /var/log/nova/nova-ask.log 가 생성되며 어떤 프로세스에서 호출하던지 해당 로그에 남게 되어 있다.


novaclient 모듈에서 로그를 추가하고 싶으면 다음과 같이 하면 된다.

# vi /usr/lib/pymodules/python2.6/novaclient/log.py

import logging

from logging.handlers import WatchedFileHandler


logger = logging.getLogger('nova.client')

logger.setLevel(logging.DEBUG)

fh = WatchedFileHandler('/var/log/nova/nova-client.log')

formatter = logging.Formatter('%(asctime)s %(levelname)s %(name)s [-] %(message)s from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d')

fh.setFormatter(formatter)

logger.addHandler(fh)


# vi /usr/lib/pymodules/python2.6/novaclient/shell.py

...
from log import logger
...

logger.debug('******* shell.py called !! ****************')







 
반응형
Posted by seungkyua@gmail.com
,
반응형
1. Virtual box 다운로드 및 설치
    http://www.virtualbox.org/wiki/Downloads

2. Vagrant 를 설치 후 이용하여 Virtual box 인스턴스 생성
     $> sudo gem update -- system

    RubyGems version 이 1.3.6 보다 낮아 에러가 난다면
    $> sudo gem install rubygems-update
    $> sudo update_rubygems

    $> sudo gem update -- system
    $> sudo gem install vagrant -- pre

    ※ Vagrant 를 체험하고 싶으면 아래와 같이 해볼 수 있다.
$> cd ~
$> vagrant box add lucid32 http://files.vagrantup.com/lucid32.box        ~/.vagrant/boxes/lucid32 디렉토리가 생김

만약 박스를 없애고 싶으면
$> vagrant box remove lucid32

$> mkdir OpenStack
$> cd OpenStack
$> mkdir vagrant
$> cd vagrant
$> vagrant init lucid32        -> Vagrant 파일이 생성됨
$> vagrant up                      -> ~/VirtualBox VMs 에 가상 서버가 생김

아직 ssh 는 가동되지 않았으므로 ssh 를 가동
$> vagrant ssh

ssh 접속이 실패하면 가상서버를 내렸다 다시 올린다. (버그가 있는 것 같음)

만약 가상서버를 내리 싶으면
$> vagrant destroy
    
3. Chef Recipes 를 받는다.
    $> cd ~
    $> git clone -v https://github.com/openstack/openstack-cookbooks openstack-cookbooks

4. Set Up Some Directories
    $> cd ~
    $> mkdir OpenStack
    $> cd OpenStack
    $> mkdir aptcache
    $> mkdir chef
    $> cd chef

5. chef-solo 기반으로 수행할 Vagrant file 을 받는다.
    chef 는 독립적으로 수행할 수 있는 chef-solo 방법과 chef server 를 설치하고 client 로 접속하여 설치하는 방법이 있다.

    $> curl -o Vagrantfile https://raw.github.com/gist/786945/solo.rb
    $> vi Vagrantfile
#aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/aptcache/")
# 아래와 같이 수정
aptdir = (ENV['APTCACHE'] or "#{ENV['HOME']}/OpenStack/aptcache/") 

6. Running OpenStack Compute within a Vagrant Instance
    $> vagrant up

7. Virtual Machine 접속
    $> vagrant ssh
    $> sudo apt-get install euca2ools
    $> euca-add-keypair test > test.pem
    $> chmod 600 test.pem
    $> euca-run-instances -t m1.tiny -k test ami-tty
    $> ssh -i test.pem root@10.0.0.3

8. Virtual Machine 삭제
    $> vagrant destroy
    $> rm *.pem novarc






3. swift 다운로드
    http://www.openstack.org/projects/storage/ 

4. 도큐먼트 설치
    #> sudo easy_install -U sphinx              install Sphinx
    #> python setup.py build_sphinx           builds the document






 
반응형
Posted by seungkyua@gmail.com
,