From: Alfredo Deza Date: Fri, 4 Oct 2013 20:54:56 +0000 (-0400) Subject: add all the new modules for remote execution X-Git-Tag: v1.2.7~1^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2ea362af6660ba23c26981e886bb6cc50ffc17c8;p=ceph-deploy.git add all the new modules for remote execution Signed-off-by: Alfredo Deza --- diff --git a/ceph_deploy/remote/__init__.py b/ceph_deploy/remote/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ceph_deploy/remote/host.py b/ceph_deploy/remote/host.py new file mode 100644 index 0000000..b9638cd --- /dev/null +++ b/ceph_deploy/remote/host.py @@ -0,0 +1,20 @@ +""" +Collection of remote functions that are specific to a given platform +""" +import platform + + +def platform_information(): + """ detect platform information from remote host """ + distro, release, codename = platform.linux_distribution() + return ( + str(distro).rstrip(), + str(release).rstrip(), + str(codename).rstrip() + ) + + +# remoto magic, needed to execute these functions remotely +if __name__ == '__channelexec__': + for item in channel: # noqa + channel.send(eval(item)) # noqa diff --git a/ceph_deploy/remote/osd.py b/ceph_deploy/remote/osd.py new file mode 100644 index 0000000..81be8ba --- /dev/null +++ b/ceph_deploy/remote/osd.py @@ -0,0 +1,28 @@ +""" +Collection of remote functions that are specific to osd/disk +actions. +""" +import os + + +def zeroing(dev): + """ zeroing last few blocks of device """ + # this kills the crab + # + # sgdisk will wipe out the main copy of the GPT partition + # table (sorry), but it doesn't remove the backup copies, and + # subsequent commands will continue to complain and fail when + # they see those. zeroing the last few blocks of the device + # appears to do the trick. + lba_size = 4096 + size = 33 * lba_size + return True + with file(dev, 'wb') as f: + f.seek(-size, os.SEEK_END) + f.write(size*'\0') + + +# remoto magic, needed to execute these functions remotely +if __name__ == '__channelexec__': + for item in channel: # noqa + channel.send(eval(item)) # noqa