Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "real" disks #43

Closed
clayg opened this issue Jul 26, 2016 · 1 comment
Closed

Use "real" disks #43

clayg opened this issue Jul 26, 2016 · 1 comment

Comments

@clayg
Copy link
Collaborator

clayg commented Jul 26, 2016

Mostly the changes should be to the data recipe [1]

I have some code in another context that does this:

@fab.roles('node')
@fab.parallel
def _clean_devices():
    for i in range(DEVICE_COUNT):
        fab.run('dmsetup remove dev%s || true' % i)
        fab.run('losetup -d /dev/loop%s || true' % i)
        fab.run('rm /var/dev%s.block || true' % i)
    fab.run('udevadm settle')


@fab.roles('node')
@fab.parallel
def _create_devices():
    for i in range(DEVICE_COUNT):
        fab.run('dd if=/dev/zero of=/var/dev%s.block bs=1M count=3000' % i)
    for i in range(DEVICE_COUNT):
        fab.run('losetup /dev/loop{0} /var/dev{0}.block'.format(i))
    for i in range(DEVICE_COUNT):
        sectors = fab.run('blockdev --getsize /dev/loop%s' % i)
        fab.run('dmsetup create dev{0} --table '
                '"0 {1} linear /dev/loop{0} 0"'.format(i, sectors))

@fab.task
@fab.runs_once
def setup_devices():
    """
    Add Device Mapper block devices to Nodes
    """
    fab.execute(_clean_devices)
    fab.execute(_create_devices)

... but I think that strategy could be improved further because vsaio's can potentially want many more swift devices than /dev/loop* entries ...

I might just create a single sparse file and loopback that onto /dev/loop0 (like the recipe already does), but then break that up into <sectors> / <DEVICE_COUNT> "chunks" and then use dmsetup to create dev<N> device tables like 0 <chunks> linear /dev/loop0 <N * chunks> [2]

  1. https://github.com/swiftstack/vagrant-swift-all-in-one/blob/master/cookbooks/swift/recipes/data.rb
  2. probably need to double check that, I think the syntax is <start-of-table-entry> <size-of-table-entry> linear <source-device> <source-device-offset> - since we only create one table entry per device, and always use the same loop device - I think it's always 0 <size-of-each-dev-in-sectors> linear /dev/loop0 <start-sector-offset-of-loop-device> - https://www.kernel.org/doc/Documentation/device-mapper/linear.txt
tipabu added a commit that referenced this issue Nov 8, 2018
Previously, we would create one loopback device with some subdirs
to represent "drives" and symlink them into place under /srv/node*

Now, use N loopback devices. Note that you may want to crank down
LOOPBACK_GB as it applies to each sparse file and the default may
allow you to fill your VM's root disk.

Two side benefits (beyond getting closer to "real" system behavior):
we can now enable mount_check, and we can have per-node-and-service
rsync modules.

Addresses #43.
@tipabu
Copy link
Collaborator

tipabu commented Nov 12, 2018

Closed by #77

@tipabu tipabu closed this as completed Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants