next up previous contents
Next: 新增 LVM Cinder volume Up: 區塊儲存 Cinder Previous: Cinder 服務啟動   Contents

建立 cinder-volumes group

  1. 啟動 openstack-cinder-volume 服務,應該會自動產生 cinder-volumes 的 vg。
    [root@deyu ~]# source keystonerc_myuser
    [root@kvm4 ~(keystone_myuser)]# vgscan 
      Reading all physical volumes.  This may take a while...
      Found volume group "cinder-volumes" using metadata type lvm2
      Found volume group "vg_os" using metadata type lvm2
    
  2. 如果但查詢紀錄檔出現以下錯誤訊息,表示 vg cinder-volumes 不存在,必須自行産生。
    [root@kvm4 ~(keystone_myuser)]# /etc/init.d/openstack-cinder-volume restart
    [root@deyu ~(keystone_myuser)]# tail /var/log/cinder/*
    ==> /var/log/cinder/api.log <==
    
    ==> /var/log/cinder/scheduler.log <==
    
    ==> /var/log/cinder/volume.log <==
        launcher.run_server(server)
      File "/usr/lib/python2.6/site-packages/cinder/service.py", line 95, in run_server
        server.start()
      File "/usr/lib/python2.6/site-packages/cinder/service.py", line 355, in start
        self.manager.init_host()
      File "/usr/lib/python2.6/site-packages/cinder/volume/manager.py", line 143, in init_host
        self.driver.check_for_setup_error()
      File "/usr/lib/python2.6/site-packages/cinder/volume/drivers/lvm.py", line 81, in check_for_setup_error
        raise exception.VolumeBackendAPIException(data=exception_message)
    VolumeBackendAPIException: Bad or unexpected response from the storage volume backend API: volume group cinder-volumes doesn't exist
    
  3. 新增分割區,type 設為 LVM。
    [root@deyu ~(keystone_myuser)]# fdisk -uc /dev/vda
    
    Command (m for help): p
    
    Disk /dev/vda: 160.0 GB, 160000000000 bytes
    255 heads, 63 sectors/track, 19452 cylinders, total 312500000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000b0430
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048     1026047      512000   83  Linux
    /dev/vda2         1026048   210741247   104857600   8e  Linux LVM
    
    Command (m for help): n
    Command action
       e   extended
       p   primary partition (1-4)
    p
    Partition number (1-4): 3
    First sector (210741248-312499999, default 210741248): 
    Using default value 210741248
    Last sector, +sectors or +size{K,M,G} (210741248-312499999, default 312499999): +5G
    
    Command (m for help): t 
    Partition number (1-4): 3
    Hex code (type L to list codes): 8e
    Changed system type of partition 3 to 8e (Linux LVM)
    
    Command (m for help): p
    
    Disk /dev/vda: 160.0 GB, 160000000000 bytes
    255 heads, 63 sectors/track, 19452 cylinders, total 312500000 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x000b0430
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048     1026047      512000   83  Linux
    /dev/vda2         1026048   210741247   104857600   8e  Linux LVM
    /dev/vda3       210741248   221227007     5242880   8e  Linux LVM
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
    The kernel still uses the old table. The new table will be used at
    the next reboot or after you run partprobe(8) or kpartx(8)
    Syncing disks.
    
  4. 加入新分割區的 mapping。
    [root@deyu ~(keystone_myuser)]# partx -va /dev/vda
    device /dev/vda: 
    start 0 size 312500000
    gpt: 0 slices
    dos: 4 slices
    # 1:      2048-  1026047 (  1024000 sectors,    524 MB)
    # 2:   1026048-210741247 (209715200 sectors, 107374 MB)
    # 3: 210741248-221227007 ( 10485760 sectors,   5368 MB)
    # 4:         0-       -1 (        0 sectors,      0 MB)
    BLKPG: Device or resource busy
    error adding partition 1
    BLKPG: Device or resource busy
    error adding partition 2
    BLKPG: Device or resource busy
    error adding partition 3
    
  5. 建立 pv。
    [root@deyu ~(keystone_myuser)]# pvcreate /dev/vda3
      Physical volume "/dev/vda3" successfully created
    
  6. 建立 vg cinder-volumes。
    [root@deyu ~(keystone_myuser)]# vgcreate -s 32M cinder-volumes /dev/vda3 
      Volume group "cinder-volumes" successfully created
    
  7. 刪除紀錄檔,再重新啟動 openstack-cinder-scheduler, openstack-cinder-api 及 openstack-cinder-volume 服務。
    [root@kvm4 ~(keystone_admin)]# rm -f /var/log/cinder/*
    [root@kvm4 ~(keystone_admin)]# /etc/init.d/openstack-cinder-scheduler restart
    Stopping openstack-cinder-scheduler:               [  OK  ]
    Starting openstack-cinder-scheduler:               [  OK  ]
    [root@kvm4 ~(keystone_admin)]# /etc/init.d/openstack-cinder-api restart
    Stopping openstack-cinder-api:                     [  OK  ]
    Starting openstack-cinder-api:                     [  OK  ]
    [root@kvm4 ~(keystone_admin)]# /etc/init.d/openstack-cinder-volume restart
    Stopping openstack-cinder-volume:                  [FAILED]
    Starting openstack-cinder-volume:                  [  OK  ]
    
  8. 再查看 cinder 服務的紀錄,已無錯誤訊息。
    [root@kvm4 ~(keystone_admin)]# tail /var/log/cinder/*
    ==> /var/log/cinder/api.log <==
    
    ==> /var/log/cinder/scheduler.log <==
    2014-01-25 06:07:01 CRITICAL [cinder] need more than 0 values to unpack
    
    ==> /var/log/cinder/volume.log <==
    



2015-12-29