File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ import sh
2+
3+ from carthage .machine import MachineCustomization
4+
5+ class LibvirtServerCustomization (MachineCustomization ):
6+ @setup_task ("Install Libvirt" )
7+ async def install_libvirt (self ):
8+ await self .run_command ("sh" , "-c" , "apt update && apt install -y nfs-common libvirt-daemon-system ovmf git dosfstools tmux fai-server" )
9+
10+ @install_libvirt .check_completed ()
11+ async def install_libvirt (self ):
12+ try :
13+ rc = await self .run_command ("dpkg" , "-l" , "libvirt-daemon-system" )
14+ return True
15+ except sh .ErrorReturnCode_1 :
16+ return False
17+
18+ @setup_task ("Enable nested virtualization" )
19+ async def enable_nested_virt (self ):
20+ with self .host .filesystem_access () as fs :
21+ return (fs / "etc/modprobe.d/10-carthage-kvm-intel.conf" ).write_text ("options kvm_intel nested=y" )
22+
23+ @enable_nested_virt .check_completed ()
24+ async def enable_nested_virt (self ):
25+ with self .host .filesystem_access () as fs :
26+ return (fs / "etc/modprobe.d/10-carthage-kvm-intel.conf" ).is_file ()
You can’t perform that action at this time.
0 commit comments