-/* Attempt to create the network device 'iface_name' through the netdev
- * library. */
-static int
-set_up_iface(const struct ovsrec_interface *iface_cfg, struct iface *iface,
- bool create)
-{
- struct shash options;
- int error = 0;
- size_t i;
-
- shash_init(&options);
- for (i = 0; i < iface_cfg->n_options; i++) {
- shash_add(&options, iface_cfg->key_options[i],
- xstrdup(iface_cfg->value_options[i]));
- }
-
- /* Include 'other_config' keys in hash of netdev options. The
- * namespace of 'other_config' and 'options' must be disjoint.
- * Prefer 'options' keys over 'other_config' keys. */
- for (i = 0; i < iface_cfg->n_other_config; i++) {
- char *value = xstrdup(iface_cfg->value_other_config[i]);
- if (!shash_add_once(&options, iface_cfg->key_other_config[i],
- value)) {
- VLOG_WARN("%s: \"other_config\" key %s conflicts with existing "
- "\"other_config\" or \"options\" entry...ignoring",
- iface_cfg->name, iface_cfg->key_other_config[i]);
- free(value);
- }
- }
-
- if (create) {
- struct netdev_options netdev_options;
-
- memset(&netdev_options, 0, sizeof netdev_options);
- netdev_options.name = iface_cfg->name;
- if (!strcmp(iface_cfg->type, "internal")) {
- /* An "internal" config type maps to a netdev "system" type. */
- netdev_options.type = "system";
- } else {
- netdev_options.type = iface_cfg->type;
- }
- netdev_options.args = &options;
- netdev_options.ethertype = NETDEV_ETH_TYPE_NONE;
-
- error = netdev_open(&netdev_options, &iface->netdev);
-
- if (iface->netdev) {
- netdev_get_carrier(iface->netdev, &iface->enabled);
- }
- } else if (iface->netdev) {
- const char *netdev_type = netdev_get_type(iface->netdev);
- const char *iface_type = iface_cfg->type && strlen(iface_cfg->type)
- ? iface_cfg->type : NULL;
-
- /* An "internal" config type maps to a netdev "system" type. */
- if (iface_type && !strcmp(iface_type, "internal")) {
- iface_type = "system";
- }
-
- if (!iface_type || !strcmp(netdev_type, iface_type)) {
- error = netdev_reconfigure(iface->netdev, &options);
- } else {
- VLOG_WARN("%s: attempting change device type from %s to %s",
- iface_cfg->name, netdev_type, iface_type);
- error = EINVAL;
- }
- }
- shash_destroy_free_data(&options);
-
- return error;
-}
-
-static int
-reconfigure_iface(const struct ovsrec_interface *iface_cfg, struct iface *iface)
-{
- return set_up_iface(iface_cfg, iface, false);
-}
-