<commit_before>package com.github.K0zka.kerub.planner.steps.vstorage.fs.create

import com.github.K0zka.kerub.model.FsStorageCapability
import com.github.K0zka.kerub.model.io.VirtualDiskFormat
import com.github.K0zka.kerub.planner.OperationalState
import com.github.K0zka.kerub.planner.steps.vstorage.AbstractCreateVirtualStorageFactory
import com.github.K0zka.kerub.utils.junix.qemu.QemuImg

object CreateImageFactory : AbstractCreateVirtualStorageFactory<CreateImage>() {
	override fun produce(state: OperationalState): List<CreateImage> {
		val storageNotAllocated = listStorageNotAllocated(state)
		val runningHosts = listRunningHosts(state)

		var steps = listOf<CreateImage>()

		val storageTechnologies = state.controllerConfig.storageTechnologies
		runningHosts.filter { QemuImg.available(it.stat.capabilities) }
				.forEach {
					hostData ->
					hostData.stat.capabilities?.storageCapabilities?.filter {
						capability
						->
						capability is FsStorageCapability
								&& capability.mountPoint in storageTechnologies.fsPathEnabled
								&& capability.fsType in storageTechnologies.fsTypeEnabled
					}?.forEach {
						mount ->
						steps += storageNotAllocated.map {
							storage ->
							CreateImage(
									disk = storage,
									host = hostData.stat,
									format = VirtualDiskFormat.qcow2,
									path = (mount as FsStorageCapability).mountPoint
							)
						}
					}
				}

		return steps
	}


}<commit_msg>fix: create the requested type of storage<commit_after>package com.github.K0zka.kerub.planner.steps.vstorage.fs.create

import com.github.K0zka.kerub.model.FsStorageCapability
import com.github.K0zka.kerub.model.expectations.StorageAvailabilityExpectation
import com.github.K0zka.kerub.model.io.VirtualDiskFormat
import com.github.K0zka.kerub.planner.OperationalState
import com.github.K0zka.kerub.planner.steps.vstorage.AbstractCreateVirtualStorageFactory
import com.github.K0zka.kerub.utils.junix.qemu.QemuImg

object CreateImageFactory : AbstractCreateVirtualStorageFactory<CreateImage>() {
	override fun produce(state: OperationalState): List<CreateImage> {
		val storageNotAllocated = listStorageNotAllocated(state)
		val runningHosts = listRunningHosts(state)

		var steps = listOf<CreateImage>()

		val storageTechnologies = state.controllerConfig.storageTechnologies
		runningHosts.filter { QemuImg.available(it.stat.capabilities) }
				.forEach {
					hostData ->
					hostData.stat.capabilities?.storageCapabilities?.filter {
						capability
						->
						capability is FsStorageCapability
								&& capability.mountPoint in storageTechnologies.fsPathEnabled
								&& capability.fsType in storageTechnologies.fsTypeEnabled
					}?.forEach {
						mount ->
						steps += storageNotAllocated.map {
							storage ->
							val format =
									(storage.expectations.firstOrNull { it is StorageAvailabilityExpectation }
											as StorageAvailabilityExpectation?)?.format
											?: VirtualDiskFormat.qcow2
							CreateImage(
									disk = storage,
									host = hostData.stat,
									format = format,
									path = (mount as FsStorageCapability).mountPoint
							)
						}
					}
				}

		return steps
	}


}
{'fraction_non_alphanumeric': 0.08620689655172414, 'fraction_numerical': 0.004702194357366771, 'mean_word_length': 3.5781922525107603, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3408086', 'n_tokens_mistral': 1222, 'n_tokens_neox': 922, 'n_words': 147}