fog / fog-libvirt

libvirt provider for fog
MIT License
16 stars 44 forks source link

Volume#clone_volume supports different pools #46

Closed atton closed 3 years ago

atton commented 6 years ago

Volume#clone_volume supports duplicate the volume. However, We have two different pools, we can't clone volume directory. So I added an option for specifying the pool name to Volume#clone_volume.

strzibny commented 5 years ago

Can you provide an example and resolve conflict? I also notices some formatting issues with whitespace.

atton commented 5 years ago

OK. I will resolve conflict and create examples.

atton commented 5 years ago

I resolved conflict.

example of clone_volume through different pool. I want to clone "template-Debian-8.qcow2" disk into poolB as "foo".

before

f = Fog::Compute.new('...')
v = f.volumes.find{|v| v.name == "template-Debian-8.qcow2"}
v2 = v.dup
v2.name = 'foo'
v2.key = nil
v2.pool_name = 'poolB'
v2.save

after (this PR)

f = Fog::Compute.new('...')
v = f.volumes.find{|v| v.name == "template-Debian-8.qcow2"}
v2 = v.clone_volume(volume_name, 'poolB')
atton commented 5 years ago

and It's whitespace sensitive

v3 = v.clone_volume('foo','poolB')
v4 = v.clone_volume('foo ','poolB')
# => can create disk with trailing white space
v5 = v.clone_volume('foo ','poolB')
Libvirt::Error: Call to virStorageVolCreateXMLFrom failed: internal error: storage volume name 'foo ' already in use.
github-actions[bot] commented 3 years ago

This pr has been marked inactive and will be closed if no further activity occurs.