Exemple #1
0
def test_spm_lifecycle(tmp_storage, tmp_repo, fake_access, fake_rescan, tmp_db,
                       fake_task, fake_sanlock):

    msd_uuid = str(uuid.uuid4())

    dev = tmp_storage.create_device(20 * GiB)
    lvm.createVG(msd_uuid, [dev], blockSD.STORAGE_UNREADY_DOMAIN_TAG, 128)
    vg = lvm.getVG(msd_uuid)

    master_dom = blockSD.BlockStorageDomain.create(sdUUID=msd_uuid,
                                                   domainName="domain",
                                                   domClass=sd.DATA_DOMAIN,
                                                   vgUUID=vg.uuid,
                                                   version=5,
                                                   storageType=sd.ISCSI_DOMAIN)

    sdCache.knownSDs[msd_uuid] = blockSD.findDomain
    sdCache.manuallyAddDomain(master_dom)

    pool = sp.StoragePool(tmp_repo.pool_id, FakeDomainMonitor(),
                          FakeTaskManager())
    pool.setBackend(StoragePoolDiskBackend(pool))
    pool.create(poolName="pool",
                msdUUID=msd_uuid,
                domList=[msd_uuid],
                masterVersion=0,
                leaseParams=sd.DEFAULT_LEASE_PARAMS)

    pool.startSpm(prevID=0, prevLVER=0, maxHostID=clusterlock.MAX_HOST_ID)
    pool.stopSpm()
Exemple #2
0
def fake_spm(pool_id, master_version, domains_map):
    pool = sp.StoragePool(pool_id, None, None)
    pool.setBackend(
        spb.StoragePoolMemoryBackend(pool, master_version, domains_map))
    pool._setSecure()
    return pool