예제 #1
0
    def test_get_encryptors(self):
        encryption = {
            'control_location': 'front-end',
            'provider': 'LuksEncryptor'
        }
        encryptor = encryptors.get_volume_encryptor(self.connection_info,
                                                    **encryption)
        self.assertIsInstance(encryptor, luks.LuksEncryptor,
                              "encryptor is not an instance of LuksEncryptor")

        encryption = {
            'control_location': 'front-end',
            'provider': 'CryptsetupEncryptor'
        }
        encryptor = encryptors.get_volume_encryptor(self.connection_info,
                                                    **encryption)
        self.assertIsInstance(
            encryptor, cryptsetup.CryptsetupEncryptor,
            "encryptor is not an instance of"
            "CryptsetupEncryptor")

        encryption = {
            'control_location': 'front-end',
            'provider': 'NoOpEncryptor'
        }
        encryptor = encryptors.get_volume_encryptor(self.connection_info,
                                                    **encryption)
        self.assertIsInstance(encryptor, nop.NoOpEncryptor,
                              "encryptor is not an instance of NoOpEncryptor")
예제 #2
0
파일: test_base.py 프로젝트: 4everming/nova
    def test_get_encryptors(self):
        encryption = {'control_location': 'front-end',
                      'provider': 'LuksEncryptor'}
        encryptor = encryptors.get_volume_encryptor(self.connection_info,
                                                    **encryption)
        self.assertIsInstance(encryptor,
                              luks.LuksEncryptor,
                              "encryptor is not an instance of LuksEncryptor")

        encryption = {'control_location': 'front-end',
                      'provider': 'CryptsetupEncryptor'}
        encryptor = encryptors.get_volume_encryptor(self.connection_info,
                                                    **encryption)
        self.assertIsInstance(encryptor,
                              cryptsetup.CryptsetupEncryptor,
                              "encryptor is not an instance of"
                              "CryptsetupEncryptor")

        encryption = {'control_location': 'front-end',
                      'provider': 'NoOpEncryptor'}
        encryptor = encryptors.get_volume_encryptor(self.connection_info,
                                                    **encryption)
        self.assertIsInstance(encryptor,
                              nop.NoOpEncryptor,
                              "encryptor is not an instance of NoOpEncryptor")
예제 #3
0
    def test_get_direct_encryptor_log(self, log):
        encryption = {
            'control_location': 'front-end',
            'provider': 'LuksEncryptor'
        }
        encryptors.get_volume_encryptor(self.connection_info, **encryption)

        encryption = {
            'control_location': 'front-end',
            'provider': 'nova.volume.encryptors.luks.LuksEncryptor'
        }
        encryptors.get_volume_encryptor(self.connection_info, **encryption)

        log.warning.assert_has_calls([
            mock.call(
                "Use of the in tree encryptor class %(provider)s by "
                "directly referencing the implementation class will be "
                "blocked in the 16.0.0 Pike release of Nova.",
                {'provider': 'LuksEncryptor'}),
            mock.call(
                "Use of the in tree encryptor class %(provider)s by "
                "directly referencing the implementation class will be "
                "blocked in the 16.0.0 Pike release of Nova.",
                {'provider': 'nova.volume.encryptors.luks.LuksEncryptor'})
        ])
예제 #4
0
 def test_error_log(self, log):
     encryption = {'control_location': 'front-end',
                   'provider': 'TestEncryptor'}
     provider = 'TestEncryptor'
     try:
         encryptors.get_volume_encryptor(self.connection_info, **encryption)
     except Exception as e:
         log.error.assert_called_once_with(_LE("Error instantiating "
                                               "%(provider)s: "
                                               "%(exception)s"),
                   {'provider': provider, 'exception': e})
예제 #5
0
파일: test_base.py 프로젝트: amadev/nova
 def test_get_missing_out_of_tree_encryptor_log(self, log):
     provider = 'TestEncryptor'
     encryption = {'control_location': 'front-end',
                   'provider': provider}
     try:
         encryptors.get_volume_encryptor(self.connection_info, **encryption)
     except Exception as e:
         log.error.assert_called_once_with("Error instantiating "
                                           "%(provider)s: "
                                           "%(exception)s",
                                           {'provider': provider,
                                            'exception': e})
         log.warning.assert_called_once_with("Use of the out of tree "
                                             "encryptor class %(provider)s "
                                             "will be blocked with the "
                                             "16.0.0 Pike release of Nova.",
                                             {'provider': provider})
예제 #6
0
 def test_get_missing_out_of_tree_encryptor_log(self, log):
     provider = 'TestEncryptor'
     encryption = {'control_location': 'front-end', 'provider': provider}
     try:
         encryptors.get_volume_encryptor(self.connection_info, **encryption)
     except Exception as e:
         log.error.assert_called_once_with(
             "Error instantiating "
             "%(provider)s: "
             "%(exception)s", {
                 'provider': provider,
                 'exception': e
             })
         log.warning.assert_called_once_with(
             "Use of the out of tree "
             "encryptor class %(provider)s "
             "will be blocked with the "
             "16.0.0 Pike release of Nova.", {'provider': provider})
예제 #7
0
파일: test_base.py 프로젝트: amadev/nova
    def test_get_direct_encryptor_log(self, log):
        encryption = {'control_location': 'front-end',
                      'provider': 'LuksEncryptor'}
        encryptors.get_volume_encryptor(self.connection_info, **encryption)

        encryption = {'control_location': 'front-end',
                      'provider': 'nova.volume.encryptors.luks.LuksEncryptor'}
        encryptors.get_volume_encryptor(self.connection_info, **encryption)

        log.warning.assert_has_calls([
            mock.call("Use of the in tree encryptor class %(provider)s by "
                      "directly referencing the implementation class will be "
                      "blocked in the 16.0.0 Pike release of Nova.",
                      {'provider': 'LuksEncryptor'}),
            mock.call("Use of the in tree encryptor class %(provider)s by "
                      "directly referencing the implementation class will be "
                      "blocked in the 16.0.0 Pike release of Nova.",
                      {'provider':
                           'nova.volume.encryptors.luks.LuksEncryptor'})])
예제 #8
0
 def _test_get_encryptor(self, provider, expected_provider_class):
     encryption = {'control_location': 'front-end', 'provider': provider}
     encryptor = encryptors.get_volume_encryptor(self.connection_info,
                                                 **encryption)
     self.assertIsInstance(encryptor, expected_provider_class)
예제 #9
0
 def _get_volume_encryptor(self, connection_info, encryption):
     encryptor = encryptors.get_volume_encryptor(connection_info,
                                                 **encryption)
     return encryptor
예제 #10
0
파일: test_base.py 프로젝트: amadev/nova
 def _test_get_encryptor(self, provider, expected_provider_class):
     encryption = {'control_location': 'front-end',
                   'provider': provider}
     encryptor = encryptors.get_volume_encryptor(self.connection_info,
                                                 **encryption)
     self.assertIsInstance(encryptor, expected_provider_class)