def addIscsiDrive(anaconda, bind=False): """ Displays a series of dialogs that walk the user through discovering and logging into iscsi nodes. Returns gtk.RESPONSE_OK if at least one iscsi node has been logged into. """ # make sure the network is up if not network.hasActiveNetDev(): if not anaconda.intf.enableNetwork(): log.info("addIscsiDrive(): early exit, network disabled.") return gtk.RESPONSE_CANCEL urlgrabber.grabber.reset_curl_obj() # This will modify behaviour of iscsi.discovery() function if storage.iscsi.iscsi().mode == "none" and not bind: storage.iscsi.iscsi().delete_interfaces() elif (storage.iscsi.iscsi().mode == "none" and bind) \ or storage.iscsi.iscsi().mode == "bind": active = set(network.getActiveNetDevs()) created = set(storage.iscsi.iscsi().ifaces.values()) storage.iscsi.iscsi().create_interfaces(active - created) wizard = iSCSIGuiWizard() login_ok_nodes = pih.drive_iscsi_addition(anaconda, wizard) if len(login_ok_nodes): return gtk.RESPONSE_OK log.info("addIscsiDrive(): no new nodes added") return gtk.RESPONSE_CANCEL
def initialize(self): """Here is were all the relative vars get initialized. """ # see if we can sniff out network info netinfo = network.Network() devices = netinfo.netdevices active_devs = network.getActiveNetDevs() self.ip = None if active_devs != []: devname = devices[active_devs[0]].iface try: ips = (isys.getIPAddresses(devname, version=4) + isys.getIPAddresses(devname, version=6)) except Exception as e: log.warning("Got an exception trying to get the self.ip addr " "of %s: %s" % (devname, e)) else: if ips and ips[0] not in ("127.0.0.1", "::1"): log.info("IPs (using first) of device %s: %s" % (devname, ips)) self.ip = ips[0] ipstr = self.ip try: hinfo = socket.gethostbyaddr(ipstr) except Exception as e: log.debug("Exception caught trying to get host name of %s: %s" % (ipstr, e)) self.name = network.getDefaultHostname(self.anaconda) else: if len(hinfo) == 3: self.name = hinfo[0] if self.ip.find(':') != -1: ipstr = "[%s]" % (self.ip,) if (self.name is not None) and (not self.name.startswith('localhost')) and (ipstr is not None): self.connxinfo = "%s:%s (%s)" % (socket.getfqdn(name=self.name), self.display, ipstr,) elif ipstr is not None: self.connxinfo = "%s:%s" % (ipstr, self.display,) else: self.connxinfo = None # figure out product info if self.name is not None: self.desktop = _("%(productName)s %(productVersion)s installation " "on host %(name)s") \ % {'productName': product.productName, 'productVersion': product.productVersion, 'name': self.name} else: self.desktop = _("%(productName)s %(productVersion)s installation")\ % {'productName': product.productName, 'productVersion': product.productVersion}
def initialize(self): """Here is were all the relative vars get initialized. """ # see if we can sniff out network info netinfo = network.Network() devices = netinfo.netdevices active_devs = network.getActiveNetDevs() if active_devs != []: dev = devices[active_devs[0]] try: self.ip = isys.getIPAddress(dev.get("DEVICE")) log.info("ip of %s is %s" % (dev.get("DEVICE"), self.ip)) if self.ip == "127.0.0.1" or self.ip == "::1": self.ip = None except Exception, e: log.warning("Got an exception trying to get the self.ip addr " "of %s: %s" % (dev.get("DEVICE"), e))
def getScreen(self, anaconda): self.intf = anaconda.intf self.colocated_nc = getattr(anaconda.id.instClass, 'colocated_nc', 0) open('/tmp/eucalyptus.conf', 'w').close() euca_conf = ConfigFile('/tmp/eucalyptus.conf') roles = ['CLC', 'WS', 'SC', 'CC'] if self.colocated_nc: roles.append('NC') self.validDevs = network.getActiveNetDevs() if not self.validDevs: self.intf.messageWindow(_("No Network Device"), _("Please go back and configure at least" " one network device to continue"), custom_icon="error", custom_buttons=[_("_Back")]) anaconda.dispatch.gotoPrev() self.intf.icw.setScreen () self.win = self.intf.icw.window return FrontendWindow.getScreen(self, euca_conf=euca_conf, roles=roles)
def initialize(self): """Here is were all the relative vars get initialized. """ # see if we can sniff out network info netinfo = network.Network() devices = netinfo.netdevices active_devs = network.getActiveNetDevs() if active_devs != []: dev = devices[active_devs[0]] try: devname = dev.iface ips = (isys.getIPAddresses(devname, version=4) + isys.getIPAddresses(devname, version=6)) self.ip = ips[0] log.info("IPs (using first) of device %s: %s" % (devname, ips)) if self.ip == "127.0.0.1" or self.ip == "::1": self.ip = None except Exception, e: log.warning("Got an exception trying to get the self.ip addr " "of %s: %s" % (devname, e))
def addIscsiDriveDialog(self, screen, bind=False): if not network.hasActiveNetDev(): ButtonChoiceWindow( screen, _("Error"), "Must have a network configuration set up " "for iSCSI config. Please boot with " "'linux asknetwork'") log.info("addIscsiDriveDialog(): early exit, network disabled.") return INSTALL_BACK # This will modify behaviour of iscsi.discovery() function if storage.iscsi.iscsi().mode == "none" and not bind: storage.iscsi.iscsi().delete_interfaces() elif (storage.iscsi.iscsi().mode == "none" and bind) \ or storage.iscsi.iscsi().mode == "bind": active = set(network.getActiveNetDevs()) created = set(storage.iscsi.iscsi().ifaces.values()) storage.iscsi.iscsi().create_interfaces(active - created) wizard = iSCSITextWizard(screen) login_ok_nodes = pih.drive_iscsi_addition(self.anaconda, wizard) if len(login_ok_nodes): return INSTALL_OK log.info("addIscsiDriveDialog(): no new nodes added") return INSTALL_BACK
def initialize(self): """Here is were all the relative vars get initialized. """ # see if we can sniff out network info netinfo = network.Network() devices = netinfo.netdevices active_devs = network.getActiveNetDevs() if active_devs != []: dev = devices[active_devs[0]] try: devname = dev.get("DEVICE") ips = (isys.getIPAddresses(devname, version=4) + isys.getIPAddresses(devname, version=6)) self.ip = ips[0] log.info("IPs (using first) of device %s: %s" % (devname, ips)) if self.ip == "127.0.0.1" or self.ip == "::1": self.ip = None except Exception, e: log.warning("Got an exception trying to get the self.ip addr " "of %s: %s" % (devname, e))
def addIscsiDriveDialog(self, screen, bind=False): if not network.hasActiveNetDev(): ButtonChoiceWindow(screen, _("Error"), "Must have a network configuration set up " "for iSCSI config. Please boot with " "'linux asknetwork'") log.info("addIscsiDriveDialog(): early exit, network disabled.") return INSTALL_BACK # This will modify behaviour of iscsi.discovery() function if storage.iscsi.iscsi().mode == "none" and not bind: storage.iscsi.iscsi().delete_interfaces() elif (storage.iscsi.iscsi().mode == "none" and bind) \ or storage.iscsi.iscsi().mode == "bind": active = set(network.getActiveNetDevs()) created = set(storage.iscsi.iscsi().ifaces.values()) storage.iscsi.iscsi().create_interfaces(active - created) wizard = iSCSITextWizard(screen) login_ok_nodes = pih.drive_iscsi_addition(self.anaconda, wizard) if len(login_ok_nodes): return INSTALL_OK log.info("addIscsiDriveDialog(): no new nodes added") return INSTALL_BACK
def addFcoeDrive(anaconda): (dxml, dialog) = gui.getGladeWidget("fcoe-config.glade", "fcoeDialog") combo = dxml.get_widget("fcoeNicCombo") dcb_cb = dxml.get_widget("dcbCheckbutton") # Populate the combo cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.set_attributes(cell, text = 0) cell.set_property("wrap-width", 525) combo.set_size_request(480, -1) store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) combo.set_model(store) netdevs = anaconda.network.available() keys = netdevs.keys() keys.sort() selected_interface = None for dev in keys: # Skip NICs which are connected (iow in use for a net install) if dev in network.getActiveNetDevs(): continue i = store.append(None) desc = netdevs[dev].get("DESC") if desc: desc = "%s - %s" %(dev, desc) else: desc = "%s" %(dev,) mac = netdevs[dev].get("HWADDR") if mac: desc = "%s - %s" %(desc, mac) if selected_interface is None: selected_interface = i store[i] = (desc, dev) if selected_interface: combo.set_active_iter(selected_interface) else: combo.set_active(0) # Show the dialog gui.addFrame(dialog) dialog.show_all() sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) sg.add_widget(dxml.get_widget("fcoeNicCombo")) while True: rc = dialog.run() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: break iter = combo.get_active_iter() if iter is None: anaconda.intf.messageWindow(_("Error"), _("You must select a NIC to use."), type="warning", custom_icon="error") continue try: anaconda.storage.fcoe.addSan(store.get_value(iter, 1), dcb=dcb_cb.get_active(), intf=anaconda.intf) except IOError as e: anaconda.intf.messageWindow(_("Error"), str(e)) rc = gtk.RESPONSE_CANCEL break dialog.destroy() return rc
def update_active_ifaces(): active_ifaces = network.getActiveNetDevs() dxml.get_widget("ifaceLabel").set_text(", ".join(active_ifaces))
def addFcoeDrive(anaconda): (dxml, dialog) = gui.getGladeWidget("fcoe-config.glade", "fcoeDialog") combo = dxml.get_widget("fcoeNicCombo") dcb_cb = dxml.get_widget("dcbCheckbutton") # Populate the combo cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.set_attributes(cell, text=0) cell.set_property("wrap-width", 525) combo.set_size_request(480, -1) store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING) combo.set_model(store) netdevs = anaconda.network.available() keys = netdevs.keys() keys.sort() selected_interface = None for dev in keys: # Skip NICs which are connected (iow in use for a net install) if dev in network.getActiveNetDevs(): continue i = store.append(None) desc = netdevs[dev].get("DESC") if desc: desc = "%s - %s" % (dev, desc) else: desc = "%s" % (dev, ) mac = netdevs[dev].get("HWADDR") if mac: desc = "%s - %s" % (desc, mac) if selected_interface is None: selected_interface = i store[i] = (desc, dev) if selected_interface: combo.set_active_iter(selected_interface) else: combo.set_active(0) # Show the dialog gui.addFrame(dialog) dialog.show_all() sg = gtk.SizeGroup(gtk.SIZE_GROUP_HORIZONTAL) sg.add_widget(dxml.get_widget("fcoeNicCombo")) while True: rc = dialog.run() if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]: break iter = combo.get_active_iter() if iter is None: anaconda.intf.messageWindow(_("Error"), _("You must select a NIC to use."), type="warning", custom_icon="error") continue try: anaconda.storage.fcoe.addSan(store.get_value(iter, 1), dcb=dcb_cb.get_active(), intf=anaconda.intf) except IOError as e: anaconda.intf.messageWindow(_("Error"), str(e)) rc = gtk.RESPONSE_CANCEL break dialog.destroy() return rc