aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/xen-api/xenapi-datamodel.tex414
-rw-r--r--tools/libxen/include/xen_vbd.h48
-rw-r--r--tools/libxen/include/xen_vif.h48
-rw-r--r--tools/libxen/src/xen_vbd.c109
-rw-r--r--tools/libxen/src/xen_vif.c109
5 files changed, 728 insertions, 0 deletions
diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex
index 988d924406..75932de341 100644
--- a/docs/xen-api/xenapi-datamodel.tex
+++ b/docs/xen-api/xenapi-datamodel.tex
@@ -6710,6 +6710,8 @@ $\mathit{RO}_\mathit{ins}$ & {\tt network} & network ref & virtual network to w
$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & virtual machine to which this vif is connected \\
$\mathit{RW}$ & {\tt MAC} & string & ethernet MAC address of virtual interface, as exposed to guest \\
$\mathit{RW}$ & {\tt MTU} & int & MTU in octets \\
+$\mathit{RW}$ & {\tt qos/algorithm\_type} & string & QoS algorithm to use \\
+$\mathit{RW}$ & {\tt qos/algorithm\_params} & (string $\rightarrow$ string) Map & Paramters for chosen QoS algorithm \\
$\mathit{RO}_\mathit{run}$ & {\tt metrics} & VIF\_metrics ref & metrics associated with this VIF. \\
\hline
\end{longtable}
@@ -7008,6 +7010,211 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
+\subsubsection{RPC name:~get\_qos\_algorithm\_type}
+
+{\bf Overview:}
+Get the qos/algorithm\_type field of the given VIF.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} string get_qos_algorithm_type (session_id s, VIF ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VIF ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+string
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_qos\_algorithm\_type}
+
+{\bf Overview:}
+Set the qos/algorithm\_type field of the given VIF.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_qos_algorithm_type (session_id s, VIF ref self, string value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VIF ref } & self & reference to the object \\ \hline
+
+{\tt string } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_qos\_algorithm\_params}
+
+{\bf Overview:}
+Get the qos/algorithm\_params field of the given VIF.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_qos_algorithm_params (session_id s, VIF ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VIF ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_qos\_algorithm\_params}
+
+{\bf Overview:}
+Set the qos/algorithm\_params field of the given VIF.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_qos_algorithm_params (session_id s, VIF ref self, (string -> string) Map value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VIF ref } & self & reference to the object \\ \hline
+
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~add\_to\_qos\_algorithm\_params}
+
+{\bf Overview:}
+Add the given key-value pair to the qos/algorithm\_params field of the
+given VIF.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void add_to_qos_algorithm_params (session_id s, VIF ref self, string key, string value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VIF ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to add \\ \hline
+
+{\tt string } & value & Value to add \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~remove\_from\_qos\_algorithm\_params}
+
+{\bf Overview:}
+Remove the given key and its corresponding value from the
+qos/algorithm\_params field of the given VIF. If the key is not in that
+Map, then do nothing.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void remove_from_qos_algorithm_params (session_id s, VIF ref self, string key)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VIF ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to remove \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
\subsubsection{RPC name:~get\_metrics}
{\bf Overview:}
@@ -9610,6 +9817,8 @@ $\mathit{RW}$ & {\tt device} & string & device seen by the guest e.g. hda1 \\
$\mathit{RW}$ & {\tt bootable} & bool & true if this VBD is bootable \\
$\mathit{RW}$ & {\tt mode} & vbd\_mode & the mode the VBD should be mounted with \\
$\mathit{RW}$ & {\tt type} & vbd\_type & how the VBD will appear to the guest (e.g. disk or CD) \\
+$\mathit{RW}$ & {\tt qos/algorithm\_type} & string & QoS algorithm to use \\
+$\mathit{RW}$ & {\tt qos/algorithm\_params} & (string $\rightarrow$ string) Map & Paramters for chosen QoS algorithm \\
$\mathit{RO}_\mathit{run}$ & {\tt metrics} & VBD\_metrics ref & metrics associated with this VBD. \\
\hline
\end{longtable}
@@ -10009,6 +10218,211 @@ void
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
+\subsubsection{RPC name:~get\_qos\_algorithm\_type}
+
+{\bf Overview:}
+Get the qos/algorithm\_type field of the given VBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} string get_qos_algorithm_type (session_id s, VBD ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+string
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_qos\_algorithm\_type}
+
+{\bf Overview:}
+Set the qos/algorithm\_type field of the given VBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_qos_algorithm_type (session_id s, VBD ref self, string value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VBD ref } & self & reference to the object \\ \hline
+
+{\tt string } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_qos\_algorithm\_params}
+
+{\bf Overview:}
+Get the qos/algorithm\_params field of the given VBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_qos_algorithm_params (session_id s, VBD ref self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_qos\_algorithm\_params}
+
+{\bf Overview:}
+Set the qos/algorithm\_params field of the given VBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void set_qos_algorithm_params (session_id s, VBD ref self, (string -> string) Map value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VBD ref } & self & reference to the object \\ \hline
+
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~add\_to\_qos\_algorithm\_params}
+
+{\bf Overview:}
+Add the given key-value pair to the qos/algorithm\_params field of the
+given VBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void add_to_qos_algorithm_params (session_id s, VBD ref self, string key, string value)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VBD ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to add \\ \hline
+
+{\tt string } & value & Value to add \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~remove\_from\_qos\_algorithm\_params}
+
+{\bf Overview:}
+Remove the given key and its corresponding value from the
+qos/algorithm\_params field of the given VBD. If the key is not in that
+Map, then do nothing.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void remove_from_qos_algorithm_params (session_id s, VBD ref self, string key)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt VBD ref } & self & reference to the object \\ \hline
+
+{\tt string } & key & Key to remove \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
\subsubsection{RPC name:~get\_metrics}
{\bf Overview:}
diff --git a/tools/libxen/include/xen_vbd.h b/tools/libxen/include/xen_vbd.h
index d86ef6d3cd..543a42288c 100644
--- a/tools/libxen/include/xen_vbd.h
+++ b/tools/libxen/include/xen_vbd.h
@@ -20,6 +20,7 @@
#define XEN_VBD_H
#include "xen_common.h"
+#include "xen_string_string_map.h"
#include "xen_vbd_decl.h"
#include "xen_vbd_metrics_decl.h"
#include "xen_vbd_mode.h"
@@ -74,6 +75,8 @@ typedef struct xen_vbd_record
bool bootable;
enum xen_vbd_mode mode;
enum xen_vbd_type type;
+ char *qos_algorithm_type;
+ xen_string_string_map *qos_algorithm_params;
struct xen_vbd_metrics_record_opt *metrics;
} xen_vbd_record;
@@ -234,6 +237,20 @@ xen_vbd_get_type(xen_session *session, enum xen_vbd_type *result, xen_vbd vbd);
/**
+ * Get the qos/algorithm_type field of the given VBD.
+ */
+extern bool
+xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd vbd);
+
+
+/**
+ * Get the qos/algorithm_params field of the given VBD.
+ */
+extern bool
+xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd);
+
+
+/**
* Get the metrics field of the given VBD.
*/
extern bool
@@ -269,6 +286,37 @@ xen_vbd_set_type(xen_session *session, xen_vbd vbd, enum xen_vbd_type type);
/**
+ * Set the qos/algorithm_type field of the given VBD.
+ */
+extern bool
+xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char *algorithm_type);
+
+
+/**
+ * Set the qos/algorithm_params field of the given VBD.
+ */
+extern bool
+xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, xen_string_string_map *algorithm_params);
+
+
+/**
+ * Add the given key-value pair to the qos/algorithm_params field of
+ * the given VBD.
+ */
+extern bool
+xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * qos/algorithm_params field of the given VBD. If the key is not in that
+ * Map, then do nothing.
+ */
+extern bool
+xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key);
+
+
+/**
* Change the media in the device for CDROM-like devices only. For
* other devices, detach the VBD and attach a new one
*/
diff --git a/tools/libxen/include/xen_vif.h b/tools/libxen/include/xen_vif.h
index 160d8a02b3..c6ec71ee03 100644
--- a/tools/libxen/include/xen_vif.h
+++ b/tools/libxen/include/xen_vif.h
@@ -21,6 +21,7 @@
#include "xen_common.h"
#include "xen_network_decl.h"
+#include "xen_string_string_map.h"
#include "xen_vif_decl.h"
#include "xen_vif_metrics_decl.h"
#include "xen_vm_decl.h"
@@ -70,6 +71,8 @@ typedef struct xen_vif_record
struct xen_vm_record_opt *vm;
char *mac;
int64_t mtu;
+ char *qos_algorithm_type;
+ xen_string_string_map *qos_algorithm_params;
struct xen_vif_metrics_record_opt *metrics;
} xen_vif_record;
@@ -223,6 +226,20 @@ xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif);
/**
+ * Get the qos/algorithm_type field of the given VIF.
+ */
+extern bool
+xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif);
+
+
+/**
+ * Get the qos/algorithm_params field of the given VIF.
+ */
+extern bool
+xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif);
+
+
+/**
* Get the metrics field of the given VIF.
*/
extern bool
@@ -250,4 +267,35 @@ extern bool
xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu);
+/**
+ * Set the qos/algorithm_type field of the given VIF.
+ */
+extern bool
+xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type);
+
+
+/**
+ * Set the qos/algorithm_params field of the given VIF.
+ */
+extern bool
+xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params);
+
+
+/**
+ * Add the given key-value pair to the qos/algorithm_params field of
+ * the given VIF.
+ */
+extern bool
+xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * qos/algorithm_params field of the given VIF. If the key is not in that
+ * Map, then do nothing.
+ */
+extern bool
+xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key);
+
+
#endif
diff --git a/tools/libxen/src/xen_vbd.c b/tools/libxen/src/xen_vbd.c
index d3c5709952..5e0b14dfbb 100644
--- a/tools/libxen/src/xen_vbd.c
+++ b/tools/libxen/src/xen_vbd.c
@@ -22,6 +22,7 @@
#include "xen_common.h"
#include "xen_internal.h"
+#include "xen_string_string_map.h"
#include "xen_vbd.h"
#include "xen_vbd_metrics.h"
#include "xen_vbd_mode_internal.h"
@@ -65,6 +66,12 @@ static const struct_member xen_vbd_record_struct_members[] =
{ .key = "type",
.type = &xen_vbd_type_abstract_type_,
.offset = offsetof(xen_vbd_record, type) },
+ { .key = "qos_algorithm_type",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_vbd_record, qos_algorithm_type) },
+ { .key = "qos_algorithm_params",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_vbd_record, qos_algorithm_params) },
{ .key = "metrics",
.type = &abstract_type_ref,
.offset = offsetof(xen_vbd_record, metrics) }
@@ -92,6 +99,8 @@ xen_vbd_record_free(xen_vbd_record *record)
xen_vm_record_opt_free(record->vm);
xen_vdi_record_opt_free(record->vdi);
free(record->device);
+ free(record->qos_algorithm_type);
+ xen_string_string_map_free(record->qos_algorithm_params);
xen_vbd_metrics_record_opt_free(record->metrics);
free(record);
}
@@ -266,6 +275,40 @@ xen_vbd_get_type(xen_session *session, enum xen_vbd_type *result, xen_vbd vbd)
bool
+xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VBD.get_qos_algorithm_type");
+ return session->ok;
+}
+
+
+bool
+xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd }
+ };
+
+ abstract_type result_type = abstract_type_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("VBD.get_qos_algorithm_params");
+ return session->ok;
+}
+
+
+bool
xen_vbd_get_metrics(xen_session *session, xen_vbd_metrics *result, xen_vbd vbd)
{
abstract_value param_values[] =
@@ -347,6 +390,72 @@ xen_vbd_set_type(xen_session *session, xen_vbd vbd, enum xen_vbd_type type)
bool
+xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char *algorithm_type)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd },
+ { .type = &abstract_type_string,
+ .u.string_val = algorithm_type }
+ };
+
+ xen_call_(session, "VBD.set_qos_algorithm_type", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, xen_string_string_map *algorithm_params)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd },
+ { .type = &abstract_type_string_string_map,
+ .u.set_val = (arbitrary_set *)algorithm_params }
+ };
+
+ xen_call_(session, "VBD.set_qos_algorithm_params", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key, char *value)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd },
+ { .type = &abstract_type_string,
+ .u.string_val = key },
+ { .type = &abstract_type_string,
+ .u.string_val = value }
+ };
+
+ xen_call_(session, "VBD.add_to_qos_algorithm_params", param_values, 3, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vbd },
+ { .type = &abstract_type_string,
+ .u.string_val = key }
+ };
+
+ xen_call_(session, "VBD.remove_from_qos_algorithm_params", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi)
{
abstract_value param_values[] =
diff --git a/tools/libxen/src/xen_vif.c b/tools/libxen/src/xen_vif.c
index 3fc214b16e..62a6ef16a2 100644
--- a/tools/libxen/src/xen_vif.c
+++ b/tools/libxen/src/xen_vif.c
@@ -23,6 +23,7 @@
#include "xen_common.h"
#include "xen_internal.h"
#include "xen_network.h"
+#include "xen_string_string_map.h"
#include "xen_vif.h"
#include "xen_vif_metrics.h"
#include "xen_vm.h"
@@ -57,6 +58,12 @@ static const struct_member xen_vif_record_struct_members[] =
{ .key = "MTU",
.type = &abstract_type_int,
.offset = offsetof(xen_vif_record, mtu) },
+ { .key = "qos_algorithm_type",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_vif_record, qos_algorithm_type) },
+ { .key = "qos_algorithm_params",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_vif_record, qos_algorithm_params) },
{ .key = "metrics",
.type = &abstract_type_ref,
.offset = offsetof(xen_vif_record, metrics) }
@@ -85,6 +92,8 @@ xen_vif_record_free(xen_vif_record *record)
xen_network_record_opt_free(record->network);
xen_vm_record_opt_free(record->vm);
free(record->mac);
+ free(record->qos_algorithm_type);
+ xen_string_string_map_free(record->qos_algorithm_params);
xen_vif_metrics_record_opt_free(record->metrics);
free(record);
}
@@ -246,6 +255,40 @@ xen_vif_get_mtu(xen_session *session, int64_t *result, xen_vif vif)
bool
+xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vif }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VIF.get_qos_algorithm_type");
+ return session->ok;
+}
+
+
+bool
+xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vif }
+ };
+
+ abstract_type result_type = abstract_type_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("VIF.get_qos_algorithm_params");
+ return session->ok;
+}
+
+
+bool
xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif vif)
{
abstract_value param_values[] =
@@ -311,6 +354,72 @@ xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu)
bool
+xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vif },
+ { .type = &abstract_type_string,
+ .u.string_val = algorithm_type }
+ };
+
+ xen_call_(session, "VIF.set_qos_algorithm_type", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vif },
+ { .type = &abstract_type_string_string_map,
+ .u.set_val = (arbitrary_set *)algorithm_params }
+ };
+
+ xen_call_(session, "VIF.set_qos_algorithm_params", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vif },
+ { .type = &abstract_type_string,
+ .u.string_val = key },
+ { .type = &abstract_type_string,
+ .u.string_val = value }
+ };
+
+ xen_call_(session, "VIF.add_to_qos_algorithm_params", param_values, 3, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
+xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vif },
+ { .type = &abstract_type_string,
+ .u.string_val = key }
+ };
+
+ xen_call_(session, "VIF.remove_from_qos_algorithm_params", param_values, 2, NULL, NULL);
+ return session->ok;
+}
+
+
+bool
xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif)
{
*result = session->ok ? xen_strdup_((char *)vif) : NULL;