Ejemplo n.º 1
0
 def cinder_context(self, infinisdk, pool, provisioning="thick", volume_backend_name=None):
     with config.get_config_parser(write_on_exit=True) as config_parser:
         key = config.apply(
             config_parser,
             self.infinisdk.get_name(),
             pool.get_name(),
             "admin",
             "123456",
             thick_provisioning=provisioning.lower() == "thick",
             prefer_fc=self.prefer_fc,
             infinidat_allow_pool_not_found=True,
             infinidat_purge_volume_on_deletion=True,
             volume_backend_name=volume_backend_name,
         )
         config.enable(config_parser, key)
         config.update_volume_type(self.get_cinder_client(), key, self.infinisdk.get_name(), pool.get_name())
     restart_cinder()
     self.wait_for_type_creation(pool)
     with cinder_logs_context(), iscsi_manager_logs_context(), var_log_messages_logs_context():
         yield
     with config.get_config_parser(write_on_exit=True) as config_parser:
         config.delete_volume_type(self.get_cinder_client(), key)
         config.disable(config_parser, key)
         config.remove(config_parser, key)
     restart_cinder()
Ejemplo n.º 2
0
 def test_backup(self, filepath="tests/conf/testing_backup.conf"):
     from glob import glob
     from os import remove
     [remove(path) for path in glob(filepath + ".*")]
     self.prepare_conf(filepath, "tests/conf/one.conf")
     with open(filepath) as fd:
         before = fd.read()
     with config.get_config_parser(filepath, True) as config_parser:
         config.remove(config_parser, key="infinibox-1-pool-1'")
     with open(filepath+".1") as fd:
         backup = fd.read()
     with open(filepath) as fd:
         after = fd.read()
     self.assertNotEquals(before, after)
     self.assertEquals(before, backup)