ia64/xen-unstable

changeset 14047:bab07bed5c0a

Added modelling and C bindings for VIF/VBD QoS parameter setting. No Xend
implementation yet.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Feb 20 22:40:55 2007 +0000 (2007-02-20)
parents 0aa6755159d5
children e0e300fda3f0
files docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_vbd.h tools/libxen/include/xen_vif.h tools/libxen/src/xen_vbd.c tools/libxen/src/xen_vif.c
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Tue Feb 20 21:55:11 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Tue Feb 20 22:40:55 2007 +0000
     1.3 @@ -6710,6 +6710,8 @@ Quals & Field & Type & Description \\
     1.4  $\mathit{RO}_\mathit{ins}$ &  {\tt VM} & VM ref & virtual machine to which this vif is connected \\
     1.5  $\mathit{RW}$ &  {\tt MAC} & string & ethernet MAC address of virtual interface, as exposed to guest \\
     1.6  $\mathit{RW}$ &  {\tt MTU} & int & MTU in octets \\
     1.7 +$\mathit{RW}$ &  {\tt qos/algorithm\_type} & string & QoS algorithm to use \\
     1.8 +$\mathit{RW}$ &  {\tt qos/algorithm\_params} & (string $\rightarrow$ string) Map & Paramters for chosen QoS algorithm \\
     1.9  $\mathit{RO}_\mathit{run}$ &  {\tt metrics} & VIF\_metrics ref & metrics associated with this VIF. \\
    1.10  \hline
    1.11  \end{longtable}
    1.12 @@ -7008,6 +7010,211 @@ void
    1.13  \vspace{0.3cm}
    1.14  \vspace{0.3cm}
    1.15  \vspace{0.3cm}
    1.16 +\subsubsection{RPC name:~get\_qos\_algorithm\_type}
    1.17 +
    1.18 +{\bf Overview:} 
    1.19 +Get the qos/algorithm\_type field of the given VIF.
    1.20 +
    1.21 + \noindent {\bf Signature:} 
    1.22 +\begin{verbatim} string get_qos_algorithm_type (session_id s, VIF ref self)\end{verbatim}
    1.23 +
    1.24 +
    1.25 +\noindent{\bf Arguments:}
    1.26 +
    1.27 + 
    1.28 +\vspace{0.3cm}
    1.29 +\begin{tabular}{|c|c|p{7cm}|}
    1.30 + \hline
    1.31 +{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.32 +{\tt VIF ref } & self & reference to the object \\ \hline 
    1.33 +
    1.34 +\end{tabular}
    1.35 +
    1.36 +\vspace{0.3cm}
    1.37 +
    1.38 + \noindent {\bf Return Type:} 
    1.39 +{\tt 
    1.40 +string
    1.41 +}
    1.42 +
    1.43 +
    1.44 +value of the field
    1.45 +\vspace{0.3cm}
    1.46 +\vspace{0.3cm}
    1.47 +\vspace{0.3cm}
    1.48 +\subsubsection{RPC name:~set\_qos\_algorithm\_type}
    1.49 +
    1.50 +{\bf Overview:} 
    1.51 +Set the qos/algorithm\_type field of the given VIF.
    1.52 +
    1.53 + \noindent {\bf Signature:} 
    1.54 +\begin{verbatim} void set_qos_algorithm_type (session_id s, VIF ref self, string value)\end{verbatim}
    1.55 +
    1.56 +
    1.57 +\noindent{\bf Arguments:}
    1.58 +
    1.59 + 
    1.60 +\vspace{0.3cm}
    1.61 +\begin{tabular}{|c|c|p{7cm}|}
    1.62 + \hline
    1.63 +{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.64 +{\tt VIF ref } & self & reference to the object \\ \hline 
    1.65 +
    1.66 +{\tt string } & value & New value to set \\ \hline 
    1.67 +
    1.68 +\end{tabular}
    1.69 +
    1.70 +\vspace{0.3cm}
    1.71 +
    1.72 + \noindent {\bf Return Type:} 
    1.73 +{\tt 
    1.74 +void
    1.75 +}
    1.76 +
    1.77 +
    1.78 +
    1.79 +\vspace{0.3cm}
    1.80 +\vspace{0.3cm}
    1.81 +\vspace{0.3cm}
    1.82 +\subsubsection{RPC name:~get\_qos\_algorithm\_params}
    1.83 +
    1.84 +{\bf Overview:} 
    1.85 +Get the qos/algorithm\_params field of the given VIF.
    1.86 +
    1.87 + \noindent {\bf Signature:} 
    1.88 +\begin{verbatim} ((string -> string) Map) get_qos_algorithm_params (session_id s, VIF ref self)\end{verbatim}
    1.89 +
    1.90 +
    1.91 +\noindent{\bf Arguments:}
    1.92 +
    1.93 + 
    1.94 +\vspace{0.3cm}
    1.95 +\begin{tabular}{|c|c|p{7cm}|}
    1.96 + \hline
    1.97 +{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.98 +{\tt VIF ref } & self & reference to the object \\ \hline 
    1.99 +
   1.100 +\end{tabular}
   1.101 +
   1.102 +\vspace{0.3cm}
   1.103 +
   1.104 + \noindent {\bf Return Type:} 
   1.105 +{\tt 
   1.106 +(string $\rightarrow$ string) Map
   1.107 +}
   1.108 +
   1.109 +
   1.110 +value of the field
   1.111 +\vspace{0.3cm}
   1.112 +\vspace{0.3cm}
   1.113 +\vspace{0.3cm}
   1.114 +\subsubsection{RPC name:~set\_qos\_algorithm\_params}
   1.115 +
   1.116 +{\bf Overview:} 
   1.117 +Set the qos/algorithm\_params field of the given VIF.
   1.118 +
   1.119 + \noindent {\bf Signature:} 
   1.120 +\begin{verbatim} void set_qos_algorithm_params (session_id s, VIF ref self, (string -> string) Map value)\end{verbatim}
   1.121 +
   1.122 +
   1.123 +\noindent{\bf Arguments:}
   1.124 +
   1.125 + 
   1.126 +\vspace{0.3cm}
   1.127 +\begin{tabular}{|c|c|p{7cm}|}
   1.128 + \hline
   1.129 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.130 +{\tt VIF ref } & self & reference to the object \\ \hline 
   1.131 +
   1.132 +{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 
   1.133 +
   1.134 +\end{tabular}
   1.135 +
   1.136 +\vspace{0.3cm}
   1.137 +
   1.138 + \noindent {\bf Return Type:} 
   1.139 +{\tt 
   1.140 +void
   1.141 +}
   1.142 +
   1.143 +
   1.144 +
   1.145 +\vspace{0.3cm}
   1.146 +\vspace{0.3cm}
   1.147 +\vspace{0.3cm}
   1.148 +\subsubsection{RPC name:~add\_to\_qos\_algorithm\_params}
   1.149 +
   1.150 +{\bf Overview:} 
   1.151 +Add the given key-value pair to the qos/algorithm\_params field of the
   1.152 +given VIF.
   1.153 +
   1.154 + \noindent {\bf Signature:} 
   1.155 +\begin{verbatim} void add_to_qos_algorithm_params (session_id s, VIF ref self, string key, string value)\end{verbatim}
   1.156 +
   1.157 +
   1.158 +\noindent{\bf Arguments:}
   1.159 +
   1.160 + 
   1.161 +\vspace{0.3cm}
   1.162 +\begin{tabular}{|c|c|p{7cm}|}
   1.163 + \hline
   1.164 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.165 +{\tt VIF ref } & self & reference to the object \\ \hline 
   1.166 +
   1.167 +{\tt string } & key & Key to add \\ \hline 
   1.168 +
   1.169 +{\tt string } & value & Value to add \\ \hline 
   1.170 +
   1.171 +\end{tabular}
   1.172 +
   1.173 +\vspace{0.3cm}
   1.174 +
   1.175 + \noindent {\bf Return Type:} 
   1.176 +{\tt 
   1.177 +void
   1.178 +}
   1.179 +
   1.180 +
   1.181 +
   1.182 +\vspace{0.3cm}
   1.183 +\vspace{0.3cm}
   1.184 +\vspace{0.3cm}
   1.185 +\subsubsection{RPC name:~remove\_from\_qos\_algorithm\_params}
   1.186 +
   1.187 +{\bf Overview:} 
   1.188 +Remove the given key and its corresponding value from the
   1.189 +qos/algorithm\_params field of the given VIF.  If the key is not in that
   1.190 +Map, then do nothing.
   1.191 +
   1.192 + \noindent {\bf Signature:} 
   1.193 +\begin{verbatim} void remove_from_qos_algorithm_params (session_id s, VIF ref self, string key)\end{verbatim}
   1.194 +
   1.195 +
   1.196 +\noindent{\bf Arguments:}
   1.197 +
   1.198 + 
   1.199 +\vspace{0.3cm}
   1.200 +\begin{tabular}{|c|c|p{7cm}|}
   1.201 + \hline
   1.202 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.203 +{\tt VIF ref } & self & reference to the object \\ \hline 
   1.204 +
   1.205 +{\tt string } & key & Key to remove \\ \hline 
   1.206 +
   1.207 +\end{tabular}
   1.208 +
   1.209 +\vspace{0.3cm}
   1.210 +
   1.211 + \noindent {\bf Return Type:} 
   1.212 +{\tt 
   1.213 +void
   1.214 +}
   1.215 +
   1.216 +
   1.217 +
   1.218 +\vspace{0.3cm}
   1.219 +\vspace{0.3cm}
   1.220 +\vspace{0.3cm}
   1.221  \subsubsection{RPC name:~get\_metrics}
   1.222  
   1.223  {\bf Overview:} 
   1.224 @@ -9610,6 +9817,8 @@ Quals & Field & Type & Description \\
   1.225  $\mathit{RW}$ &  {\tt bootable} & bool & true if this VBD is bootable \\
   1.226  $\mathit{RW}$ &  {\tt mode} & vbd\_mode & the mode the VBD should be mounted with \\
   1.227  $\mathit{RW}$ &  {\tt type} & vbd\_type & how the VBD will appear to the guest (e.g. disk or CD) \\
   1.228 +$\mathit{RW}$ &  {\tt qos/algorithm\_type} & string & QoS algorithm to use \\
   1.229 +$\mathit{RW}$ &  {\tt qos/algorithm\_params} & (string $\rightarrow$ string) Map & Paramters for chosen QoS algorithm \\
   1.230  $\mathit{RO}_\mathit{run}$ &  {\tt metrics} & VBD\_metrics ref & metrics associated with this VBD. \\
   1.231  \hline
   1.232  \end{longtable}
   1.233 @@ -10009,6 +10218,211 @@ void
   1.234  \vspace{0.3cm}
   1.235  \vspace{0.3cm}
   1.236  \vspace{0.3cm}
   1.237 +\subsubsection{RPC name:~get\_qos\_algorithm\_type}
   1.238 +
   1.239 +{\bf Overview:} 
   1.240 +Get the qos/algorithm\_type field of the given VBD.
   1.241 +
   1.242 + \noindent {\bf Signature:} 
   1.243 +\begin{verbatim} string get_qos_algorithm_type (session_id s, VBD ref self)\end{verbatim}
   1.244 +
   1.245 +
   1.246 +\noindent{\bf Arguments:}
   1.247 +
   1.248 + 
   1.249 +\vspace{0.3cm}
   1.250 +\begin{tabular}{|c|c|p{7cm}|}
   1.251 + \hline
   1.252 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.253 +{\tt VBD ref } & self & reference to the object \\ \hline 
   1.254 +
   1.255 +\end{tabular}
   1.256 +
   1.257 +\vspace{0.3cm}
   1.258 +
   1.259 + \noindent {\bf Return Type:} 
   1.260 +{\tt 
   1.261 +string
   1.262 +}
   1.263 +
   1.264 +
   1.265 +value of the field
   1.266 +\vspace{0.3cm}
   1.267 +\vspace{0.3cm}
   1.268 +\vspace{0.3cm}
   1.269 +\subsubsection{RPC name:~set\_qos\_algorithm\_type}
   1.270 +
   1.271 +{\bf Overview:} 
   1.272 +Set the qos/algorithm\_type field of the given VBD.
   1.273 +
   1.274 + \noindent {\bf Signature:} 
   1.275 +\begin{verbatim} void set_qos_algorithm_type (session_id s, VBD ref self, string value)\end{verbatim}
   1.276 +
   1.277 +
   1.278 +\noindent{\bf Arguments:}
   1.279 +
   1.280 + 
   1.281 +\vspace{0.3cm}
   1.282 +\begin{tabular}{|c|c|p{7cm}|}
   1.283 + \hline
   1.284 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.285 +{\tt VBD ref } & self & reference to the object \\ \hline 
   1.286 +
   1.287 +{\tt string } & value & New value to set \\ \hline 
   1.288 +
   1.289 +\end{tabular}
   1.290 +
   1.291 +\vspace{0.3cm}
   1.292 +
   1.293 + \noindent {\bf Return Type:} 
   1.294 +{\tt 
   1.295 +void
   1.296 +}
   1.297 +
   1.298 +
   1.299 +
   1.300 +\vspace{0.3cm}
   1.301 +\vspace{0.3cm}
   1.302 +\vspace{0.3cm}
   1.303 +\subsubsection{RPC name:~get\_qos\_algorithm\_params}
   1.304 +
   1.305 +{\bf Overview:} 
   1.306 +Get the qos/algorithm\_params field of the given VBD.
   1.307 +
   1.308 + \noindent {\bf Signature:} 
   1.309 +\begin{verbatim} ((string -> string) Map) get_qos_algorithm_params (session_id s, VBD ref self)\end{verbatim}
   1.310 +
   1.311 +
   1.312 +\noindent{\bf Arguments:}
   1.313 +
   1.314 + 
   1.315 +\vspace{0.3cm}
   1.316 +\begin{tabular}{|c|c|p{7cm}|}
   1.317 + \hline
   1.318 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.319 +{\tt VBD ref } & self & reference to the object \\ \hline 
   1.320 +
   1.321 +\end{tabular}
   1.322 +
   1.323 +\vspace{0.3cm}
   1.324 +
   1.325 + \noindent {\bf Return Type:} 
   1.326 +{\tt 
   1.327 +(string $\rightarrow$ string) Map
   1.328 +}
   1.329 +
   1.330 +
   1.331 +value of the field
   1.332 +\vspace{0.3cm}
   1.333 +\vspace{0.3cm}
   1.334 +\vspace{0.3cm}
   1.335 +\subsubsection{RPC name:~set\_qos\_algorithm\_params}
   1.336 +
   1.337 +{\bf Overview:} 
   1.338 +Set the qos/algorithm\_params field of the given VBD.
   1.339 +
   1.340 + \noindent {\bf Signature:} 
   1.341 +\begin{verbatim} void set_qos_algorithm_params (session_id s, VBD ref self, (string -> string) Map value)\end{verbatim}
   1.342 +
   1.343 +
   1.344 +\noindent{\bf Arguments:}
   1.345 +
   1.346 + 
   1.347 +\vspace{0.3cm}
   1.348 +\begin{tabular}{|c|c|p{7cm}|}
   1.349 + \hline
   1.350 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.351 +{\tt VBD ref } & self & reference to the object \\ \hline 
   1.352 +
   1.353 +{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 
   1.354 +
   1.355 +\end{tabular}
   1.356 +
   1.357 +\vspace{0.3cm}
   1.358 +
   1.359 + \noindent {\bf Return Type:} 
   1.360 +{\tt 
   1.361 +void
   1.362 +}
   1.363 +
   1.364 +
   1.365 +
   1.366 +\vspace{0.3cm}
   1.367 +\vspace{0.3cm}
   1.368 +\vspace{0.3cm}
   1.369 +\subsubsection{RPC name:~add\_to\_qos\_algorithm\_params}
   1.370 +
   1.371 +{\bf Overview:} 
   1.372 +Add the given key-value pair to the qos/algorithm\_params field of the
   1.373 +given VBD.
   1.374 +
   1.375 + \noindent {\bf Signature:} 
   1.376 +\begin{verbatim} void add_to_qos_algorithm_params (session_id s, VBD ref self, string key, string value)\end{verbatim}
   1.377 +
   1.378 +
   1.379 +\noindent{\bf Arguments:}
   1.380 +
   1.381 + 
   1.382 +\vspace{0.3cm}
   1.383 +\begin{tabular}{|c|c|p{7cm}|}
   1.384 + \hline
   1.385 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.386 +{\tt VBD ref } & self & reference to the object \\ \hline 
   1.387 +
   1.388 +{\tt string } & key & Key to add \\ \hline 
   1.389 +
   1.390 +{\tt string } & value & Value to add \\ \hline 
   1.391 +
   1.392 +\end{tabular}
   1.393 +
   1.394 +\vspace{0.3cm}
   1.395 +
   1.396 + \noindent {\bf Return Type:} 
   1.397 +{\tt 
   1.398 +void
   1.399 +}
   1.400 +
   1.401 +
   1.402 +
   1.403 +\vspace{0.3cm}
   1.404 +\vspace{0.3cm}
   1.405 +\vspace{0.3cm}
   1.406 +\subsubsection{RPC name:~remove\_from\_qos\_algorithm\_params}
   1.407 +
   1.408 +{\bf Overview:} 
   1.409 +Remove the given key and its corresponding value from the
   1.410 +qos/algorithm\_params field of the given VBD.  If the key is not in that
   1.411 +Map, then do nothing.
   1.412 +
   1.413 + \noindent {\bf Signature:} 
   1.414 +\begin{verbatim} void remove_from_qos_algorithm_params (session_id s, VBD ref self, string key)\end{verbatim}
   1.415 +
   1.416 +
   1.417 +\noindent{\bf Arguments:}
   1.418 +
   1.419 + 
   1.420 +\vspace{0.3cm}
   1.421 +\begin{tabular}{|c|c|p{7cm}|}
   1.422 + \hline
   1.423 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.424 +{\tt VBD ref } & self & reference to the object \\ \hline 
   1.425 +
   1.426 +{\tt string } & key & Key to remove \\ \hline 
   1.427 +
   1.428 +\end{tabular}
   1.429 +
   1.430 +\vspace{0.3cm}
   1.431 +
   1.432 + \noindent {\bf Return Type:} 
   1.433 +{\tt 
   1.434 +void
   1.435 +}
   1.436 +
   1.437 +
   1.438 +
   1.439 +\vspace{0.3cm}
   1.440 +\vspace{0.3cm}
   1.441 +\vspace{0.3cm}
   1.442  \subsubsection{RPC name:~get\_metrics}
   1.443  
   1.444  {\bf Overview:} 
     2.1 --- a/tools/libxen/include/xen_vbd.h	Tue Feb 20 21:55:11 2007 +0000
     2.2 +++ b/tools/libxen/include/xen_vbd.h	Tue Feb 20 22:40:55 2007 +0000
     2.3 @@ -20,6 +20,7 @@
     2.4  #define XEN_VBD_H
     2.5  
     2.6  #include "xen_common.h"
     2.7 +#include "xen_string_string_map.h"
     2.8  #include "xen_vbd_decl.h"
     2.9  #include "xen_vbd_metrics_decl.h"
    2.10  #include "xen_vbd_mode.h"
    2.11 @@ -74,6 +75,8 @@ typedef struct xen_vbd_record
    2.12      bool bootable;
    2.13      enum xen_vbd_mode mode;
    2.14      enum xen_vbd_type type;
    2.15 +    char *qos_algorithm_type;
    2.16 +    xen_string_string_map *qos_algorithm_params;
    2.17      struct xen_vbd_metrics_record_opt *metrics;
    2.18  } xen_vbd_record;
    2.19  
    2.20 @@ -234,6 +237,20 @@ xen_vbd_get_type(xen_session *session, e
    2.21  
    2.22  
    2.23  /**
    2.24 + * Get the qos/algorithm_type field of the given VBD.
    2.25 + */
    2.26 +extern bool
    2.27 +xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd vbd);
    2.28 +
    2.29 +
    2.30 +/**
    2.31 + * Get the qos/algorithm_params field of the given VBD.
    2.32 + */
    2.33 +extern bool
    2.34 +xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd);
    2.35 +
    2.36 +
    2.37 +/**
    2.38   * Get the metrics field of the given VBD.
    2.39   */
    2.40  extern bool
    2.41 @@ -269,6 +286,37 @@ xen_vbd_set_type(xen_session *session, x
    2.42  
    2.43  
    2.44  /**
    2.45 + * Set the qos/algorithm_type field of the given VBD.
    2.46 + */
    2.47 +extern bool
    2.48 +xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char *algorithm_type);
    2.49 +
    2.50 +
    2.51 +/**
    2.52 + * Set the qos/algorithm_params field of the given VBD.
    2.53 + */
    2.54 +extern bool
    2.55 +xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, xen_string_string_map *algorithm_params);
    2.56 +
    2.57 +
    2.58 +/**
    2.59 + * Add the given key-value pair to the qos/algorithm_params field of
    2.60 + * the given VBD.
    2.61 + */
    2.62 +extern bool
    2.63 +xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key, char *value);
    2.64 +
    2.65 +
    2.66 +/**
    2.67 + * Remove the given key and its corresponding value from the
    2.68 + * qos/algorithm_params field of the given VBD.  If the key is not in that
    2.69 + * Map, then do nothing.
    2.70 + */
    2.71 +extern bool
    2.72 +xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key);
    2.73 +
    2.74 +
    2.75 +/**
    2.76   * Change the media in the device for CDROM-like devices only. For
    2.77   * other devices, detach the VBD and attach a new one
    2.78   */
     3.1 --- a/tools/libxen/include/xen_vif.h	Tue Feb 20 21:55:11 2007 +0000
     3.2 +++ b/tools/libxen/include/xen_vif.h	Tue Feb 20 22:40:55 2007 +0000
     3.3 @@ -21,6 +21,7 @@
     3.4  
     3.5  #include "xen_common.h"
     3.6  #include "xen_network_decl.h"
     3.7 +#include "xen_string_string_map.h"
     3.8  #include "xen_vif_decl.h"
     3.9  #include "xen_vif_metrics_decl.h"
    3.10  #include "xen_vm_decl.h"
    3.11 @@ -70,6 +71,8 @@ typedef struct xen_vif_record
    3.12      struct xen_vm_record_opt *vm;
    3.13      char *mac;
    3.14      int64_t mtu;
    3.15 +    char *qos_algorithm_type;
    3.16 +    xen_string_string_map *qos_algorithm_params;
    3.17      struct xen_vif_metrics_record_opt *metrics;
    3.18  } xen_vif_record;
    3.19  
    3.20 @@ -223,6 +226,20 @@ xen_vif_get_mtu(xen_session *session, in
    3.21  
    3.22  
    3.23  /**
    3.24 + * Get the qos/algorithm_type field of the given VIF.
    3.25 + */
    3.26 +extern bool
    3.27 +xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif);
    3.28 +
    3.29 +
    3.30 +/**
    3.31 + * Get the qos/algorithm_params field of the given VIF.
    3.32 + */
    3.33 +extern bool
    3.34 +xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif);
    3.35 +
    3.36 +
    3.37 +/**
    3.38   * Get the metrics field of the given VIF.
    3.39   */
    3.40  extern bool
    3.41 @@ -250,4 +267,35 @@ extern bool
    3.42  xen_vif_set_mtu(xen_session *session, xen_vif vif, int64_t mtu);
    3.43  
    3.44  
    3.45 +/**
    3.46 + * Set the qos/algorithm_type field of the given VIF.
    3.47 + */
    3.48 +extern bool
    3.49 +xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type);
    3.50 +
    3.51 +
    3.52 +/**
    3.53 + * Set the qos/algorithm_params field of the given VIF.
    3.54 + */
    3.55 +extern bool
    3.56 +xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params);
    3.57 +
    3.58 +
    3.59 +/**
    3.60 + * Add the given key-value pair to the qos/algorithm_params field of
    3.61 + * the given VIF.
    3.62 + */
    3.63 +extern bool
    3.64 +xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value);
    3.65 +
    3.66 +
    3.67 +/**
    3.68 + * Remove the given key and its corresponding value from the
    3.69 + * qos/algorithm_params field of the given VIF.  If the key is not in that
    3.70 + * Map, then do nothing.
    3.71 + */
    3.72 +extern bool
    3.73 +xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key);
    3.74 +
    3.75 +
    3.76  #endif
     4.1 --- a/tools/libxen/src/xen_vbd.c	Tue Feb 20 21:55:11 2007 +0000
     4.2 +++ b/tools/libxen/src/xen_vbd.c	Tue Feb 20 22:40:55 2007 +0000
     4.3 @@ -22,6 +22,7 @@
     4.4  
     4.5  #include "xen_common.h"
     4.6  #include "xen_internal.h"
     4.7 +#include "xen_string_string_map.h"
     4.8  #include "xen_vbd.h"
     4.9  #include "xen_vbd_metrics.h"
    4.10  #include "xen_vbd_mode_internal.h"
    4.11 @@ -65,6 +66,12 @@ static const struct_member xen_vbd_recor
    4.12          { .key = "type",
    4.13            .type = &xen_vbd_type_abstract_type_,
    4.14            .offset = offsetof(xen_vbd_record, type) },
    4.15 +        { .key = "qos_algorithm_type",
    4.16 +          .type = &abstract_type_string,
    4.17 +          .offset = offsetof(xen_vbd_record, qos_algorithm_type) },
    4.18 +        { .key = "qos_algorithm_params",
    4.19 +          .type = &abstract_type_string_string_map,
    4.20 +          .offset = offsetof(xen_vbd_record, qos_algorithm_params) },
    4.21          { .key = "metrics",
    4.22            .type = &abstract_type_ref,
    4.23            .offset = offsetof(xen_vbd_record, metrics) }
    4.24 @@ -92,6 +99,8 @@ xen_vbd_record_free(xen_vbd_record *reco
    4.25      xen_vm_record_opt_free(record->vm);
    4.26      xen_vdi_record_opt_free(record->vdi);
    4.27      free(record->device);
    4.28 +    free(record->qos_algorithm_type);
    4.29 +    xen_string_string_map_free(record->qos_algorithm_params);
    4.30      xen_vbd_metrics_record_opt_free(record->metrics);
    4.31      free(record);
    4.32  }
    4.33 @@ -266,6 +275,40 @@ xen_vbd_get_type(xen_session *session, e
    4.34  
    4.35  
    4.36  bool
    4.37 +xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd vbd)
    4.38 +{
    4.39 +    abstract_value param_values[] =
    4.40 +        {
    4.41 +            { .type = &abstract_type_string,
    4.42 +              .u.string_val = vbd }
    4.43 +        };
    4.44 +
    4.45 +    abstract_type result_type = abstract_type_string;
    4.46 +
    4.47 +    *result = NULL;
    4.48 +    XEN_CALL_("VBD.get_qos_algorithm_type");
    4.49 +    return session->ok;
    4.50 +}
    4.51 +
    4.52 +
    4.53 +bool
    4.54 +xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd)
    4.55 +{
    4.56 +    abstract_value param_values[] =
    4.57 +        {
    4.58 +            { .type = &abstract_type_string,
    4.59 +              .u.string_val = vbd }
    4.60 +        };
    4.61 +
    4.62 +    abstract_type result_type = abstract_type_string_string_map;
    4.63 +
    4.64 +    *result = NULL;
    4.65 +    XEN_CALL_("VBD.get_qos_algorithm_params");
    4.66 +    return session->ok;
    4.67 +}
    4.68 +
    4.69 +
    4.70 +bool
    4.71  xen_vbd_get_metrics(xen_session *session, xen_vbd_metrics *result, xen_vbd vbd)
    4.72  {
    4.73      abstract_value param_values[] =
    4.74 @@ -347,6 +390,72 @@ xen_vbd_set_type(xen_session *session, x
    4.75  
    4.76  
    4.77  bool
    4.78 +xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char *algorithm_type)
    4.79 +{
    4.80 +    abstract_value param_values[] =
    4.81 +        {
    4.82 +            { .type = &abstract_type_string,
    4.83 +              .u.string_val = vbd },
    4.84 +            { .type = &abstract_type_string,
    4.85 +              .u.string_val = algorithm_type }
    4.86 +        };
    4.87 +
    4.88 +    xen_call_(session, "VBD.set_qos_algorithm_type", param_values, 2, NULL, NULL);
    4.89 +    return session->ok;
    4.90 +}
    4.91 +
    4.92 +
    4.93 +bool
    4.94 +xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, xen_string_string_map *algorithm_params)
    4.95 +{
    4.96 +    abstract_value param_values[] =
    4.97 +        {
    4.98 +            { .type = &abstract_type_string,
    4.99 +              .u.string_val = vbd },
   4.100 +            { .type = &abstract_type_string_string_map,
   4.101 +              .u.set_val = (arbitrary_set *)algorithm_params }
   4.102 +        };
   4.103 +
   4.104 +    xen_call_(session, "VBD.set_qos_algorithm_params", param_values, 2, NULL, NULL);
   4.105 +    return session->ok;
   4.106 +}
   4.107 +
   4.108 +
   4.109 +bool
   4.110 +xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key, char *value)
   4.111 +{
   4.112 +    abstract_value param_values[] =
   4.113 +        {
   4.114 +            { .type = &abstract_type_string,
   4.115 +              .u.string_val = vbd },
   4.116 +            { .type = &abstract_type_string,
   4.117 +              .u.string_val = key },
   4.118 +            { .type = &abstract_type_string,
   4.119 +              .u.string_val = value }
   4.120 +        };
   4.121 +
   4.122 +    xen_call_(session, "VBD.add_to_qos_algorithm_params", param_values, 3, NULL, NULL);
   4.123 +    return session->ok;
   4.124 +}
   4.125 +
   4.126 +
   4.127 +bool
   4.128 +xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key)
   4.129 +{
   4.130 +    abstract_value param_values[] =
   4.131 +        {
   4.132 +            { .type = &abstract_type_string,
   4.133 +              .u.string_val = vbd },
   4.134 +            { .type = &abstract_type_string,
   4.135 +              .u.string_val = key }
   4.136 +        };
   4.137 +
   4.138 +    xen_call_(session, "VBD.remove_from_qos_algorithm_params", param_values, 2, NULL, NULL);
   4.139 +    return session->ok;
   4.140 +}
   4.141 +
   4.142 +
   4.143 +bool
   4.144  xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi)
   4.145  {
   4.146      abstract_value param_values[] =
     5.1 --- a/tools/libxen/src/xen_vif.c	Tue Feb 20 21:55:11 2007 +0000
     5.2 +++ b/tools/libxen/src/xen_vif.c	Tue Feb 20 22:40:55 2007 +0000
     5.3 @@ -23,6 +23,7 @@
     5.4  #include "xen_common.h"
     5.5  #include "xen_internal.h"
     5.6  #include "xen_network.h"
     5.7 +#include "xen_string_string_map.h"
     5.8  #include "xen_vif.h"
     5.9  #include "xen_vif_metrics.h"
    5.10  #include "xen_vm.h"
    5.11 @@ -57,6 +58,12 @@ static const struct_member xen_vif_recor
    5.12          { .key = "MTU",
    5.13            .type = &abstract_type_int,
    5.14            .offset = offsetof(xen_vif_record, mtu) },
    5.15 +        { .key = "qos_algorithm_type",
    5.16 +          .type = &abstract_type_string,
    5.17 +          .offset = offsetof(xen_vif_record, qos_algorithm_type) },
    5.18 +        { .key = "qos_algorithm_params",
    5.19 +          .type = &abstract_type_string_string_map,
    5.20 +          .offset = offsetof(xen_vif_record, qos_algorithm_params) },
    5.21          { .key = "metrics",
    5.22            .type = &abstract_type_ref,
    5.23            .offset = offsetof(xen_vif_record, metrics) }
    5.24 @@ -85,6 +92,8 @@ xen_vif_record_free(xen_vif_record *reco
    5.25      xen_network_record_opt_free(record->network);
    5.26      xen_vm_record_opt_free(record->vm);
    5.27      free(record->mac);
    5.28 +    free(record->qos_algorithm_type);
    5.29 +    xen_string_string_map_free(record->qos_algorithm_params);
    5.30      xen_vif_metrics_record_opt_free(record->metrics);
    5.31      free(record);
    5.32  }
    5.33 @@ -246,6 +255,40 @@ xen_vif_get_mtu(xen_session *session, in
    5.34  
    5.35  
    5.36  bool
    5.37 +xen_vif_get_qos_algorithm_type(xen_session *session, char **result, xen_vif vif)
    5.38 +{
    5.39 +    abstract_value param_values[] =
    5.40 +        {
    5.41 +            { .type = &abstract_type_string,
    5.42 +              .u.string_val = vif }
    5.43 +        };
    5.44 +
    5.45 +    abstract_type result_type = abstract_type_string;
    5.46 +
    5.47 +    *result = NULL;
    5.48 +    XEN_CALL_("VIF.get_qos_algorithm_type");
    5.49 +    return session->ok;
    5.50 +}
    5.51 +
    5.52 +
    5.53 +bool
    5.54 +xen_vif_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vif vif)
    5.55 +{
    5.56 +    abstract_value param_values[] =
    5.57 +        {
    5.58 +            { .type = &abstract_type_string,
    5.59 +              .u.string_val = vif }
    5.60 +        };
    5.61 +
    5.62 +    abstract_type result_type = abstract_type_string_string_map;
    5.63 +
    5.64 +    *result = NULL;
    5.65 +    XEN_CALL_("VIF.get_qos_algorithm_params");
    5.66 +    return session->ok;
    5.67 +}
    5.68 +
    5.69 +
    5.70 +bool
    5.71  xen_vif_get_metrics(xen_session *session, xen_vif_metrics *result, xen_vif vif)
    5.72  {
    5.73      abstract_value param_values[] =
    5.74 @@ -311,6 +354,72 @@ xen_vif_set_mtu(xen_session *session, xe
    5.75  
    5.76  
    5.77  bool
    5.78 +xen_vif_set_qos_algorithm_type(xen_session *session, xen_vif vif, char *algorithm_type)
    5.79 +{
    5.80 +    abstract_value param_values[] =
    5.81 +        {
    5.82 +            { .type = &abstract_type_string,
    5.83 +              .u.string_val = vif },
    5.84 +            { .type = &abstract_type_string,
    5.85 +              .u.string_val = algorithm_type }
    5.86 +        };
    5.87 +
    5.88 +    xen_call_(session, "VIF.set_qos_algorithm_type", param_values, 2, NULL, NULL);
    5.89 +    return session->ok;
    5.90 +}
    5.91 +
    5.92 +
    5.93 +bool
    5.94 +xen_vif_set_qos_algorithm_params(xen_session *session, xen_vif vif, xen_string_string_map *algorithm_params)
    5.95 +{
    5.96 +    abstract_value param_values[] =
    5.97 +        {
    5.98 +            { .type = &abstract_type_string,
    5.99 +              .u.string_val = vif },
   5.100 +            { .type = &abstract_type_string_string_map,
   5.101 +              .u.set_val = (arbitrary_set *)algorithm_params }
   5.102 +        };
   5.103 +
   5.104 +    xen_call_(session, "VIF.set_qos_algorithm_params", param_values, 2, NULL, NULL);
   5.105 +    return session->ok;
   5.106 +}
   5.107 +
   5.108 +
   5.109 +bool
   5.110 +xen_vif_add_to_qos_algorithm_params(xen_session *session, xen_vif vif, char *key, char *value)
   5.111 +{
   5.112 +    abstract_value param_values[] =
   5.113 +        {
   5.114 +            { .type = &abstract_type_string,
   5.115 +              .u.string_val = vif },
   5.116 +            { .type = &abstract_type_string,
   5.117 +              .u.string_val = key },
   5.118 +            { .type = &abstract_type_string,
   5.119 +              .u.string_val = value }
   5.120 +        };
   5.121 +
   5.122 +    xen_call_(session, "VIF.add_to_qos_algorithm_params", param_values, 3, NULL, NULL);
   5.123 +    return session->ok;
   5.124 +}
   5.125 +
   5.126 +
   5.127 +bool
   5.128 +xen_vif_remove_from_qos_algorithm_params(xen_session *session, xen_vif vif, char *key)
   5.129 +{
   5.130 +    abstract_value param_values[] =
   5.131 +        {
   5.132 +            { .type = &abstract_type_string,
   5.133 +              .u.string_val = vif },
   5.134 +            { .type = &abstract_type_string,
   5.135 +              .u.string_val = key }
   5.136 +        };
   5.137 +
   5.138 +    xen_call_(session, "VIF.remove_from_qos_algorithm_params", param_values, 2, NULL, NULL);
   5.139 +    return session->ok;
   5.140 +}
   5.141 +
   5.142 +
   5.143 +bool
   5.144  xen_vif_get_uuid(xen_session *session, char **result, xen_vif vif)
   5.145  {
   5.146      *result = session->ok ? xen_strdup_((char *)vif) : NULL;