[libvirt-users] How to start a storage pool using libvirt?

Osier Yang jyang at redhat.com
Fri Jun 29 06:37:40 UTC 2012


On 2012年06月28日 22:20, Ananth wrote:
> I figured out that poolObject.create(0) can start the storage pool. Is
> there a way to automatically create the folder, if the folder does not
> exist while defining a pool?
> for example, if i do pool-define myPool.xml, how can I make it create
> the folder if the target path does not exist? Is it necessary that the
> path specified in the xml should exist already?

There is API for build the pool. The C level API is virStoragePoolBuild.
I.e. For a persistent pool, there are generally 3 steps to get a new
pool started.

1) define
2) build
3) start

The Python API: virStoragePool.build

For a non-persistent pool, you might want to use 
virStoragePoolCreateXML, which will create the pool as trasicient,
and start it. Yeah, no build process.

I'm thinking it's desired to introduce a flag for virStoragePoolCreate
and virStoragePoolCreateXML, to allow to build the pool meanwhile.
e.g. "--build" for command "virsh pool-start".

Regards,
Osier
Regards,
Osier




More information about the libvirt-users mailing list