[virt-tools-list] [virt-manager PATCH RFC 3/4] virt-manager: OVMF support

Giuseppe Scrivano gscrivan at redhat.com
Thu Sep 11 16:56:28 UTC 2014


Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
 ui/create.ui          | 325 +++++++++++++++++++++++++++++++++++++++++++++++---
 virtManager/create.py |  59 ++++++++-
 2 files changed, 369 insertions(+), 15 deletions(-)

diff --git a/ui/create.ui b/ui/create.ui
index 7a4f500..87da4ec 100644
--- a/ui/create.ui
+++ b/ui/create.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.16.1 -->
 <interface>
   <requires lib="gtk+" version="3.0"/>
   <object class="GtkAdjustment" id="adjustment2">
@@ -256,6 +256,8 @@
                               <packing>
                                 <property name="left_attach">0</property>
                                 <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
                               </packing>
                             </child>
                             <child>
@@ -335,12 +337,16 @@
                               <packing>
                                 <property name="left_attach">0</property>
                                 <property name="top_attach">1</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
                               </packing>
                             </child>
                           </object>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">2</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -406,6 +412,8 @@
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
                           </packing>
                         </child>
                         <child>
@@ -435,6 +443,8 @@
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">1</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -446,6 +456,8 @@
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">0</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -460,6 +472,8 @@
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">0</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -474,6 +488,8 @@
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">1</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -488,6 +504,8 @@
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">2</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -499,6 +517,8 @@
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">2</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                   </object>
@@ -516,6 +536,8 @@
                           <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>
@@ -542,6 +564,8 @@
                                   <packing>
                                     <property name="left_attach">0</property>
                                     <property name="top_attach">0</property>
+                                    <property name="width">1</property>
+                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -560,6 +584,8 @@ bar</property>
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="top_attach">0</property>
+                                    <property name="width">1</property>
+                                    <property name="height">1</property>
                                   </packing>
                                 </child>
                               </object>
@@ -573,6 +599,8 @@ bar</property>
                           <packing>
                             <property name="left_attach">0</property>
                             <property name="top_attach">1</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
                           </packing>
                         </child>
                       </object>
@@ -1111,6 +1139,8 @@ User shouldn't see this.</property>
                                               <packing>
                                                 <property name="left_attach">0</property>
                                                 <property name="top_attach">1</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -1125,6 +1155,8 @@ User shouldn't see this.</property>
                                               <packing>
                                                 <property name="left_attach">0</property>
                                                 <property name="top_attach">2</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -1139,6 +1171,8 @@ User shouldn't see this.</property>
                                               <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>
@@ -1150,6 +1184,8 @@ User shouldn't see this.</property>
                                               <packing>
                                                 <property name="left_attach">1</property>
                                                 <property name="top_attach">1</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -1161,6 +1197,8 @@ User shouldn't see this.</property>
                                               <packing>
                                                 <property name="left_attach">1</property>
                                                 <property name="top_attach">2</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -1172,6 +1210,8 @@ User shouldn't see this.</property>
                                               <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>
@@ -1186,6 +1226,8 @@ User shouldn't see this.</property>
                                               <packing>
                                                 <property name="left_attach">2</property>
                                                 <property name="top_attach">1</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -1200,6 +1242,8 @@ User shouldn't see this.</property>
                                               <packing>
                                                 <property name="left_attach">2</property>
                                                 <property name="top_attach">2</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -1214,6 +1258,8 @@ User shouldn't see this.</property>
                                               <packing>
                                                 <property name="left_attach">2</property>
                                                 <property name="top_attach">3</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -1251,6 +1297,7 @@ User shouldn't see this.</property>
                                                 <property name="left_attach">0</property>
                                                 <property name="top_attach">0</property>
                                                 <property name="width">3</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -1266,6 +1313,8 @@ User shouldn't see this.</property>
                                               <packing>
                                                 <property name="left_attach">0</property>
                                                 <property name="top_attach">4</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                             <child>
@@ -1277,6 +1326,7 @@ User shouldn't see this.</property>
                                                 <property name="left_attach">1</property>
                                                 <property name="top_attach">4</property>
                                                 <property name="width">2</property>
+                                                <property name="height">1</property>
                                               </packing>
                                             </child>
                                           </object>
@@ -2055,6 +2105,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">2</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2067,6 +2119,8 @@ is not yet supported.</small></property>
                                       <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>
@@ -2079,6 +2133,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">4</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2092,6 +2148,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">5</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2109,6 +2167,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">6</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2122,6 +2182,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">0</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2138,6 +2200,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">0</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2150,6 +2214,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">1</property>
                                         <property name="top_attach">1</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2164,6 +2230,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">2</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2178,6 +2246,8 @@ is not yet supported.</small></property>
                                       <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>
@@ -2192,6 +2262,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">4</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2206,6 +2278,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">5</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2220,6 +2294,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">1</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                     <child>
@@ -2234,6 +2310,8 @@ is not yet supported.</small></property>
                                       <packing>
                                         <property name="left_attach">0</property>
                                         <property name="top_attach">6</property>
