direct-io.hg

changeset 14423:2adbc1d22fe7

Replace VDI.location with a more generic VDI.other_config map. Remove
VDI.sector_size.

Xend work by Tom Wilkie <tom.wilkie@gmail.com>.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Sat Mar 17 23:55:03 2007 +0000 (2007-03-17)
parents f40bd358129a
children cfb265b93b2d
files docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_vbd.h tools/libxen/include/xen_vdi.h tools/libxen/src/xen_vbd.c tools/libxen/src/xen_vdi.c tools/libxen/test/test_bindings.c tools/python/scripts/test_hvm_create.py tools/python/scripts/test_vm_create.py tools/python/scripts/xapi.py tools/python/scripts/xapi.vdicfg.py tools/python/xen/xend/XendAPI.py tools/python/xen/xend/XendVDI.py
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Sat Mar 17 16:56:39 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Sat Mar 17 23:55:03 2007 +0000
     1.3 @@ -9359,10 +9359,10 @@ Quals & Field & Type & Description \\
     1.4  $\mathit{RO}_\mathit{run}$ &  {\tt crash\_dumps} & (crashdump ref) Set & list of crash dumps that refer to this disk \\
     1.5  $\mathit{RW}$ &  {\tt virtual\_size} & int & size of disk as presented to the guest (in bytes). Note that, depending on storage backend type, requested size may not be respected exactly \\
     1.6  $\mathit{RO}_\mathit{run}$ &  {\tt physical\_utilisation} & int & amount of physical space that the disk image is currently taking up on the storage repository (in bytes) \\
     1.7 -$\mathit{RO}_\mathit{ins}$ &  {\tt sector\_size} & int & sector size of VDI (in bytes) \\
     1.8  $\mathit{RO}_\mathit{ins}$ &  {\tt type} & vdi\_type & type of the VDI \\
     1.9  $\mathit{RW}$ &  {\tt sharable} & bool & true if this disk may be shared \\
    1.10  $\mathit{RW}$ &  {\tt read\_only} & bool & true if this disk may ONLY be mounted read-only \\
    1.11 +$\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\
    1.12  \hline
    1.13  \end{longtable}
    1.14  \subsection{RPCs associated with class: VDI}
    1.15 @@ -9812,38 +9812,6 @@ value of the field
    1.16  \vspace{0.3cm}
    1.17  \vspace{0.3cm}
    1.18  \vspace{0.3cm}
    1.19 -\subsubsection{RPC name:~get\_sector\_size}
    1.20 -
    1.21 -{\bf Overview:} 
    1.22 -Get the sector\_size field of the given VDI.
    1.23 -
    1.24 - \noindent {\bf Signature:} 
    1.25 -\begin{verbatim} int get_sector_size (session_id s, VDI ref self)\end{verbatim}
    1.26 -
    1.27 -
    1.28 -\noindent{\bf Arguments:}
    1.29 -
    1.30 - 
    1.31 -\vspace{0.3cm}
    1.32 -\begin{tabular}{|c|c|p{7cm}|}
    1.33 - \hline
    1.34 -{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.35 -{\tt VDI ref } & self & reference to the object \\ \hline 
    1.36 -
    1.37 -\end{tabular}
    1.38 -
    1.39 -\vspace{0.3cm}
    1.40 -
    1.41 - \noindent {\bf Return Type:} 
    1.42 -{\tt 
    1.43 -int
    1.44 -}
    1.45 -
    1.46 -
    1.47 -value of the field
    1.48 -\vspace{0.3cm}
    1.49 -\vspace{0.3cm}
    1.50 -\vspace{0.3cm}
    1.51  \subsubsection{RPC name:~get\_type}
    1.52  
    1.53  {\bf Overview:} 
    1.54 @@ -10008,6 +9976,143 @@ void
    1.55  \vspace{0.3cm}
    1.56  \vspace{0.3cm}
    1.57  \vspace{0.3cm}
    1.58 +\subsubsection{RPC name:~get\_other\_config}
    1.59 +
    1.60 +{\bf Overview:} 
    1.61 +Get the other\_config field of the given VDI.
    1.62 +
    1.63 + \noindent {\bf Signature:} 
    1.64 +\begin{verbatim} ((string -> string) Map) get_other_config (session_id s, VDI ref self)\end{verbatim}
    1.65 +
    1.66 +
    1.67 +\noindent{\bf Arguments:}
    1.68 +
    1.69 + 
    1.70 +\vspace{0.3cm}
    1.71 +\begin{tabular}{|c|c|p{7cm}|}
    1.72 + \hline
    1.73 +{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.74 +{\tt VDI ref } & self & reference to the object \\ \hline 
    1.75 +
    1.76 +\end{tabular}
    1.77 +
    1.78 +\vspace{0.3cm}
    1.79 +
    1.80 + \noindent {\bf Return Type:} 
    1.81 +{\tt 
    1.82 +(string $\rightarrow$ string) Map
    1.83 +}
    1.84 +
    1.85 +
    1.86 +value of the field
    1.87 +\vspace{0.3cm}
    1.88 +\vspace{0.3cm}
    1.89 +\vspace{0.3cm}
    1.90 +\subsubsection{RPC name:~set\_other\_config}
    1.91 +
    1.92 +{\bf Overview:} 
    1.93 +Set the other\_config field of the given VDI.
    1.94 +
    1.95 + \noindent {\bf Signature:} 
    1.96 +\begin{verbatim} void set_other_config (session_id s, VDI ref self, (string -> string) Map value)\end{verbatim}
    1.97 +
    1.98 +
    1.99 +\noindent{\bf Arguments:}
   1.100 +
   1.101 + 
   1.102 +\vspace{0.3cm}
   1.103 +\begin{tabular}{|c|c|p{7cm}|}
   1.104 + \hline
   1.105 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.106 +{\tt VDI ref } & self & reference to the object \\ \hline 
   1.107 +
   1.108 +{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 
   1.109 +
   1.110 +\end{tabular}
   1.111 +
   1.112 +\vspace{0.3cm}
   1.113 +
   1.114 + \noindent {\bf Return Type:} 
   1.115 +{\tt 
   1.116 +void
   1.117 +}
   1.118 +
   1.119 +
   1.120 +
   1.121 +\vspace{0.3cm}
   1.122 +\vspace{0.3cm}
   1.123 +\vspace{0.3cm}
   1.124 +\subsubsection{RPC name:~add\_to\_other\_config}
   1.125 +
   1.126 +{\bf Overview:} 
   1.127 +Add the given key-value pair to the other\_config field of the given VDI.
   1.128 +
   1.129 + \noindent {\bf Signature:} 
   1.130 +\begin{verbatim} void add_to_other_config (session_id s, VDI ref self, string key, string value)\end{verbatim}
   1.131 +
   1.132 +
   1.133 +\noindent{\bf Arguments:}
   1.134 +
   1.135 + 
   1.136 +\vspace{0.3cm}
   1.137 +\begin{tabular}{|c|c|p{7cm}|}
   1.138 + \hline
   1.139 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.140 +{\tt VDI ref } & self & reference to the object \\ \hline 
   1.141 +
   1.142 +{\tt string } & key & Key to add \\ \hline 
   1.143 +
   1.144 +{\tt string } & value & Value to add \\ \hline 
   1.145 +
   1.146 +\end{tabular}
   1.147 +
   1.148 +\vspace{0.3cm}
   1.149 +
   1.150 + \noindent {\bf Return Type:} 
   1.151 +{\tt 
   1.152 +void
   1.153 +}
   1.154 +
   1.155 +
   1.156 +
   1.157 +\vspace{0.3cm}
   1.158 +\vspace{0.3cm}
   1.159 +\vspace{0.3cm}
   1.160 +\subsubsection{RPC name:~remove\_from\_other\_config}
   1.161 +
   1.162 +{\bf Overview:} 
   1.163 +Remove the given key and its corresponding value from the other\_config
   1.164 +field of the given VDI.  If the key is not in that Map, then do nothing.
   1.165 +
   1.166 + \noindent {\bf Signature:} 
   1.167 +\begin{verbatim} void remove_from_other_config (session_id s, VDI ref self, string key)\end{verbatim}
   1.168 +
   1.169 +
   1.170 +\noindent{\bf Arguments:}
   1.171 +
   1.172 + 
   1.173 +\vspace{0.3cm}
   1.174 +\begin{tabular}{|c|c|p{7cm}|}
   1.175 + \hline
   1.176 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.177 +{\tt VDI ref } & self & reference to the object \\ \hline 
   1.178 +
   1.179 +{\tt string } & key & Key to remove \\ \hline 
   1.180 +
   1.181 +\end{tabular}
   1.182 +
   1.183 +\vspace{0.3cm}
   1.184 +
   1.185 + \noindent {\bf Return Type:} 
   1.186 +{\tt 
   1.187 +void
   1.188 +}
   1.189 +
   1.190 +
   1.191 +
   1.192 +\vspace{0.3cm}
   1.193 +\vspace{0.3cm}
   1.194 +\vspace{0.3cm}
   1.195  \subsubsection{RPC name:~create}
   1.196  
   1.197  {\bf Overview:} 
     2.1 --- a/tools/libxen/include/xen_vbd.h	Sat Mar 17 16:56:39 2007 +0000
     2.2 +++ b/tools/libxen/include/xen_vbd.h	Sat Mar 17 23:55:03 2007 +0000
     2.3 @@ -72,7 +72,6 @@ typedef struct xen_vbd_record
     2.4      struct xen_vm_record_opt *vm;
     2.5      struct xen_vdi_record_opt *vdi;
     2.6      char *device;
     2.7 -    char *image;
     2.8      bool bootable;
     2.9      enum xen_vbd_mode mode;
    2.10      enum xen_vbd_type type;
     3.1 --- a/tools/libxen/include/xen_vdi.h	Sat Mar 17 16:56:39 2007 +0000
     3.2 +++ b/tools/libxen/include/xen_vdi.h	Sat Mar 17 23:55:03 2007 +0000
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2006, XenSource Inc.
     3.6 + * Copyright (c) 2006-2007, XenSource Inc.
     3.7   *
     3.8   * This library is free software; you can redistribute it and/or
     3.9   * modify it under the terms of the GNU Lesser General Public
    3.10 @@ -22,6 +22,7 @@
    3.11  #include "xen_common.h"
    3.12  #include "xen_crashdump_decl.h"
    3.13  #include "xen_sr_decl.h"
    3.14 +#include "xen_string_string_map.h"
    3.15  #include "xen_vbd_decl.h"
    3.16  #include "xen_vdi_decl.h"
    3.17  #include "xen_vdi_type.h"
    3.18 @@ -73,11 +74,10 @@ typedef struct xen_vdi_record
    3.19      struct xen_crashdump_record_opt_set *crash_dumps;
    3.20      int64_t virtual_size;
    3.21      int64_t physical_utilisation;
    3.22 -    int64_t sector_size;
    3.23 -    char *location;
    3.24      enum xen_vdi_type type;
    3.25      bool sharable;
    3.26      bool read_only;
    3.27 +    xen_string_string_map *other_config;
    3.28  } xen_vdi_record;
    3.29  
    3.30  /**
    3.31 @@ -251,13 +251,6 @@ xen_vdi_get_physical_utilisation(xen_ses
    3.32  
    3.33  
    3.34  /**
    3.35 - * Get the sector_size field of the given VDI.
    3.36 - */
    3.37 -extern bool
    3.38 -xen_vdi_get_sector_size(xen_session *session, int64_t *result, xen_vdi vdi);
    3.39 -
    3.40 -
    3.41 -/**
    3.42   * Get the type field of the given VDI.
    3.43   */
    3.44  extern bool
    3.45 @@ -279,6 +272,13 @@ xen_vdi_get_read_only(xen_session *sessi
    3.46  
    3.47  
    3.48  /**
    3.49 + * Get the other_config field of the given VDI.
    3.50 + */
    3.51 +extern bool
    3.52 +xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, xen_vdi vdi);
    3.53 +
    3.54 +
    3.55 +/**
    3.56   * Set the name/label field of the given VDI.
    3.57   */
    3.58  extern bool
    3.59 @@ -314,6 +314,30 @@ xen_vdi_set_read_only(xen_session *sessi
    3.60  
    3.61  
    3.62  /**
    3.63 + * Set the other_config field of the given VDI.
    3.64 + */
    3.65 +extern bool
    3.66 +xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, xen_string_string_map *other_config);
    3.67 +
    3.68 +
    3.69 +/**
    3.70 + * Add the given key-value pair to the other_config field of the given
    3.71 + * VDI.
    3.72 + */
    3.73 +extern bool
    3.74 +xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char *value);
    3.75 +
    3.76 +
    3.77 +/**
    3.78 + * Remove the given key and its corresponding value from the
    3.79 + * other_config field of the given VDI.  If the key is not in that Map, then
    3.80 + * do nothing.
    3.81 + */
    3.82 +extern bool
    3.83 +xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key);
    3.84 +
    3.85 +
    3.86 +/**
    3.87   * Take an exact copy of the VDI; the snapshot lives in the same
    3.88   * Storage Repository as its parent.
    3.89   */
     4.1 --- a/tools/libxen/src/xen_vbd.c	Sat Mar 17 16:56:39 2007 +0000
     4.2 +++ b/tools/libxen/src/xen_vbd.c	Sat Mar 17 23:55:03 2007 +0000
     4.3 @@ -54,9 +54,6 @@ static const struct_member xen_vbd_recor
     4.4          { .key = "device",
     4.5            .type = &abstract_type_string,
     4.6            .offset = offsetof(xen_vbd_record, device) },
     4.7 -        { .key = "image",
     4.8 -          .type = &abstract_type_string,
     4.9 -          .offset = offsetof(xen_vbd_record, image) },
    4.10          { .key = "bootable",
    4.11            .type = &abstract_type_bool,
    4.12            .offset = offsetof(xen_vbd_record, bootable) },
     5.1 --- a/tools/libxen/src/xen_vdi.c	Sat Mar 17 16:56:39 2007 +0000
     5.2 +++ b/tools/libxen/src/xen_vdi.c	Sat Mar 17 23:55:03 2007 +0000
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 2006, XenSource Inc.
     5.6 + * Copyright (c) 2006-2007, XenSource Inc.
     5.7   *
     5.8   * This library is free software; you can redistribute it and/or
     5.9   * modify it under the terms of the GNU Lesser General Public
    5.10 @@ -24,6 +24,7 @@
    5.11  #include "xen_crashdump.h"
    5.12  #include "xen_internal.h"
    5.13  #include "xen_sr.h"
    5.14 +#include "xen_string_string_map.h"
    5.15  #include "xen_vbd.h"
    5.16  #include "xen_vdi.h"
    5.17  #include "xen_vdi_type_internal.h"
    5.18 @@ -64,12 +65,6 @@ static const struct_member xen_vdi_recor
    5.19          { .key = "physical_utilisation",
    5.20            .type = &abstract_type_int,
    5.21            .offset = offsetof(xen_vdi_record, physical_utilisation) },
    5.22 -        { .key = "sector_size",
    5.23 -          .type = &abstract_type_int,
    5.24 -          .offset = offsetof(xen_vdi_record, sector_size) },
    5.25 -        { .key = "location",
    5.26 -          .type = &abstract_type_string,
    5.27 -          .offset = offsetof(xen_vdi_record, location) },
    5.28          { .key = "type",
    5.29            .type = &xen_vdi_type_abstract_type_,
    5.30            .offset = offsetof(xen_vdi_record, type) },
    5.31 @@ -78,7 +73,10 @@ static const struct_member xen_vdi_recor
    5.32            .offset = offsetof(xen_vdi_record, sharable) },
    5.33          { .key = "read_only",
    5.34            .type = &abstract_type_bool,
    5.35 -          .offset = offsetof(xen_vdi_record, read_only) }
    5.36 +          .offset = offsetof(xen_vdi_record, read_only) },
    5.37 +        { .key = "other_config",
    5.38 +          .type = &abstract_type_string_string_map,
    5.39 +          .offset = offsetof(xen_vdi_record, other_config) }
    5.40      };
    5.41  
    5.42  const abstract_type xen_vdi_record_abstract_type_ =
    5.43 @@ -105,6 +103,7 @@ xen_vdi_record_free(xen_vdi_record *reco
    5.44      xen_sr_record_opt_free(record->sr);
    5.45      xen_vbd_record_opt_set_free(record->vbds);
    5.46      xen_crashdump_record_opt_set_free(record->crash_dumps);
    5.47 +    xen_string_string_map_free(record->other_config);
    5.48      free(record);
    5.49  }
    5.50  
    5.51 @@ -315,22 +314,6 @@ xen_vdi_get_physical_utilisation(xen_ses
    5.52  
    5.53  
    5.54  bool
    5.55 -xen_vdi_get_sector_size(xen_session *session, int64_t *result, xen_vdi vdi)
    5.56 -{
    5.57 -    abstract_value param_values[] =
    5.58 -        {
    5.59 -            { .type = &abstract_type_string,
    5.60 -              .u.string_val = vdi }
    5.61 -        };
    5.62 -
    5.63 -    abstract_type result_type = abstract_type_int;
    5.64 -
    5.65 -    XEN_CALL_("VDI.get_sector_size");
    5.66 -    return session->ok;
    5.67 -}
    5.68 -
    5.69 -
    5.70 -bool
    5.71  xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi)
    5.72  {
    5.73      abstract_value param_values[] =
    5.74 @@ -378,6 +361,23 @@ xen_vdi_get_read_only(xen_session *sessi
    5.75  
    5.76  
    5.77  bool
    5.78 +xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, xen_vdi vdi)
    5.79 +{
    5.80 +    abstract_value param_values[] =
    5.81 +        {
    5.82 +            { .type = &abstract_type_string,
    5.83 +              .u.string_val = vdi }
    5.84 +        };
    5.85 +
    5.86 +    abstract_type result_type = abstract_type_string_string_map;
    5.87 +
    5.88 +    *result = NULL;
    5.89 +    XEN_CALL_("VDI.get_other_config");
    5.90 +    return session->ok;
    5.91 +}
    5.92 +
    5.93 +
    5.94 +bool
    5.95  xen_vdi_set_name_label(xen_session *session, xen_vdi vdi, char *label)
    5.96  {
    5.97      abstract_value param_values[] =
    5.98 @@ -458,6 +458,56 @@ xen_vdi_set_read_only(xen_session *sessi
    5.99  
   5.100  
   5.101  bool
   5.102 +xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, xen_string_string_map *other_config)
   5.103 +{
   5.104 +    abstract_value param_values[] =
   5.105 +        {
   5.106 +            { .type = &abstract_type_string,
   5.107 +              .u.string_val = vdi },
   5.108 +            { .type = &abstract_type_string_string_map,
   5.109 +              .u.set_val = (arbitrary_set *)other_config }
   5.110 +        };
   5.111 +
   5.112 +    xen_call_(session, "VDI.set_other_config", param_values, 2, NULL, NULL);
   5.113 +    return session->ok;
   5.114 +}
   5.115 +
   5.116 +
   5.117 +bool
   5.118 +xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char *value)
   5.119 +{
   5.120 +    abstract_value param_values[] =
   5.121 +        {
   5.122 +            { .type = &abstract_type_string,
   5.123 +              .u.string_val = vdi },
   5.124 +            { .type = &abstract_type_string,
   5.125 +              .u.string_val = key },
   5.126 +            { .type = &abstract_type_string,
   5.127 +              .u.string_val = value }
   5.128 +        };
   5.129 +
   5.130 +    xen_call_(session, "VDI.add_to_other_config", param_values, 3, NULL, NULL);
   5.131 +    return session->ok;
   5.132 +}
   5.133 +
   5.134 +
   5.135 +bool
   5.136 +xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key)
   5.137 +{
   5.138 +    abstract_value param_values[] =
   5.139 +        {
   5.140 +            { .type = &abstract_type_string,
   5.141 +              .u.string_val = vdi },
   5.142 +            { .type = &abstract_type_string,
   5.143 +              .u.string_val = key }
   5.144 +        };
   5.145 +
   5.146 +    xen_call_(session, "VDI.remove_from_other_config", param_values, 2, NULL, NULL);
   5.147 +    return session->ok;
   5.148 +}
   5.149 +
   5.150 +
   5.151 +bool
   5.152  xen_vdi_snapshot(xen_session *session, xen_vdi *result, xen_vdi vdi)
   5.153  {
   5.154      abstract_value param_values[] =
     6.1 --- a/tools/libxen/test/test_bindings.c	Sat Mar 17 16:56:39 2007 +0000
     6.2 +++ b/tools/libxen/test/test_bindings.c	Sat Mar 17 23:55:03 2007 +0000
     6.3 @@ -421,8 +421,7 @@ static xen_vm create_new_vm(xen_session 
     6.4              .name_label = "MyRootFS",
     6.5              .name_description = "MyRootFS description",
     6.6              .sr = &sr_record,
     6.7 -            .virtual_size = (1 << 21),  // 1GiB / 512 bytes/sector
     6.8 -            .sector_size = 512,
     6.9 +            .virtual_size = (INT64_C(1) << 30),  // 1GiB
    6.10              .type = XEN_VDI_TYPE_SYSTEM,
    6.11              .sharable = false,
    6.12              .read_only = false
     7.1 --- a/tools/python/scripts/test_hvm_create.py	Sat Mar 17 16:56:39 2007 +0000
     7.2 +++ b/tools/python/scripts/test_hvm_create.py	Sat Mar 17 23:55:03 2007 +0000
     7.3 @@ -39,14 +39,13 @@ vm_cfg = {
     7.4  local_vdi_cfg = {
     7.5      'name_label': 'gentoo.hvm',
     7.6      'name_description': '',
     7.7 -    'location': 'file:/root/gentoo.amd64.hvm.img',
     7.8      'virtual_size': 0,
     7.9 -    'sector_size': 0,
    7.10      'type': 'system',
    7.11      'parent': '',
    7.12      'SR_name': 'Local',
    7.13      'sharable': False,
    7.14      'read_only': False,
    7.15 +    'other_config': {'location': 'file:/root/gentoo.amd64.hvm.img'},
    7.16  }    
    7.17  
    7.18  local_vbd_cfg = {
     8.1 --- a/tools/python/scripts/test_vm_create.py	Sat Mar 17 16:56:39 2007 +0000
     8.2 +++ b/tools/python/scripts/test_vm_create.py	Sat Mar 17 23:55:03 2007 +0000
     8.3 @@ -39,8 +39,7 @@ vm_cfg = {
     8.4  vdi_cfg = {
     8.5      'name_label': 'API_VDI',
     8.6      'name_description': '',
     8.7 -    'virtual_size': 100 * 1024 * 1024,
     8.8 -    'sector_size': 1024,
     8.9 +    'virtual_size': 100 * 1024 * 1024 * 1024,
    8.10      'type': 'system',
    8.11      'parent': '',
    8.12      'SR_name': 'QCoW',
    8.13 @@ -60,14 +59,13 @@ vbd_cfg = {
    8.14  local_vdi_cfg = {
    8.15      'name_label': 'gentoo.amd64.img',
    8.16      'name_description': '',
    8.17 -    'location': 'file:/root/gentoo.amd64.img',
    8.18      'virtual_size': 0,
    8.19 -    'sector_size': 0,
    8.20      'type': 'system',
    8.21      'parent': '',
    8.22      'SR_name': 'Local',
    8.23      'sharable': False,
    8.24      'read_only': False,
    8.25 +    'other_config': {'location': 'file:/root/gentoo.amd64.img'},
    8.26  }    
    8.27  
    8.28  local_vbd_cfg = {
     9.1 --- a/tools/python/scripts/xapi.py	Sat Mar 17 16:56:39 2007 +0000
     9.2 +++ b/tools/python/scripts/xapi.py	Sat Mar 17 23:55:03 2007 +0000
     9.3 @@ -40,8 +40,7 @@ VM_LIST_FORMAT = '%(name_label)-18s %(me
     9.4                   ' %(power_state)-10s %(uuid)-36s'
     9.5  SR_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(physical_size)-10s' \
     9.6                   '%(type)-10s'
     9.7 -VDI_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(virtual_size)-8s '\
     9.8 -                  '%(sector_size)-8s'
     9.9 +VDI_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(virtual_size)-8s'
    9.10  VBD_LIST_FORMAT = '%(device)-6s %(uuid)-36s %(VDI)-8s'
    9.11  TASK_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(status)-8s %(progress)-4s'
    9.12  VIF_LIST_FORMAT = '%(name)-8s %(device)-7s %(uuid)-36s %(MAC)-10s'
    9.13 @@ -96,12 +95,9 @@ OPTIONS = {
    9.14      
    9.15      'vdi-create': [(('--name-label',), {'help': 'Name for VDI'}),
    9.16                     (('--name-description',), {'help': 'Description for VDI'}),
    9.17 -                   (('--sector-size',), {'type': 'int',
    9.18 -                                         'help': 'Sector size',
    9.19 -                                         'default': 0}),
    9.20                     (('--virtual-size',), {'type': 'int',
    9.21                                            'default': 0,
    9.22 -                                          'help': 'Size of VDI in sectors'}),
    9.23 +                                          'help': 'Size of VDI in bytes'}),
    9.24                     (('--type',), {'choices': ['system', 'user', 'ephemeral'],
    9.25                                    'default': 'system',
    9.26                                    'help': 'VDI type'}),
    9.27 @@ -569,8 +565,7 @@ def xapi_vdi_list(args, async = False):
    9.28      if not is_long:
    9.29          print VDI_LIST_FORMAT % {'name_label': 'VDI Label',
    9.30                                   'uuid' : 'UUID',
    9.31 -                                 'virtual_size': 'Bytes',
    9.32 -                                 'sector_size': 'Sector Size'}
    9.33 +                                 'virtual_size': 'Bytes'}
    9.34          
    9.35          for vdi in vdis:
    9.36              vdi_struct = execute(server, 'VDI.get_record', (session, vdi))
    10.1 --- a/tools/python/scripts/xapi.vdicfg.py	Sat Mar 17 16:56:39 2007 +0000
    10.2 +++ b/tools/python/scripts/xapi.vdicfg.py	Sat Mar 17 23:55:03 2007 +0000
    10.3 @@ -1,7 +1,6 @@
    10.4  name_label = 'VDI 1'
    10.5  name_description = ''
    10.6 -virtual_size = 10 * 1024 * 1024
    10.7 -sector_size = 1024
    10.8 +virtual_size = 10 * 1024 * 1024 * 1024
    10.9  type = 'system'
   10.10  sharable = False
   10.11  read_only = False
    11.1 --- a/tools/python/xen/xend/XendAPI.py	Sat Mar 17 16:56:39 2007 +0000
    11.2 +++ b/tools/python/xen/xend/XendAPI.py	Sat Mar 17 23:55:03 2007 +0000
    11.3 @@ -1811,13 +1811,13 @@ class XendAPI(object):
    11.4      VDI_attr_ro = ['SR',
    11.5                     'VBDs',
    11.6                     'physical_utilisation',
    11.7 -                   'sector_size',
    11.8                     'type']
    11.9      VDI_attr_rw = ['name_label',
   11.10                     'name_description',
   11.11                     'virtual_size',
   11.12                     'sharable',
   11.13 -                   'read_only']
   11.14 +                   'read_only',
   11.15 +                   'other_config']
   11.16      VDI_attr_inst = VDI_attr_ro + VDI_attr_rw
   11.17  
   11.18      VDI_methods = [('snapshot', 'VDI')]
   11.19 @@ -1832,10 +1832,7 @@ class XendAPI(object):
   11.20      
   11.21      def VDI_get_physical_utilisation(self, session, vdi_ref):
   11.22          return xen_api_success(self._get_VDI(vdi_ref).
   11.23 -                               get_physical_utilisation())        
   11.24 -    
   11.25 -    def VDI_get_sector_size(self, session, vdi_ref):
   11.26 -        return xen_api_success(self._get_VDI(vdi_ref).sector_size)        
   11.27 +                               get_physical_utilisation())              
   11.28      
   11.29      def VDI_get_type(self, session, vdi_ref):
   11.30          return xen_api_success(self._get_VDI(vdi_ref).type)
   11.31 @@ -1877,6 +1874,14 @@ class XendAPI(object):
   11.32          self._get_VDI(vdi_ref).read_only = bool(value)
   11.33          return xen_api_success_void()
   11.34  
   11.35 +    def VDI_get_other_config(self, session, vdi_ref):
   11.36 +        return xen_api_success(
   11.37 +            self._get_VDI(vdi_ref).other_config)
   11.38 +
   11.39 +    def VDI_set_other_config(self, session, vdi_ref, other_config):
   11.40 +        self._get_VDI(vdi_ref).other_config = other_config
   11.41 +        return xen_api_success_void()
   11.42 +
   11.43      # Object Methods
   11.44      def VDI_snapshot(self, session, vdi_ref):
   11.45          return xen_api_todo()
   11.46 @@ -1896,10 +1901,10 @@ class XendAPI(object):
   11.47              'VBDs': [], # TODO
   11.48              'virtual_size': image.virtual_size,
   11.49              'physical_utilisation': image.physical_utilisation,
   11.50 -            'sector_size': image.sector_size,
   11.51              'type': image.type,
   11.52              'sharable': image.sharable,
   11.53              'read_only': image.read_only,
   11.54 +            'other_config': image.other_config
   11.55              })
   11.56  
   11.57      # Class Functions    
    12.1 --- a/tools/python/xen/xend/XendVDI.py	Sat Mar 17 16:56:39 2007 +0000
    12.2 +++ b/tools/python/xen/xend/XendVDI.py	Sat Mar 17 23:55:03 2007 +0000
    12.3 @@ -54,7 +54,6 @@ class XendVDI(AutoSaveObject):
    12.4      
    12.5      SAVED_CFG = ['name_label',
    12.6                   'name_description',
    12.7 -                 'sector_size',
    12.8                   'virtual_size',
    12.9                   'physical_utilisation',
   12.10                   'sharable',
   12.11 @@ -67,13 +66,12 @@ class XendVDI(AutoSaveObject):
   12.12          self.sr_uuid = sr_uuid
   12.13          self.name_label = ""
   12.14          self.name_description = ""
   12.15 -        self.sector_size = 1024
   12.16          self.virtual_size = 0
   12.17          self.physical_utilisation = 0
   12.18          self.sharable = False
   12.19          self.read_only = False
   12.20          self.type = "system"
   12.21 -        self.location = ''
   12.22 +        self.other_config = {}
   12.23  
   12.24      def load_config_dict(self, cfg):
   12.25          """Loads configuration into the object from a dict.
   12.26 @@ -144,11 +142,10 @@ class XendVDI(AutoSaveObject):
   12.27                  'name_description': self.name_description,
   12.28                  'virtual_size': self.virtual_size,
   12.29                  'physical_utilisation': self.physical_utilisation,
   12.30 -                'sector_size': self.sector_size,
   12.31                  'sharable': False,
   12.32                  'readonly': False,
   12.33                  'SR': self.sr_uuid,
   12.34 -                'location': self.get_location(),
   12.35 +                'other_config': self.other_config,
   12.36                  'VBDs': []}
   12.37  
   12.38      def get_location(self):
   12.39 @@ -163,12 +160,11 @@ class XendQCoWVDI(XendVDI):
   12.40          self.cfg_path = cfg_path
   12.41          self.physical_utilisation = psize
   12.42          self.virtual_size = vsize
   12.43 -        self.sector_size = 512
   12.44          self.auto_save = True
   12.45 -        self.location = 'tap:qcow:%s' % self.qcow_path
   12.46 +        self.other_config['location'] = 'tap:qcow:%s' % self.qcow_path
   12.47  
   12.48      def get_location(self):
   12.49 -        return self.location
   12.50 +        return self.other_config['location']
   12.51  
   12.52  class XendLocalVDI(XendVDI):
   12.53      def __init__(self, vdi_struct):
   12.54 @@ -182,11 +178,10 @@ class XendLocalVDI(XendVDI):
   12.55          self.name_description = vdi_struct.get('name_description', '')
   12.56          self.physical_utilisation = 0
   12.57          self.virtual_size = 0
   12.58 -        self.sector_size = 0
   12.59          self.type = vdi_struct.get('type', '')
   12.60          self.sharable = vdi_struct.get('sharable', False)
   12.61          self.read_only = vdi_struct.get('read_only', False)
   12.62 -        self.location = vdi_struct.get('location', 'file:/dev/null')
   12.63 +        self.other_config = vdi_struct.get('other_config', {})
   12.64  
   12.65      def get_location(self):
   12.66 -        return self.location
   12.67 +        return self.other_config['location']