linux-lvm.redhat.com archive mirror
 help / color / mirror / Atom feed
* [linux-lvm] vgcfgrestore + pvcreate using liblockdev api in C
@ 2020-09-14  5:56 Tomas Dalebjörk
  2020-09-15 11:55 ` Vojtěch Trefný
  0 siblings, 1 reply; 2+ messages in thread
From: Tomas Dalebjörk @ 2020-09-14  5:56 UTC (permalink / raw)
  To: linux-lvm

hi

Is there an api available today or an example how to perform the below OS commands in C using a function or api instead of system calls?

1. create an unique uid on the server, and store it on the PV disk

# pvcreatue -u <generated uid> <your device>

2. create the LVM metadata backup content (as /etc/lvm/backup/...)
- add PV uid generated above as there is no parameter to save the data to a device
- add unique VG
- add exactly 1 contiguous LV

3. save LVM metadata to the PV disk as the OS command does

# vgcfgrestore VG

Can this be done by instead of using system() calls, instead using native C commands either via an API or other methods?

the examples for bd_lvm_pvcreate() in libblockdevapi for example does not say how to add -u flag
and I couldn’t find any vgcfgrestore there too?

besides this, I found it strange why pvcreate -u is needed at all? would be better to have a <dev> parameter directly to the vgcfgrestore command instead

looking forward to hearing from you soon again 

regards Tomas

Sent from my iPhone

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [linux-lvm] vgcfgrestore + pvcreate using liblockdev api in C
  2020-09-14  5:56 [linux-lvm] vgcfgrestore + pvcreate using liblockdev api in C Tomas Dalebjörk
@ 2020-09-15 11:55 ` Vojtěch Trefný
  0 siblings, 0 replies; 2+ messages in thread
From: Vojtěch Trefný @ 2020-09-15 11:55 UTC (permalink / raw)
  To: linux-lvm

Hi, libblockdev is not part of the LVM project so it's usually better to
ask on our GitHub: https://github.com/storaged-project/libblockdev

Example for extra arguments is available in the documentation:
http://storaged.org/libblockdev/libblockdev-Utils.html#bd-extra-arg-new
(the example is for the filesystem plugin, but it works the same for LVM
plugin).

We don't have full coverage of all LVM commands so there is no
vgcfgrestore function in the LVM plugin. We are currently working on new
major release so this would be a good time for adding new functions
and/or adjusting API so please open an issue on GitHub for things you'd
like to be added to libblockdev.

On 9/14/20 7:56 AM, Tomas Dalebjörk wrote:
> hi
> 
> Is there an api available today or an example how to perform the below OS commands in C using a function or api instead of system calls?
> 
> 1. create an unique uid on the server, and store it on the PV disk
> 
> # pvcreatue -u <generated uid> <your device>
> 
> 2. create the LVM metadata backup content (as /etc/lvm/backup/...)
> - add PV uid generated above as there is no parameter to save the data to a device
> - add unique VG
> - add exactly 1 contiguous LV
> 
> 3. save LVM metadata to the PV disk as the OS command does
> 
> # vgcfgrestore VG
> 
> Can this be done by instead of using system() calls, instead using native C commands either via an API or other methods?
> 
> the examples for bd_lvm_pvcreate() in libblockdevapi for example does not say how to add -u flag
> and I couldn’t find any vgcfgrestore there too?
> 
> besides this, I found it strange why pvcreate -u is needed at all? would be better to have a <dev> parameter directly to the vgcfgrestore command instead
> 
> looking forward to hearing from you soon again 
> 
> regards Tomas
> 
> Sent from my iPhone
> 
> 
> _______________________________________________
> linux-lvm mailing list
> linux-lvm@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-lvm
> read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-15 11:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14  5:56 [linux-lvm] vgcfgrestore + pvcreate using liblockdev api in C Tomas Dalebjörk
2020-09-15 11:55 ` Vojtěch Trefný

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).