Sandro Bonazzola has posted comments on this change.
Change subject: packaging: Added backup DB functionality to setup
......................................................................
Patch Set 7: (3 inline comments)
....................................................
File packaging/common_utils.py
Line 639: logging.debug("Checking available space on %s" % (path))
Line 640: stat = os.statvfs(path)
Line 641: #block size * available blocks = available space in bytes, we
devide by
Line 642: #1024 ^ 2 in order to get the size in megabytes
Line 643: availableSpace = (stat.f_bsize * stat.f_bavail) / pow(1024, 2)
I suggest pow(1024, 2) -> pow(2,20) commonly used for megabyte
Line 644: logging.debug("Available space on %s is %s" % (path,
availableSpace))
Line 645: return int(availableSpace)
Line 646:
Line 647: def getDbSize(db_dict):
Line 657: failOnError=True,
Line 658: errMsg=ERR_DB_GET_SPACE % db_dict['name']
Line 659: )
Line 660: size = int(out[0]['pg_database_size'])
Line 661: size = size / 1024 / 1024 # Get size in MB
size = int(out[0]['pg_database_size']) / pow(2,20). Not sure that python 2.6
supports it, but // (explicit integer division) should be better
Line 662: return size
Line 663:
Line 664: def performBackup(db_dict, backupPath):
Line 665: # Check abvailable space
Line 732: '--format=p',
Line 733: '-U', db_dict['username'],
Line 734: '-h', db_dict['host'],
Line 735: '-p', db_dict['port'],
Line 736: '-Fc',
Any reason for using -Fc instead of -Ft or -Fp?
Line 737: '-f', backup_file,
Line 738: db_dict['name'],
Line 739: ]
Line 740: execCmd(
--
To view, visit http://gerrit.ovirt.org/15772
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I8ccf8938099207b4e73bb947d1bb5fd673605071
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-dwh
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <[email protected]>
Gerrit-Reviewer: Alex Lourie <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Yaniv Dary <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches