Test for acl rejection

This commit is contained in:
Alex Young
2012-06-28 13:29:22 +01:00
parent c9fdd5a60e
commit 4de4cee3d0
6 changed files with 99 additions and 46 deletions

View File

@@ -265,6 +265,13 @@ class FlexNBD
"#{@debug}"
end
def acl_cmd( *acl )
"#{@bin} acl " \
"--sock #{ctrl} "\
"#{@debug} "\
"#{acl.join " "}"
end
def run_serve_cmd(cmd)
File.unlink(ctrl) if File.exists?(ctrl)
@@ -354,6 +361,7 @@ class FlexNBD
@wait_thread.join
end
def mirror_unchecked( dest_ip, dest_port, bandwidth=nil, action=nil, timeout=nil )
cmd = mirror_cmd( dest_ip, dest_port)
debug( cmd )
@@ -361,6 +369,7 @@ class FlexNBD
maybe_timeout( cmd, timeout )
end
def maybe_timeout(cmd, timeout=nil )
stdout, stderr = "",""
run = Proc.new do
@@ -388,8 +397,12 @@ class FlexNBD
stdout
end
def acl(*acl)
control_command("acl", *acl)
cmd = acl_cmd( *acl )
debug( cmd )
maybe_timeout( cmd, 2 )
end
@@ -403,6 +416,11 @@ class FlexNBD
end
def launched?
!!@pid
end
protected
def control_command(*args)
raise "Server not running" unless @pid