[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Replace VDI.location with a more generic VDI.other_config map. Remove



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1174175703 0
# Node ID 2adbc1d22fe7bec28ba757240194b0c82ff6273a
# Parent  f40bd358129a8f83e4503bc7129c1e6598563c8c
Replace VDI.location with a more generic VDI.other_config map.  Remove
VDI.sector_size.

Xend work by Tom Wilkie <tom.wilkie@xxxxxxxxx>.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex       |  241 ++++++++++++++++++++++----------
 tools/libxen/include/xen_vbd.h          |    1 
 tools/libxen/include/xen_vdi.h          |   44 ++++-
 tools/libxen/src/xen_vbd.c              |    3 
 tools/libxen/src/xen_vdi.c              |   98 +++++++++----
 tools/libxen/test/test_bindings.c       |    3 
 tools/python/scripts/test_hvm_create.py |    3 
 tools/python/scripts/test_vm_create.py  |    6 
 tools/python/scripts/xapi.py            |   11 -
 tools/python/scripts/xapi.vdicfg.py     |    3 
 tools/python/xen/xend/XendAPI.py        |   19 +-
 tools/python/xen/xend/XendVDI.py        |   17 --
 12 files changed, 307 insertions(+), 142 deletions(-)

diff -r f40bd358129a -r 2adbc1d22fe7 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Sat Mar 17 16:56:39 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Sat Mar 17 23:55:03 2007 +0000
@@ -9359,10 +9359,10 @@ Quals & Field & Type & Description \\
 $\mathit{RO}_\mathit{run}$ &  {\tt crash\_dumps} & (crashdump ref) Set & list 
of crash dumps that refer to this disk \\
 $\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 \\
 $\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) \\
-$\mathit{RO}_\mathit{ins}$ &  {\tt sector\_size} & int & sector size of VDI 
(in bytes) \\
 $\mathit{RO}_\mathit{ins}$ &  {\tt type} & vdi\_type & type of the VDI \\
 $\mathit{RW}$ &  {\tt sharable} & bool & true if this disk may be shared \\
 $\mathit{RW}$ &  {\tt read\_only} & bool & true if this disk may ONLY be 
mounted read-only \\
+$\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & 
additional configuration \\
 \hline
 \end{longtable}
 \subsection{RPCs associated with class: VDI}
@@ -9812,13 +9812,13 @@ value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_sector\_size}
-
-{\bf Overview:} 
-Get the sector\_size field of the given VDI.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} int get_sector_size (session_id s, VDI ref self)\end{verbatim}
+\subsubsection{RPC name:~get\_type}
+
+{\bf Overview:} 
+Get the type field of the given VDI.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} (vdi_type) get_type (session_id s, VDI ref self)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -9836,21 +9836,21 @@ Get the sector\_size field of the given 
 
  \noindent {\bf Return Type:} 
 {\tt 
-int
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_type}
-
-{\bf Overview:} 
-Get the type field of the given VDI.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} (vdi_type) get_type (session_id s, VDI ref self)\end{verbatim}
+vdi\_type
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_sharable}
+
+{\bf Overview:} 
+Get the sharable field of the given VDI.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} bool get_sharable (session_id s, VDI ref self)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -9868,21 +9868,21 @@ Get the type field of the given VDI.
 
  \noindent {\bf Return Type:} 
 {\tt 
-vdi\_type
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_sharable}
-
-{\bf Overview:} 
-Get the sharable field of the given VDI.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} bool get_sharable (session_id s, VDI ref self)\end{verbatim}
+bool
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_sharable}
+
+{\bf Overview:} 
+Set the sharable field of the given VDI.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_sharable (session_id s, VDI ref self, bool 
value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -9894,6 +9894,40 @@ Get the sharable field of the given VDI.
 {\bf type} & {\bf name} & {\bf description} \\ \hline
 {\tt VDI ref } & self & reference to the object \\ \hline 
 
+{\tt bool } & 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\_read\_only}
+
+{\bf Overview:} 
+Get the read\_only field of the given VDI.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} bool get_read_only (session_id s, VDI 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 VDI ref } & self & reference to the object \\ \hline 
+
 \end{tabular}
 
 \vspace{0.3cm}
