Skip to content

Commit

Permalink
Merge pull request #94 from vojtechtrefny/master_libblockdev-30
Browse files Browse the repository at this point in the history
Allow running with both libblockdev 3.0 and 2.0 API
  • Loading branch information
tasleson authored Jun 24, 2023
2 parents 2472376 + a86b892 commit daf584c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions targetd/backends/lvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,23 @@
import gi

gi.require_version("GLib", "2.0")
gi.require_version("BlockDev", "2.0")

from gi.repository import GLib
from gi.repository import BlockDev as bd

try:
gi.require_version("BlockDev", "3.0")
from gi.repository import BlockDev as bd
except ValueError:
gi.require_version("BlockDev", "2.0")
from gi.repository import BlockDev as bd

bd.switch_init_checks(False)

from targetd.main import TargetdError

REQUESTED_PLUGIN_NAMES = {"lvm"}

requested_plugins = bd.plugin_specs_from_names(REQUESTED_PLUGIN_NAMES)

bd.switch_init_checks(False)

pools = []
vg_name_2_pool_name_dict = {}

Expand Down

0 comments on commit daf584c

Please sign in to comment.