Github user gauravaradhye commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/117#discussion_r26833819
  
    --- Diff: tools/marvin/marvin/lib/common.py ---
    @@ -1395,3 +1396,218 @@ def isNetworkDeleted(apiclient, networkid, 
timeout=600):
             time.sleep(60)
         #end while
         return networkDeleted
    +
    +
    +def createChecksum(testdata, 
    +                   virtual_machine, 
    +                   disk, 
    +                   disk_type):
    +
    +    """ Calculate the MD5 checksum of the disk by writing \
    +           data on the disk where disk_type is either root disk or data 
disk 
    +   @return: returns the calculated checksum"""
    +
    +    random_data_0 = random_gen(size=100)
    +    # creating checksum(MD5)
    +    m = hashlib.md5()
    +    m.update(random_data_0)
    +    ckecksum_random_data_0 = m.hexdigest()
    +    try:
    +        ssh_client = SshClient(
    +            virtual_machine.ssh_ip,
    +            virtual_machine.ssh_port,
    +            virtual_machine.username,
    +            virtual_machine.password
    +        )
    +    except Exception: 
    +        raise Exception("SSH access failed for server with IP address: %s" 
%
    +                    virtual_machine.ssh_ip)
    +
    +    # Format partition using ext3
    +
    +    format_volume_to_ext3(
    +        ssh_client,
    +        testdata["volume_write_path"][
    +            virtual_machine.hypervisor][disk_type]
    +    )
    +    cmds = ["fdisk -l",
    +            "mkdir -p %s" % testdata["data_write_paths"]["mount_dir"],
    +            "mount -t ext3 %s1 %s" % (
    +                testdata["volume_write_path"][
    +                    virtual_machine.hypervisor][disk_type],
    +                testdata["data_write_paths"]["mount_dir"]
    +            ),
    +            "mkdir -p %s/%s/%s " % (
    +                testdata["data_write_paths"]["mount_dir"],
    +                testdata["data_write_paths"]["sub_dir"],
    +                testdata["data_write_paths"]["sub_lvl_dir1"],
    +            ),
    +            "echo %s > %s/%s/%s/%s" % (
    +                random_data_0,
    +                testdata["data_write_paths"]["mount_dir"],
    +                testdata["data_write_paths"]["sub_dir"],
    +                testdata["data_write_paths"]["sub_lvl_dir1"],
    +                testdata["data_write_paths"]["random_data"]
    +            ),
    +            "cat %s/%s/%s/%s" % (
    +                testdata["data_write_paths"]["mount_dir"],
    +                testdata["data_write_paths"]["sub_dir"],
    +                testdata["data_write_paths"]["sub_lvl_dir1"],
    +                testdata["data_write_paths"]["random_data"]
    +            )
    +            ]
    +
    +    for c in cmds:
    +        ssh_client.execute(c)
    +
    +    # Unmount the storage
    +    cmds = [
    +        "umount %s" % (testdata["data_write_paths"]["mount_dir"]),
    +    ]
    +
    +    for c in cmds:
    +        ssh_client.execute(c)
    +
    +    return ckecksum_random_data_0
    +
    +
    +def compareChecksum(
    +        apiclient,
    +        testdata,
    +        original_checksum,
    +        disk_type,
    +        template_id,
    +        account_name,
    +        account_domainid,
    +        service_offering_id,
    +        zone_id,
    +        zone_networktype,
    +        virt_machine=None,
    +        disk=None,
    +        new_vm=False,
    +        ):
    +    """
    +    Create md5 checksum of the data present on the disk and compare
    +    it with the given checksum
    +    """
    +
    +    if disk_type == "datadiskdevice_1" and new_vm:
    +        new_virtual_machine = VirtualMachine.create(
    --- End diff --
    
    Can we create the VM outside the function and pass it as parameter? 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to