summaryrefslogtreecommitdiff
path: root/kpov_judge/create_disk_images.py
diff options
context:
space:
mode:
authorgasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-01-13 22:23:54 +0000
committergasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-01-13 22:23:54 +0000
commit3bb4942284171043e9336ede0fd85eac76b274d1 (patch)
treeb97807f998e8575cae082e6a5e20e403af5571bb /kpov_judge/create_disk_images.py
parent52a1fa090067c1b25d205d7a7ebd442fe071f843 (diff)
Fixed add_task, started work on create_disk_image
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@182 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/create_disk_images.py')
-rwxr-xr-xkpov_judge/create_disk_images.py80
1 files changed, 80 insertions, 0 deletions
diff --git a/kpov_judge/create_disk_images.py b/kpov_judge/create_disk_images.py
index 168aa5a..d36ff90 100755
--- a/kpov_judge/create_disk_images.py
+++ b/kpov_judge/create_disk_images.py
@@ -11,6 +11,86 @@ import os
import glob
import subprocess
import fcntl
+import pyssh
+import paramiko
+
+class SSHGuestFs():
+ def __init__(hostname, username, password):
+s = pxssh.pxssh()
+ hostname = raw_input('hostname: ')
+ username = raw_input('username: ')
+ password = getpass.getpass('password: ')
+ s.login (hostname, username, password)
+ s.sendline ('uptime')
+ self.conn = pxssh.open(hostname, username, password)
+ def chmod(self, mode, path)
+ self.conn.
+ def chown(self, owner, group, path)
+ pass
+ def command(self, arguments)
+ pass
+ def cp(self, src, dest)
+ pass
+ def cp_a(self, src, dest)
+ pass
+ def cp_r(self, src, dest)
+ pass
+ def dd(self, src, dest)
+ pass
+ def df(self)
+ pass
+ def download(self)
+ pass
+ def du(self, path)
+ pass
+ def equal(self, file1, file2)
+ pass
+ def file(self, path)
+ pass
+ def getxattrs(self, path)
+ pass
+ def mv (self, src, dest):
+ pass
+ def read_file (self, path):
+ pass
+ def readdir (self, dir):
+ pass
+ def readlink (self, path):
+ pass
+ def rename (self, oldpath, newpath):
+ pass
+ def rm (self, path):
+ pass
+ def rm_rf (self, path):
+ pass
+ def rmdir (self, path):
+ pass
+ def setxattr (self, xattr, val, vallen, path):
+ pass
+ def write (self, path, content):
+ """This call creates a file called "path". The content of
+ the file is the string "content" (which can contain any
+ 8 bit data).
+
+ See also "g.write_append".
+ """
+ self._check_not_closed ()
+ r = libguestfsmod.write (self._o, path, content)
+ return r
+
+ def write_append (self, path, content):
+ """This call appends "content" to the end of file "path".
+ If "path" does not exist, then a new file is created.
+
+ See also "g.write".
+ """
+ self._check_not_closed ()
+ r = libguestfsmod.write_append (self._o, path, content)
+ return r
+
+ def write_file (self, path, content, size):
+
+# The external cmp(1) program is used for the comparison.
def get_prepare_disks(db, task_id):
prepare_disks_source = db.prepare_disks.find_one({'task_id':task_id})['source']