ia64/xen-unstable

view tools/libxen/src/xen_vbd_metrics.c @ 19848:5839491bbf20

[IA64] replace MAX_VCPUS with d->max_vcpus where necessary.

don't use MAX_VCPUS, and use vcpu::max_vcpus.
The changeset of 2f9e1348aa98 introduced max_vcpus to allow more vcpus
per guest. This patch is ia64 counter part.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Mon Jun 29 11:26:05 2009 +0900 (2009-06-29)
parents 295858ddac87
children
line source
1 /*
2 * Copyright (c) 2006-2007, XenSource Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
20 #include <stddef.h>
21 #include <stdlib.h>
23 #include "xen_internal.h"
24 #include <xen/api/xen_common.h>
25 #include <xen/api/xen_vbd_metrics.h>
28 XEN_FREE(xen_vbd_metrics)
29 XEN_SET_ALLOC_FREE(xen_vbd_metrics)
30 XEN_ALLOC(xen_vbd_metrics_record)
31 XEN_SET_ALLOC_FREE(xen_vbd_metrics_record)
32 XEN_ALLOC(xen_vbd_metrics_record_opt)
33 XEN_RECORD_OPT_FREE(xen_vbd_metrics)
34 XEN_SET_ALLOC_FREE(xen_vbd_metrics_record_opt)
37 static const struct_member xen_vbd_metrics_record_struct_members[] =
38 {
39 { .key = "uuid",
40 .type = &abstract_type_string,
41 .offset = offsetof(xen_vbd_metrics_record, uuid) },
42 { .key = "io_read_kbs",
43 .type = &abstract_type_float,
44 .offset = offsetof(xen_vbd_metrics_record, io_read_kbs) },
45 { .key = "io_write_kbs",
46 .type = &abstract_type_float,
47 .offset = offsetof(xen_vbd_metrics_record, io_write_kbs) },
48 { .key = "last_updated",
49 .type = &abstract_type_datetime,
50 .offset = offsetof(xen_vbd_metrics_record, last_updated) }
51 };
53 const abstract_type xen_vbd_metrics_record_abstract_type_ =
54 {
55 .typename = STRUCT,
56 .struct_size = sizeof(xen_vbd_metrics_record),
57 .member_count =
58 sizeof(xen_vbd_metrics_record_struct_members) / sizeof(struct_member),
59 .members = xen_vbd_metrics_record_struct_members
60 };
63 void
64 xen_vbd_metrics_record_free(xen_vbd_metrics_record *record)
65 {
66 if (record == NULL)
67 {
68 return;
69 }
70 free(record->handle);
71 free(record->uuid);
72 free(record);
73 }
76 bool
77 xen_vbd_metrics_get_record(xen_session *session, xen_vbd_metrics_record **result, xen_vbd_metrics vbd_metrics)
78 {
79 abstract_value param_values[] =
80 {
81 { .type = &abstract_type_string,
82 .u.string_val = vbd_metrics }
83 };
85 abstract_type result_type = xen_vbd_metrics_record_abstract_type_;
87 *result = NULL;
88 XEN_CALL_("VBD_metrics.get_record");
90 if (session->ok)
91 {
92 (*result)->handle = xen_strdup_((*result)->uuid);
93 }
95 return session->ok;
96 }
99 bool
100 xen_vbd_metrics_get_by_uuid(xen_session *session, xen_vbd_metrics *result, char *uuid)
101 {
102 abstract_value param_values[] =
103 {
104 { .type = &abstract_type_string,
105 .u.string_val = uuid }
106 };
108 abstract_type result_type = abstract_type_string;
110 *result = NULL;
111 XEN_CALL_("VBD_metrics.get_by_uuid");
112 return session->ok;
113 }
116 bool
117 xen_vbd_metrics_get_io_read_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics)
118 {
119 abstract_value param_values[] =
120 {
121 { .type = &abstract_type_string,
122 .u.string_val = vbd_metrics }
123 };
125 abstract_type result_type = abstract_type_float;
127 XEN_CALL_("VBD_metrics.get_io_read_kbs");
128 return session->ok;
129 }
132 bool
133 xen_vbd_metrics_get_io_write_kbs(xen_session *session, double *result, xen_vbd_metrics vbd_metrics)
134 {
135 abstract_value param_values[] =
136 {
137 { .type = &abstract_type_string,
138 .u.string_val = vbd_metrics }
139 };
141 abstract_type result_type = abstract_type_float;
143 XEN_CALL_("VBD_metrics.get_io_write_kbs");
144 return session->ok;
145 }
148 bool
149 xen_vbd_metrics_get_last_updated(xen_session *session, time_t *result, xen_vbd_metrics vbd_metrics)
150 {
151 abstract_value param_values[] =
152 {
153 { .type = &abstract_type_string,
154 .u.string_val = vbd_metrics }
155 };
157 abstract_type result_type = abstract_type_datetime;
159 XEN_CALL_("VBD_metrics.get_last_updated");
160 return session->ok;
161 }
164 bool
165 xen_vbd_metrics_get_all(xen_session *session, struct xen_vbd_metrics_set **result)
166 {
168 abstract_type result_type = abstract_type_string_set;
170 *result = NULL;
171 xen_call_(session, "VBD_metrics.get_all", NULL, 0, &result_type, result);
172 return session->ok;
173 }
176 bool
177 xen_vbd_metrics_get_uuid(xen_session *session, char **result, xen_vbd_metrics vbd_metrics)
178 {
179 abstract_value param_values[] =
180 {
181 { .type = &abstract_type_string,
182 .u.string_val = vbd_metrics }
183 };
185 abstract_type result_type = abstract_type_string;
187 *result = NULL;
188 XEN_CALL_("VBD_metrics.get_uuid");
189 return session->ok;
190 }