aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxen
diff options
context:
space:
mode:
authorEwan Mellor <ewan@xensource.com>2007-02-25 23:37:05 +0000
committerEwan Mellor <ewan@xensource.com>2007-02-25 23:37:05 +0000
commit496ee4e22a895b6b13452ef0b2f59d95851d37bd (patch)
tree8bff4495eee034ec82116c549744df9b45ca4b35 /tools/libxen
parentd8f5871da1f98195c4f8b86c1cd5188b729fdc5c (diff)
downloadxen-496ee4e22a895b6b13452ef0b2f59d95851d37bd.tar.gz
xen-496ee4e22a895b6b13452ef0b2f59d95851d37bd.tar.bz2
xen-496ee4e22a895b6b13452ef0b2f59d95851d37bd.zip
Added host.capabilities field.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools/libxen')
-rw-r--r--tools/libxen/include/xen_host.h8
-rw-r--r--tools/libxen/src/xen_host.c21
-rw-r--r--tools/libxen/test/test_bindings.c24
3 files changed, 53 insertions, 0 deletions
diff --git a/tools/libxen/include/xen_host.h b/tools/libxen/include/xen_host.h
index 8f84dc37ad..f9919ad309 100644
--- a/tools/libxen/include/xen_host.h
+++ b/tools/libxen/include/xen_host.h
@@ -78,6 +78,7 @@ typedef struct xen_host_record
xen_string_string_map *api_version_vendor_implementation;
xen_string_string_map *software_version;
xen_string_string_map *other_config;
+ struct xen_string_set *capabilities;
struct xen_string_set *supported_bootloaders;
struct xen_vm_record_opt_set *resident_vms;
xen_string_string_map *logging;
@@ -253,6 +254,13 @@ xen_host_get_other_config(xen_session *session, xen_string_string_map **result,
/**
+ * Get the capabilities field of the given host.
+ */
+extern bool
+xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host);
+
+
+/**
* Get the supported_bootloaders field of the given host.
*/
extern bool
diff --git a/tools/libxen/src/xen_host.c b/tools/libxen/src/xen_host.c
index 04b8452e5d..204664ae3c 100644
--- a/tools/libxen/src/xen_host.c
+++ b/tools/libxen/src/xen_host.c
@@ -70,6 +70,9 @@ static const struct_member xen_host_record_struct_members[] =
{ .key = "other_config",
.type = &abstract_type_string_string_map,
.offset = offsetof(xen_host_record, other_config) },
+ { .key = "capabilities",
+ .type = &abstract_type_string_set,
+ .offset = offsetof(xen_host_record, capabilities) },
{ .key = "supported_bootloaders",
.type = &abstract_type_string_set,
.offset = offsetof(xen_host_record, supported_bootloaders) },
@@ -124,6 +127,7 @@ xen_host_record_free(xen_host_record *record)
xen_string_string_map_free(record->api_version_vendor_implementation);
xen_string_string_map_free(record->software_version);
xen_string_string_map_free(record->other_config);
+ xen_string_set_free(record->capabilities);
xen_string_set_free(record->supported_bootloaders);
xen_vm_record_opt_set_free(record->resident_vms);
xen_string_string_map_free(record->logging);
@@ -329,6 +333,23 @@ xen_host_get_other_config(xen_session *session, xen_string_string_map **result,
bool
+xen_host_get_capabilities(xen_session *session, struct xen_string_set **result, xen_host host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ XEN_CALL_("host.get_capabilities");
+ return session->ok;
+}
+
+
+bool
xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set **result, xen_host host)
{
abstract_value param_values[] =
diff --git a/tools/libxen/test/test_bindings.c b/tools/libxen/test/test_bindings.c
index c76768af15..6a51cd3a05 100644
--- a/tools/libxen/test/test_bindings.c
+++ b/tools/libxen/test/test_bindings.c
@@ -238,6 +238,22 @@ int main(int argc, char **argv)
return 1;
}
+ xen_string_set *capabilities;
+ if (!xen_host_get_capabilities(session, &capabilities, host))
+ {
+ print_error(session);
+ free(dmesg);
+ xen_string_set_free(supported_bootloaders);
+ xen_string_string_map_free(versions);
+ xen_host_free(host);
+ xen_vm_record_free(vm_record);
+ xen_uuid_bytes_free(vm_uuid_bytes);
+ xen_uuid_free(vm_uuid);
+ xen_vm_free(vm);
+ CLEANUP;
+ return 1;
+ }
+
printf("%s.\n", vm_uuid);
fprintf(stderr, "In bytes, the VM UUID is ");
@@ -264,6 +280,13 @@ int main(int argc, char **argv)
}
printf("\n");
+ printf("Host has the following capabilities:");
+ for (size_t i = 0; i < capabilities->size; i++)
+ {
+ printf(" %s", capabilities->contents[i]);
+ }
+ printf("\n");
+
printf("%s.\n", vm_record->uuid);
printf("Resident on %s.\n", (char *)vm_record->resident_on->u.handle);
@@ -279,6 +302,7 @@ int main(int argc, char **argv)
xen_string_string_map_free(versions);
free(dmesg);
xen_string_set_free(supported_bootloaders);
+ xen_string_set_free(capabilities);
print_vm_metrics(session, vm);
if (!session->ok)