示例#1
0
def get_distributed_appliances(appliance):
    """Returns one database-owning appliance, and a second appliance
       that connects to the database of the first.
    """
    ver_to_prov = str(appliance.version)
    appl1 = provision_appliance(ver_to_prov, 'long-test_childDB_A')
    appl2 = provision_appliance(ver_to_prov, 'long-test_childDB_B')
    appl1.configure(region=1)
    appl1.ipapp.wait_for_web_ui()
    appl2.configure(region=1, key_address=appl1.hostname, db_address=appl1.hostname)
    appl2.ipapp.wait_for_web_ui()
    return appl1, appl2
def get_distributed_appliances(appliance):
    """Returns one database-owning appliance, and a second appliance
       that connects to the database of the first.
    """
    ver_to_prov = str(appliance.version)
    appl1 = provision_appliance(ver_to_prov, 'long-test_childDB_A')
    appl2 = provision_appliance(ver_to_prov, 'long-test_childDB_B')
    appl1.configure(region=1)
    appl1.ipapp.wait_for_web_ui()
    appl2.configure(region=1, key_address=appl1.hostname, db_address=appl1.hostname)
    appl2.ipapp.wait_for_web_ui()
    return appl1, appl2
def get_appliances():
    """Returns two database-owning appliances

    """
    ver_to_prov = str(version.current_version())
    appl1 = provision_appliance(ver_to_prov, 'test_back')
    appl2 = provision_appliance(ver_to_prov, 'test_rest')
    appl1.configure(region=0)
    appl1.ipapp.wait_for_web_ui()
    appl2.configure(region=0)
    appl2.ipapp.wait_for_web_ui()
    return (appl1, appl2)
示例#4
0
def get_appliances():
    """Returns two database-owning appliances

    """
    ver_to_prov = str(version.current_version())
    appl1 = provision_appliance(ver_to_prov, 'test_back')
    appl2 = provision_appliance(ver_to_prov, 'test_rest')
    appl1.configure(region=0)
    appl1.ipapp.wait_for_web_ui()
    appl2.configure(region=0)
    appl2.ipapp.wait_for_web_ui()
    return (appl1, appl2)
def get_replication_appliances(appliance):
    """Returns two database-owning appliances configured
       with unique region numbers.
    """
    ver_to_prov = str(appliance.version)
    appl1 = provision_appliance(ver_to_prov, 'long-test_repl_A')
    appl2 = provision_appliance(ver_to_prov, 'long-test_repl_B')
    appl1.configure(region=1)
    appl1.ipapp.wait_for_web_ui()
    appl2.update_guid()
    appl2.configure(region=2, key_address=appl1.hostname)
    appl2.ipapp.wait_for_web_ui()
    return appl1, appl2
def get_replication_appliances():
    """Returns two database-owning appliances configured
       with unique region numbers.
    """
    ver_to_prov = str(current_appliance.version)
    appl1 = provision_appliance(ver_to_prov, 'long-test_repl_A')
    appl2 = provision_appliance(ver_to_prov, 'long-test_repl_B')
    appl1.configure(region=1)
    appl1.ipapp.wait_for_web_ui()
    appl2.update_guid()
    appl2.configure(region=2, key_address=appl1.address)
    appl2.ipapp.wait_for_web_ui()
    return appl1, appl2
示例#7
0
def get_replication_appliances(appliance):
    """Returns two database-owning appliances configured
       with unique region numbers.
    """
    ver_to_prov = str(appliance.version)
    # FIXME: refactor to use appliance fixtures that use sprout, or pass provider name
    appl1 = provision_appliance(ver_to_prov, 'long-test_repl_A')
    appl2 = provision_appliance(ver_to_prov, 'long-test_repl_B')
    appl1.configure(region=1)
    appl1.ipapp.wait_for_web_ui()
    appl2.update_guid()
    appl2.configure(region=2, key_address=appl1.hostname)
    appl2.ipapp.wait_for_web_ui()
    return appl1, appl2
