[libvirt] [PATCH go-xml] Add address support for memory device
Peter Krempa
pkrempa at redhat.com
Mon Oct 30 09:27:13 UTC 2017
On Mon, Oct 30, 2017 at 11:05:13 +0800, zhenwei.pi wrote:
> Add Base element for DomainAddress.
> Add address element for DomainMemorydev.
> Add test code for new DomainMemorydev.
>
> Signed-off-by: zhenwei.pi <zhenwei.pi at youruncloud.com>
> ---
> domain.go | 2 ++
> domain_test.go | 9 +++++++++
> 2 files changed, 11 insertions(+)
>
> diff --git a/domain.go b/domain.go
> index bacab11..3d9404f 100644
> --- a/domain.go
> +++ b/domain.go
> @@ -297,6 +297,7 @@ type DomainAddress struct {
> Function *HexUint `xml:"function,attr"`
> Target *uint `xml:"target,attr"`
> Unit *uint `xml:"unit,attr"`
> + Base *HexUint `xml:"base,attr"`
> }
>
> type DomainConsole struct {
> @@ -450,6 +451,7 @@ type DomainMemorydev struct {
> Model string `xml:"model,attr"`
> Access string `xml:"access,attr"`
> Target *DomainMemorydevTarget `xml:"target"`
> + Address *DomainAddress `xml:"address"`
> }
>
> type DomainDeviceList struct {
> diff --git a/domain_test.go b/domain_test.go
> index dbebe42..cbc5d7f 100644
> --- a/domain_test.go
> +++ b/domain_test.go
> @@ -66,6 +66,9 @@ var vcpuId0 uint = 0
> var vcpuOrder0 uint = 1
> var vcpuId1 uint = 1
>
> +var memorydevAddressSlot HexUint = 0
> +var memorydevAddressBase HexUint = 4294967296
> +
> var domainTestData = []struct {
> Object Document
> Expected []string
> @@ -385,6 +388,11 @@ var domainTestData = []struct {
> Value: 0,
> },
> },
> + Address: &DomainAddress{
> + Type: "dimm",
> + Slot: &memorydevAddressSlot,
> + Base: &memorydevAddressBase,
> + },
> },
> },
> },
> @@ -434,6 +442,7 @@ var domainTestData = []struct {
> ` <size unit="GiB">1</size>`,
> ` <node>0</node>`,
> ` </target>`,
> + ` <address type="dimm" slot="0" base="4294967296"></address>`,
This is not a hex number. you are missing the 0x prefix. Also the
element has no content so no closing tag is required.
> ` </memory>`,
> ` </devices>`,
> `</domain>`,
> --
> 2.7.4
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
More information about the libvir-list
mailing list