Skip to content

Commit

Permalink
Revert "Merge remote-tracking branch 'mt/netif-requires' into testing"
Browse files Browse the repository at this point in the history
This reverts commit 2491658, reversing
changes made to 6aba72d.
  • Loading branch information
mtomaschewski committed Oct 9, 2015
1 parent 2491658 commit 597776b
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 121 deletions.
62 changes: 0 additions & 62 deletions client/ifup.c
Expand Up @@ -73,54 +73,6 @@ __ni_ifup_generate_match_dev(xml_node_t *node, ni_ifworker_t *w)
return xml_node_new_element(NI_NANNY_IFPOLICY_MATCH_DEV, node, w->name);
}

static ni_bool_t
__ni_ifup_generate_link_port_match(xml_node_t *node, xml_node_t *port)
{
const char *type = xml_node_get_attr(port, NI_CLIENT_IFCONFIG_PORT_TYPE);
ni_iftype_t ptype = ni_linktype_name_to_type(type);
xml_node_t *bridge;

switch (ptype) {
case NI_IFTYPE_OVS_BRIDGE:
bridge = xml_node_get_child(port, NI_CLIENT_IFCONFIG_BRIDGE);
if (!bridge || ni_string_empty(bridge->cdata))
return TRUE; /* Hmm... missed relation -> error? */
return !!xml_node_new_element(NI_NANNY_IFPOLICY_MATCH_DEV_REF,
node, bridge->cdata);
default:
break;
}
return TRUE;
}

static ni_bool_t
__ni_ifup_generate_link_match(xml_node_t *node, xml_node_t *config)
{
xml_node_t *link, *master, *port;

if ((link = xml_node_get_child(config, NI_CLIENT_IFCONFIG_LINK))) {
master = xml_node_get_child(link, NI_CLIENT_IFCONFIG_MASTER);
if (!master || ni_string_empty(master->cdata))
return TRUE;

if (!xml_node_new_element(NI_NANNY_IFPOLICY_MATCH_DEV_REF,
node, master->cdata))
return FALSE;

port = xml_node_get_child(link, NI_CLIENT_IFCONFIG_LINK_PORT);
if (port && !__ni_ifup_generate_link_port_match(node, port))
return FALSE;
}

return TRUE; /* it isn't an error */
}

static ni_bool_t
__ni_ifup_generate_match_refs(xml_node_t *match, xml_node_t *config)
{
return __ni_ifup_generate_link_match(match, config);
}

static xml_node_t *
__ni_ifup_generate_match(const char *name, ni_ifworker_t *w)
{
Expand All @@ -129,8 +81,6 @@ __ni_ifup_generate_match(const char *name, ni_ifworker_t *w)
if (!(match = xml_node_new(name, NULL)))
goto error;

ni_debug_wicked_xml(w->config.node, NI_LOG_DEBUG, "generate policy match for %s", w->name);

if (!__ni_ifup_generate_match_dev(match, w))
goto error;

Expand All @@ -143,18 +93,6 @@ __ni_ifup_generate_match(const char *name, ni_ifworker_t *w)
break;
}

if (w->masterdev) {
if (!__ni_ifup_generate_match_dev(match, w->masterdev)) {
ni_debug_application("%s: unable to generate master device %s match",
w->name, w->masterdev->name);
goto error;
}
} else if (!__ni_ifup_generate_match_refs(match, w->config.node)) {
ni_debug_application("%s: unable to generate policy match for references",
w->name);
goto error;
}

