From nobody Mon Apr 29 19:52:29 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; dkim=fail spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1492552908867128.42336580213475; Tue, 18 Apr 2017 15:01:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A97986AAD8; Tue, 18 Apr 2017 22:01:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 275605C884; Tue, 18 Apr 2017 22:01:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 73B5718523C7; Tue, 18 Apr 2017 22:01:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v3IM1eW9032194 for ; Tue, 18 Apr 2017 18:01:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D0D417B92; Tue, 18 Apr 2017 22:01:40 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8531C183C1 for ; Tue, 18 Apr 2017 22:01:38 +0000 (UTC) Received: from mail-pg0-f52.google.com (mail-pg0-f52.google.com [74.125.83.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C4243DBC5 for ; Tue, 18 Apr 2017 22:01:37 +0000 (UTC) Received: by mail-pg0-f52.google.com with SMTP id s64so2640977pgb.1 for ; Tue, 18 Apr 2017 15:01:37 -0700 (PDT) Received: from abby.goodwu.net ([2602:306:c5a7:aed9:178:e451:3aa8:847c]) by smtp.gmail.com with ESMTPSA id 4sm385733pff.17.2017.04.18.15.01.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Apr 2017 15:01:35 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A97986AAD8 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=isi.edu Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A97986AAD8 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=isi-edu.20150623.gappssmtp.com header.i=@isi-edu.20150623.gappssmtp.com header.b="Pkk/C9bJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8C4243DBC5 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=isi.edu Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=rgoodfel@isi.edu DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8C4243DBC5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=isi-edu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=SgVPs0/5pN9yOctEuRlU3j/2yfCqv6oK7Ni2iTT0YnE=; b=Pkk/C9bJpWmcWyUOx3T/aucOSrpM7JfiSnM58QMvulrLFvho62Uy3Nsh4FV9wyTqZ2 KIptK+sVZBF8Mkh0NPgXXDq+3Y86FdiTaYF54qQNzr+B7s2uiRcONRlhlGplT1+YERle nqLq8SjS7nY4fRY42DDzhtMf566rbnVc0kCOlrjPy6Mm87AmetoEy8K9JVbItOkbzzxW kdLPYyVg8XjBtGb+0tLOw9+UuuF21xm67zvr0ZiS6pQ163/0gTNM0oAu+c/z2AyI+v1J tjnYTIMk/jqGxulM2LpuYE9Q3H48lkEQjODmIOSgC5r6f1kfAhADoYJCxVapLjnVhlXw nhGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SgVPs0/5pN9yOctEuRlU3j/2yfCqv6oK7Ni2iTT0YnE=; b=eGe2TuLXbZ9NLRAbig4JXStfP2UqNvaLhXtqLD5x5/6E0MaxpjXVG9jVAgGyLs6rFT 2c5/UKwyLeY9tB2uFNFYwNC+VOdmkT10Pera29U/Na8pMyKMwEQ1kEc3HgE51HE+yFyH zRN1KtEcUzBZfj+FJoe9HLknIckUnEunsuy5wojsIuzMKuxNine2jceSIVTpNsftisuS reM3FMjaV6WBkTZSnLbOly1GSporBEjft4tY/rGCAnPU3OS7FADQWbNt29kn9el94F8U jbVog6ehkykWljti5R/nzvcAAoAdI2agreI+fHjhfT7fEg0Lj5+wIwQ9WLHxtklslVtF 5kfA== X-Gm-Message-State: AN3rC/7HsPglHb0JQR/yI91DdiMePfgfcm6jIkWGoAfXA7ErT/XRUJKl P4mmhk4Njtr+nd0A X-Received: by 10.98.193.65 with SMTP id i62mr19635138pfg.149.1492552896388; Tue, 18 Apr 2017 15:01:36 -0700 (PDT) From: Ryan Goodfellow To: libvir-list@redhat.com Date: Tue, 18 Apr 2017 15:01:18 -0700 Message-Id: <20170418220118.16970-1-rgoodfel@isi.edu> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 18 Apr 2017 22:01:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 18 Apr 2017 22:01:37 +0000 (UTC) for IP:'74.125.83.52' DOMAIN:'mail-pg0-f52.google.com' HELO:'mail-pg0-f52.google.com' FROM:'rgoodfel@isi.edu' RCPT:'' X-RedHat-Spam-Score: 0.87 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM) 74.125.83.52 mail-pg0-f52.google.com 74.125.83.52 mail-pg0-f52.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Ryan Goodfellow Subject: [libvirt] [PATCH go-xml] Support for filesystem devices X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 18 Apr 2017 22:01:47 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This commit adds filesystem device support. A new family of types DomainFilesystem* are introduced and plumbed into the DomainDeviceList struct. Testing has also been included. --- domain.go | 40 ++++++++++++++++++++++++++++++++++++++++ domain_test.go | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) diff --git a/domain.go b/domain.go index 307c71c..cccd9a6 100644 --- a/domain.go +++ b/domain.go @@ -81,6 +81,45 @@ type DomainDisk struct { Target *DomainDiskTarget `xml:"target"` } =20 +type DomainFilesystemDriver struct { + Type string `xml:"type,attr"` + Name string `xml:"name,attr,omitempty"` + WRPolicy string `xml:"wrpolicy,attr,omitempty"` +} + +type DomainFilesystemSource struct { + Dir string `xml:"dir,attr,omitempty"` + File string `xml:"file,attr,omitempty"` +} + +type DomainFilesystemTarget struct { + Dir string `xml:"dir,attr"` +} + +type DomainFilesystemReadOnly struct { +} + +type DomainFilesystemSpaceHardLimit struct { + Value int `xml:",chardata"` + Unit string `xml:"unit,attr,omitempty"` +} + +type DomainFilesystemSpaceSoftLimit struct { + Value int `xml:",chardata"` + Unit string `xml:"unit,attr,omitempty"` +} + +type DomainFilesystem struct { + Type string `xml:"type,attr"` + AccessMode string `xml:"accessmode,attr"` + Driver *DomainFilesystemDriver `xml:"driver"` + Source *DomainFilesystemSource `xml:"source"` + Target *DomainFilesystemTarget `xml:"target"` + ReadOnly *DomainFilesystemReadOnly `xml:"readonly"` + SpaceHardLimit *DomainFilesystemSpaceHardLimit `xml:"space_hard_limit"` + SpaceSoftLimit *DomainFilesystemSpaceSoftLimit `xml:"space_soft_limit"` +} + type DomainInterfaceMAC struct { Address string `xml:"address,attr"` } @@ -212,6 +251,7 @@ type DomainVideo struct { type DomainDeviceList struct { Controllers []DomainController `xml:"controller"` Disks []DomainDisk `xml:"disk"` + Filesystems []DomainFilesystem `xml:"filesystem"` Interfaces []DomainInterface `xml:"interface"` Serials []DomainChardev `xml:"serial"` Consoles []DomainChardev `xml:"console"` diff --git a/domain_test.go b/domain_test.go index e5347ea..06d585c 100644 --- a/domain_test.go +++ b/domain_test.go @@ -690,6 +690,61 @@ var domainTestData =3D []struct { ``, }, }, + { + Object: &Domain{ + Type: "kvm", + Name: "test", + Devices: &DomainDeviceList{ + Filesystems: []DomainFilesystem{ + DomainFilesystem{ + Type: "mount", + AccessMode: "mapped", + Driver: &DomainFilesystemDriver{ + Type: "path", + WRPolicy: "immediate", + }, + Source: &DomainFilesystemSource{ + Dir: "/home/user/test", + }, + Target: &DomainFilesystemTarget{ + Dir: "user-test-mount", + }, + }, + DomainFilesystem{ + Type: "file", + AccessMode: "passthrough", + Driver: &DomainFilesystemDriver{ + Name: "loop", + Type: "raw", + }, + Source: &DomainFilesystemSource{ + File: "/home/user/test.img", + }, + Target: &DomainFilesystemTarget{ + Dir: "user-file-test-mount", + }, + }, + }, + }, + }, + Expected: []string{ + ``, + ` test`, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ` `, + ``, + }, + }, } =20 func TestDomain(t *testing.T) { --=20 2.11.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list