From 3bb4942284171043e9336ede0fd85eac76b274d1 Mon Sep 17 00:00:00 2001 From: "gasperfele@fri1.uni-lj.si" Date: Tue, 13 Jan 2015 22:23:54 +0000 Subject: 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 --- kpov_judge/create_disk_images.py | 80 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) (limited to 'kpov_judge/create_disk_images.py') 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'] -- cgit v1.2.1