@@ -9908,13 +9942,13 @@ value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~set\_sharable}
-
-{\bf Overview:} 
-Set the sharable field of the given VDI.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_sharable (session_id s, VDI ref self, bool 
value)\end{verbatim}
+\subsubsection{RPC name:~set\_read\_only}
+
+{\bf Overview:} 
+Set the read\_only field of the given VDI.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_read_only (session_id s, VDI ref self, bool 
value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -9942,13 +9976,13 @@ void
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_read\_only}
-
-{\bf Overview:} 
-Get the read\_only field of the given VDI.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} bool get_read_only (session_id s, VDI ref self)\end{verbatim}
+\subsubsection{RPC name:~get\_other\_config}
+
+{\bf Overview:} 
+Get the other\_config field of the given VDI.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} ((string -> string) Map) get_other_config (session_id s, VDI 
ref self)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -9966,21 +10000,21 @@ Get the read\_only field of the given VD
 
  \noindent {\bf Return Type:} 
 {\tt 
-bool
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_read\_only}
-
-{\bf Overview:} 
-Set the read\_only field of the given VDI.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_read_only (session_id s, VDI ref self, bool 
value)\end{verbatim}
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_other\_config}
+
+{\bf Overview:} 
+Set the other\_config field of the given VDI.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_other_config (session_id s, VDI ref self, (string -> 
string) Map value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -9992,7 +10026,78 @@ Set the read\_only field of the given VD
 {\bf type} & {\bf name} & {\bf description} \\ \hline
 {\tt VDI ref } & self & reference to the object \\ \hline 
 
-{\tt bool } & value & New value to set \\ \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\_other\_config}
+
+{\bf Overview:} 
+Add the given key-value pair to the other\_config field of the given VDI.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void add_to_other_config (session_id s, VDI 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 VDI 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\_other\_config}
+
+{\bf Overview:} 
+Remove the given key and its corresponding value from the other\_config
+field of the given VDI.  If the key is not in that Map, then do nothing.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void remove_from_other_config (session_id s, VDI 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 VDI ref } & self & reference to the object \\ \hline 
+
+{\tt string } & key & Key to remove \\ \hline 
 
 \end{tabular}
 
diff -r f40bd358129a -r 2adbc1d22fe7 tools/libxen/include/xen_vbd.h
--- a/tools/libxen/include/xen_vbd.h    Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/libxen/include/xen_vbd.h    Sat Mar 17 23:55:03 2007 +0000
@@ -72,7 +72,6 @@ typedef struct xen_vbd_record
     struct xen_vm_record_opt *vm;
     struct xen_vdi_record_opt *vdi;
     char *device;
-    char *image;
     bool bootable;
     enum xen_vbd_mode mode;
     enum xen_vbd_type type;
diff -r f40bd358129a -r 2adbc1d22fe7 tools/libxen/include/xen_vdi.h
--- a/tools/libxen/include/xen_vdi.h    Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/libxen/include/xen_vdi.h    Sat Mar 17 23:55:03 2007 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, XenSource Inc.
+ * 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
@@ -22,6 +22,7 @@
 #include "xen_common.h"
 #include "xen_crashdump_decl.h"
 #include "xen_sr_decl.h"
+#include "xen_string_string_map.h"
 #include "xen_vbd_decl.h"
 #include "xen_vdi_decl.h"
 #include "xen_vdi_type.h"
@@ -73,11 +74,10 @@ typedef struct xen_vdi_record
     struct xen_crashdump_record_opt_set *crash_dumps;
     int64_t virtual_size;
     int64_t physical_utilisation;
-    int64_t sector_size;
-    char *location;
     enum xen_vdi_type type;
     bool sharable;
     bool read_only;
+    xen_string_string_map *other_config;
 } xen_vdi_record;
 
 /**
@@ -251,13 +251,6 @@ xen_vdi_get_physical_utilisation(xen_ses
 
 
 /**
- * Get the sector_size field of the given VDI.
- */
-extern bool
-xen_vdi_get_sector_size(xen_session *session, int64_t *result, xen_vdi vdi);
-
-
-/**
  * Get the type field of the given VDI.
  */
 extern bool
@@ -279,6 +272,13 @@ xen_vdi_get_read_only(xen_session *sessi
 
 
 /**
+ * Get the other_config field of the given VDI.
+ */
+extern bool
+xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, 
xen_vdi vdi);
+
+
+/**
  * Set the name/label field of the given VDI.
  */
 extern bool
@@ -311,6 +311,30 @@ xen_vdi_set_sharable(xen_session *sessio
  */
 extern bool
 xen_vdi_set_read_only(xen_session *session, xen_vdi vdi, bool read_only);
+
+
+/**
+ * Set the other_config field of the given VDI.
+ */
+extern bool
+xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, 
xen_string_string_map *other_config);
+
+
+/**
+ * Add the given key-value pair to the other_config field of the given
+ * VDI.
+ */
+extern bool
+xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * other_config field of the given VDI.  If the key is not in that Map, then
+ * do nothing.
+ */
+extern bool
+xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key);
 
 
 /**
diff -r f40bd358129a -r 2adbc1d22fe7 tools/libxen/src/xen_vbd.c
--- a/tools/libxen/src/xen_vbd.c        Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/libxen/src/xen_vbd.c        Sat Mar 17 23:55:03 2007 +0000
@@ -54,9 +54,6 @@ static const struct_member xen_vbd_recor
         { .key = "device",
           .type = &abstract_type_string,
           .offset = offsetof(xen_vbd_record, device) },
-        { .key = "image",
-          .type = &abstract_type_string,
-          .offset = offsetof(xen_vbd_record, image) },
         { .key = "bootable",
           .type = &abstract_type_bool,
           .offset = offsetof(xen_vbd_record, bootable) },
diff -r f40bd358129a -r 2adbc1d22fe7 tools/libxen/src/xen_vdi.c
--- a/tools/libxen/src/xen_vdi.c        Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/libxen/src/xen_vdi.c        Sat Mar 17 23:55:03 2007 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, XenSource Inc.
+ * 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
@@ -24,6 +24,7 @@
 #include "xen_crashdump.h"
 #include "xen_internal.h"
 #include "xen_sr.h"
+#include "xen_string_string_map.h"
 #include "xen_vbd.h"
 #include "xen_vdi.h"
 #include "xen_vdi_type_internal.h"
@@ -64,12 +65,6 @@ static const struct_member xen_vdi_recor
         { .key = "physical_utilisation",
           .type = &abstract_type_int,
           .offset = offsetof(xen_vdi_record, physical_utilisation) },
-        { .key = "sector_size",
-          .type = &abstract_type_int,
-          .offset = offsetof(xen_vdi_record, sector_size) },
-        { .key = "location",
-          .type = &abstract_type_string,
-          .offset = offsetof(xen_vdi_record, location) },
         { .key = "type",
           .type = &xen_vdi_type_abstract_type_,
           .offset = offsetof(xen_vdi_record, type) },
@@ -78,7 +73,10 @@ static const struct_member xen_vdi_recor
           .offset = offsetof(xen_vdi_record, sharable) },
         { .key = "read_only",
           .type = &abstract_type_bool,
-          .offset = offsetof(xen_vdi_record, read_only) }
+          .offset = offsetof(xen_vdi_record, read_only) },
+        { .key = "other_config",
+          .type = &abstract_type_string_string_map,
+          .offset = offsetof(xen_vdi_record, other_config) }
     };
 
 const abstract_type xen_vdi_record_abstract_type_ =
@@ -105,6 +103,7 @@ xen_vdi_record_free(xen_vdi_record *reco
     xen_sr_record_opt_free(record->sr);
     xen_vbd_record_opt_set_free(record->vbds);
     xen_crashdump_record_opt_set_free(record->crash_dumps);
+    xen_string_string_map_free(record->other_config);
     free(record);
 }
 
@@ -315,22 +314,6 @@ xen_vdi_get_physical_utilisation(xen_ses
 
 
 bool
-xen_vdi_get_sector_size(xen_session *session, int64_t *result, xen_vdi vdi)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vdi }
-        };
-
-    abstract_type result_type = abstract_type_int;
-
-    XEN_CALL_("VDI.get_sector_size");
-    return session->ok;
-}
-
-
-bool
 xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi)
 {
     abstract_value param_values[] =
@@ -378,6 +361,23 @@ xen_vdi_get_read_only(xen_session *sessi
 
 
 bool
+xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, 
xen_vdi vdi)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vdi }
+        };
+
+    abstract_type result_type = abstract_type_string_string_map;
+
+    *result = NULL;
+    XEN_CALL_("VDI.get_other_config");
+    return session->ok;
+}
+
+
+bool
 xen_vdi_set_name_label(xen_session *session, xen_vdi vdi, char *label)
 {
     abstract_value param_values[] =
@@ -458,6 +458,56 @@ xen_vdi_set_read_only(xen_session *sessi
 
 
 bool
+xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, 
xen_string_string_map *other_config)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vdi },
+            { .type = &abstract_type_string_string_map,
+              .u.set_val = (arbitrary_set *)other_config }
+        };
+
+    xen_call_(session, "VDI.set_other_config", param_values, 2, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char 
*value)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vdi },
+            { .type = &abstract_type_string,
+              .u.string_val = key },
+            { .type = &abstract_type_string,
+              .u.string_val = value }
+        };
+
+    xen_call_(session, "VDI.add_to_other_config", param_values, 3, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vdi },
+            { .type = &abstract_type_string,
+              .u.string_val = key }
+        };
+
+    xen_call_(session, "VDI.remove_from_other_config", param_values, 2, NULL, 
NULL);
+    return session->ok;
+}
+
+
+bool
 xen_vdi_snapshot(xen_session *session, xen_vdi *result, xen_vdi vdi)
 {
     abstract_value param_values[] =
diff -r f40bd358129a -r 2adbc1d22fe7 tools/libxen/test/test_bindings.c
--- a/tools/libxen/test/test_bindings.c Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/libxen/test/test_bindings.c Sat Mar 17 23:55:03 2007 +0000
@@ -421,8 +421,7 @@ static xen_vm create_new_vm(xen_session 
             .name_label = "MyRootFS",
             .name_description = "MyRootFS description",
             .sr = &sr_record,
-            .virtual_size = (1 << 21),  // 1GiB / 512 bytes/sector
-            .sector_size = 512,
+            .virtual_size = (INT64_C(1) << 30),  // 1GiB
             .type = XEN_VDI_TYPE_SYSTEM,
             .sharable = false,
             .read_only = false
diff -r f40bd358129a -r 2adbc1d22fe7 tools/python/scripts/test_hvm_create.py
--- a/tools/python/scripts/test_hvm_create.py   Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/python/scripts/test_hvm_create.py   Sat Mar 17 23:55:03 2007 +0000
@@ -39,14 +39,13 @@ local_vdi_cfg = {
 local_vdi_cfg = {
     'name_label': 'gentoo.hvm',
     'name_description': '',
-    'location': 'file:/root/gentoo.amd64.hvm.img',
     'virtual_size': 0,
-    'sector_size': 0,
     'type': 'system',
     'parent': '',
     'SR_name': 'Local',
     'sharable': False,
     'read_only': False,
+    'other_config': {'location': 'file:/root/gentoo.amd64.hvm.img'},
 }    
 
 local_vbd_cfg = {
diff -r f40bd358129a -r 2adbc1d22fe7 tools/python/scripts/test_vm_create.py
--- a/tools/python/scripts/test_vm_create.py    Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/python/scripts/test_vm_create.py    Sat Mar 17 23:55:03 2007 +0000
@@ -39,8 +39,7 @@ vdi_cfg = {
 vdi_cfg = {
     'name_label': 'API_VDI',
     'name_description': '',
-    'virtual_size': 100 * 1024 * 1024,
-    'sector_size': 1024,
+    'virtual_size': 100 * 1024 * 1024 * 1024,
     'type': 'system',
     'parent': '',
     'SR_name': 'QCoW',
@@ -60,14 +59,13 @@ local_vdi_cfg = {
 local_vdi_cfg = {
     'name_label': 'gentoo.amd64.img',
     'name_description': '',
-    'location': 'file:/root/gentoo.amd64.img',
     'virtual_size': 0,
-    'sector_size': 0,
     'type': 'system',
     'parent': '',
     'SR_name': 'Local',
     'sharable': False,
     'read_only': False,
+    'other_config': {'location': 'file:/root/gentoo.amd64.img'},
 }    
 
 local_vbd_cfg = {
diff -r f40bd358129a -r 2adbc1d22fe7 tools/python/scripts/xapi.py
--- a/tools/python/scripts/xapi.py      Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/python/scripts/xapi.py      Sat Mar 17 23:55:03 2007 +0000
@@ -40,8 +40,7 @@ VM_LIST_FORMAT = '%(name_label)-18s %(me
                  ' %(power_state)-10s %(uuid)-36s'
 SR_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(physical_size)-10s' \
                  '%(type)-10s'
-VDI_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(virtual_size)-8s '\
-                  '%(sector_size)-8s'
+VDI_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(virtual_size)-8s'
 VBD_LIST_FORMAT = '%(device)-6s %(uuid)-36s %(VDI)-8s'
 TASK_LIST_FORMAT = '%(name_label)-18s %(uuid)-36s %(status)-8s %(progress)-4s'
 VIF_LIST_FORMAT = '%(name)-8s %(device)-7s %(uuid)-36s %(MAC)-10s'
@@ -96,12 +95,9 @@ OPTIONS = {
     
     'vdi-create': [(('--name-label',), {'help': 'Name for VDI'}),
                    (('--name-description',), {'help': 'Description for VDI'}),
-                   (('--sector-size',), {'type': 'int',
-                                         'help': 'Sector size',
-                                         'default': 0}),
                    (('--virtual-size',), {'type': 'int',
                                           'default': 0,
-                                          'help': 'Size of VDI in sectors'}),
+                                          'help': 'Size of VDI in bytes'}),
                    (('--type',), {'choices': ['system', 'user', 'ephemeral'],
                                   'default': 'system',
                                   'help': 'VDI type'}),
@@ -569,8 +565,7 @@ def xapi_vdi_list(args, async = False):
     if not is_long:
         print VDI_LIST_FORMAT % {'name_label': 'VDI Label',
                                  'uuid' : 'UUID',
-                                 'virtual_size': 'Bytes',
-                                 'sector_size': 'Sector Size'}
+                                 'virtual_size': 'Bytes'}
         
         for vdi in vdis:
             vdi_struct = execute(server, 'VDI.get_record', (session, vdi))
diff -r f40bd358129a -r 2adbc1d22fe7 tools/python/scripts/xapi.vdicfg.py
--- a/tools/python/scripts/xapi.vdicfg.py       Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/python/scripts/xapi.vdicfg.py       Sat Mar 17 23:55:03 2007 +0000
@@ -1,7 +1,6 @@ name_label = 'VDI 1'
 name_label = 'VDI 1'
 name_description = ''
-virtual_size = 10 * 1024 * 1024
-sector_size = 1024
+virtual_size = 10 * 1024 * 1024 * 1024
 type = 'system'
 sharable = False
 read_only = False
diff -r f40bd358129a -r 2adbc1d22fe7 tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Sat Mar 17 23:55:03 2007 +0000
@@ -1811,13 +1811,13 @@ class XendAPI(object):
     VDI_attr_ro = ['SR',
                    'VBDs',
                    'physical_utilisation',
-                   'sector_size',
                    'type']
     VDI_attr_rw = ['name_label',
                    'name_description',
                    'virtual_size',
                    'sharable',
-                   'read_only']
+                   'read_only',
+                   'other_config']
     VDI_attr_inst = VDI_attr_ro + VDI_attr_rw
 
     VDI_methods = [('snapshot', 'VDI')]
@@ -1832,10 +1832,7 @@ class XendAPI(object):
     
     def VDI_get_physical_utilisation(self, session, vdi_ref):
         return xen_api_success(self._get_VDI(vdi_ref).
-                               get_physical_utilisation())        
-    
-    def VDI_get_sector_size(self, session, vdi_ref):
-        return xen_api_success(self._get_VDI(vdi_ref).sector_size)        
+                               get_physical_utilisation())              
     
     def VDI_get_type(self, session, vdi_ref):
         return xen_api_success(self._get_VDI(vdi_ref).type)
@@ -1875,6 +1872,14 @@ class XendAPI(object):
     
     def VDI_set_read_only(self, session, vdi_ref, value):
         self._get_VDI(vdi_ref).read_only = bool(value)
+        return xen_api_success_void()
+
+    def VDI_get_other_config(self, session, vdi_ref):
+        return xen_api_success(
+            self._get_VDI(vdi_ref).other_config)
+
+    def VDI_set_other_config(self, session, vdi_ref, other_config):
+        self._get_VDI(vdi_ref).other_config = other_config
         return xen_api_success_void()
 
     # Object Methods
@@ -1896,10 +1901,10 @@ class XendAPI(object):
             'VBDs': [], # TODO
             'virtual_size': image.virtual_size,
             'physical_utilisation': image.physical_utilisation,
-            'sector_size': image.sector_size,
             'type': image.type,
             'sharable': image.sharable,
             'read_only': image.read_only,
+            'other_config': image.other_config
             })
 
     # Class Functions    
diff -r f40bd358129a -r 2adbc1d22fe7 tools/python/xen/xend/XendVDI.py
--- a/tools/python/xen/xend/XendVDI.py  Sat Mar 17 16:56:39 2007 +0000
+++ b/tools/python/xen/xend/XendVDI.py  Sat Mar 17 23:55:03 2007 +0000
@@ -54,7 +54,6 @@ class XendVDI(AutoSaveObject):
     
     SAVED_CFG = ['name_label',
                  'name_description',
-                 'sector_size',
                  'virtual_size',
                  'physical_utilisation',
                  'sharable',
@@ -67,13 +66,12 @@ class XendVDI(AutoSaveObject):
         self.sr_uuid = sr_uuid
         self.name_label = ""
         self.name_description = ""
-        self.sector_size = 1024
         self.virtual_size = 0
         self.physical_utilisation = 0
         self.sharable = False
         self.read_only = False
         self.type = "system"
-        self.location = ''
+        self.other_config = {}
 
     def load_config_dict(self, cfg):
         """Loads configuration into the object from a dict.
@@ -144,11 +142,10 @@ class XendVDI(AutoSaveObject):
                 'name_description': self.name_description,
                 'virtual_size': self.virtual_size,
                 'physical_utilisation': self.physical_utilisation,
-                'sector_size': self.sector_size,
                 'sharable': False,
                 'readonly': False,
                 'SR': self.sr_uuid,
-                'location': self.get_location(),
+                'other_config': self.other_config,
                 'VBDs': []}
 
     def get_location(self):
@@ -163,12 +160,11 @@ class XendQCoWVDI(XendVDI):
         self.cfg_path = cfg_path
         self.physical_utilisation = psize
         self.virtual_size = vsize
-        self.sector_size = 512
         self.auto_save = True
-        self.location = 'tap:qcow:%s' % self.qcow_path
+        self.other_config['location'] = 'tap:qcow:%s' % self.qcow_path
 
     def get_location(self):
-        return self.location
+        return self.other_config['location']
 
 class XendLocalVDI(XendVDI):
     def __init__(self, vdi_struct):
@@ -182,11 +178,10 @@ class XendLocalVDI(XendVDI):
         self.name_description = vdi_struct.get('name_description', '')
         self.physical_utilisation = 0
         self.virtual_size = 0
-        self.sector_size = 0
         self.type = vdi_struct.get('type', '')
         self.sharable = vdi_struct.get('sharable', False)
         self.read_only = vdi_struct.get('read_only', False)
-        self.location = vdi_struct.get('location', 'file:/dev/null')
+        self.other_config = vdi_struct.get('other_config', {})
 
     def get_location(self):
-        return self.location
+        return self.other_config['location']

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.