Signed-off-by: Daniel P. Berrange <berra...@redhat.com>
---
 Changes                    |  1 +
 Virt.xs                    | 16 ++++++++++++----
 lib/Sys/Virt/StorageVol.pm | 16 ++++++++++++++--
 3 files changed, 27 insertions(+), 6 deletions(-)

Pushed as a build fix

diff --git a/Changes b/Changes
index 48ac221..672b566 100644
--- a/Changes
+++ b/Changes
@@ -9,6 +9,7 @@ Revision history for perl module Sys::Virt
  - Add PERF_PARAM_STALLED_CYCLES_FRONTEND constant
  - Add PERF_PARAM_STALLED_CYCLES_BACKEND constant
  - Add PERF_PARAM_REF_CPU_CYCLES constant
+ - Add virStorageVolGetInfoFlags & associated constants
 
 2.5.0 2016-12-05
 
diff --git a/Virt.xs b/Virt.xs
index d694eff..1eb94a8 100644
--- a/Virt.xs
+++ b/Virt.xs
@@ -1,6 +1,6 @@
 /* -*- c -*-
  *
- * Copyright (C) 2006-2014 Red Hat
+ * Copyright (C) 2006-2016 Red Hat
  * Copyright (C) 2006-2014 Daniel P. Berrange
  *
  * This program is free software; You can redistribute it and/or modify
@@ -6630,13 +6630,19 @@ wipe_pattern(vol, algorithm, flags=0)
 
 
 HV *
-get_info(vol)
+get_info(vol, flags=0)
       virStorageVolPtr vol;
+      unsigned int flags;
   PREINIT:
       virStorageVolInfo info;
     CODE:
-      if (virStorageVolGetInfo(vol, &info) < 0)
-          _croak_error();
+      if (flags != 0) {
+         if (virStorageVolGetInfoFlags(vol, &info, flags) < 0)
+              _croak_error();
+      } else {
+          if (virStorageVolGetInfo(vol, &info) < 0)
+              _croak_error();
+      }
 
       RETVAL = (HV *)sv_2mortal((SV*)newHV());
       (void)hv_store (RETVAL, "type", 4, newSViv(info.type), 0);
@@ -8701,6 +8707,8 @@ BOOT:
       REGISTER_CONSTANT(VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA, 
CREATE_PREALLOC_METADATA);
       REGISTER_CONSTANT(VIR_STORAGE_VOL_CREATE_REFLINK, CREATE_REFLINK);
 
+      REGISTER_CONSTANT(VIR_STORAGE_VOL_USE_ALLOCATION, USE_ALLOCATION);
+      REGISTER_CONSTANT(VIR_STORAGE_VOL_GET_PHYSICAL, GET_PHYSICAL);
 
       stash = gv_stashpv( "Sys::Virt::Secret", TRUE );
       REGISTER_CONSTANT(VIR_SECRET_USAGE_TYPE_NONE, USAGE_TYPE_NONE);
diff --git a/lib/Sys/Virt/StorageVol.pm b/lib/Sys/Virt/StorageVol.pm
index d293bfa..42f10e8 100644
--- a/lib/Sys/Virt/StorageVol.pm
+++ b/lib/Sys/Virt/StorageVol.pm
@@ -118,7 +118,7 @@ to erase data, and should be one of the WIPE ALGORITHM 
CONSTANTS
 listed later. The C<flags> parameter is currently unused and defaults
 to zero.
 
-=item my $info = $vol->get_info()
+=item my $info = $vol->get_info($flags = 0)
 
 Retrieve live information about the storage volume. The returned
 C<$info> hash reference contains three keys. C<type> indicates whether
@@ -127,7 +127,19 @@ logical size of the volume. C<allocation> provides the 
current
 physical usage of the volume. The allocation may be less than the
 capacity for sparse, or grow-on-demand volumes. The allocation
 may also be larger than the capacity, if there is a metadata overhead
-for the volume format.
+for the volume format. C<$flags> may take one of the values
+
+=over 4
+
+=item Sys::Virt::StorageVol::USE_ALLOCATION
+
+Return the current allocation in allocation
+
+=item Sys::Virt::StorageVol::GET_PHYSICAL
+
+Return the physical size in allocation
+
+=back
 
 =item $vol->download($st, $offset, $length);
 
-- 
2.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to