Debian Codegraph @

vif_plug_ovs/ovs.py

raw symbols SCIP
1 # Derived from nova/virt/libvirt/vif.py
2 #
3 # Copyright (C) 2011 Midokura KK
4 # Copyright (C) 2011 Nicira, Inc
5 # Copyright 2011 OpenStack Foundation
6 # All Rights Reserved.
7 #
8 # Licensed under the Apache License, Version 2.0 (the "License"); you may
9 # not use this file except in compliance with the License. You may obtain
10 # a copy of the License at
11 #
12 # http://www.apache.org/licenses/LICENSE-2.0
13 #
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17 # License for the specific language governing permissions and limitations
18 # under the License.
19
20 from oslo_config import cfg
21 from oslo_log import log as logging
22
23 from os_vif import exception as osv_exception
24 from os_vif.internal.ip.api import ip as ip_lib
25 from os_vif import objects
26 from os_vif import plugin
27
28 from vif_plug_ovs import constants
29 from vif_plug_ovs import exception
30 from vif_plug_ovs import linux_net
31 from vif_plug_ovs.ovsdb import api as ovsdb_api
32 from vif_plug_ovs.ovsdb import ovsdb_lib
33
34 LOG = logging.getLogger(__name__)
35
36
37 def is_trunk_bridge(bridge_name):
38 return bridge_name.startswith(constants.TRUNK_BR_PREFIX)
39
40
41 class OvsPlugin(plugin.PluginBase):
42 """An OVS plugin that can setup VIFs in many ways
43
44 The OVS plugin supports several different VIF types, VIFBridge
45 and VIFOpenVSwitch, and will choose the appropriate plugging
46 action depending on the type of VIF config it receives.
47
48 If given a VIFBridge, then it will create connect the VM via
49 a regular Linux bridge device to allow security group rules to
50 be applied to VM traffic.
51 """
52
53 NIC_NAME_LEN = 14
54
55 CONFIG_OPTS = (
56 cfg.IntOpt('network_device_mtu',
57 default=1500,
58 help='MTU setting for network interface.',
59 deprecated_group="DEFAULT"),
60 cfg.IntOpt('ovs_vsctl_timeout',
61 default=120,
62 help='Amount of time, in seconds, that ovs_vsctl should '
63 'wait for a response from the database. 0 is to wait '
64 'forever.',
65 deprecated_group="DEFAULT"),
66 cfg.StrOpt('ovsdb_connection',
67 default='tcp:127.0.0.1:6640',
68 help='The connection string for the OVSDB backend. '
69 'When executing commands using the native or vsctl '
70 'ovsdb interface drivers this config option defines '
71 'the ovsdb endpoint used.'),
72 cfg.StrOpt('ovsdb_interface',
73 choices=list(ovsdb_api.interface_map),
74 default='native',
75 deprecated_for_removal=True,
76 deprecated_since='2.2.0',
77 deprecated_reason="""
78 os-vif has supported ovsdb access via python bindings
79 since Stein (1.15.0), starting in Victoria (2.2.0) the
80 ovs-vsctl driver is now deprecated for removal and
81 in future releases it will be be removed.
82 """,
83 help='The interface for interacting with the OVSDB'),
84 # NOTE(sean-k-mooney): This value is a bool for two reasons.
85 # First I want to allow this config option to be reusable with
86 # non ml2/ovs deployment in the future if required, as such I do not
87 # want to encode how the isolation is done in the config option.
88 # Second in the case of ml2/ovs the isolation is based on VLAN tags.
89 # The 802.1Q IEEE spec that defines the VLAN format reserved two VLAN
90 # id values, VLAN ID 0 means the packet is a member of no VLAN
91 # and VLAN ID 4095 is reserved for implementation defined use.
92 # Using VLAN ID 0 would not provide isolation and all other VLAN IDs
93 # except VLAN ID 4095 are valid for the ml2/ovs agent to use for a
94 # tenant network's local VLAN ID. As such only VLAN ID 4095 is valid
95 # to use for vif isolation which is defined in Neutron as the
96 # dead VLAN, a VLAN on which all traffic will be dropped.
97 cfg.BoolOpt('isolate_vif', default=False,
98 help='Controls if VIF should be isolated when plugged '
99 'to the ovs bridge. This should only be set to True '
100 'when using the neutron ovs ml2 agent.'),
101 cfg.BoolOpt('per_port_bridge', default=False,
102 help='Controls if VIF should be plugged into a per-port '
103 'bridge. This is experimental and controls the plugging '
104 'behavior when not using hybrid-plug.'
105 'This is only used on linux and should be set to false '
106 'in all other cases such as ironic smartnic ports.'),
107 cfg.StrOpt('default_qos_type',
108 choices=[
109 'linux-htb', 'linux-hfsc', 'linux-sfq', 'linux-codel',
110 'linux-fq_codel', 'linux-noop'
111 ],
112 default='linux-noop',
113 help="""
114 The default qos type to apply to ovs ports.
115 linux-noop is the default. ovs will not modify
116 the qdisc on the port if linux-noop is specified.
117 This allows operators to manage QOS out of band
118 of OVS. For more information see the ovs man pages
119 https://manpages.debian.org/testing/openvswitch-common/ovs-vswitchd.conf.db.5.en.html#type~4
120
121 Note: This will only be set when a port is first created
122 on the ovs bridge to ensure that the qos type can be
123 managed via neutron if required for bandwidth limiting
124 and other use-cases.
125 """),
126 )
127
128 def __init__(self, config):
129 super(OvsPlugin, self).__init__(config)
130 self.ovsdb = ovsdb_lib.BaseOVS(self.config)
131
132 @staticmethod
133 def gen_port_name(prefix, vif_id, max_length=NIC_NAME_LEN):
134 return ("%s%s" % (prefix, vif_id))[:max_length]
135
136 @staticmethod
137 def get_veth_pair_names(vif):
138 return (OvsPlugin.gen_port_name("qvb", vif.id),
139 OvsPlugin.gen_port_name("qvo", vif.id))
140
141 def describe(self):
142 pp_ovs = objects.host_info.HostPortProfileInfo(
143 profile_object_name=objects.vif.VIFPortProfileOpenVSwitch.__name__, # noqa
144 min_version="1.0",
145 max_version="1.0",
146 )
147 pp_ovs_representor = objects.host_info.HostPortProfileInfo(
148 profile_object_name=objects.vif.VIFPortProfileOVSRepresentor.__name__, # noqa
149 min_version="1.0",
150 max_version="1.0",
151 )
152 return objects.host_info.HostPluginInfo(
153 plugin_name=constants.PLUGIN_NAME,
154 vif_info=[
155 objects.host_info.HostVIFInfo(
156 vif_object_name=objects.vif.VIFBridge.__name__,
157 min_version="1.0",
158 max_version="1.0",
159 supported_port_profiles=[pp_ovs]),
160 objects.host_info.HostVIFInfo(
161 vif_object_name=objects.vif.VIFOpenVSwitch.__name__,
162 min_version="1.0",
163 max_version="1.0",
164 supported_port_profiles=[pp_ovs]),
165 objects.host_info.HostVIFInfo(
166 vif_object_name=objects.vif.VIFVHostUser.__name__,
167 min_version="1.0",
168 max_version="1.0",
169 supported_port_profiles=[pp_ovs, pp_ovs_representor]),
170 objects.host_info.HostVIFInfo(
171 vif_object_name=objects.vif.VIFHostDevice.__name__,
172 min_version="1.0",
173 max_version="1.0",
174 supported_port_profiles=[pp_ovs, pp_ovs_representor]),
175 ])
176
177 def _get_mtu(self, vif):
178 if vif.network and vif.network.mtu:
179 return vif.network.mtu
180 return self.config.network_device_mtu
181
182 def supports_tc_qdisc(self, vif) -> bool:
183 if self._get_vif_datapath_type(vif) != constants.OVS_DATAPATH_SYSTEM:
184 return False
185 return True
186
187 def _isolate_vif(self, vif_name, bridge):
188 # NOTE(vsaienko): don't break traffic if port already exists,
189 # we assume it is called when nova-compute is initialized and
190 # since port is present it should be bound already.
191 return (self.config.isolate_vif and
192 not self.ovsdb.port_exists(vif_name, bridge))
193
194 def _create_vif_port(self, vif, vif_name, instance_info, **kwargs):
195 mtu = self._get_mtu(vif)
196 # NOTE(sean-k-mooney): As part of a partial fix to bug #1734320
197 # we introduced the isolate_vif config option to enable isolation
198 # of the vif prior to neutron wiring up the interface. To do
199 # this we take advantage of the fact the ml2/ovs uses the
200 # implementation defined VLAN 4095 as a dead VLAN to indicate
201 # that all packets should be dropped. We only enable this
202 # behaviour conditionally as it is not portable to SDN based
203 # deployment such as ODL or OVN as such operator must opt-in
204 # to this behaviour by setting the isolate_vif config option.
205 # TODO(sean-k-mooney): Extend neutron to record what ml2 driver
206 # bound the interface in the vif binding details so isolation
207 # can be enabled automatically in the future.
208 bridge = kwargs.pop('bridge', vif.network.bridge)
209 # See bug #2069543.
210 if (self._isolate_vif(vif_name, bridge) and
211 not is_trunk_bridge(bridge)):
212 kwargs['tag'] = constants.DEAD_VLAN
213 kwargs['vlan_mode'] = 'trunk'
214 kwargs['trunks'] = constants.DEAD_VLAN
215 qos_type = self._get_qos_type(vif)
216 if qos_type is not None:
217 # NOTE(sean-k-mooney): If the port is not already created
218 # on the bridge we need to set the default qos type to
219 # ensure that the port is created with the correct qos
220 # type. This is only needed for the linux kernel datapath
221 # as the qos type is not managed by neutron for the other
222 # datapaths.
223 # This is a mitigation for the performance regression
224 # introduced by the fix for bug #1734320. See bug #2017868
225 # for more details.
226 if not self.ovsdb.port_exists(vif_name, bridge):
227 kwargs['qos_type'] = qos_type
228 self.ovsdb.create_ovs_vif_port(
229 bridge,
230 vif_name,
231 vif.port_profile.interface_id,
232 vif.address, instance_info.uuid,
233 mtu=mtu,
234 **kwargs)
235 # Check if tap creation is requested:
236 # - 'field in profile.fields' checks if field exists in schema
237 # - 'field in profile' checks if the attribute is set on instance
238 profile = vif.port_profile
239 create_tap = (
240 isinstance(profile, objects.vif.VIFPortProfileOpenVSwitch) and
241 'create_tap' in profile.fields and
242 'create_tap' in profile and
243 profile.create_tap
244 )
245
246 if create_tap:
247 # Validate VIF type - only VIFOpenVSwitch supports tap creation
248 if not isinstance(vif, objects.vif.VIFOpenVSwitch):
249 raise exception.TapCreationNotSupported(
250 vif_type=vif.__class__.__name__)
251
252 # Get multiqueue setting from port profile if available
253 # 'field in profile.fields' checks schema, 'field in profile'
254 # checks if the attribute is set
255 multiqueue = ('multiqueue' in profile.fields and
256 'multiqueue' in profile and
257 profile.multiqueue)
258
259 # Create the tap device with proper MAC and MTU if it doesn't
260 # already exist (e.g., from a previous plug during init_host)
261 if not ip_lib.exists(vif_name):
262 linux_net.create_tap(
263 vif_name, mtu, vif.address, multiqueue=multiqueue)
264
265 def _update_vif_port(self, vif, vif_name):
266 mtu = self._get_mtu(vif)
267 self.ovsdb.update_ovs_vif_port(vif_name, mtu)
268
269 def _delete_tap_if_required(self, vif, vif_name):
270 """Delete tap device if it was created via create_tap flag.
271
272 :param vif: VIF object
273 :param vif_name: Name of the tap device
274 """
275 # Check if this VIF had a tap device created for it:
276 # - 'field in profile.fields' checks if field exists in schema
277 # - 'field in profile' checks if the attribute is set on instance
278 profile = getattr(vif, 'port_profile', None)
279 create_tap = (
280 profile is not None and
281 isinstance(profile, objects.vif.VIFPortProfileOpenVSwitch) and
282 isinstance(vif, objects.vif.VIFOpenVSwitch) and
283 'create_tap' in profile.fields and
284 'create_tap' in profile and
285 profile.create_tap
286 )
287
288 if create_tap and ip_lib.exists(vif_name):
289 linux_net.delete_net_dev(vif_name)
290
291 @staticmethod
292 def _get_vif_datapath_type(vif, datapath=constants.OVS_DATAPATH_SYSTEM):
293 profile = vif.port_profile
294 if 'datapath_type' not in profile or not profile.datapath_type:
295 return datapath
296 return profile.datapath_type
297
298 def _plug_vhostuser(self, vif, instance_info):
299 vif_name = OvsPlugin.gen_port_name(
300 constants.OVS_VHOSTUSER_PREFIX, vif.id)
301 args = {}
302 args['datapath_type'] = self._get_vif_datapath_type(vif,
303 datapath=constants.OVS_DATAPATH_NETDEV)
304 if vif.mode == "client":
305 args['interface_type'] = \
306 constants.OVS_VHOSTUSER_INTERFACE_TYPE
307 else:
308 args['interface_type'] = \
309 constants.OVS_VHOSTUSER_CLIENT_INTERFACE_TYPE
310 args['vhost_server_path'] = vif.path
311
312 self._create_vif_port(
313 vif, vif_name, instance_info, **args)
314
315 def _plug_bridge(self, vif, instance_info):
316 """Plug using hybrid strategy
317
318 Create a per-VIF linux bridge, then link that bridge to the OVS
319 integration bridge via a veth device, setting up the other end
320 of the veth device just like a normal OVS port. Then boot the
321 VIF on the linux bridge using standard libvirt mechanisms.
322 """
323
324 v1_name, v2_name = self.get_veth_pair_names(vif)
325
326 linux_net.ensure_bridge(vif.bridge_name)
327
328 mtu = self._get_mtu(vif)
329 if not ip_lib.exists(v2_name):
330 linux_net.create_veth_pair(v1_name, v2_name, mtu)
331 linux_net.add_bridge_port(vif.bridge_name, v1_name)
332 self.ovsdb.ensure_ovs_bridge(vif.network.bridge,
333 self._get_vif_datapath_type(vif))
334 self._create_vif_port(vif, v2_name, instance_info)
335 else:
336 linux_net.update_veth_pair(v1_name, v2_name, mtu)
337 self._update_vif_port(vif, v2_name)
338
339 def _plug_port_bridge(self, vif, instance_info):
340 """Create a per-VIF OVS bridge and patch pair."""
341
342 # NOTE(sean-k-mooney): the port name prefix should not be
343 # changed to avoid losing ports on upgrade.
344 port_bridge_name = self.gen_port_name('pb', vif.id)
345 port_bridge_patch = self.gen_port_name('pbp', vif.id, max_length=64)
346 int_bridge_name = vif.network.bridge
347 int_bridge_patch = self.gen_port_name('ibp', vif.id, max_length=64)
348
349 self.ovsdb.ensure_ovs_bridge(
350 int_bridge_name, self._get_vif_datapath_type(vif))
351 self.ovsdb.ensure_ovs_bridge(
352 port_bridge_name, self._get_vif_datapath_type(vif))
353 self._create_vif_port(
354 vif, vif.vif_name, instance_info, bridge=port_bridge_name,
355 set_ids=False
356 )
357 tag = (constants.DEAD_VLAN
358 if self._isolate_vif(int_bridge_patch, int_bridge_name)
359 else None)
360 iface_id = vif.id
361 mac = vif.address
362 instance_id = instance_info.uuid
363 LOG.debug(
364 'creating patch port pair \n'
365 f'{port_bridge_name}: ({port_bridge_patch}) -> '
366 f'{int_bridge_name}: ({int_bridge_patch})'
367 )
368 self.ovsdb.create_patch_port_pair(
369 port_bridge_name, port_bridge_patch, int_bridge_name,
370 int_bridge_patch, iface_id, mac, instance_id, tag=tag)
371
372 def _plug_vif_generic(self, vif, instance_info):
373 """Create a per-VIF OVS port."""
374 self.ovsdb.ensure_ovs_bridge(vif.network.bridge,
375 self._get_vif_datapath_type(vif))
376 # NOTE(sean-k-mooney): as part of a partial revert of
377 # change Iaf15fa7a678ec2624f7c12f634269c465fbad930
378 # (always create ovs port during plug), we stopped calling
379 # self._create_vif_port(vif, vif.vif_name, instance_info).
380 # Calling _create_vif_port here was intended to ensure
381 # that the vif was wired up by neutron before the vm was
382 # spawned on boot or live migration to partially resolve
383 # #1734320. When the "always create ovs port during plug" change
384 # was written it was understood by me that libvirt would not
385 # modify ovs if the port exists but in fact it deletes and
386 # recreates the port. This both undoes the effort to resolve
387 # bug #1734320 and introduces other issues for neutron.
388 # this comment will be removed when we actually fix #1734320 in
389 # all cases.
390
391 # NOTE(hamdyk): As a WA to the above note, one can use
392 # VIFPortProfileOpenVSwitch.create_port flag to explicitly
393 # plug the port to the switch.
394 if ("create_port" in vif.port_profile and
395 vif.port_profile.create_port):
396 self._create_vif_port(vif, vif.vif_name, instance_info)
397
398 def _plug_vf(self, vif, instance_info):
399 datapath = self._get_vif_datapath_type(vif)
400 self.ovsdb.ensure_ovs_bridge(vif.network.bridge, datapath)
401 pci_slot = vif.dev_address
402 vf_num = linux_net.get_vf_num_by_pci_address(pci_slot)
403 args = []
404 kwargs = {}
405 if datapath == constants.OVS_DATAPATH_SYSTEM:
406 pf_ifname = linux_net.get_ifname_by_pci_address(
407 pci_slot, pf_interface=True, switchdev=True)
408 representor = linux_net.get_representor_port(pf_ifname, vf_num)
409 linux_net.set_interface_state(representor, 'up')
410 args = [vif, representor, instance_info]
411 else:
412 representor = linux_net.get_dpdk_representor_port_name(
413 vif.id)
414 pf_pci = linux_net.get_pf_pci_from_vf(pci_slot)
415 args = [vif, representor, instance_info]
416 kwargs = {'interface_type': constants.OVS_DPDK_INTERFACE_TYPE,
417 'pf_pci': pf_pci,
418 'vf_num': vf_num}
419 self._create_vif_port(*args, **kwargs)
420
421 def plug(self, vif, instance_info):
422 if not hasattr(vif, "port_profile"):
423 raise exception.MissingPortProfile()
424 if not isinstance(vif.port_profile,
425 objects.vif.VIFPortProfileOpenVSwitch):
426 raise exception.WrongPortProfile(
427 profile=vif.port_profile.__class__.__name__)
428
429 if isinstance(vif, objects.vif.VIFOpenVSwitch):
430 if self.config.per_port_bridge:
431 self._plug_port_bridge(vif, instance_info)
432 else:
433 self._plug_vif_generic(vif, instance_info)
434 elif isinstance(vif, objects.vif.VIFBridge):
435 self._plug_bridge(vif, instance_info)
436 elif isinstance(vif, objects.vif.VIFVHostUser):
437 self._plug_vhostuser(vif, instance_info)
438 elif isinstance(vif, objects.vif.VIFHostDevice):
439 self._plug_vf(vif, instance_info)
440 else:
441 # This should never be raised.
442 raise osv_exception.PlugException(
443 vif=vif,
444 err="This vif type is not supported by this plugin")
445
446 def _delete_bridge_if_trunk(self, vif):
447 if is_trunk_bridge(vif.network.bridge):
448 self.ovsdb.delete_ovs_bridge(vif.network.bridge)
449
450 def _unplug_vhostuser(self, vif, instance_info):
451 self.ovsdb.delete_ovs_vif_port(vif.network.bridge,
452 OvsPlugin.gen_port_name(
453 constants.OVS_VHOSTUSER_PREFIX,
454 vif.id))
455 self._delete_bridge_if_trunk(vif)
456
457 def _unplug_bridge(self, vif, instance_info, linux_bridge_name):
458 """UnPlug using hybrid strategy
459
460 Unhook port from OVS, unhook port from bridge, delete
461 bridge, and delete both veth devices.
462 """
463
464 v1_name, v2_name = self.get_veth_pair_names(vif)
465
466 linux_net.delete_bridge(linux_bridge_name, v1_name)
467
468 qos_type = self._get_qos_type(vif)
469 self.ovsdb.delete_ovs_vif_port(
470 vif.network.bridge, v2_name, qos_type=qos_type
471 )
472 self._delete_bridge_if_trunk(vif)
473
474 def _get_qos_type(self, vif):
475 qos_type = None
476 if self.supports_tc_qdisc(vif):
477 qos_type = self.config.default_qos_type
478 return qos_type
479
480 def _unplug_port_bridge(self, vif, instance_info):
481 """Create a per-VIF OVS bridge and patch pair."""
482 # Delete tap device if it was created
483 self._delete_tap_if_required(vif, vif.vif_name)
484
485 # NOTE(sean-k-mooney): the port name prefix should not be
486 # changed to avoid loosing ports on upgrade.
487 port_bridge_name = self.gen_port_name('pb', vif.id)
488 port_bridge_patch = self.gen_port_name('pbp', vif.id, max_length=64)
489 int_bridge_patch = self.gen_port_name('ibp', vif.id, max_length=64)
490 self.ovsdb.delete_ovs_vif_port(vif.network.bridge, int_bridge_patch)
491 self.ovsdb.delete_ovs_vif_port(port_bridge_name, port_bridge_patch)
492 qos_type = self._get_qos_type(vif)
493 self.ovsdb.delete_ovs_vif_port(
494 port_bridge_name, vif.vif_name, qos_type=qos_type
495 )
496 self.ovsdb.delete_ovs_bridge(port_bridge_name)
497 self._delete_bridge_if_trunk(vif)
498
499 def _unplug_vif_generic(self, vif, instance_info):
500 """Remove port from OVS."""
501 # Delete tap device if it was created
502 self._delete_tap_if_required(vif, vif.vif_name)
503
504 # NOTE(sean-k-mooney): even with the partial revert of change
505 # Iaf15fa7a678ec2624f7c12f634269c465fbad930 this should be correct
506 # so this is not removed.
507 qos_type = self._get_qos_type(vif)
508 self.ovsdb.delete_ovs_vif_port(
509 vif.network.bridge, vif.vif_name, qos_type=qos_type
510 )
511 self._delete_bridge_if_trunk(vif)
512
513 def _unplug_vf(self, vif):
514 """Remove port from OVS."""
515 datapath = self._get_vif_datapath_type(vif)
516 if datapath == constants.OVS_DATAPATH_SYSTEM:
517 pci_slot = vif.dev_address
518 pf_ifname = linux_net.get_ifname_by_pci_address(
519 pci_slot, pf_interface=True, switchdev=True)
520 vf_num = linux_net.get_vf_num_by_pci_address(pci_slot)
521 representor = linux_net.get_representor_port(pf_ifname, vf_num)
522 else:
523 representor = linux_net.get_dpdk_representor_port_name(
524 vif.id)
525
526 # The representor interface can't be deleted because it bind the
527 # SR-IOV VF, therefore we just need to remove it from the ovs bridge
528 # and set the status to down
529 qos_type = self._get_qos_type(vif)
530 self.ovsdb.delete_ovs_vif_port(
531 vif.network.bridge, representor, delete_netdev=False,
532 qos_type=qos_type
533 )
534 if datapath == constants.OVS_DATAPATH_SYSTEM:
535 linux_net.set_interface_state(representor, 'down')
536 self._delete_bridge_if_trunk(vif)
537
538 def unplug(self, vif, instance_info):
539 if not hasattr(vif, "port_profile"):
540 raise exception.MissingPortProfile()
541 if not isinstance(vif.port_profile,
542 objects.vif.VIFPortProfileOpenVSwitch):
543 raise exception.WrongPortProfile(
544 profile=vif.port_profile.__class__.__name__)
545 if isinstance(vif, objects.vif.VIFOpenVSwitch):
546 if self.config.per_port_bridge:
547 self._unplug_port_bridge(vif, instance_info)
548 else:
549 linux_bridge_name = self.gen_port_name('qbr', vif.id)
550 if ip_lib.exists(linux_bridge_name):
551 self._unplug_bridge(vif, instance_info, linux_bridge_name)
552 else:
553 self._unplug_vif_generic(vif, instance_info)
554 elif isinstance(vif, objects.vif.VIFBridge):
555 self._unplug_bridge(vif, instance_info, vif.bridge_name)
556 elif isinstance(vif, objects.vif.VIFVHostUser):
557 self._unplug_vhostuser(vif, instance_info)
558 elif isinstance(vif, objects.vif.VIFHostDevice):
559 self._unplug_vf(vif)
560 else:
561 # this should never be raised.
562 raise osv_exception.UnplugException(
563 vif=vif,
564 err="This vif type is not supported by this plugin")