[OpenStack] OpenStack Nova storage management

 

OpenStack Nova created out of the instance that not all types are stored, such as m1.tiny: Memory: 512MB, VCPUS: 1, Storage: 0GB, FlavorID: 1, Swap: 0MB, RXTX Quota: 0GB, RXTX Cap: 0MB of store is 0, which means that all data will be lost after closing m1.tiny type of instance. OpenStack Nova nova-volume use of services to manage storage, which can serve as USB era of cloud computing, you can always attach additional storage to do the instance, its implementation and Amazon's Elastic Block Storage (EBS) different, nova-volume provided is based on Linux LVM's iSCSI solutions.

Nova-volume need to do a separate partition LVM, if no extra LVM partitions do if the file system can be used to act as a hard drive, of course, this method can only play their own test applications to a production environment is best to use a physical hard disk do partition on LVM.

Create a new file to do LVM:

# dd if=/dev/zero of=/home/vpsee/nova-volumes.img bs=1M seek=100000 count=0
# losetup -f nova-volumes.img

# losetup -a
/dev/loop0: [fb00]:24120015 (/home/vpsee/nova-volumes.img)

# vgcreate nova-volumes /dev/loop0
  No physical volume label read from /dev/loop0
  Physical volume "/dev/loop0" successfully created
  Volume group "nova-volumes" successfully created

# pvscan
  PV /dev/sda5    VG node01         lvm2 [465.52 GiB / 48.00 MiB free]
  PV /dev/loop0   VG nova-volumes   lvm2 [97.65 GiB / 77.65 GiB free]
  Total: 2 [563.17 GiB] / in use: 2 [563.17 GiB] / in no VG: 0 [0   ]

By default iscsitarget after package installation does not start automatically, so you need to manually configure and start iscsitarget services:

# vi /etc/default/iscsitarget
ISCSITARGET_ENABLE=true

# service iscsitarget start
 * Starting iSCSI enterprise target service

Create a new size for the volume 10GB, the check is successfully created (available), and the newly created volume attached to the instance is running, check the status of the additional volume of success again becomes the in-use:

# euca-create-volume -s 10 -z nova
VOLUME	vol-00000003	10	creating (mycloud, None, None, None)	2011-08-30T13:20:04Z

# euca-describe-volumes
VOLUME	vol-00000003	 10		nova	available (mycloud, node01, None, None)	2011-08-30T13:20:04Z

# euca-describe-instances
RESERVATION	r-i5927300	mycloud	default
INSTANCE	i-00000031	ami-00000006	172.16.39.224	172.16.39.224	running	mykey.priv (mycloud, node01)	0		m1.tiny	2011-08-26T07:12:57Z	nova		

# euca-attach-volume -i i-00000031 -d /dev/vdb vol-00000003
VOLUME	vol-00000003

# euca-describe-volumes
VOLUME	vol-00000003	 10		nova	in-use (mycloud, node01, i-00000031[node01], /dev/vdb)	2011-08-30T13:20:04Z

If you want to uninstall volume from the running instance, then use euca-detach-volume, unloading successful will see the volume status changes back to the available:

# euca-detach-volume vol-00000003
VOLUME	vol-00000003

# euca-describe-volumes
VOLUME	vol-00000003	 10		nova	available (mycloud, node01, None, None)	2

Reproduced in: https: //www.cnblogs.com/licheng/archive/2012/06/05/2537313.html

Guess you like

Origin blog.csdn.net/weixin_34268753/article/details/92627890