+                                        <property name="width">1</property>
+                                        <property name="height">1</property>
                                       </packing>
                                     </child>
                                   </object>
@@ -2330,19 +2408,8 @@ is not yet supported.</small></property>
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">2</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <object class="GtkEntry" id="config-macaddr">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">True</property>
-                                            <property name="halign">start</property>
-                                            <property name="hexpand">False</property>
-                                            <property name="width_chars">20</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>
@@ -2356,6 +2423,8 @@ is not yet supported.</small></property>
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">1</property>
+                                            <property name="width">1</property>
+                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -2392,6 +2461,234 @@ is not yet supported.</small></property>
                                           <packing>
                                             <property name="left_attach">0</property>
                                             <property name="top_attach">0</property>
+                                            <property name="width">1</property>
+                                            <property name="height">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkEntry" id="config-macaddr">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="halign">start</property>
+                                            <property name="hexpand">False</property>
+                                            <property name="width_chars">20</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="GtkGrid" id="grid2">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="row_spacing">6</property>
+                                            <property name="column_spacing">6</property>
+                                            <child>
+                                              <object class="GtkComboBox" id="config-uefi-type">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <signal name="changed" handler="on_config_uefi_type_changed" swapped="no"/>
+                                              </object>
+                                              <packing>
+                                                <property name="left_attach">1</property>
+                                                <property name="top_attach">0</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel" id="label31">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="hexpand">False</property>
+                                                <property name="xalign">1</property>
+                                                <property name="label" translatable="yes"><span color='#484848'>Firmware type:</span></property>
+                                                <property name="use_markup">True</property>
+                                              </object>
+                                              <packing>
+                                                <property name="left_attach">0</property>
+                                                <property name="top_attach">0</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkHBox" id="config-uefi-binary-box">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="spacing">6</property>
+                                                <child>
+                                                  <object class="GtkEntry" id="config-uefi-binary">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="invisible_char">●</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">True</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <object class="GtkButton" id="config-uefi-binary-browse">
+                                                    <property name="label" translatable="yes">B_rowse...</property>
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="receives_default">True</property>
+                                                    <property name="use_underline">True</property>
+                                                    <signal name="clicked" handler="on_config_uefi_binary_browse_clicked" swapped="no"/>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
+                                              </object>
+                                              <packing>
+                                                <property name="left_attach">1</property>
+                                                <property name="top_attach">1</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel" id="label39">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="hexpand">False</property>
+                                                <property name="xalign">1</property>
+                                                <property name="label" translatable="yes"><span color='#484848'>UEFI binary:</span></property>
+                                                <property name="use_markup">True</property>
+                                              </object>
+                                              <packing>
+                                                <property name="left_attach">0</property>
+                                                <property name="top_attach">1</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkHBox" id="config-uefi-template-box">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="spacing">6</property>
+                                                <child>
+                                                  <object class="GtkEntry" id="config-uefi-template">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="invisible_char">●</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">True</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <object class="GtkButton" id="config-uefi-template-browse">
+                                                    <property name="label" translatable="yes">B_rowse...</property>
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="receives_default">True</property>
+                                                    <property name="use_underline">True</property>
+                                                    <signal name="clicked" handler="on_config_uefi_template_browse_clicked" swapped="no"/>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
+                                              </object>
+                                              <packing>
+                                                <property name="left_attach">1</property>
+                                                <property name="top_attach">2</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel" id="label52">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="hexpand">False</property>
+                                                <property name="xalign">1</property>
+                                                <property name="label" translatable="yes"><span color='#484848'>UEFI varstore template:</span></property>
+                                                <property name="use_markup">True</property>
+                                              </object>
+                                              <packing>
+                                                <property name="left_attach">0</property>
+                                                <property name="top_attach">2</property>
+                                                <property name="width">1</property>
+                                                <property name="height">1</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel" id="label53">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="hexpand">False</property>
+                                                <property name="xalign">1</property>
+                                                <property name="label" translatable="yes"><span color='#484848'>UEFI existing varstore:</span></property>
+                                                <property name="use_markup">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="GtkHBox" id="config-uefi-varstore-box">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="spacing">6</property>
+                                                <child>
+                                                  <object class="GtkEntry" id="config-uefi-varstore">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="invisible_char">●</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">True</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <object class="GtkButton" id="config-uefi-varstore-browse">
+                                                    <property name="label" translatable="yes">B_rowse...</property>
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="receives_default">True</property>
+                                                    <property name="use_underline">True</property>
+                                                    <signal name="clicked" handler="on_config_uefi_varstore_browse_clicked" swapped="no"/>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
+                                              </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>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">4</property>
+                                            <property name="width">1</property>
+                                            <property name="height">1</property>
                                           </packing>
                                         </child>
                                       </object>
diff --git a/virtManager/create.py b/virtManager/create.py
index d93c7f6..9451a1c 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -60,6 +60,12 @@ INSTALL_PAGE_IMPORT = 3
 INSTALL_PAGE_CONTAINER_APP = 4
 INSTALL_PAGE_CONTAINER_OS = 5
 
