]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-deploy.git/commitdiff
add all the new modules for remote execution
authorAlfredo Deza <alfredo.deza@inktank.com>
Fri, 4 Oct 2013 20:54:56 +0000 (16:54 -0400)
committerAlfredo Deza <alfredo.deza@inktank.com>
Fri, 4 Oct 2013 20:54:56 +0000 (16:54 -0400)
Signed-off-by: Alfredo Deza <alfredo.deza@inktank.com>
ceph_deploy/remote/__init__.py [new file with mode: 0644]
ceph_deploy/remote/host.py [new file with mode: 0644]
ceph_deploy/remote/osd.py [new file with mode: 0644]

diff --git a/ceph_deploy/remote/__init__.py b/ceph_deploy/remote/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/ceph_deploy/remote/host.py b/ceph_deploy/remote/host.py
new file mode 100644 (file)
index 0000000..b9638cd
--- /dev/null
@@ -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 (file)
index 0000000..81be8ba
--- /dev/null
@@ -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