Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,19 @@ public boolean deleteStoragePool(KVMStoragePool pool) {
return deleteStoragePool(pool.getUuid());
}

private void makeResourceAvailable(DevelopersApi api, String rscName, boolean diskfull) throws ApiException
{
ResourceMakeAvailable rma = new ResourceMakeAvailable();
rma.diskful(diskfull);
ApiCallRcList answers = api.resourceMakeAvailableOnNode(rscName, localNodeName, rma);
handleLinstorApiAnswers(answers,
String.format("Linstor: Unable to make resource %s available on node: %s", rscName, localNodeName));
}

/**
* createPhysicalDisk will check if the resource wasn't yet created and do so, also it will make sure
* it is accessible from this node (MakeAvailable).
*/
@Override
public KVMPhysicalDisk createPhysicalDisk(String name, KVMStoragePool pool, QemuImg.PhysicalDiskFormat format,
Storage.ProvisioningType provisioningType, long size, byte[] passphrase)
Expand All @@ -214,7 +227,7 @@ public KVMPhysicalDisk createPhysicalDisk(String name, KVMStoragePool pool, Qemu
rgSpawn.setResourceDefinitionName(rscName);
rgSpawn.addVolumeSizesItem(size / 1024); // linstor uses KiB

s_logger.debug("Linstor: Spawn resource " + rscName);
s_logger.info("Linstor: Spawn resource " + rscName);
ApiCallRcList answers = api.resourceGroupSpawn(lpool.getResourceGroup(), rgSpawn);
handleLinstorApiAnswers(answers, "Linstor: Unable to spawn resource.");
}
Expand All @@ -228,7 +241,7 @@ public KVMPhysicalDisk createPhysicalDisk(String name, KVMStoragePool pool, Qemu
null,
null);

// TODO make available on node
makeResourceAvailable(api, rscName, true);

if (!resources.isEmpty() && !resources.get(0).getVolumes().isEmpty()) {
final String devPath = resources.get(0).getVolumes().get(0).getDevicePath();
Expand Down Expand Up @@ -418,7 +431,7 @@ public KVMPhysicalDisk copyPhysicalDisk(KVMPhysicalDisk disk, String name, KVMSt
final QemuImgFile srcFile = new QemuImgFile(sourcePath, sourceFormat);

final KVMPhysicalDisk dstDisk = destPools.createPhysicalDisk(
name, QemuImg.PhysicalDiskFormat.RAW, Storage.ProvisioningType.FAT, disk.getVirtualSize(), null);
name, QemuImg.PhysicalDiskFormat.RAW, provisioningType, disk.getVirtualSize(), null);

final QemuImgFile destFile = new QemuImgFile(dstDisk.getPath());
destFile.setFormat(dstDisk.getFormat());
Expand Down