예제 #1
0
    def test_get(self, mock_get_wrap):
        get = tf_vm.Get(self.apt, self.instance)
        get.execute()
        mock_get_wrap.assert_called_once_with(self.apt, self.instance)

        # Validate args on taskflow.task.Task instantiation
        with mock.patch('taskflow.task.Task.__init__') as tf:
            tf_vm.Get(self.apt, self.instance)
        tf.assert_called_once_with(name='get_vm', provides='lpar_wrap')
예제 #2
0
    def plug_vifs(self, instance, network_info):
        """Plug VIFs into networks."""
        self._log_operation('plug_vifs', instance)

        # Define the flow
        flow = tf_lf.Flow("plug_vifs")

        # Get the LPAR Wrapper
        flow.add(tf_vm.Get(self.adapter, instance))

        # Run the attach
        flow.add(
            tf_net.PlugVifs(self.virtapi, self.adapter, instance,
                            network_info))

        # Run the flow
        try:
            tf_base.run(flow, instance=instance)
        except exc.InstanceNotFound:
            raise exc.VirtualInterfacePlugException(
                _("Plug vif failed because instance %s was not found.") %
                instance.name)
        except Exception:
            LOG.exception("PowerVM error plugging vifs.", instance=instance)
            raise exc.VirtualInterfacePlugException(
                _("Plug vif failed because of an unexpected error."))