Skip to content

Commit 2dd1e6d

Browse files
Enable UEFI on KVM hosts (by default), and configure with some default settings (#11740)
1 parent 9c0efb7 commit 2dd1e6d

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/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/

packaging/el8/cloud.spec

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ Requires: ipset
115115
Requires: perl
116116
Requires: rsync
117117
Requires: cifs-utils
118+
Requires: edk2-ovmf
119+
Requires: swtpm
118120
Requires: (python3-libvirt or python3-libvirt-python)
119121
Requires: (qemu-img or qemu-tools)
120122
Requires: qemu-kvm
@@ -356,6 +358,7 @@ install -D packaging/systemd/cloudstack-agent.service ${RPM_BUILD_ROOT}%{_unitdi
356358
install -D packaging/systemd/[email protected] ${RPM_BUILD_ROOT}%{_unitdir}/%{name}[email protected]
357359
install -D packaging/systemd/cloudstack-agent.default ${RPM_BUILD_ROOT}%{_sysconfdir}/default/%{name}-agent
358360
install -D agent/target/transformed/agent.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/agent.properties
361+
install -D agent/target/transformed/uefi.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/uefi.properties
359362
install -D agent/target/transformed/environment.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/environment.properties
360363
install -D agent/target/transformed/log4j-cloud.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/log4j-cloud.xml
361364
install -D agent/target/transformed/cloud-setup-agent ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-agent
@@ -523,14 +526,22 @@ mkdir -m 0755 -p /usr/share/cloudstack-agent/tmp
523526
/usr/bin/systemctl enable cloudstack-rolling-maintenance@p > /dev/null 2>&1 || true
524527
/usr/bin/systemctl enable --now rngd > /dev/null 2>&1 || true
525528

526-
# if saved configs from upgrade exist, copy them over
529+
# if saved agent.properties from upgrade exist, copy them over
527530
if [ -f "%{_sysconfdir}/cloud.rpmsave/agent/agent.properties" ]; then
528531
mv %{_sysconfdir}/%{name}/agent/agent.properties %{_sysconfdir}/%{name}/agent/agent.properties.rpmnew
529532
cp -p %{_sysconfdir}/cloud.rpmsave/agent/agent.properties %{_sysconfdir}/%{name}/agent
530533
# make sure we only do this on the first install of this RPM, don't want to overwrite on a reinstall
531534
mv %{_sysconfdir}/cloud.rpmsave/agent/agent.properties %{_sysconfdir}/cloud.rpmsave/agent/agent.properties.rpmsave
532535
fi
533536

537+
# if saved uefi.properties from upgrade exist, copy them over
538+
if [ -f "%{_sysconfdir}/cloud.rpmsave/agent/uefi.properties" ]; then
539+
mv %{_sysconfdir}/%{name}/agent/uefi.properties %{_sysconfdir}/%{name}/agent/uefi.properties.rpmnew
540+
cp -p %{_sysconfdir}/cloud.rpmsave/agent/uefi.properties %{_sysconfdir}/%{name}/agent
541+
# make sure we only do this on the first install of this RPM, don't want to overwrite on a reinstall
542+
mv %{_sysconfdir}/cloud.rpmsave/agent/uefi.properties %{_sysconfdir}/cloud.rpmsave/agent/uefi.properties.rpmsave
543+
fi
544+
534545
systemctl daemon-reload
535546

536547
# Print help message

packaging/el8/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/

pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,15 +1038,19 @@
10381038
<exclude>dist/console-proxy/js/jquery.js</exclude>
10391039
<exclude>engine/schema/dist/**</exclude>
10401040
<exclude>plugins/hypervisors/hyperv/conf/agent.properties</exclude>
1041+
<exclude>plugins/hypervisors/hyperv/conf/uefi.properties</exclude>
10411042
<exclude>plugins/hypervisors/hyperv/DotNet/ServerResource/**</exclude>
10421043
<exclude>scripts/installer/windows/acs_license.rtf</exclude>
10431044
<exclude>scripts/vm/systemvm/id_rsa.cloud</exclude>
10441045
<exclude>services/console-proxy/server/conf/agent.properties</exclude>
1046+
<exclude>services/console-proxy/server/conf/uefi.properties</exclude>
10451047
<exclude>services/console-proxy/server/conf/environment.properties</exclude>
10461048
<exclude>services/console-proxy/server/js/jquery.js</exclude>
10471049
<exclude>services/secondary-storage/conf/agent.properties</exclude>
1050+
<exclude>services/secondary-storage/conf/uefi.properties</exclude>
10481051
<exclude>services/secondary-storage/conf/environment.properties</exclude>
10491052
<exclude>systemvm/agent/conf/agent.properties</exclude>
1053+
<exclude>systemvm/agent/conf/uefi.properties</exclude>
10501054
<exclude>systemvm/agent/conf/environment.properties</exclude>
10511055
<exclude>systemvm/agent/js/jquery.js</exclude>
10521056
<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
@@ -1410,7 +1410,7 @@ protected Pair<Boolean, List<HostVO>> filterUefiHostsForMigration(List<HostVO> a
14101410
if (vmInstanceDetailVO != null &&
14111411
(ApiConstants.BootMode.LEGACY.toString().equalsIgnoreCase(vmInstanceDetailVO.getValue()) ||
14121412
ApiConstants.BootMode.SECURE.toString().equalsIgnoreCase(vmInstanceDetailVO.getValue()))) {
1413-
logger.info(" Live Migration of UEFI enabled VM : " + vm.getInstanceName() + " is not supported");
1413+
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());
14141414
if (CollectionUtils.isEmpty(filteredHosts)) {
14151415
filteredHosts = new ArrayList<>(allHosts);
14161416
}
@@ -1420,6 +1420,9 @@ protected Pair<Boolean, List<HostVO>> filterUefiHostsForMigration(List<HostVO> a
14201420
return new Pair<>(false, null);
14211421
}
14221422
filteredHosts.removeIf(host -> !uefiEnabledHosts.contains(host.getId()));
1423+
if (filteredHosts.isEmpty()) {
1424+
logger.warn("No UEFI enabled hosts are available for the live migration of VM {}", vm.getInstanceName());
1425+
}
14231426
return new Pair<>(!filteredHosts.isEmpty(), filteredHosts);
14241427
}
14251428
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)