Skip to contentSkip to conversation

Cpupools: libxen part

PATCH In review Juergen Gross 1 participant 1 message Apr 20, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 3/6 Cpupools: libxen part

Signature · 6 lines
-- 
Juergen Gross                 Principal Developer Operating Systems
TSP ES&S SWE OS6                       Telephone: +49 (0) 89 3222 2967
Fujitsu Technology Solutions              e-mail: [email protected]
Domagkstr. 28                           Internet: ts.fujitsu.com
D-80807 Muenchen                 Company details: ts.fujitsu.com/imprint.html
Signed-off-by [email protected]
tools/libxen/include/xen/api/xen_all.h +1 -0
diff -r fadf63ab49e7 tools/libxen/include/xen/api/xen_all.h
@@ -37,4 +37,5 @@
 #include <xen/api/xen_vm_power_state.h>
 #include <xen/api/xen_vtpm.h>
 #include <xen/api/xen_xspolicy.h>
+#include <xen/api/xen_cpu_pool.h>
 #endif
tools/libxen/include/xen/api/xen_cpu_pool.h new file +424 -0

424 lines not on this page · raw message

tools/libxen/include/xen/api/xen_cpu_pool_decl.h new file +30 -0
diff -r fadf63ab49e7 tools/libxen/include/xen/api/xen_cpu_pool_decl.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
+ */
+
+#ifndef XEN_CPU_POOL_DECL_H
+#define XEN_CPU_POOL_DECL_H
+
+typedef void *xen_cpu_pool;
+
+struct xen_cpu_pool_set;
+struct xen_cpu_pool_record;
+struct xen_cpu_pool_record_set;
+struct xen_cpu_pool_record_opt;
+struct xen_cpu_pool_record_opt_set;
+
+#endif
tools/libxen/include/xen/api/xen_host.h +9 -1
diff -r fadf63ab49e7 tools/libxen/include/xen/api/xen_host.h
@@ -29,7 +29,7 @@
 #include <xen/api/xen_string_set.h>
 #include <xen/api/xen_string_string_map.h>
 #include <xen/api/xen_vm_decl.h>
-
+#include <xen/api/xen_cpu_pool_decl.h>
 
 /*
  * The host class.
@@ -91,6 +91,7 @@ typedef struct xen_host_record
     struct xen_pbd_record_opt_set *pbds;
     struct xen_host_cpu_record_opt_set *host_cpus;
     struct xen_host_metrics_record_opt *metrics;
+    struct xen_cpu_pool_record_opt_set *resident_cpu_pools;
 } xen_host_record;
 
 /**
@@ -494,4 +495,11 @@ xen_host_get_all(xen_session *session, s
 xen_host_get_all(xen_session *session, struct xen_host_set **result);
 
 
+/**
+ * Get list of resident cpu pools.
+ */
+extern bool
+xen_host_get_resident_cpu_pools(xen_session *session, struct xen_cpu_pool_set **result,
+       xen_host host);
+
 #endif
tools/libxen/include/xen/api/xen_host_cpu.h +16 -0
diff -r fadf63ab49e7 tools/libxen/include/xen/api/xen_host_cpu.h
@@ -22,6 +22,7 @@
 #include <xen/api/xen_common.h>
 #include <xen/api/xen_host_cpu_decl.h>
 #include <xen/api/xen_host_decl.h>
+#include <xen/api/xen_cpu_pool_decl.h>
 
 
 /*
@@ -72,6 +73,7 @@ typedef struct xen_host_cpu_record
     char *flags;
     char *features;
     double utilisation;
+    struct xen_cpu_pool_record_opt_set *cpu_pools;
 } xen_host_cpu_record;
 
 /**
@@ -244,4 +246,18 @@ xen_host_cpu_get_all(xen_session *sessio
 xen_host_cpu_get_all(xen_session *session, struct xen_host_cpu_set **result);
 
 
+/**
+ * Get the ref of the cpu_pool to which the host_cpu belongs.
+ */
+extern bool
+xen_host_cpu_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_host_cpu host_cpu);
+
+
+/**
+ * Return a list of all the host_cpus not assigned to a cpu_pool.
+ */
+extern bool
+xen_host_cpu_get_unassigned_cpus(xen_session *session, struct xen_host_cpu_set **result);
+
+
 #endif
tools/libxen/include/xen/api/xen_vm.h +32 -0
diff -r fadf63ab49e7 tools/libxen/include/xen/api/xen_vm.h
@@ -34,6 +34,7 @@
 #include <xen/api/xen_vm_metrics_decl.h>
 #include <xen/api/xen_vm_power_state.h>
 #include <xen/api/xen_vtpm_decl.h>
