0

I am trying to start a merge of a LVM snapshot using the blockdev API in C, similar to the “lvconvert —merge -b vg/lvsnap” OS command

The issue is that the merge starts, but it doesn’t go in background The code waits for the completion of the merge, before it can continue

Not sure what I am doing wrong, or if there is another way to resolve this?

    BDExtraArg          lv_arg = {"--background",""};
    const BDExtraArg    *extra_args[2] = {&lv_arg, NULL};
    g_autoptr(GError)   error = NULL;
    
    bd_switch_init_checks (FALSE, &error);
    bd_ensure_init (plugins, NULL, &error);
    bd_lvm_lvsnapshotmerge(vg_name,lv_snap,extra_args,&error);

Am I supposed to start this as a background thread instead?

Regards Tomas

user413990
  • 39
  • 5
  • I suspect spawning the background daemon is done by the lvm executable rather than the back-end library since the command says it returns whether the merge was successful. Fork or thread. – stark Jan 02 '22 at 13:58
  • Thanks will try to create a thread – user413990 Jan 03 '22 at 11:49

0 Answers0