[Libguestfs] [PATCH nbdkit v2 08/10] python: Implement can_multi_conn.

Richard W.M. Jones
Fri, 22 Nov 2019 19:54:03 -0000

---
 plugins/python/nbdkit-python-plugin.pod | 8 +++++++-
 plugins/python/python.c                 | 7 +++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/plugins/python/nbdkit-python-plugin.pod
b/plugins/python/nbdkit-python-plugin.pod
index ab8f5d9..df503f8 100644
--- a/plugins/python/nbdkit-python-plugin.pod
+++ b/plugins/python/nbdkit-python-plugin.pod
@@ -191,6 +191,13 @@ contents will be garbage collected.
  def is_rotational(h):
    # return a boolean

+=item C<can_multi_conn>
+
+(Optional)
+
+ def can_multi_conn(h):
+   # return a boolean
+
 =item C<can_write>

 (Optional)
@@ -345,7 +352,6 @@ C<magic_config_key>,
 C<can_fua>,
 C<can_cache>,
 C<can_extents>,
-C<can_multi_conn>,
 C<extents>.

 These are not yet supported.
diff --git a/plugins/python/python.c b/plugins/python/python.c
index 9693180..9119b8a 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -751,6 +751,12 @@ py_is_rotational (void *handle)
   return boolean_callback (handle, "is_rotational", NULL);
 }

+static int
+py_can_multi_conn (void *handle)
+{
+  return boolean_callback (handle, "can_multi_conn", NULL);
+}
+
 static int
 py_can_write (void *handle)
 {
@@ -804,6 +810,7 @@ static struct nbdkit_plugin plugin = {

   .get_size          = py_get_size,
   .is_rotational     = py_is_rotational,
+  .can_multi_conn    = py_can_multi_conn,
   .can_write         = py_can_write,
   .can_flush         = py_can_flush,
   .can_trim          = py_can_trim,
--
2.23.0