Este contenido no está disponible en el idioma seleccionado.
12.5.4. Creating an iSCSI-based Storage Pool with virsh
Use pool-define-as to define the pool from the command line
Storage pool definitions can be created with thevirsh
command line tool. Creating storage pools withvirsh
is useful for systems administrators using scripts to create multiple storage pools.Thevirsh pool-define-as
command has several parameters which are accepted in the following format:virsh pool-define-as
name type source-host source-path source-dev source-name
targetThe parameters are explained as follows:- type
- defines this pool as a particular type, iscsi for example
- name
- must be unique and sets the name for the storage pool
- source-host and source-path
- the host name and iSCSI IQN respectively
- source-dev and source-name
- these parameters are not required for iSCSI-based pools, use a - character to leave the field blank.
- target
- defines the location for mounting the iSCSI device on the host physical machine
The example below creates the same iSCSI-based storage pool as the previous step.# virsh pool-define-as --name scsirhel6guest --type iscsi \ --source-host server1.example.com \ --source-dev iqn.2010-05.com.example.server1:iscsirhel6guest --target /dev/disk/by-path Pool iscsirhel6guest defined
Verify the storage pool is listed
Verify the storage pool object is created correctly and the state reports asinactive
.# virsh pool-list --all Name State Autostart ----------------------------------------- default active yes iscsirhel6guest inactive no
Start the storage pool
Use the virsh commandpool-start
for this.pool-start
enables a directory storage pool, allowing it to be used for volumes and guest virtual machines.# virsh pool-start guest_images_disk Pool guest_images_disk started # virsh pool-list --all Name State Autostart ----------------------------------------- default active yes iscsirhel6guest active no
Turn on autostart
Turn onautostart
for the storage pool. Autostart configures thelibvirtd
service to start the storage pool when the service starts.# virsh pool-autostart iscsirhel6guest Pool iscsirhel6guest marked as autostarted
Verify that the iscsirhel6guest pool has autostart set:# virsh pool-list --all Name State Autostart ----------------------------------------- default active yes iscsirhel6guest active yes
Verify the storage pool configuration
Verify the storage pool was created correctly, the sizes reported correctly, and the state reports asrunning
.# virsh pool-info iscsirhel6guest Name: iscsirhel6guest UUID: afcc5367-6770-e151-bcb3-847bc36c5e28 State: running Persistent: unknown Autostart: yes Capacity: 100.31 GB Allocation: 0.00 Available: 100.31 GB
An iSCSI-based storage pool is now available.