[virt-tools-list] [virt-manager PATCH 4/4] ui: add support for gluster fs

Giuseppe Scrivano gscrivan at redhat.com
Wed Feb 12 12:28:04 UTC 2014


Add a new field "pool-source-name" in the createpool UI that is used
only with gluster fs pools.

Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 ui/createpool.ui          | 48 ++++++++++++++++++++++++++++++++++++++---------
 virtManager/createpool.py | 15 +++++++++++++++
 2 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/ui/createpool.ui b/ui/createpool.ui
index d5f9507..5f3972f 100644
--- a/ui/createpool.ui
+++ b/ui/createpool.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.15.4 on Fri Sep 27 12:09:53 2013 -->
+<!-- Generated with glade 3.16.1 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkWindow" id="vmm-create-pool">
     <property name="height_request">350</property>
     <property name="can_focus">False</property>
@@ -219,7 +219,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">5</property>
+                            <property name="top_attach">6</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
@@ -260,7 +260,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
-                            <property name="top_attach">4</property>
+                            <property name="top_attach">5</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
@@ -320,7 +320,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">3</property>
+                            <property name="top_attach">4</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
@@ -336,7 +336,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
-                            <property name="top_attach">4</property>
+                            <property name="top_attach">5</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
@@ -389,7 +389,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">2</property>
-                            <property name="top_attach">3</property>
+                            <property name="top_attach">4</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
@@ -408,7 +408,7 @@
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
-                            <property name="top_attach">3</property>
+                            <property name="top_attach">4</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
@@ -453,12 +453,42 @@
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
-                            <property name="top_attach">5</property>
+                            <property name="top_attach">6</property>
                             <property name="width">1</property>
                             <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
+                          <object class="GtkLabel" id="pool-source-name-label">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">1</property>
+                            <property name="label" translatable="yes">_Source Name:</property>
+                            <property name="use_underline">True</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">3</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkEntry" id="pool-source-name">
+                            <property name="can_focus">True</property>
+                            <property name="width_chars">25</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">3</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
                           <placeholder/>
                         </child>
                         <child>
diff --git a/virtManager/createpool.py b/virtManager/createpool.py
index 17daf2a..abc35fb 100644
--- a/virtManager/createpool.py
+++ b/virtManager/createpool.py
@@ -255,6 +255,7 @@ class vmmCreatePool(vmmGObjectUI):
 
         src = self._pool.supports_property("source_path")
         src_b = src and not self.conn.is_remote()
+        src_name = self._pool.type == StoragePool.TYPE_GLUSTER
         tgt = self._pool.supports_property("target_path")
         tgt_b = tgt and not self.conn.is_remote()
         host = self._pool.supports_property("host")
@@ -274,6 +275,7 @@ class vmmCreatePool(vmmGObjectUI):
         show_row("pool-format", fmt)
         show_row("pool-build", buildsens)
         show_row("pool-iqn", iqn)
+        show_row("pool-source-name", src_name)
 
         if tgt:
             self.widget("pool-target-path").get_child().set_text(
@@ -283,6 +285,10 @@ class vmmCreatePool(vmmGObjectUI):
         self.widget("pool-source-button").set_sensitive(src_b)
         self.widget("pool-build").set_active(builddef)
 
+        if src_name:
+            self.widget("pool-source-name").get_child().set_text(
+                self._pool.source_name)
+
         self.widget("pool-format").set_active(-1)
         if fmt:
             self.populate_pool_format(self._pool.list_formats("formats"))
@@ -323,6 +329,12 @@ class vmmCreatePool(vmmGObjectUI):
             return host.get_text().strip()
         return None
 
+    def get_config_source_name(self):
+        name = self.widget("pool-source-name")
+        if name.get_sensitive():
+            return name.get_text().strip()
+        return None
+
     def get_config_format(self):
         return uiutil.get_list_selection(self.widget("pool-format"), 0)
 
@@ -476,6 +488,7 @@ class vmmCreatePool(vmmGObjectUI):
         source = self.get_config_source_path()
         fmt = self.get_config_format()
         iqn = self.get_config_iqn()
+        source_name = self.get_config_source_name()
 
         if not self._validate_page_name(self.get_pool_to_validate()):
             return
@@ -490,6 +503,8 @@ class vmmCreatePool(vmmGObjectUI):
                 self._pool.format = fmt
             if iqn:
                 self._pool.iqn = iqn
+            if source_name:
+                self._pool.source_name = source_name
 
             self._pool.validate()
         except ValueError, e:
-- 
1.8.5.3




More information about the virt-tools-list mailing list