Ejemplo n.º 1
0
 def setUp(self):
     super(GetConsoleOutputTestCase, self).setUp()
     stubs.stubout_session(self.stubs, xenapi_fake.SessionBase)
     self._session = xenapi_conn.XenAPISession('test_url', 'root',
                                               'test_pass',
                                               fake.FakeVirtAPI())
     self.vmops = vmops.VMOps(self._session, fake.FakeVirtAPI())
     self.vms = []
Ejemplo n.º 2
0
    def __init__(self, *args, **kwargs):
        """Connect to the hypervisor."""

        # This driver leverages Xen storage manager, and hence requires
        # hypervisor to be Xen
        if FLAGS.connection_type != 'xenapi':
            msg = _('XenSMDriver requires xenapi connection')
            raise exception.NovaException(msg)

        url = FLAGS.xenapi_connection_url
        username = FLAGS.xenapi_connection_username
        password = FLAGS.xenapi_connection_password
        try:
            session = xenapi_conn.XenAPISession(url, username, password)
            self._volumeops = volumeops.VolumeOps(session)
        except Exception as ex:
            LOG.exception(ex)
            raise exception.NovaException(_("Failed to initiate session"))

        super(XenSMDriver, self).__init__(execute=utils.execute,
                                          sync_exec=utils.execute,
                                          *args,
                                          **kwargs)
Ejemplo n.º 3
0
 def _setup_mock_vmops(self, product_brand=None, product_version=None):
     stubs.stubout_session(self.stubs, xenapi_fake.SessionBase)
     self._session = xenapi_conn.XenAPISession('test_url', 'root',
                                               'test_pass',
                                               fake.FakeVirtAPI())
     self.vmops = vmops.VMOps(self._session, fake.FakeVirtAPI())