+#include <xen/api/xen_cpu_pool_decl.h>
 
 
 /*
@@ -113,6 +114,8 @@ typedef struct xen_vm_record
     struct xen_vm_metrics_record_opt *metrics;
     struct xen_vm_guest_metrics_record_opt *guest_metrics;
     char *security_label;
+    char *pool_name;
+    struct xen_cpu_pool_record_opt_set *cpu_pool;
 } xen_vm_record;
 
 /**
@@ -905,4 +908,33 @@ extern bool
 extern bool
 xen_vm_get_security_label(xen_session *session, char **result, xen_vm vm);
 
+
+/**
+ * Get the cpu_pool ref field of a domain.
+ */
+extern bool
+xen_vm_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_vm vm);
+
+
+/**
+ * Get the pool_name field of a domain.
+ */
+extern bool
+xen_vm_get_pool_name(xen_session *session, char **result, xen_vm vm);
+
+
+/**
+ * Set the pool_name field of a domain.
+ */
+extern bool
+xen_vm_set_pool_name(xen_session *session, xen_vm vm, char *pool_name);
+
+
+/**
+ * Migrate the VM to another cpu_pool (on the same host). This can only be
+ * called when the specified VM is in the Running state.
+ */
+extern bool
+xen_vm_cpu_pool_migrate(xen_session *session, xen_vm vm, xen_cpu_pool cpu_pool);
+
 #endif
tools/libxen/src/xen_cpu_pool.c new file +671 -0

671 lines not on this page · raw message

tools/libxen/src/xen_host.c +25 -1
diff -r fadf63ab49e7 tools/libxen/src/xen_host.c
@@ -30,6 +30,7 @@
 #include <xen/api/xen_sr.h>
 #include <xen/api/xen_string_string_map.h>
 #include <xen/api/xen_vm.h>
+#include <xen/api/xen_cpu_pool.h>
 
 
 XEN_FREE(xen_host)
@@ -108,7 +109,10 @@ static const struct_member xen_host_reco
           .offset = offsetof(xen_host_record, host_cpus) },
         { .key = "metrics",
           .type = &abstract_type_ref,
-          .offset = offsetof(xen_host_record, metrics) }
+          .offset = offsetof(xen_host_record, metrics) },
+        { .key = "resident_cpu_pools",
+          .type = &abstract_type_ref_set,
+          .offset = offsetof(xen_host_record, resident_cpu_pools) }
     };
 
 const abstract_type xen_host_record_abstract_type_ =
@@ -148,6 +152,7 @@ xen_host_record_free(xen_host_record *re
     xen_pbd_record_opt_set_free(record->pbds);
     xen_host_cpu_record_opt_set_free(record->host_cpus);
     xen_host_metrics_record_opt_free(record->metrics);
+    xen_cpu_pool_record_opt_set_free(record->resident_cpu_pools);
     free(record);
 }
 
@@ -889,3 +894,22 @@ xen_host_get_uuid(xen_session *session, 
     XEN_CALL_("host.get_uuid");
     return session->ok;
 }
+
+
+bool
+xen_host_get_resident_cpu_pools(xen_session *session, struct xen_cpu_pool_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_resident_cpu_pools");
+    return session->ok;
+}
+
tools/libxen/src/xen_host_cpu.c +37 -1
diff -r fadf63ab49e7 tools/libxen/src/xen_host_cpu.c
@@ -24,6 +24,7 @@
 #include <xen/api/xen_common.h>
 #include <xen/api/xen_host.h>
 #include <xen/api/xen_host_cpu.h>
+#include <xen/api/xen_cpu_pool.h>
 
 
 XEN_FREE(xen_host_cpu)
@@ -66,7 +67,10 @@ static const struct_member xen_host_cpu_
           .offset = offsetof(xen_host_cpu_record, features) },
         { .key = "utilisation",
           .type = &abstract_type_float,
-          .offset = offsetof(xen_host_cpu_record, utilisation) }
+          .offset = offsetof(xen_host_cpu_record, utilisation) },
+        { .key = "cpu_pool",
+          .type = &abstract_type_ref_set,
+          .offset = offsetof(xen_host_cpu_record, cpu_pools) },
     };
 
 const abstract_type xen_host_cpu_record_abstract_type_ =
@@ -94,6 +98,7 @@ xen_host_cpu_record_free(xen_host_cpu_re
     free(record->stepping);
     free(record->flags);
     free(record->features);
+    xen_cpu_pool_record_opt_set_free(record->cpu_pools);
     free(record);
 }
 
@@ -315,3 +320,34 @@ xen_host_cpu_get_uuid(xen_session *sessi
     XEN_CALL_("host_cpu.get_uuid");
     return session->ok;
 }
+
+
+bool
+xen_host_cpu_get_cpu_pool(xen_session *session, struct xen_cpu_pool_set **result, xen_host_cpu host_cpu)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host_cpu }
+        };
+
+    abstract_type result_type = abstract_type_string_set;
+
+    *result = NULL;
+    XEN_CALL_("host_cpu.get_cpu_pool");
+    return session->ok;
+}
+
+
+bool
+xen_host_cpu_get_unassigned_cpus(xen_session *session, struct xen_host_cpu_set **result)
+{
+    abstract_type result_type = abstract_type_string_set;
+
+    *result = NULL;
+    xen_call_(session, "host_cpu.get_unassigned_cpus", NULL, 0, &result_type, result);
+    return session->ok;
+}
+
+
+
tools/libxen/src/xen_vm.c +77 -1

99 lines not on this page · raw message

tools/libxen/test/test_bindings.c +649 -0

667 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel