mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-22 13:38:26 +00:00
clh: Boot from persistent memory device
This patch enables clh to mount the guest rootfs on a pmem device while booting, which can reduce the guest memory footprint. Fixes: #2589 Depends-on: github.com/kata-containers/packaging#1014 Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
parent
e8fc25a7f4
commit
7aa3168500
@ -127,7 +127,7 @@ type cloudHypervisor struct {
|
|||||||
|
|
||||||
var clhKernelParams = []Param{
|
var clhKernelParams = []Param{
|
||||||
|
|
||||||
{"root", "/dev/vda1"},
|
{"root", "/dev/pmem0p1"},
|
||||||
{"panic", "1"}, // upon kernel panic wait 1 second before reboot
|
{"panic", "1"}, // upon kernel panic wait 1 second before reboot
|
||||||
{"no_timer_check", ""}, // do not check broken timer IRQ resources
|
{"no_timer_check", ""}, // do not check broken timer IRQ resources
|
||||||
{"noreplace-smp", ""}, // do not replace SMP instructions
|
{"noreplace-smp", ""}, // do not replace SMP instructions
|
||||||
@ -269,11 +269,17 @@ func (clh *cloudHypervisor) createSandbox(ctx context.Context, id string, networ
|
|||||||
return errors.New("image path is empty")
|
return errors.New("image path is empty")
|
||||||
}
|
}
|
||||||
|
|
||||||
disk := chclient.DiskConfig{
|
st, err := os.Stat(imagePath)
|
||||||
Path: imagePath,
|
if err != nil {
|
||||||
Readonly: true,
|
return fmt.Errorf("Failed to get information for image file '%v': %v", imagePath, err)
|
||||||
}
|
}
|
||||||
clh.vmconfig.Disks = append(clh.vmconfig.Disks, disk)
|
|
||||||
|
pmem := chclient.PmemConfig{
|
||||||
|
File: imagePath,
|
||||||
|
Size: st.Size(),
|
||||||
|
DiscardWrites: true,
|
||||||
|
}
|
||||||
|
clh.vmconfig.Pmem = append(clh.vmconfig.Pmem, pmem)
|
||||||
|
|
||||||
// set the serial console to the cloud hypervisor
|
// set the serial console to the cloud hypervisor
|
||||||
if clh.config.Debug {
|
if clh.config.Debug {
|
||||||
|
Loading…
Reference in New Issue
Block a user