Skip to content
Open
Show file tree
Hide file tree
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 @@ -34,6 +34,10 @@ public class CephGlobalConfig {
public static GlobalConfig CEPH_BS_ALLOW_PORTS = new GlobalConfig(CATEGORY, "cephbs.allow.ports");
@GlobalConfigValidation
public static GlobalConfig CEPH_PS_ALLOW_PORTS = new GlobalConfig(CATEGORY, "cephps.allow.ports");
@GlobalConfigDef(type = Integer.class, defaultValue = "1", description = "max automatic IOThread count for ZStone primary storage volumes")
@GlobalConfigValidation(inNumberRange = {1, 8})
public static GlobalConfig ZSTONE_IOTHREAD_MAX =
new GlobalConfig(CATEGORY, "zstone.iothread.max");

@GlobalConfigDef(type = Boolean.class, defaultValue = "true")
@GlobalConfigValidation
Expand Down
10 changes: 10 additions & 0 deletions plugin/kvm/src/main/java/org/zstack/kvm/KVMAgentCommands.java
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ public static class HostFactResponse extends AgentResponse {
private String osRelease;
@GrayVersion(value = "5.0.0")
private String qemuImgVersion;
@GrayVersion(value = "5.5.28")
private String qemuKvmPackageVersion;
@GrayVersion(value = "5.0.0")
private String libvirtVersion;
@GrayVersion(value = "5.0.0")
Expand Down Expand Up @@ -580,6 +582,14 @@ public void setQemuImgVersion(String qemuImgVersion) {
this.qemuImgVersion = qemuImgVersion;
}

public String getQemuKvmPackageVersion() {
return qemuKvmPackageVersion;
}

public void setQemuKvmPackageVersion(String qemuKvmPackageVersion) {
this.qemuKvmPackageVersion = qemuKvmPackageVersion;
}

public List<String> getIpAddresses() {
return ipAddresses;
}
Expand Down
2 changes: 2 additions & 0 deletions plugin/kvm/src/main/java/org/zstack/kvm/KVMConstant.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ public interface KVMConstant {
String MIN_QEMU_LIVESNAPSHOT_VERSION = "1.3.0";
String MIN_LIBVIRT_LIVE_BLOCK_COMMIT_VERSION = "1.2.7";
String MIN_LIBVIRT_VIRTIO_SCSI_VERSION = "1.0.4";
String MIN_QEMU_KVM_IOTHREAD_VQ_MAPPING_PACKAGE_VERSION = "6.2.0-451";
String MIN_LIBVIRT_IOTHREAD_VQ_MAPPING_PACKAGE_VERSION = "8.0.0-163";

String KVM_REPORT_VM_STATE = "/kvm/reportvmstate";
String KVM_RECONNECT_ME = "/kvm/reconnectme";
Expand Down
10 changes: 9 additions & 1 deletion plugin/kvm/src/main/java/org/zstack/kvm/KVMHost.java
Original file line number Diff line number Diff line change
Expand Up @@ -6326,8 +6326,16 @@ private boolean checkVirtualizationEnabled(HostFactResponse response) {
private void saveKvmHostRelatedFacts(HostFactResponse ret) {
updateHostOsInformation(ret.getOsDistribution(), ret.getOsRelease(), ret.getOsVersion());

if (ret.getLibvirtPackageVersion() != null) {
if (StringUtils.isNotBlank(ret.getLibvirtPackageVersion())) {
createTagWithoutNonValue(KVMSystemTags.LIBVIRT_PACKAGE_VERSION, KVMSystemTags.LIBVIRT_PACKAGE_VERSION_TOKEN, ret.getLibvirtPackageVersion().trim(), false);
} else {
KVMSystemTags.LIBVIRT_PACKAGE_VERSION.delete(self.getUuid());
}

if (StringUtils.isNotBlank(ret.getQemuKvmPackageVersion())) {
createTagWithoutNonValue(KVMSystemTags.QEMU_KVM_PACKAGE_VERSION, KVMSystemTags.QEMU_KVM_PACKAGE_VERSION_TOKEN, ret.getQemuKvmPackageVersion().trim(), false);
} else {
KVMSystemTags.QEMU_KVM_PACKAGE_VERSION.delete(self.getUuid());
}

createTagWithoutNonValue(KVMSystemTags.QEMU_IMG_VERSION, KVMSystemTags.QEMU_IMG_VERSION_TOKEN, ret.getQemuImgVersion(), false);
Expand Down
3 changes: 3 additions & 0 deletions plugin/kvm/src/main/java/org/zstack/kvm/KVMSystemTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class KVMSystemTags {
public static final String QEMU_IMG_VERSION_TOKEN = "version";
public static PatternedSystemTag QEMU_IMG_VERSION = new PatternedSystemTag(String.format("qemu-img::version::{%s}", QEMU_IMG_VERSION_TOKEN), HostVO.class);

public static final String QEMU_KVM_PACKAGE_VERSION_TOKEN = "version";
public static PatternedSystemTag QEMU_KVM_PACKAGE_VERSION = new PatternedSystemTag(String.format("qemu-kvm::package::version::{%s}", QEMU_KVM_PACKAGE_VERSION_TOKEN), HostVO.class);

public static final String LIBVIRT_VERSION_TOKEN = "version";
public static PatternedSystemTag LIBVIRT_VERSION = new PatternedSystemTag(String.format("libvirt::version::{%s}", LIBVIRT_VERSION_TOKEN), HostVO.class);

Expand Down
11 changes: 11 additions & 0 deletions plugin/kvm/src/main/java/org/zstack/kvm/VolumeTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public class VolumeTO extends BaseVirtualDeviceTO {
private String multiQueues;
private int ioThreadId;
private String ioThreadPin;
// 0 means automatic IOThread VQ Mapping is disabled.
private int ioThreads;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
private int controllerIndex;

static {
Expand Down Expand Up @@ -80,6 +82,7 @@ public VolumeTO(VolumeTO other) {
this.multiQueues = other.multiQueues;
this.ioThreadId = other.ioThreadId;
this.ioThreadPin = other.ioThreadPin;
this.ioThreads = other.ioThreads;
this.controllerIndex = other.controllerIndex;
}

Expand Down Expand Up @@ -290,6 +293,14 @@ public String getIoThreadPin() {
return ioThreadPin;
}

public int getIoThreads() {
return ioThreads;
}

public void setIoThreads(int ioThreads) {
this.ioThreads = ioThreads;
}

public int getControllerIndex() {
return controllerIndex;
}
Expand Down
8 changes: 8 additions & 0 deletions sdk/src/main/java/org/zstack/sdk/VolumeTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ public java.lang.String getIoThreadPin() {
return this.ioThreadPin;
}

public int ioThreads;
public void setIoThreads(int ioThreads) {
this.ioThreads = ioThreads;
}
public int getIoThreads() {
return this.ioThreads;
}

public int controllerIndex;
public void setControllerIndex(int controllerIndex) {
this.controllerIndex = controllerIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import org.zstack.header.host.HostVO
import org.zstack.kvm.APIAddKVMHostMsg
import org.zstack.kvm.AddKVMHostMsg
import org.zstack.kvm.KVMHostInventory
import org.zstack.kvm.KVMSystemTags
import org.zstack.sdk.AddKVMHostAction
import org.zstack.sdk.ClusterInventory
import org.zstack.sdk.GetHypervisorTypesResult
Expand Down Expand Up @@ -56,6 +57,7 @@ class AddHostCase extends SubCase {
testCheckHostManagementFailure()
testInnerAddHostMsg()
testGetHypervisorTypes()
testPackageVersionTagsClearedWhenFactMissing()
testAddHostFailureRollback()
testAddHostViaLongJob()
testLongJobAddHostFailure()
Expand Down Expand Up @@ -256,6 +258,43 @@ class AddHostCase extends SubCase {
assert (reply.inventory as KVMHostInventory).osDistribution == distribution
}

void testPackageVersionTagsClearedWhenFactMissing() {
String qemuKvmPackageVersion = "6.2.0-451.g623f2a5caf.el8"
String libvirtPackageVersion = "8.0.0-163.gd30ff15b84.el8"

env.afterSimulator(KVM_HOST_FACT_PATH) { HostFactResponse rsp ->
rsp.qemuKvmPackageVersion = qemuKvmPackageVersion
rsp.libvirtPackageVersion = libvirtPackageVersion
return rsp
}

org.zstack.sdk.KVMHostInventory host = addKVMHost {
resourceUuid = Platform.uuid
sessionId = adminSession()
clusterUuid = cluster.uuid
name = "kvm-package-version"
managementIp = "127.0.0.6"
username = "root"
password = "password"
} as org.zstack.sdk.KVMHostInventory

assert KVMSystemTags.QEMU_KVM_PACKAGE_VERSION.getTokenByResourceUuid(host.uuid, KVMSystemTags.QEMU_KVM_PACKAGE_VERSION_TOKEN) == qemuKvmPackageVersion
assert KVMSystemTags.LIBVIRT_PACKAGE_VERSION.getTokenByResourceUuid(host.uuid, KVMSystemTags.LIBVIRT_PACKAGE_VERSION_TOKEN) == libvirtPackageVersion

env.afterSimulator(KVM_HOST_FACT_PATH) { HostFactResponse rsp ->
rsp.qemuKvmPackageVersion = null
rsp.libvirtPackageVersion = " "
return rsp
}

reconnectHost {
uuid = host.uuid
}

assert KVMSystemTags.QEMU_KVM_PACKAGE_VERSION.getTokenByResourceUuid(host.uuid, KVMSystemTags.QEMU_KVM_PACKAGE_VERSION_TOKEN) == null
assert KVMSystemTags.LIBVIRT_PACKAGE_VERSION.getTokenByResourceUuid(host.uuid, KVMSystemTags.LIBVIRT_PACKAGE_VERSION_TOKEN) == null
}

void testGetHypervisorTypes() {
GetHypervisorTypesResult result = getHypervisorTypes {
sessionId = adminSession()
Expand Down