if (w->children.count) {
xml_node_t *or;
unsigned int i;
Expand Down
4 changes: 2 additions & 2 deletions include/wicked/fsm.h
Expand Up @@ -289,7 +289,7 @@ extern ni_fsm_policy_t * ni_fsm_policy_by_name(ni_fsm_t *, const char *);
extern ni_bool_t ni_fsm_policy_remove(ni_fsm_t *, ni_fsm_policy_t *);
extern unsigned int ni_fsm_policy_get_applicable_policies(ni_fsm_t *, ni_ifworker_t *,
const ni_fsm_policy_t **, unsigned int);
extern ni_bool_t ni_fsm_exists_applicable_policy(ni_fsm_t *, ni_fsm_policy_t *, ni_ifworker_t *);
extern ni_bool_t ni_fsm_exists_applicable_policy(ni_fsm_policy_t *, ni_ifworker_t *);
extern xml_node_t * ni_fsm_policy_transform_document(xml_node_t *, ni_fsm_policy_t * const *, unsigned int);
extern const char * ni_fsm_policy_name(const ni_fsm_policy_t *);
extern xml_location_t * ni_fsm_policy_location(const ni_fsm_policy_t *);
Expand All @@ -313,7 +313,7 @@ extern unsigned int ni_fsm_fail_count(ni_fsm_t *);
extern ni_ifworker_t * ni_fsm_ifworker_by_object_path(ni_fsm_t *, const char *);
extern ni_ifworker_t * ni_fsm_ifworker_by_ifindex(ni_fsm_t *, unsigned int);
extern ni_ifworker_t * ni_fsm_ifworker_by_netdev(ni_fsm_t *, const ni_netdev_t *);
extern ni_ifworker_t * ni_fsm_ifworker_by_name(const ni_fsm_t *, ni_ifworker_type_t, const char *);
extern ni_ifworker_t * ni_fsm_ifworker_by_name(ni_fsm_t *, ni_ifworker_type_t, const char *);
extern ni_ifworker_t * ni_fsm_ifworker_by_policy_name(ni_fsm_t *, ni_ifworker_type_t, const char *);
extern ni_ifworker_t * ni_fsm_recv_new_netif(ni_fsm_t *fsm, ni_dbus_object_t *object, ni_bool_t refresh);
extern ni_ifworker_t * ni_fsm_recv_new_netif_path(ni_fsm_t *fsm, const char *path);
Expand Down
4 changes: 2 additions & 2 deletions nanny/nanny.c
Expand Up @@ -530,7 +530,7 @@ ni_nanny_register_device(ni_nanny_t *mgr, ni_ifworker_t *w)
mdev->allowed? ", user control allowed" : "",
mdev->monitor? ", monitored (auto-enabled)" : "");

if (ni_fsm_exists_applicable_policy(mgr->fsm, mgr->fsm->policies, w))
if (ni_fsm_exists_applicable_policy(mgr->fsm->policies, w))
ni_nanny_schedule_recheck(&mgr->recheck, w);

ni_ifworker_set_progress_callback(w, ni_managed_device_progress, mdev);
Expand All @@ -556,7 +556,7 @@ ni_nanny_unregister_device(ni_nanny_t *mgr, ni_ifworker_t *w)
ni_ifworker_set_completion_callback(w, NULL, NULL);

if (!ni_ifworker_is_factory_device(w) ||
!ni_fsm_exists_applicable_policy(mgr->fsm, mgr->fsm->policies, w)) {
!ni_fsm_exists_applicable_policy(mgr->fsm->policies, w)) {
ni_nanny_unschedule(&mgr->recheck, w);
}
}
Expand Down
6 changes: 0 additions & 6 deletions src/client/ifconfig.h
Expand Up @@ -31,9 +31,6 @@
#define NI_CLIENT_IFCONFIG_MODE "mode"
#define NI_CLIENT_IFCONFIG_LINK "link"
#define NI_CLIENT_IFCONFIG_MASTER "master"
#define NI_CLIENT_IFCONFIG_LINK_PORT "port"
#define NI_CLIENT_IFCONFIG_PORT_TYPE "type"
#define NI_CLIENT_IFCONFIG_BRIDGE "bridge"
#define NI_CLIENT_IFCONFIG_IPV4 "ipv4"
#define NI_CLIENT_IFCONFIG_IPV6 "ipv6"
#define NI_CLIENT_IFCONFIG_IP_ENABLED "enabled"
Expand All @@ -48,9 +45,6 @@
#define NI_NANNY_IFPOLICY_MATCH_COND_CHILD "child"
#define NI_NANNY_IFPOLICY_MATCH_ALWAYS_TRUE "any"
#define NI_NANNY_IFPOLICY_MATCH_DEV "device"
#define NI_NANNY_IFPOLICY_MATCH_REF "reference"
#define NI_NANNY_IFPOLICY_MATCH_DEV_REF NI_NANNY_IFPOLICY_MATCH_DEV ":" \
NI_NANNY_IFPOLICY_MATCH_REF
#define NI_NANNY_IFPOLICY_MATCH_MIN_STATE "minimum-device-state"
#define NI_NANNY_IFPOLICY_MATCH_LINK_TYPE "link-type"
#define NI_NANNY_IFPOLICY_MERGE "merge"
Expand Down

0 comments on commit 597776b

Please sign in to comment.