Re: RFC: virt-manager: Redesigned 'New VM' wizard

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

 



On Mon, Mar 02, 2009 at 07:50:28PM +0000, Daniel P. Berrange wrote:
> On Mon, Mar 02, 2009 at 08:12:03PM +0100, Guido G?nther wrote:
> > Hi Cole,
> > this all looks great.
> > On Fri, Feb 27, 2009 at 05:50:15PM -0500, Cole Robinson wrote:
> > > The summary section is pretty straight forward, no surprises here.
> > > The 'Advanced Options' section encompasses networking, hypervisor, and
> > > architecture options. The hypervisor and arch defaults were explained above.
> > An option to select disk (scsi, ide, virtio) and network adapter model
> > (e1000, ...) as advanced options would be great (still defaulting to
> > virtio if supported via the osdict) since there are some OSes that don't
> > support all hardware out of the box and there are kvm/qemu versions that
> > have problems with certain adapter types.
> 
> If there are combinations of OS,Disk that don't work IMHO we should
> improve the OS type metadata so we don't use them. Choice of specific
> hardware models is something we really want to keep out of the new VM
> wizard, because the end user really isn't in a position to have the
> knowledge to make suitable choices.
Sometimes it's not an issue of the guest but of the hypervisor like
missing PXE roms[1]. Attached is a patch Andreas Unterkircher that adds
NIC model selection to the advanced options of the vm wizard (some code
could probably be shared with vmmAddHardware).
Cheers,
 -- Guido

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521091
# HG changeset patch
# Node ID af07557895b63ed3c73c0f291c4d55213adbfc69
# Parent  64b1e55e4aa5c6348c0ef53701729e50b54411b6
[mq]: nic-model-wizard

diff -r 64b1e55e4aa5 -r af07557895b6 src/virtManager/create.py
--- a/src/virtManager/create.py	Thu Apr 16 13:08:07 2009 +0200
+++ b/src/virtManager/create.py	Thu Apr 16 18:12:50 2009 +0200
@@ -240,6 +240,13 @@
         net_list.add_attribute(text, 'text', 2)
         net_list.add_attribute(text, 'sensitive', 3)
 
+        netmodel_list  = self.window.get_widget("net-model")
+        netmodel_model = gtk.ListStore(str, str)
+        netmodel_list.set_model(netmodel_model)
+        text = gtk.CellRendererText()
+        netmodel_list.pack_start(text, True)
+        netmodel_list.add_attribute(text, 'text', 1)
+
         # Archtecture
         archModel = gtk.ListStore(str)
         archList = self.window.get_widget("config-arch")
@@ -466,6 +473,10 @@
             logging.exception("Generating macaddr failed: %s" % str(e))
         self.window.get_widget("config-macaddr").set_text(newmac)
 
+        netmodel = self.window.get_widget("net-model")
+        self.populate_network_model_model(netmodel.get_model())
+        netmodel.set_active(0)
+
     def populate_hv(self):
         hv_list = self.window.get_widget("config-hv")
         model = hv_list.get_model()
@@ -689,6 +700,20 @@
 
         net_list.set_active(default)
 
+    def populate_network_model_model(self, model):
+        model.clear()
+
+        # [xml value, label]
+        model.append([None, _("Hypervisor default")])
+        mod_list = [ "rtl8139", "ne2k_pci", "pcnet" ]
+        if self.capsdomain.hypervisor_type.lower() == "kvm":
+            mod_list.append("e1000")
+            mod_list.append("virtio")
+        mod_list.sort()
+
+        for m in mod_list:
+           model.append([m, m])
+
     def change_caps(self, gtype=None, dtype=None):
 
         if gtype == None:
@@ -889,6 +914,12 @@
 
         return netinfo[0], netinfo[1], macaddr.strip()
 
+    def get_config_net_model(self):
+        model = self.window.get_widget("net-model")
+        modelxml = model.get_model().get_value(model.get_active_iter(), 0)
+        modelstr = model.get_model().get_value(model.get_active_iter(), 1)
+        return modelxml, modelstr
+
     def get_config_sound(self):
         if self.conn.is_remote():
             return self.config.get_remote_sound()
@@ -1347,7 +1378,14 @@
                                           network = netname,
                                           macaddr = macaddr)
 
+            modelxml = self.get_config_net_model()[0]
+            modelstr = self.get_config_net_model()[1]
+            if modelxml != None:
+                logging.debug(_("NIC model %s (%s) selected") % (modelstr, modelxml) )
+                net.model = modelxml
+
             self.guest.nics.append(net)
+
         except Exception, e:
             return self.verr(_("Error with network parameters."), str(e))
 
diff -r 64b1e55e4aa5 -r af07557895b6 src/vmm-create.glade
--- a/src/vmm-create.glade	Thu Apr 16 13:08:07 2009 +0200
+++ b/src/vmm-create.glade	Thu Apr 16 18:12:50 2009 +0200
@@ -1443,6 +1443,32 @@
                                             <property name="position">2</property>
                                           </packing>
                                         </child>
+                                        <!-- Device Model -->
+                                        <child>
+                                          <widget class="GtkLabel" id="label6">
+                                            <property name="visible">True</property>
+                                            <property name="xalign">0</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="label" translatable="yes">Device Model:</property>
+                                          </widget>
+                                          <packing>
+                                            <property name="top_attach">8</property>
+                                            <property name="bottom_attach">9</property>
+                                            <property name="x_options">GTK_FILL</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <widget class="GtkComboBox" id="net-model">
+                                            <property name="visible">True</property>
+                                          </widget>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="right_attach">2</property>
+                                            <property name="top_attach">8</property>
+                                            <property name="bottom_attach">9</property>
+                                          </packing>
+                                        </child>
+                                      <!-- //Device Model -->
                                       </widget>
                                       <packing>
                                         <property name="expand">False</property>
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux