Skip to content

Commit 2508376

Browse files
committed
config default value
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 07bc6d0 commit 2508376

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

engine/api/src/main/java/com/cloud/vm/VirtualMachineManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public interface VirtualMachineManager extends Manager {
8888
"If provided, a custom cloud-name in cloud-init metadata", true, ConfigKey.Scope.Zone);
8989

9090
ConfigKey<String> VmMetadataManufacturer = new ConfigKey<>("Advanced", String.class,
91-
"vm.metadata.manufacturer", "",
91+
"vm.metadata.manufacturer", "Apache Software Foundation",
9292
"If provided, a custom manufacturer will be used in the instance metadata. When an empty" +
9393
"value is set then default manufacturer will be 'Apache Software Foundation'. " +
9494
"A custom manufacturer may break cloud-init functionality with CloudStack datasource. Please " +

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,8 +1262,16 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil
12621262
vmGuru.finalizeVirtualMachineProfile(vmProfile, dest, ctx);
12631263

12641264
final VirtualMachineTO vmTO = hvGuru.implement(vmProfile);
1265-
vmTO.setMetadataManufacturer(VmMetadataManufacturer.valueIn(vm.getDataCenterId()));
1266-
vmTO.setMetadataProductName(VmMetadataProductName.valueIn(vm.getDataCenterId()));
1265+
String metadataManufacturer = VmMetadataManufacturer.valueIn(vm.getDataCenterId());
1266+
if (StringUtils.isBlank(metadataManufacturer)) {
1267+
metadataManufacturer = VmMetadataManufacturer.defaultValue();
1268+
}
1269+
vmTO.setMetadataManufacturer(metadataManufacturer);
1270+
String metadataProduct = VmMetadataProductName.valueIn(vm.getDataCenterId());
1271+
if (StringUtils.isBlank(metadataManufacturer)) {
1272+
metadataProduct = String.format("CloudStack %s Hypervisor", vm.getHypervisorType().toString());
1273+
}
1274+
vmTO.setMetadataProductName(metadataProduct);
12671275

12681276
checkAndSetEnterSetupMode(vmTO, params);
12691277

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,6 @@ public GuestType getGuestType() {
127127
}
128128

129129
public String getManufacturer() {
130-
if (StringUtils.isEmpty(manufacturer)) {
131-
return "Apache Software Foundation";
132-
}
133130
return manufacturer;
134131
}
135132

@@ -138,9 +135,6 @@ public void setManufacturer(String manufacturer) {
138135
}
139136

140137
public String getProduct() {
141-
if (StringUtils.isEmpty(product)) {
142-
return String.format("CloudStack %s Hypervisor", _type.toString());
143-
}
144138
return product;
145139
}
146140

0 commit comments

Comments
 (0)