On 8/14/2013 2:33 PM, F. Y. wrote:
Hello,

I have this bit of code that tries to remove a physical volume from the
VG (which consists of /dev/sda5 amd /dev/sdb1):

                 volume_group {
                         "system":
                         ensure => absent,
                         physical_volumes => "/dev/sdb1",
                 }

But I get this error:

Error: Execution of '/sbin/vgremove system' returned 5: Do you really
want to remove volume group "system" containing 2 logical volumes?
[y/n]:   Volume group "system" not removed
Error: /Stage[main]/Node_emake/Volume_group[system]/ensure: change from
present to absent failed: Execution of '/sbin/vgremove system' returned
5: Do you really want to remove volume group "system" containing 2
logical volumes? [y/n]:   Volume group "system" not removed

Is there a way to force it or a work around?

Thank you in advance.

Your define statement is wrong. volume_group { 'system': ensure => absent } will attempt to remove the volume group regardless of the other parameters. You want simply

volume_group { 'system':
  ensure           => present,
  physical_volumes => '/dev/sda5', # or whatever pv you want to keep
}

Assuming you're using the puppetlabs-lvm module it'll handle comparing the physical volume membership of the volume group and call vgreduce or vgextend as needed.

Ramin

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to