def save_config(conn, iface, gateway=None): n = IPv4Network(get_dev_netaddr(iface)) net_params = {'ipaddr': str(n.ip), 'netmask': str(n.netmask)} if gateway: net_params['gateway'] = gateway iface_xml = InterfaceModel()._create_iface_xml(iface, net_params) iface = conn.interfaceDefineXML(iface_xml)
def __init__(self): objstore_loc = config.get_object_store() + '_ginger' self._objstore = ObjectStore(objstore_loc) sub_models = [] firmware = FirmwareModel() powerprofiles = PowerProfilesModel() powerprofile = PowerProfileModel() users = UsersModel() user = UserModel() interfaces = InterfacesModel() interface = InterfaceModel() network = NetworkModel() archives = ArchivesModel(objstore=self._objstore) archive = ArchiveModel(objstore=self._objstore) backup = BackupModel(objstore=self._objstore, archives_model=archives, archive_model=archive) san_adapters = SanAdaptersModel() san_adapter = SanAdapterModel() sensors = SensorsModel() ibm_sep = SepModel() features = [ firmware, backup, network, powerprofiles, san_adapters, sensors, ibm_sep, users ] capabilities = CapabilitiesModel(features) sub_models = [ backup, archives, archive, firmware, interfaces, interface, network, powerprofiles, powerprofile, users, user, san_adapters, san_adapter, sensors, ibm_sep, capabilities ] super(GingerModel, self).__init__(sub_models)
def save_config(conn, iface, gateway=None): nic_info = ethtool.get_interfaces_info(iface)[0] ipv4 = '' if nic_info.ipv4_address: ipv4 = "%s/%s" % (nic_info.ipv4_address, nic_info.ipv4_netmask) n = IPv4Network(ipv4) net_params = {'ipaddr': str(n.ip), 'netmask': str(n.netmask)} if gateway: net_params['gateway'] = gateway iface_xml = InterfaceModel()._create_iface_xml(iface, net_params) iface = conn.interfaceDefineXML(iface_xml)
def __init__(self): objstore_loc = config.get_object_store() + '_ginger' self._objstore = ObjectStore(objstore_loc) sub_models = [] firmware = FirmwareModel() powerprofiles = PowerProfilesModel() powerprofile = PowerProfileModel() users = UsersModel() user = UserModel() interfaces = InterfacesModel() interface = InterfaceModel() cfginterface = CfginterfaceModel() cfginterfaces = CfginterfacesModel() dasddevs = DASDdevsModel() dasddev = DASDdevModel(objstore=self._objstore) dasdpartitions = DASDPartitionsModel() dasdpartition = DASDPartitionModel() network = NetworkModel() filesystems = FileSystemsModel() filesystem = FileSystemModel() archives = ArchivesModel(objstore=self._objstore) archive = ArchiveModel(objstore=self._objstore) backup = BackupModel(objstore=self._objstore, archives_model=archives, archive_model=archive) san_adapters = SanAdaptersModel() san_adapter = SanAdapterModel() sensors = SensorsModel() ibm_sep = SepModel() subscription = SubscriptionModel() subscriber = SubscribersModel() features = [ firmware, backup, dasddevs, dasdpartitions, network, powerprofiles, san_adapters, sensors, ibm_sep, users, filesystems ] capabilities = CapabilitiesModel(features) sub_models = [ backup, archives, archive, firmware, interfaces, interface, cfginterface, cfginterfaces, dasddevs, dasddev, dasdpartitions, dasdpartition, network, filesystems, filesystem, powerprofiles, powerprofile, users, user, san_adapters, san_adapter, sensors, ibm_sep, subscription, subscriber, capabilities ] super(GingerModel, self).__init__(sub_models)
def deactivate_if_itis_active(self, name): type = netinfo.get_interface_type(name) allowed_active_types = [IFACE_BOND, IFACE_VLAN] if type in allowed_active_types: InterfaceModel().deactivate(name)