+(INSTALL_FIRMWARE_SEABIOS,
+INSTALL_FIRMWARE_SYSTEM_UEFI,
+INSTALL_FIRMWARE_CUSTOM_UEFI
+) = range(3)
+
+
 STABLE_OS_SUPPORT = [
     "rhel3", "rhel4", "rhel5.4", "rhel6",
     "win2k3", "winxp", "win2k8", "vista", "win7",
@@ -146,7 +152,11 @@ class vmmCreate(vmmGObjectUI):
             "on_config_kernel_browse_clicked": self.browse_kernel,
             "on_config_initrd_browse_clicked": self.browse_initrd,
             "on_config_dtb_browse_clicked": self.browse_dtb,
+            "on_config_uefi_binary_browse_clicked": self.browse_uefi_binary,
+            "on_config_uefi_template_browse_clicked": self.browse_uefi_template,
+            "on_config_uefi_varstore_browse_clicked": self.browse_uefi_varstore,
 
+            "on_config_uefi_type_changed": self.uefi_type_changed,
             "on_enable_storage_toggled": self.toggle_enable_storage,
 
             "on_config_set_macaddr_toggled": self.toggle_macaddr,
@@ -322,6 +332,17 @@ class vmmCreate(vmmGObjectUI):
         uiutil.set_combo_text_column(lst, 0)
         lst.set_row_separator_func(lambda m, i, ignore: m[i][0] is None, None)
 
+        firmwareType = self.widget("config-uefi-type")
+        firmwareTypeModel = Gtk.ListStore(str, int)
+        firmwareType.set_model(firmwareTypeModel)
+        uiutil.set_combo_text_column(firmwareType, 0)
+        for i in ([_("SeaBIOS"), INSTALL_FIRMWARE_SEABIOS],
+                  [_("System-wide UEFI"), INSTALL_FIRMWARE_SYSTEM_UEFI],
+                  [_("Custom UEFI"), INSTALL_FIRMWARE_CUSTOM_UEFI]):
+            firmwareTypeModel.append(i)
+        firmwareType.set_active(INSTALL_FIRMWARE_SEABIOS)
+        self.uefi_type_changed(None)
+
     def reset_state(self, urihint=None):
         self.failed_guest = None
         self.have_startup_error = False
@@ -1249,6 +1270,17 @@ class vmmCreate(vmmGObjectUI):
         else:
             nodetect_label.show()
 
+    def uefi_type_changed(self, ignore):
+        sel = uiutil.get_list_selection(self.widget("config-uefi-type"), None)
+
+        uiutil.set_grid_row_visible(self.widget("config-uefi-binary-box"),
+                                    sel[1] == INSTALL_FIRMWARE_CUSTOM_UEFI)
+        uiutil.set_grid_row_visible(self.widget("config-uefi-template-box"),
+                                    sel[1] == INSTALL_FIRMWARE_CUSTOM_UEFI)
+        uiutil.set_grid_row_visible(self.widget("config-uefi-varstore-box"),
+                                    sel[1] != INSTALL_FIRMWARE_SEABIOS)
+
+
     def browse_oscontainer(self, ignore):
         self._browse_file("install-oscontainer-fs", is_dir=True)
     def browse_app(self, ignore):
@@ -1266,6 +1298,12 @@ class vmmCreate(vmmGObjectUI):
         self._browse_file("config-initrd")
     def browse_dtb(self, ignore):
         self._browse_file("config-dtb")
+    def browse_uefi_binary(self, ignore):
+        self._browse_file("config-uefi-binary")
+    def browse_uefi_template(self, ignore):
+        self._browse_file("config-uefi-template")
+    def browse_uefi_varstore(self, ignore):
+        self._browse_file("config-uefi-varstore")
 
     def toggle_enable_storage(self, src):
         self.widget("config-storage-align").set_sensitive(src.get_active())
@@ -1766,9 +1804,28 @@ class vmmCreate(vmmGObjectUI):
         if self.validate(page) is not True:
             return False
 
-        logging.debug("Starting create finish() sequence")
         guest = self.guest
 
+        guest.os.loader_ro = None
+        guest.os.loader_type = None
+        guest.os.loader = None
+        guest.os.nvram_template = None
+        guest.os.nvram = None
+        sel = uiutil.get_list_selection(self.widget("config-uefi-type"), None)
+        if sel[1] != INSTALL_FIRMWARE_SEABIOS:
+            guest.os.loader_ro = True
+            guest.os.loader_type = "pflash"
+            varstore = self.widget("config-uefi-varstore").get_text()
+            guest.os.nvram = varstore or None
+            if sel[1] == INSTALL_FIRMWARE_SYSTEM_UEFI:
+                guest.os.loader = "/usr/share/OVMF/OVMF_CODE.fd"
+            else:
+                guest.os.loader = self.widget("config-uefi-binary").get_text()
+                template = self.widget("config-uefi-template").get_text()
+                guest.os.nvram_template = template
+
+        logging.debug("Starting create finish() sequence")
+
         # Start the install
         self.failed_guest = None
         self.topwin.set_sensitive(False)
-- 
1.9.3




More information about the virt-tools-list mailing list