[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH v2 06/10] Add capability to fetch balloon stats



On Mon, Jul 08, 2013 at 03:20:32PM -0400, John Ferlan wrote:
> This patch will add the QEMU_MONITOR_OBJECT_PROPERTY_BALLOON_STATS type and
> a mechanism in the qemuMonitorObjectProperty to fetch and store an opaque
> data array assuming that we are provided a count of current elements,
> a count of maximum elements, and the address of the array store the data.
> Use the mechanism to fetch balloon driver statistics.
> ---
>  src/qemu/qemu_monitor.c      |   3 +-
>  src/qemu/qemu_monitor_json.c | 206 ++++++++++++++++++++-----------------------
>  src/qemu/qemu_monitor_json.h |   5 ++
>  3 files changed, 103 insertions(+), 111 deletions(-)


> @@ -4747,6 +4729,9 @@ int qemuMonitorJSONGetObjectProperty(qemuMonitorPtr mon,
>          if (tmp)
>              ret = 0;
>          break;
> +    case QEMU_MONITOR_OBJECT_PROPERTY_BALLOON_STATS:
> +        ret = qemuMonitorJSONGetBalloonStats(data, prop);
> +        break;
>      case QEMU_MONITOR_OBJECT_PROPERTY_LAST:
>      default:
>          virReportError(VIR_ERR_INTERNAL_ERROR,
> @@ -4810,6 +4795,7 @@ int qemuMonitorJSONSetObjectProperty(qemuMonitorPtr mon,
>      case QEMU_MONITOR_OBJECT_PROPERTY_STRING:
>          MAKE_SET_CMD("s:value", prop->val.str);
>          break;
> +    case QEMU_MONITOR_OBJECT_PROPERTY_BALLOON_STATS:
>      case QEMU_MONITOR_OBJECT_PROPERTY_LAST:
>      default:
>          virReportError(VIR_ERR_INTERNAL_ERROR,
> @@ -4830,7 +4816,7 @@ cleanup:
>  
>      return ret;
>  }
> -

[snip]

> @@ -360,6 +361,7 @@ typedef enum {
>      QEMU_MONITOR_OBJECT_PROPERTY_ULONG,
>      QEMU_MONITOR_OBJECT_PROPERTY_DOUBLE,
>      QEMU_MONITOR_OBJECT_PROPERTY_STRING,
> +    QEMU_MONITOR_OBJECT_PROPERTY_BALLOON_STATS,
>  
>      QEMU_MONITOR_OBJECT_PROPERTY_LAST
>  } qemuMonitorJSONObjectPropertyType;
> @@ -368,6 +370,8 @@ typedef struct _qemuMonitorJSONObjectProperty qemuMonitorJSONObjectProperty;
>  typedef qemuMonitorJSONObjectProperty *qemuMonitorJSONObjectPropertyPtr;
>  struct _qemuMonitorJSONObjectProperty {
>      int type;    /* qemuMonitorJSONObjectPropertyType */
> +    int curelems;   /* Current number elements in **ptr array */
> +    int maxelems;   /* Maximum number elements allowed in any **ptr array */
>      union {
>          bool b;
>          int i;
> @@ -376,6 +380,7 @@ struct _qemuMonitorJSONObjectProperty {
>          unsigned long long ul;
>          double d;
>          char *str;
> +        void **ptr;
>      } val;

I still don't really like that you're taking a function which is
generic (qemuMonitorJSONGetObjectProperty) and adding in code which
is specific to a single monitor command, and storing command specific
data structures in a 'void **'.  IMHO qemuMonitorJSONGetObjectProperty
should only ever return generic data structures, and the conversion
to the memory stats struct should be done by the caller.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]