Skip to content

Commit 530281c

Browse files
sureshanapartidhslove
authored andcommitted
Enable UEFI on KVM hosts (by default), and configure with some default settings (apache#11740)
1 parent 8b2da1d commit 530281c

File tree

10 files changed

+58
-4
lines changed

10 files changed

+58
-4
lines changed

agent/conf/uefi.properties.in

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# Configuration file for UEFI
19+
20+
guest.nvram.template.legacy=@GUESTNVRAMTEMPLATELEGACY@
21+
guest.loader.legacy=@GUESTLOADERLEGACY@
22+
guest.nvram.template.secure=@GUESTNVRAMTEMPLATESECURE@
23+
guest.loader.secure=@GUESTLOADERSECURE@
24+
guest.nvram.path=@GUESTNVRAMPATH@

debian/cloudstack-agent.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# under the License.
1717

1818
/etc/cloudstack/agent/agent.properties
19+
/etc/cloudstack/agent/uefi.properties
1920
/etc/cloudstack/agent/environment.properties
2021
/etc/cloudstack/agent/log4j-cloud.xml
2122
/etc/default/cloudstack-agent

debian/cloudstack-agent.postinst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ case "$1" in
2323
configure)
2424
OLDCONFDIR="/etc/cloud/agent"
2525
NEWCONFDIR="/etc/cloudstack/agent"
26-
CONFFILES="agent.properties log4j.xml log4j-cloud.xml"
26+
CONFFILES="agent.properties uefi.properties log4j.xml log4j-cloud.xml"
2727

2828
mkdir -m 0755 -p /usr/share/cloudstack-agent/tmp
2929

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Description: CloudStack server library
2424

2525
Package: cloudstack-agent
2626
Architecture: all
27-
Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat
27+
Depends: ${python:Depends}, ${python3:Depends}, openjdk-17-jre-headless | java17-runtime-headless | java17-runtime | zulu-17, cloudstack-common (= ${source:Version}), lsb-base (>= 9), openssh-client, qemu-kvm (>= 2.5) | qemu-system-x86 (>= 5.2), libvirt-bin (>= 1.3) | libvirt-daemon-system (>= 3.0), iproute2, ebtables, vlan, ipset, python3-libvirt, ethtool, iptables, cryptsetup, rng-tools, rsync, ovmf, swtpm, lsb-release, ufw, apparmor, cpu-checker, libvirt-daemon-driver-storage-rbd, sysstat
2828
Recommends: init-system-helpers
2929
Conflicts: cloud-agent, cloud-agent-libs, cloud-agent-deps, cloud-agent-scripts
3030
Description: CloudStack agent

