예제 #1
0
    def do_setup(self, context):
        """Perform validations and establish connection to server.

        :param context: Context information
        """

        # Throw error if required parameters are not set.
        required_params = ['vmware_host_ip',
                           'vmware_host_username',
                           'vmware_host_password']
        for param in required_params:
            if not getattr(self.configuration, param, None):
                raise exception.InvalidInput(_("%s not set.") % param)

        # Create the session object for the first time
        max_objects = self.configuration.vmware_max_objects_retrieval
        self._volumeops = volumeops.VMwareVolumeOps(self.session, max_objects)
        LOG.info(_("Successfully setup driver: %(driver)s for "
                   "server: %(ip)s.") %
                 {'driver': self.__class__.__name__,
                  'ip': self.configuration.vmware_host_ip})
 def setUp(self):
     super(VolumeOpsTestCase, self).setUp()
     self.session = mock.MagicMock()
     self.vops = volumeops.VMwareVolumeOps(self.session, self.MAX_OBJECTS)
예제 #3
0
 def volumeops(self):
     if not self._volumeops:
         max_objects = self.configuration.vmware_max_objects_retrieval
         self._volumeops = volumeops.VMwareVolumeOps(
             self.session, max_objects)
     return self._volumeops
예제 #4
0
 def volumeops(self):
     if not self._volumeops:
         self._volumeops = volumeops.VMwareVolumeOps(self.session)
     return self._volumeops