Mailinglist Archive: yast-devel (87 mails)

< Previous Next >
Re: [yast-devel] 2nd attempt: do we need a layer between libstorage-ng and (the rest) of YaST?
On Mon, Feb 27, 2017 at 08:51:01AM +0100, Ancor Gonzalez Sosa wrote:
Since the original thread is already ruined with discussions about
concrete API design details that were not the main topic of my question,
I will try once again from scratch.

Sorry to bother you, but if you continue to bring such bad
examples this thread will also be ruined by the end of the day.

a_filesystem.all_disks

But the user is expected to do this

blk_dev = a_filesystem.blk_devices[0]
if Storage.encryption?(blk_device)
blk_device = Storage.to_encryption(blk_device).blk_device
end
return [Storage.to_disk(blk_dev)] if Storage.disk?(blk_dev)
if Storage.partition?(blk_device)
partition = Storage.to_partition(blk_device)
if Storage.disk?(partition.partition_table.partitionable)
return [Storage.to_disk(partition.partition_table.partitionable)]
else
# MD case
end
elsif Storage.lvm_lv?(blk_device)
# The LVM case, which is double the size than the partition one
end

Or just:

for filesystem.ancestors do |device| do
ret = []
ret << device if disk?(device)
return ret
done

ciao Arvin

--
Arvin Schnell, <aschnell@xxxxxxxx>
Senior Software Engineer, Research & Development
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284
(AG Nürnberg)
Maxfeldstraße 5
90409 Nürnberg
Germany
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References