Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CBQE-3043: Full Disk Scenario for XDCR
Change-Id: I1ad5c9ef97b7a5ad673ca945a1c8fb1860bd93c2 Reviewed-on: http://review.couchbase.org/55214 Tested-by: buildbot <build@couchbase.com> Reviewed-by: Ritam Sharma <ritamcouchbase@gmail.com>
- Loading branch information
Showing
4 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#things to be done before running these testcases: | ||
#scripts/install.py has to be run with init_nodes=False | ||
#scripts/cbqe3043.py has to be run against the ini file - this script will mount a 20MB partition on the nodes required for the test | ||
xdcr.uniXDCR.unidirectional: | ||
test_disk_full,items=50000,rdirection=unidirection | ||
|
||
xdcr.biXDCR.bidirectional: | ||
test_disk_full,items=25000,rdirection=bidirection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import getopt | ||
import sys | ||
import os | ||
|
||
sys.path.append('.') | ||
sys.path.append('lib') | ||
from lib.remote.remote_util import RemoteMachineShellConnection | ||
from lib.membase.api.rest_client import RestConnection | ||
import logger | ||
import logging.config | ||
import TestInput | ||
|
||
def usage(error=None): | ||
print "Please provide INI file" | ||
sys.exit(error) | ||
|
||
def main(): | ||
try: | ||
(opts, _) = getopt.getopt(sys.argv[1:], 'hi:', []) | ||
for o, _ in opts: | ||
if o == "-h": | ||
usage() | ||
|
||
_input = TestInput.TestInputParser.get_test_input(sys.argv) | ||
if not _input.servers: | ||
usage("ERROR: no servers specified. Please use the -i parameter.") | ||
except IndexError: | ||
usage() | ||
except getopt.GetoptError, error: | ||
usage("ERROR: " + str(error)) | ||
|
||
for server in _input.servers: | ||
shell = RemoteMachineShellConnection(server) | ||
command = "mount | grep '/cbqe3043'" | ||
output, error = shell.execute_command(command) | ||
if len(error) > 0: | ||
raise Exception("Unable to determine if a partition of 20MB already exists on " + server.ip) | ||
if len(output) > 0: | ||
print "/cbqe3043 partition is already mounted on " + server.ip | ||
if len(output) == 0: | ||
print "/cbqe3043 not mounted on " + server.ip | ||
print "creating /cbqe3043 on " + server.ip | ||
command = "rm -rf /cbqe3043; mkdir -p /cbqe3043" | ||
output, _ = shell.execute_command(command) | ||
if len(output) > 0: | ||
raise Exception("Unable to create directory /cbqe3043 on " + server.ip) | ||
print "creating /usr/disk-img on " + server.ip | ||
command = "rm -rf /usr/disk-img; mkdir -p /usr/disk-img" | ||
output, _ = shell.execute_command(command) | ||
if len(output) > 0: | ||
raise Exception("Unable to create directory /usr/disk-img on " + server.ip) | ||
print "creating disk file /usr/disk-img/disk-cbqe3043.ext3 on " + server.ip | ||
command = "dd if=/dev/zero of=/usr/disk-img/disk-cbqe3043.ext3 count=40960" | ||
output, _ = shell.execute_command(command) | ||
if len(output) > 0: | ||
raise Exception("Unable to create disk file /usr/disk-img/disk-cbqe3043.ext3 on " + server.ip) | ||
print "formatting disk file into an ext3 filesystem on " + server.ip | ||
command = "/sbin/mkfs -t ext3 -q /usr/disk-img/disk-cbqe3043.ext3 -F" | ||
output, _ = shell.execute_command(command) | ||
if len(output) > 0: | ||
raise Exception("Unable to format disk file into an ext3 filesystem on " + server.ip) | ||
print "mounting /cbqe3043 on" + server.ip | ||
command = "mount -o loop,rw,usrquota,grpquota /usr/disk-img/disk-cbqe3043.ext3 /cbqe3043" | ||
output, _ = shell.execute_command(command) | ||
if len(output) > 0: | ||
raise Exception("Unable to mount /cbqe3043 on " + server.ip) | ||
print "giving 777 permissions for /cbqe3043 on " + server.ip | ||
command = "chmod 777 /cbqe3043" | ||
output, _ = shell.execute_command(command) | ||
if len(output) > 0: | ||
raise Exception("Unable to give permissions for /cbqe3043 on " + server.ip) | ||
|
||
print "setting data path to /cbqe3043 on " + server.ip | ||
rest_conn = RestConnection(server) | ||
rest_conn.set_data_path(data_path="/cbqe3043") | ||
|
||
if __name__ == "__main__": | ||
main() |