packaging/centos7/cloud.spec

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ Requires: ipset
124124
Requires: perl
125125
Requires: rsync
126126
Requires: cifs-utils
127+
Requires: edk2-ovmf
128+
Requires: swtpm
127129
Requires: (python3-libvirt or python3-libvirt-python)
128130
Requires: (qemu-img or qemu-tools)
129131
Requires: qemu-kvm
@@ -374,6 +376,7 @@ install -D packaging/systemd/cloudstack-agent.service ${RPM_BUILD_ROOT}%{_unitdi
374376
install -D packaging/systemd/cloudstack-rolling-maintenance@.service ${RPM_BUILD_ROOT}%{_unitdir}/%{name}-rolling-maintenance@.service
375377
install -D packaging/systemd/cloudstack-agent.default ${RPM_BUILD_ROOT}%{_sysconfdir}/default/%{name}-agent
376378
install -D agent/target/transformed/agent.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/agent.properties
379+
install -D agent/target/transformed/uefi.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/uefi.properties
377380
install -D agent/target/transformed/environment.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/environment.properties
378381
install -D agent/target/transformed/log4j-cloud.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/log4j-cloud.xml
379382
install -D agent/target/transformed/cloud-setup-agent ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-agent
@@ -540,14 +543,22 @@ mkdir -m 0755 -p /usr/share/cloudstack-agent/tmp
540543
/usr/bin/systemctl enable cloudstack-rolling-maintenance@p > /dev/null 2>&1 || true
541544
/usr/bin/systemctl enable --now rngd > /dev/null 2>&1 || true
542545

543-
# if saved configs from upgrade exist, copy them over
546+
# if saved agent.properties from upgrade exist, copy them over
544547
if [ -f "%{_sysconfdir}/cloud.rpmsave/agent/agent.properties" ]; then
545548
mv %{_sysconfdir}/%{name}/agent/agent.properties %{_sysconfdir}/%{name}/agent/agent.properties.rpmnew
546549
cp -p %{_sysconfdir}/cloud.rpmsave/agent/agent.properties %{_sysconfdir}/%{name}/agent
547550
# make sure we only do this on the first install of this RPM, don't want to overwrite on a reinstall
548551
mv %{_sysconfdir}/cloud.rpmsave/agent/agent.properties %{_sysconfdir}/cloud.rpmsave/agent/agent.properties.rpmsave
549552
fi
550553

554+
# if saved uefi.properties from upgrade exist, copy them over
555+
if [ -f "%{_sysconfdir}/cloud.rpmsave/agent/uefi.properties" ]; then
556+
mv %{_sysconfdir}/%{name}/agent/uefi.properties %{_sysconfdir}/%{name}/agent/uefi.properties.rpmnew
557+
cp -p %{_sysconfdir}/cloud.rpmsave/agent/uefi.properties %{_sysconfdir}/%{name}/agent
558+
# make sure we only do this on the first install of this RPM, don't want to overwrite on a reinstall
559+
mv %{_sysconfdir}/cloud.rpmsave/agent/uefi.properties %{_sysconfdir}/cloud.rpmsave/agent/uefi.properties.rpmsave
560+
fi
561+
551562
systemctl daemon-reload
552563

553564
%posttrans agent

packaging/centos8/replace.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ USAGECLASSPATH=
5858
USAGELOG=/var/log/cloudstack/usage/usage.log
5959
USAGESYSCONFDIR=/etc/sysconfig
6060
EXTENSIONSDEPLOYMENTMODE=production
61+
GUESTNVRAMTEMPLATELEGACY=/usr/share/edk2/ovmf/OVMF_VARS.fd
62+
GUESTLOADERLEGACY=/usr/share/edk2/ovmf/OVMF_CODE.cc.fd
63+
GUESTNVRAMTEMPLATESECURE=/usr/share/edk2/ovmf/OVMF_VARS.secboot.fd
64+
GUESTLOADERSECURE=/usr/share/edk2/ovmf/OVMF_CODE.secboot.fd
65+
GUESTNVRAMPATH=/var/lib/libvirt/qemu/nvram/

packaging/debian/replace.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ USAGELOG=/var/log/cloudstack/usage/usage.log
5959
USAGESYSCONFDIR=/etc/cloudstack/usage
6060
PACKAGE=cloudstack
6161
EXTENSIONSDEPLOYMENTMODE=production
62+
GUESTNVRAMTEMPLATELEGACY=/usr/share/OVMF/OVMF_VARS_4M.fd
63+
GUESTLOADERLEGACY=/usr/share/OVMF/OVMF_CODE_4M.fd
64+
GUESTNVRAMTEMPLATESECURE=/usr/share/OVMF/OVMF_VARS_4M.ms.fd
65+
GUESTLOADERSECURE=/usr/share/OVMF/OVMF_CODE_4M.secboot.fd
66+
GUESTNVRAMPATH=/var/lib/libvirt/qemu/nvram/

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,15 +1058,19 @@
10581058
<exclude>dist/console-proxy/js/jquery.js</exclude>
10591059
<exclude>engine/schema/dist/**</exclude>
10601060
<exclude>plugins/hypervisors/hyperv/conf/agent.properties</exclude>
1061+
<exclude>plugins/hypervisors/hyperv/conf/uefi.properties</exclude>
10611062
<exclude>plugins/hypervisors/hyperv/DotNet/ServerResource/**</exclude>
10621063
<exclude>scripts/installer/windows/acs_license.rtf</exclude>
10631064
<exclude>scripts/vm/systemvm/id_rsa.cloud</exclude>
10641065
<exclude>services/console-proxy/server/conf/agent.properties</exclude>
1066+
<exclude>services/console-proxy/server/conf/uefi.properties</exclude>
10651067
<exclude>services/console-proxy/server/conf/environment.properties</exclude>
10661068
<exclude>services/console-proxy/server/js/jquery.js</exclude>
10671069
<exclude>services/secondary-storage/conf/agent.properties</exclude>
1070+
<exclude>services/secondary-storage/conf/uefi.properties</exclude>
10681071
<exclude>services/secondary-storage/conf/environment.properties</exclude>
10691072
<exclude>systemvm/agent/conf/agent.properties</exclude>
1073+
<exclude>systemvm/agent/conf/uefi.properties</exclude>
10701074
<exclude>systemvm/agent/conf/environment.properties</exclude>
10711075
<exclude>systemvm/agent/js/jquery.js</exclude>
10721076
<exclude>systemvm/agent/js/jquery.flot.navigate.js</exclude>

server/src/main/java/com/cloud/server/ManagementServerImpl.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ protected Pair<Boolean, List<HostVO>> filterUefiHostsForMigration(List<HostVO> a
16401640
if (vmInstanceDetailVO != null &&
16411641
(ApiConstants.BootMode.LEGACY.toString().equalsIgnoreCase(vmInstanceDetailVO.getValue()) ||
16421642
ApiConstants.BootMode.SECURE.toString().equalsIgnoreCase(vmInstanceDetailVO.getValue()))) {
1643-
logger.info(" Live Migration of UEFI enabled VM : " + vm.getInstanceName() + " is not supported");
1643+
logger.debug("{} VM is UEFI enabled, Checking for other UEFI enabled hosts as it can be live migrated to UEFI enabled host only.", vm.getInstanceName());
16441644
if (CollectionUtils.isEmpty(filteredHosts)) {
16451645
filteredHosts = new ArrayList<>(allHosts);
16461646
}
@@ -1650,6 +1650,9 @@ protected Pair<Boolean, List<HostVO>> filterUefiHostsForMigration(List<HostVO> a
16501650
return new Pair<>(false, null);
16511651
}
16521652
filteredHosts.removeIf(host -> !uefiEnabledHosts.contains(host.getId()));
1653+
if (filteredHosts.isEmpty()) {
1654+
logger.warn("No UEFI enabled hosts are available for the live migration of VM {}", vm.getInstanceName());
1655+
}
16531656
return new Pair<>(!filteredHosts.isEmpty(), filteredHosts);
16541657
}
16551658
return new Pair<>(true, filteredHosts);

systemvm/systemvm-agent-descriptor.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<include>log4j-cloud.xml</include>
6161
<include>consoleproxy.properties</include>
6262
<include>agent.properties</include>
63+
<include>uefi.properties</include>
6364
</includes>
6465
</fileSet>
6566
<fileSet>

0 commit comments

Comments
 (0)