From ee420f682c0318cc6fee15875250cbba3b3478c3 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Tue, 25 Apr 2017 22:06:42 +0800 Subject: [PATCH] add dax support Signed-off-by: Lai Jiangshan --- api/descriptions.pb.go | 134 +++++++++++++++++---------------- api/descriptions.proto | 3 +- hack/update-generated-proto.sh | 2 +- hypervisor/context.go | 10 +++ hypervisor/disk.go | 10 ++- hypervisor/libvirt/libvirt.go | 31 +++++++- hypervisor/persistence.go | 2 + hypervisor/qemu/qemu.go | 53 ++++++++++++- hypervisor/qemu/qemu_amd64.go | 2 +- hypervisor/qemu/qmp_wrapper.go | 28 ------- 10 files changed, 177 insertions(+), 98 deletions(-) diff --git a/api/descriptions.pb.go b/api/descriptions.pb.go index ff74a76e..2b8b628a 100644 --- a/api/descriptions.pb.go +++ b/api/descriptions.pb.go @@ -35,7 +35,9 @@ var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. -const _ = proto.ProtoPackageIsVersion1 +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type SandboxConfig struct { Hostname string `protobuf:"bytes,1,opt,name=hostname" json:"hostname,omitempty"` @@ -226,6 +228,7 @@ type VolumeOption struct { Keyring string `protobuf:"bytes,3,opt,name=keyring" json:"keyring,omitempty"` BytesPerSec int32 `protobuf:"varint,4,opt,name=bytesPerSec" json:"bytesPerSec,omitempty"` Iops int32 `protobuf:"varint,5,opt,name=iops" json:"iops,omitempty"` + DaxBlock bool `protobuf:"varint,6,opt,name=daxBlock" json:"daxBlock,omitempty"` } func (m *VolumeOption) Reset() { *m = VolumeOption{} } @@ -287,71 +290,74 @@ func init() { proto.RegisterType((*Process)(nil), "api.Process") } +func init() { proto.RegisterFile("descriptions.proto", fileDescriptor0) } + var fileDescriptor0 = []byte{ - // 1030 bytes of a gzipped FileDescriptorProto + // 1043 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08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1, 0x5a, + 0x9d, 0xed, 0xd1, 0x54, 0x3d, 0xfb, 0x37, 0x00, 0x00, 0xff, 0xff, 0xd3, 0x6f, 0xd3, 0xc7, 0x8d, + 0x09, 0x00, 0x00, } diff --git a/api/descriptions.proto b/api/descriptions.proto index 799d99ba..ea485b0d 100644 --- a/api/descriptions.proto +++ b/api/descriptions.proto @@ -86,6 +86,7 @@ message VolumeOption { string keyring = 3; int32 bytesPerSec = 4; int32 iops = 5; + bool daxBlock = 6; } message UserGroupInfo { @@ -110,4 +111,4 @@ message Process { repeated string Args = 7; repeated string Envs = 8; string Workdir = 9; -} \ No newline at end of file +} diff --git a/hack/update-generated-proto.sh b/hack/update-generated-proto.sh index 3b22b26f..40b84c13 100755 --- a/hack/update-generated-proto.sh +++ b/hack/update-generated-proto.sh @@ -3,7 +3,7 @@ set -o errexit set -o nounset set -o pipefail -if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3.0."* ]]; then +if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3."* ]]; then echo "Generating protobuf requires protoc 3.0.0-beta1 or newer. Please download and" echo "install the platform appropriate Protobuf package for your OS: " echo diff --git a/hypervisor/context.go b/hypervisor/context.go index 1304f9c8..ce777279 100644 --- a/hypervisor/context.go +++ b/hypervisor/context.go @@ -18,6 +18,7 @@ import ( type VmHwStatus struct { PciAddr int //next available pci addr for pci hotplug ScsiId int //next available scsi id for scsi hotplug + PmemId int //next available pmem id for nvdimm hotplug AttachId uint64 //next available attachId for attached tty GuestCid uint32 //vsock guest cid } @@ -50,6 +51,7 @@ type VmContext struct { pciAddr int //next available pci addr for pci hotplug scsiId int //next available scsi id for scsi hotplug + pmemId int //next available pmem id for nvdimm hotplug // InterfaceCount int @@ -185,6 +187,14 @@ func (ctx *VmContext) unsetTimeout() { } } +func (ctx *VmContext) nextPmemId() int { + ctx.idLock.Lock() + id := ctx.pmemId + ctx.pmemId++ + ctx.idLock.Unlock() + return id +} + func (ctx *VmContext) nextScsiId() int { ctx.idLock.Lock() id := ctx.scsiId diff --git a/hypervisor/disk.go b/hypervisor/disk.go index 759ae83a..7900c83a 100644 --- a/hypervisor/disk.go +++ b/hypervisor/disk.go @@ -19,6 +19,8 @@ type DiskDescriptor struct { ScsiAddr string DockerVolume bool Options map[string]string + Dax bool + PmemId int } func (d *DiskDescriptor) IsDir() bool { @@ -65,6 +67,8 @@ func NewDiskContext(ctx *VmContext, vol *api.VolumeDescription) *DiskContext { "bytespersec": strconv.Itoa(int(vol.Options.BytesPerSec)), "iops": strconv.Itoa(int(vol.Options.Iops)), } + } else if vol.Options != nil && vol.Options.DaxBlock && ctx.Boot.HotAddCpuMem { + dc.DiskDescriptor.Dax = true } return dc } @@ -78,7 +82,11 @@ func (dc *DiskContext) insert(result chan api.Result) { return } - dc.ScsiId = dc.sandbox.nextScsiId() + if dc.Dax { + dc.PmemId = dc.sandbox.nextPmemId() + } else { + dc.ScsiId = dc.sandbox.nextScsiId() + } usage := "volume" if dc.isRootVol { usage = "image" diff --git a/hypervisor/libvirt/libvirt.go b/hypervisor/libvirt/libvirt.go index a143008a..c090195d 100644 --- a/hypervisor/libvirt/libvirt.go +++ b/hypervisor/libvirt/libvirt.go @@ -461,7 +461,7 @@ func (lc *LibvirtContext) domainXml(ctx *hypervisor.VmContext) (string, error) { } if ctx.Boot.HotAddCpuMem { - dom.OS.Type.Machine = "pc-i440fx-2.1" + dom.OS.Type.Machine = "pc-i440fx-2.1,nvdimm" dom.VCpu.Content = hypervisor.DefaultMaxCpus dom.MaxMem = &maxmem{Unit: "MiB", Slots: "1", Content: hypervisor.DefaultMaxMem} @@ -918,6 +918,35 @@ func (lc *LibvirtContext) AddDisk(ctx *hypervisor.VmContext, sourceType string, return } + if blockInfo.Dax { + // get the size + fi, e := os.Stat(blockInfo.Filename) + if e != nil { + result <- &hypervisor.DeviceFailed{} + return + } + size := fi.Size() + // compose hmp + hmp := fmt.Sprintf("object_add memory-backend-file,id=mem%d,share=off,mem-path=%s,size=%d", blockInfo.PmemId, blockInfo.Filename, size) + err := exec.Command("virsh", "-c", LibvirtdAddress, "qemu-monitor-command", ctx.Id, "--hmp", hmp).Run() + if err != nil { + result <- &hypervisor.DeviceFailed{} + return + } + hmp = fmt.Sprintf("device_add nvdimm,id=nvdimm%d,memdev=mem%d", blockInfo.PmemId, blockInfo.PmemId) + err = exec.Command("virsh", "-c", LibvirtdAddress, "qemu-monitor-command", ctx.Id, "--hmp", hmp).Run() + if err != nil { + result <- &hypervisor.DeviceFailed{} + return + } + result <- &hypervisor.BlockdevInsertedEvent{ + Name: name, + SourceType: sourceType, + DeviceName: "pmem" + strconv.Itoa(blockInfo.PmemId), + } + return + } + secretUUID, err := lc.diskSecretUUID(blockInfo) if err != nil { glog.Error("generate disk-get-secret failed, ", err.Error()) diff --git a/hypervisor/persistence.go b/hypervisor/persistence.go index f68957e1..b3cff8cd 100644 --- a/hypervisor/persistence.go +++ b/hypervisor/persistence.go @@ -136,6 +136,7 @@ func (ctx *VmContext) dumpHwInfo() *VmHwStatus { return &VmHwStatus{ PciAddr: ctx.pciAddr, ScsiId: ctx.scsiId, + PmemId: ctx.pmemId, AttachId: ctx.hyperstart.LastStreamSeq(), GuestCid: ctx.GuestCid, } @@ -144,6 +145,7 @@ func (ctx *VmContext) dumpHwInfo() *VmHwStatus { func (ctx *VmContext) loadHwStatus(pinfo *PersistInfo) error { ctx.pciAddr = pinfo.HwStat.PciAddr ctx.scsiId = pinfo.HwStat.ScsiId + ctx.pmemId = pinfo.HwStat.PmemId ctx.GuestCid = pinfo.HwStat.GuestCid if ctx.GuestCid != 0 { if !VsockCidManager.MarkCidInuse(ctx.GuestCid) { diff --git a/hypervisor/qemu/qemu.go b/hypervisor/qemu/qemu.go index 52ce10e4..7cde48fa 100644 --- a/hypervisor/qemu/qemu.go +++ b/hypervisor/qemu/qemu.go @@ -247,7 +247,58 @@ func (qc *QemuContext) AddDisk(ctx *hypervisor.VmContext, sourceType string, blo } } - newDiskAddSession(ctx, qc, name, sourceType, filename, format, id, result) + commands := make([]*QmpCommand, 2) + devName := scsiId2Name(id) + if !blockInfo.Dax { + commands[0] = &QmpCommand{ + Execute: "human-monitor-command", + Arguments: map[string]interface{}{ + "command-line": "drive_add dummy file=" + + filename + ",if=none,id=" + "drive" + strconv.Itoa(id) + ",format=" + format + ",cache=writeback", + }, + } + commands[1] = &QmpCommand{ + Execute: "device_add", + Arguments: map[string]interface{}{ + "driver": "scsi-hd", "bus": "scsi0.0", "scsi-id": strconv.Itoa(id), + "drive": "drive" + strconv.Itoa(id), "id": "scsi-disk" + strconv.Itoa(id), + }, + } + } else { + // get the size + fi, e := os.Stat(filename) + if e != nil { + result <- &hypervisor.DeviceFailed{} + return + } + size := fi.Size() + // compose qmp commands + // hmp: object_add memory-backend-file,id=mem2,share=off,mem-path=/path/to/dax.img,size=10G + // hmp: device_add nvdimm,id=nvdimm2,memdev=mem2 + commands[0] = &QmpCommand{ + Execute: "human-monitor-command", + Arguments: map[string]interface{}{ + "command-line": "object_add memory-backend-file,id=mem" + strconv.Itoa(blockInfo.PmemId) + + ",share=off,mem-path=" + filename + ",size=" + strconv.FormatInt(size, 10), + }, + } + commands[1] = &QmpCommand{ + Execute: "device_add", + Arguments: map[string]interface{}{ + "driver": "nvdimm", "memdev": "mem" + strconv.Itoa(blockInfo.PmemId), "id": "nvdimm" + strconv.Itoa(blockInfo.PmemId), + }, + } + devName = "pmem" + strconv.Itoa(blockInfo.PmemId) + } + qc.qmp <- &QmpSession{ + commands: commands, + respond: defaultRespond(result, &hypervisor.BlockdevInsertedEvent{ + Name: name, + SourceType: sourceType, + DeviceName: devName, + ScsiId: id, + }), + } } func (qc *QemuContext) RemoveDisk(ctx *hypervisor.VmContext, blockInfo *hypervisor.DiskDescriptor, callback hypervisor.VmEvent, result chan<- hypervisor.VmEvent) { diff --git a/hypervisor/qemu/qemu_amd64.go b/hypervisor/qemu/qemu_amd64.go index ba7e5143..94e0fb58 100644 --- a/hypervisor/qemu/qemu_amd64.go +++ b/hypervisor/qemu/qemu_amd64.go @@ -29,7 +29,7 @@ func (qc *QemuContext) arguments(ctx *hypervisor.VmContext) []string { var machineClass, memParams, cpuParams string if boot.HotAddCpuMem || boot.BootToBeTemplate || boot.BootFromTemplate { - machineClass = "pc-i440fx-2.1" + machineClass = "pc-i440fx-2.1,nvdimm" memParams = fmt.Sprintf("size=%d,slots=1,maxmem=%dM", boot.Memory, hypervisor.DefaultMaxMem) // TODO set maxmem to the total memory of the system cpuParams = fmt.Sprintf("cpus=%d,maxcpus=%d", boot.CPU, hypervisor.DefaultMaxCpus) // TODO set it to the cpus of the system } else { diff --git a/hypervisor/qemu/qmp_wrapper.go b/hypervisor/qemu/qmp_wrapper.go index c78f7ce3..1bc716f9 100644 --- a/hypervisor/qemu/qmp_wrapper.go +++ b/hypervisor/qemu/qmp_wrapper.go @@ -33,34 +33,6 @@ func defaultRespond(result chan<- hypervisor.VmEvent, callback hypervisor.VmEven } } -func newDiskAddSession(ctx *hypervisor.VmContext, qc *QemuContext, name, sourceType, filename, format string, id int, result chan<- hypervisor.VmEvent) { - commands := make([]*QmpCommand, 2) - commands[0] = &QmpCommand{ - Execute: "human-monitor-command", - Arguments: map[string]interface{}{ - "command-line": "drive_add dummy file=" + - filename + ",if=none,id=" + "drive" + strconv.Itoa(id) + ",format=" + format + ",cache=writeback", - }, - } - commands[1] = &QmpCommand{ - Execute: "device_add", - Arguments: map[string]interface{}{ - "driver": "scsi-hd", "bus": "scsi0.0", "scsi-id": strconv.Itoa(id), - "drive": "drive" + strconv.Itoa(id), "id": "scsi-disk" + strconv.Itoa(id), - }, - } - devName := scsiId2Name(id) - qc.qmp <- &QmpSession{ - commands: commands, - respond: defaultRespond(result, &hypervisor.BlockdevInsertedEvent{ - Name: name, - SourceType: sourceType, - DeviceName: devName, - ScsiId: id, - }), - } -} - func newDiskDelSession(ctx *hypervisor.VmContext, qc *QemuContext, id int, callback hypervisor.VmEvent, result chan<- hypervisor.VmEvent) { commands := make([]*QmpCommand, 2) commands[1] = &QmpCommand{