def get_distributed_appliances():
    """Returns one database-owning appliance, and a second appliance
       that connects to the database of the first.
    """
    ver_to_prov = str(version.current_version())
    appl1 = provision_appliance(ver_to_prov, 'long-test_childDB_A')
    appl2 = provision_appliance(ver_to_prov, 'long-test_childDB_B')
    appl1.configure(region=1, patch_ajax_wait=False)
    appl1.ipapp.wait_for_web_ui()
    appl2.configure(region=1,
                    patch_ajax_wait=False,
                    key_address=appl1.address,
                    db_address=appl1.address)
    appl2.ipapp.wait_for_web_ui()
    return appl1, appl2
def scvmm_appliance(provider, cfme_vhd):
    """ Create an appliance from the VHD provided on SCVMM """
    # script to create template
    version = ".".join(re.findall(r"\d+", cfme_vhd)[0:4])  # [0:4] gets the 4 version num for CFME
    template_name = f"cfme-{version}-template"
    vhd_path = provider.data.get("vhd_path")
    small_disk = provider.data.get("small_disk")

    if not vhd_path:
        pytest.skip("vhd_path not present in yamls, skipping test")
    if not small_disk:
        pytest.skip("No small_disk vhd specified, skipping test")

    template_script = """
        $networkName = "cfme2"
        $templateName = "{template_name}"
        $templateOwner = "{domain}\\{user}"
        $maxMemorySizeMb = 12288
        $startMemeorySizeMb = 4096
        $minMemorySizeMb = 128
        $cpuCount = 4
        $srcName = "{image}"
        $srcPath = "{vhd_path}\\$srcName"
        $dbDiskName = "{small_disk}"
        $dbDiskSrcPath = "{vhd_path}\\$dbDiskName"
        $scvmmFqdn = "{hostname}"

        $JobGroupId01 = [Guid]::NewGuid().ToString()
        $LogicalNet = Get-SCLogicalNetwork -Name $networkName
        New-SCVirtualNetworkAdapter -JobGroup $JobGroupId01 -MACAddressType Dynamic\
            -LogicalNetwork $LogicalNet -Synthetic
        New-SCVirtualSCSIAdapter -JobGroup $JobGroupId01 -AdapterID 6 -Shared $False
        New-SCHardwareProfile -Name $templateName -Owner $templateOwner -Description\
            'Temp profile used to create a VM Template' -DynamicMemoryEnabled $True\
            -DynamicMemoryMaximumMB $maxMemorySizeMb -DynamicMemoryMinimumMB $minMemorySizeMb\
            -CPUCount $cpuCount -JobGroup $JobGroupId01
        $JobGroupId02 = [Guid]::NewGuid().ToString()
        $VHD = Get-SCVirtualHardDisk -Name $srcName
        New-SCVirtualDiskDrive -IDE -Bus 0 -LUN 0 -JobGroup $JobGroupId02 -VirtualHardDisk $VHD
        $DBVHD = Get-SCVirtualHardDisk -Name $dbDiskName
        New-SCVirtualDiskDrive -IDE -Bus 1 -LUN 0 -JobGroup $JobGroupId02 -VirtualHardDisk $DBVHD
        $HWProfile = Get-SCHardwareProfile | where {{ $_.Name -eq $templateName }}
        New-SCVMTemplate -Name $templateName -Owner $templateOwner -HardwareProfile $HWProfile\
         -JobGroup $JobGroupId02 -RunAsynchronously -Generation 1 -NoCustomization
        Remove-HardwareProfile -HardwareProfile $templateName
    """.format(
        domain=provider.mgmt.domain,
        user=provider.mgmt.user,
        image=cfme_vhd,
        hostname=provider.mgmt.host,
        template_name=template_name,
        vhd_path=vhd_path,
        small_disk=small_disk,
    )
    # create the template
    provider.mgmt.run_script(template_script)
    # provision the appliance from the newly created template
    scvmm_appliance = provision_appliance(
        provider.key, version=version, template=template_name, vm_name_prefix='test-cfme'
    )

    delete_zip = scvmm_appliance.version >= "5.11"

    yield scvmm_appliance

    # 1) delete VM
    scvmm_appliance.destroy()
    # 2) delete template
    template = provider.mgmt.get_template(template_name)
    template.delete()
    # 3) delete the VHD
    provider.mgmt.delete_vhd(cfme_vhd)
    if delete_zip:
        provider.mgmt.delete_app_package(cfme_vhd.replace(".vhd", ".zip"))
    provider.mgmt.update_scvmm_library()