[email protected] writes:
 > From: Yiqiao Pu <[email protected]>
 > 
 > Set up the image_filename for test cases in an env which has iscsi.
 > The prepare work should already down. And here just init the iscsi
 > related parameters such as image_name and image_format which are using to
 > generate qemu command line.
 > Parameters added:
 > iscsi_dev: the device name in /dev, such as: /dev/sda /dev/sdb
 > iscsi_number: how many partitions you have in your device
 > 

A better solution is to let autotest can use raw device which is more generic
than your method.

 > Signed-off-by: Yiqiao Pu <[email protected]>
 > ---
 >  client/tests/kvm/kvm_preprocessing.py  |   14 +++++++++++++-
 >  client/tests/kvm/kvm_vm.py             |    2 ++
 >  client/tests/kvm/tests_base.cfg.sample |    3 +++
 >  3 files changed, 18 insertions(+), 1 deletions(-)
 > 
 > diff --git a/client/tests/kvm/kvm_preprocessing.py 
 > b/client/tests/kvm/kvm_preprocessing.py
 > index 1ddf99b..09162c3 100644
 > --- a/client/tests/kvm/kvm_preprocessing.py
 > +++ b/client/tests/kvm/kvm_preprocessing.py
 > @@ -260,7 +260,19 @@ def preprocess(test, params, env):
 >                          int(params.get("pre_command_timeout", "600")),
 >                          params.get("pre_command_noncritical") == "yes")
 >  
 > -    # Preprocess all VMs and images
 > +    # Generate iscsi related paramters
 > +    if params.get("use_storage") == "iscsi":
 > +        images = re.split("\s+", params.get("images"))
 > +        if len(images) > params.get("iscsi_number"):
 > +            raise error.TestError("Don't have enough iscsi storage")
 > +        device = params.get("iscsi_dev")
 > +        count = 1
 > +        for i in images:
 > +           params["image_name_%s" % i] = "%s%s" % (device, count)
 > +           params["image_format_%s" % i] = "qcow2"
 > +           count += 1
 > +
 > +   # Preprocess all VMs and images
 >      process(test, params, env, preprocess_image, preprocess_vm)
 >  
 >      # Start the screendump thread
 > diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py
 > index a860437..82a30bb 100755
 > --- a/client/tests/kvm/kvm_vm.py
 > +++ b/client/tests/kvm/kvm_vm.py
 > @@ -24,6 +24,8 @@ def get_image_filename(params, root_dir):
 >      """
 >      image_name = params.get("image_name", "image")
 >      image_format = params.get("image_format", "qcow2")
 > +    if params.get("use_storage") == "iscsi":
 > +        return image_name
 >      image_filename = "%s.%s" % (image_name, image_format)
 >      image_filename = kvm_utils.get_path(root_dir, image_filename)
 >      return image_filename
 > diff --git a/client/tests/kvm/tests_base.cfg.sample 
 > b/client/tests/kvm/tests_base.cfg.sample
 > index 23232f3..6e7b3f9 100644
 > --- a/client/tests/kvm/tests_base.cfg.sample
 > +++ b/client/tests/kvm/tests_base.cfg.sample
 > @@ -62,6 +62,9 @@ run_tcpdump = yes
 >  profilers = kvm_stat
 >  login_timeout = 360
 >  
 > +#iscsi
 > +iscsi_dev = "/dev/sdb"
 > +iscsi_number = 4
 >  
 >  # Tests
 >  variants:
 > -- 
 > 1.7.1
 > 
 > _______________________________________________
 > Autotest mailing list
 > [email protected]
 > http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to