pax_global_header00006660000000000000000000000064146353755500014527gustar00rootroot0000000000000052 comment=8fd6d79b0f36047100ed4ac654225666ba161af4 golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/000077500000000000000000000000001463537555000234715ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/.github/000077500000000000000000000000001463537555000250315ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/.github/CODEOWNERS000066400000000000000000000000331463537555000264200ustar00rootroot00000000000000* @digitalocean/go-libvirt golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/.github/dependabot.yml000066400000000000000000000001551463537555000276620ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "gomod" directory: "/" schedule: interval: "weekly" golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/.github/workflows/000077500000000000000000000000001463537555000270665ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/.github/workflows/libvirtd.conf000066400000000000000000000002231463537555000315510ustar00rootroot00000000000000# libvirtd configuration for ci listen_tls = 0 listen_tcp = 1 tcp_port = "16509" listen_addr = "127.0.0.1" auth_unix_rw = "none" auth_tcp = "none" golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/.github/workflows/main.yml000066400000000000000000000032231463537555000305350ustar00rootroot00000000000000name: CI on: push: branches: [ master ] pull_request: branches: [ master ] # allow manual execution from the web interface workflow_dispatch: jobs: test: strategy: matrix: os: ['ubuntu-20.04', 'ubuntu-22.04'] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 # respository path: $GITHUB_WORKSPACE - uses: actions/setup-go@v2 with: go-version: 1.21 - name: Install golint run: go install golang.org/x/lint/golint@latest - name: Install goyacc run: go install golang.org/x/tools/cmd/goyacc@latest - name: Install libvirt run: | sudo apt-get update sudo apt-get -qqy install libvirt-daemon-system - name: Stop libvirtd run: sudo systemctl stop libvirtd - name: Start libvirtd with custom config run: sudo libvirtd -d -l -f $GITHUB_WORKSPACE/.github/workflows/libvirtd.conf - name: Setup test artifacts env: TESTDATA: ${{ github.workspace }}/testdata run: | go get -d ./... sudo qemu-img create -f raw -o size=10M /var/lib/libvirt/images/test.raw sudo virsh define $TESTDATA/test-domain.xml sudo virsh start test sudo virsh pool-create $TESTDATA/test-pool.xml sudo virsh secret-define $TESTDATA/test-secret.xml - name: Lint and Vet run: | golint -set_exit_status ./... go vet ./... - name: Unit test run: go test -race ./... - name: integration test run: sudo go test -race -tags=integration ./... - name: Build run: go build ./... golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/.gitignore000066400000000000000000000000251463537555000254560ustar00rootroot00000000000000.idea/ bin/ libvirt/ golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/AUTHORS000066400000000000000000000015531463537555000245450ustar00rootroot00000000000000Maintainer ---------- DigitalOcean, Inc Original Authors ---------------- Ben LeMasurier Matt Layher Contributors ------------ Justin Kim Ricky Medina Charlie Drage Michael Koppmann Simarpreet Singh Alexander Polyakov Amanda Andrade Geoff Hickey Yuriy Taraday Sylvain Baubeau David Schneider Alec Hothan Akos Varga Peter Kurfer Sam Roberts Moritz Wanzenböck Jenni Griesmann Zane Bitter golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/CONTRIBUTING.md000066400000000000000000000024171463537555000257260ustar00rootroot00000000000000Contributing ============ The `go-libvirt` project makes use of the [GitHub Flow](https://guides.github.com/introduction/flow/) for contributions. If you'd like to contribute to the project, please [open an issue](https://github.com/digitalocean/go-libvirt/issues/new) or find an [existing issue](https://github.com/digitalocean/go-libvirt/issues) that you'd like to take on. This ensures that efforts are not duplicated, and that a new feature aligns with the focus of the rest of the repository. Once your suggestion has been submitted and discussed, please be sure that your code meets the following criteria: - code is completely `gofmt`'d - new features or codepaths have appropriate test coverage - `go test ./...` passes - `go vet ./...` passes - `golint ./...` returns no warnings, including documentation comment warnings In addition, if this is your first time contributing to the `go-libvirt` project, add your name and email address to the [AUTHORS](https://github.com/digitalocean/go-libvirt/blob/master/AUTHORS) file under the "Contributors" section using the format: `First Last `. Finally, submit a pull request for review! Feel free to join us in [`#go-libvirt` on libera chat](https://web.libera.chat/) if you'd like to discuss the project. golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/LICENSE.md000066400000000000000000000243771463537555000251120ustar00rootroot00000000000000Apache License ============== _Version 2.0, January 2004_ _<>_ ### Terms and Conditions for use, reproduction, and distribution #### 1. Definitions “License” shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. “Licensor” shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. “Legal Entity” shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, “control” means **(i)** the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the outstanding shares, or **(iii)** beneficial ownership of such entity. “You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by this License. “Source” form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. “Object” form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. “Work” shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). “Derivative Works” shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. “Contribution” shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as “Not a Contribution.” “Contributor” shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. #### 2. Grant of Copyright License Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. #### 3. Grant of Patent License Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. #### 4. Redistribution You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: * **(a)** You must give any other recipients of the Work or Derivative Works a copy of this License; and * **(b)** You must cause any modified files to carry prominent notices stating that You changed the files; and * **(c)** You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and * **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. #### 5. Submission of Contributions Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. #### 6. Trademarks This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. #### 7. Disclaimer of Warranty Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. #### 8. Limitation of Liability In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. #### 9. Accepting Warranty or Additional Liability While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. _END OF TERMS AND CONDITIONS_ ### APPENDIX: How to apply the Apache License to your work To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets `[]` replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/README.md000066400000000000000000000227541463537555000247620ustar00rootroot00000000000000libvirt [![GoDoc](http://godoc.org/github.com/digitalocean/go-libvirt?status.svg)](http://godoc.org/github.com/digitalocean/go-libvirt) [![Build Status](https://github.com/digitalocean/go-libvirt/actions/workflows/main.yml/badge.svg)](https://github.com/digitalocean/go-libvirt/actions/) [![Report Card](https://goreportcard.com/badge/github.com/digitalocean/go-libvirt)](https://goreportcard.com/report/github.com/digitalocean/go-libvirt) ==== Package `go-libvirt` provides a pure Go interface for interacting with libvirt. Rather than using libvirt's C bindings, this package makes use of libvirt's RPC interface, as documented [here](https://libvirt.org/kbase/internals/rpc.html). Connections to the libvirt server may be local, or remote. RPC packets are encoded using the XDR standard as defined by [RFC 4506](https://tools.ietf.org/html/rfc4506.html). libvirt's RPC interface is quite extensive, and changes from one version to the next, so this project uses a pair of code generators to build the go bindings. The code generators should be run whenever you want to build go-libvirt for a new version of libvirt. See the next section for directions on re-generating go-libvirt. [Pull requests are welcome](https://github.com/digitalocean/go-libvirt/blob/master/CONTRIBUTING.md)! Feel free to join us in [`#go-libvirt` on libera chat](https://web.libera.chat/) if you'd like to discuss the project. Running the Code Generators --------------------------- The code generator doesn't run automatically when you build go-libvirt. It's meant to be run manually any time you change the version of libvirt you're using. When you download go-libvirt it will come with generated files corresponding to a particular version of libvirt. You can use the library as-is, but the generated code may be missing libvirt functions, if you're using a newer version of libvirt, or it may have extra functions that will return 'unimplemented' errors if you try to call them. If this is a problem, you should re-run the code generator. To do this, follow these steps: - First, download a copy of the libvirt sources corresponding to the version you want to use. - Change directories into where you've unpacked your distribution of libvirt. - The second step depends on the version of libvirt you'd like to build against. It's not necessary to actually build libvirt, but it is necessary to run libvirt's "configure" step because it generates required files. - For libvirt < v6.7.0: - `$ mkdir build; cd build` - `$ ../autogen.sh` - For libvirt >= v6.7.0: - `$ meson setup build` - Finally, set the environment variable `LIBVIRT_SOURCE` to the directory you put libvirt into, and run `go generate ./...` from the go-libvirt directory. This runs both of the go-libvirt's code generators. How to Use This Library ----------------------- Once you've vendored go-libvirt into your project, you'll probably want to call some libvirt functions. There's some example code below showing how to connect to libvirt and make one such call, but once you get past the introduction you'll next want to call some other libvirt functions. How do you find them? Start with the [libvirt API reference](https://libvirt.org/html/index.html). Let's say you want to gracefully shutdown a VM, and after reading through the libvirt docs you determine that virDomainShutdown() is the function you want to call to do that. Where's that function in go-libvirt? We transform the names slightly when building the go bindings. There's no need for a global prefix like "vir" in Go, since all our functions are inside the package namespace, so we drop it. That means the Go function for `virDomainShutdown()` is just `DomainShutdown()`, and sure enough, you can find the Go function `DomainShutdown()` in libvirt.gen.go, with parameters and return values equivalent to those documented in the API reference. Suppose you then decide you need more control over your shutdown, so you switch over to `virDomainShutdownFlags()`. As its name suggests, this function takes a flag parameter which has possible values specified in an enum called `virDomainShutdownFlagValues`. Flag types like this are a little tricky for the code generator, because the C functions just take an integer type - only the libvirt documentation actually ties the flags to the enum types. In most cases though we're able to generate a wrapper function with a distinct flag type, making it easier for Go tooling to suggest possible flag values while you're working. Checking the documentation for this function: `godoc github.com/digitalocean/go-libvirt DomainShutdownFlags` returns this: `func (l *Libvirt) DomainShutdownFlags(Dom Domain, Flags DomainShutdownFlagValues) (err error)` If you want to see the possible flag values, `godoc` can help again: ``` $ godoc github.com/digitalocean/go-libvirt DomainShutdownFlagValues type DomainShutdownFlagValues int32 DomainShutdownFlagValues as declared in libvirt/libvirt-domain.h:1121 const ( DomainShutdownDefault DomainShutdownFlagValues = iota DomainShutdownAcpiPowerBtn DomainShutdownFlagValues = 1 DomainShutdownGuestAgent DomainShutdownFlagValues = 2 DomainShutdownInitctl DomainShutdownFlagValues = 4 DomainShutdownSignal DomainShutdownFlagValues = 8 DomainShutdownParavirt DomainShutdownFlagValues = 16 ) DomainShutdownFlagValues enumeration from libvirt/libvirt-domain.h:1121 ``` One other suggestion: most of the code in go-libvirt is now generated, but a few hand-written routines still exist in libvirt.go, and wrap calls to the generated code with slightly different parameters or return values. We suggest avoiding these hand-written routines and calling the generated routines in libvirt.gen.go instead. Over time these handwritten routines will be removed from go-libvirt. Warning ------- While these package are reasonably well-tested and have seen some use inside of DigitalOcean, there may be subtle bugs which could cause the packages to act in unexpected ways. Use at your own risk! In addition, the API is not considered stable at this time. If you would like to include package `libvirt` in a project, we highly recommend vendoring it into your project. Example ------- ```go package main import ( "fmt" "log" "net/url" "github.com/digitalocean/go-libvirt" ) func main() { uri, _ := url.Parse(string(libvirt.QEMUSystem)) l, err := libvirt.ConnectToURI(uri) if err != nil { log.Fatalf("failed to connect: %v", err) } v, err := l.ConnectGetLibVersion() if err != nil { log.Fatalf("failed to retrieve libvirt version: %v", err) } fmt.Println("Version:", v) flags := libvirt.ConnectListDomainsActive | libvirt.ConnectListDomainsInactive domains, _, err := l.ConnectListAllDomains(1, flags) if err != nil { log.Fatalf("failed to retrieve domains: %v", err) } fmt.Println("ID\tName\t\tUUID") fmt.Printf("--------------------------------------------------------\n") for _, d := range domains { fmt.Printf("%d\t%s\t%x\n", d.ID, d.Name, d.UUID) } if err = l.Disconnect(); err != nil { log.Fatalf("failed to disconnect: %v", err) } } ``` ``` Version: 1.3.4 ID Name UUID -------------------------------------------------------- 1 Test-1 dc329f87d4de47198cfd2e21c6105b01 2 Test-2 dc229f87d4de47198cfd2e21c6105b01 ``` Example (Connect to libvirt via TLS over TCP) ------- ```go package main import ( "crypto/tls" "crypto/x509" "fmt" "io/ioutil" "log" "github.com/digitalocean/go-libvirt" "github.com/digitalocean/go-libvirt/socket/dialers" ) func main() { // This dials libvirt on the local machine // It connects to libvirt via TLS over TCP // To connect to a remote machine, you need to have the ca/cert/key of it. // The private key is at ~/.pki/libvirt/clientkey.pem // or /etc/pki/libvirt/private/clientkey.pem // The Client Cert is at ~/.pki/libvirt/clientcert.pem // or /etc/pki/libvirt/clientcert.pem // The CA Cert is at ~/.pki/libvirt/cacert.pem // or /etc/pki/CA/cacert.pem // Use host name or IP which is valid in certificate addr := "10.10.10.10" l := libvirt.NewWithDialer(dialers.NewTLS(addr)) if err := l.Connect(); err != nil { log.Fatalf("failed to connect: %v", err) } v, err := l.Version() if err != nil { log.Fatalf("failed to retrieve libvirt version: %v", err) } fmt.Println("Version:", v) // Return both running and stopped VMs flags := libvirt.ConnectListDomainsActive | libvirt.ConnectListDomainsInactive domains, _, err := l.ConnectListAllDomains(1, flags) if err != nil { log.Fatalf("failed to retrieve domains: %v", err) } fmt.Println("ID\tName\t\tUUID") fmt.Println("--------------------------------------------------------") for _, d := range domains { fmt.Printf("%d\t%s\t%x\n", d.ID, d.Name, d.UUID) } if err := l.Disconnect(); err != nil { log.Fatalf("failed to disconnect: %v", err) } } ``` Running the Integration Tests ----------------------------- GitHub actions workflows are defined in [.github/workflows](.github/workflows) and can be triggered manually in the GitHub UI after pushing a branch. There are not currently convenient scripts for setting up and running integration tests locally, but installing libvirt and defining only the artifacts described by the files in testdata should be sufficient to be able to run the integration test file against. golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/connect_uri.go000066400000000000000000000142751463537555000263410ustar00rootroot00000000000000package libvirt import ( "errors" "fmt" "net/url" "os/user" "strconv" "strings" "github.com/digitalocean/go-libvirt/socket" "github.com/digitalocean/go-libvirt/socket/dialers" ) // ConnectToURI returns a new, connected client instance using the appropriate // dialer for the given libvirt URI. func ConnectToURI(uri *url.URL) (*Libvirt, error) { dialer, err := dialerForURI(uri) if err != nil { return nil, err } lv := NewWithDialer(dialer) if err := lv.ConnectToURI(RemoteURI(uri)); err != nil { return nil, fmt.Errorf("failed to connect to libvirt: %w", err) } return lv, nil } // RemoteURI returns the libvirtd URI corresponding to a given client URI. // The client URI contains details of the connection method, but once connected // to libvirtd, all connections are local. So e.g. the client may want to // connect to qemu+tcp://example.com/system but once the socket is established // it will ask the remote libvirtd for qemu:///system. func RemoteURI(uri *url.URL) ConnectURI { remoteURI := (&url.URL{ Scheme: strings.Split(uri.Scheme, "+")[0], Path: uri.Path, }).String() if name := uri.Query().Get("name"); name != "" { remoteURI = name } return ConnectURI(remoteURI) } func dialerForURI(uri *url.URL) (socket.Dialer, error) { transport := "unix" if scheme := strings.SplitN(uri.Scheme, "+", 2); len(scheme) > 1 { transport = scheme[1] } else if uri.Host != "" { transport = "tls" } switch transport { case "unix": options := []dialers.LocalOption{} if s := uri.Query().Get("socket"); s != "" { options = append(options, dialers.WithSocket(s)) } if err := checkModeOption(uri); err != nil { return nil, err } return dialers.NewLocal(options...), nil case "tcp": options := []dialers.RemoteOption{} if port := uri.Port(); port != "" { options = append(options, dialers.UsePort(port)) } return dialers.NewRemote(uri.Hostname(), options...), nil case "tls": options := []dialers.TLSOption{} if port := uri.Port(); port != "" { options = append(options, dialers.UseTLSPort(port)) } if pkiPath := uri.Query().Get("pkipath"); pkiPath != "" { options = append(options, dialers.UsePKIPath(pkiPath)) } if nv, err := noVerifyOption(uri); err != nil { return nil, err } else if nv { options = append(options, dialers.WithInsecureNoVerify()) } return dialers.NewTLS(uri.Hostname(), options...), nil case "libssh", "libssh2": options := []dialers.SSHOption{} options, err := processCommonSSHOptions(uri, options) if err != nil { return nil, err } if knownHosts := uri.Query().Get("known_hosts"); knownHosts != "" { options = append(options, dialers.UseKnownHostsFile(knownHosts)) } if hostVerify := uri.Query().Get("known_hosts_verify"); hostVerify != "" { switch hostVerify { case "normal": case "auto": options = append(options, dialers.WithAcceptUnknownHostKey()) case "ignore": options = append(options, dialers.WithInsecureIgnoreHostKey()) default: return nil, fmt.Errorf("invalid ssh known hosts verify method %v", hostVerify) } } if auth := uri.Query().Get("sshauth"); auth != "" { authMethods := &dialers.SSHAuthMethods{} for _, a := range strings.Split(auth, ",") { switch strings.ToLower(a) { case "agent": authMethods.Agent() case "privkey": authMethods.PrivKey() case "password": authMethods.Password() case "keyboard-interactive": authMethods.KeyboardInteractive() default: return nil, fmt.Errorf("invalid ssh auth method %v", a) } } options = append(options, dialers.WithSSHAuthMethods(authMethods)) } if noVerify := uri.Query().Get("no_verify"); noVerify != "" { return nil, fmt.Errorf( "\"no_verify\" option invalid with %s transport, use known_hosts_verify=ignore instead", transport) } return dialers.NewSSH(uri.Hostname(), options...), nil case "ssh": // Emulate ssh using golang ssh library. Note that this means that // system ssh config is not respected as it would be when shelling out // to the ssh binary. currentUser, err := user.Current() if err != nil { return nil, err } options := []dialers.SSHOption{ dialers.WithSystemSSHDefaults(currentUser), } options, err = processCommonSSHOptions(uri, options) if err != nil { return nil, err } if nv, err := noVerifyOption(uri); err != nil { return nil, err } else if nv { options = append(options, dialers.WithInsecureIgnoreHostKey()) } fieldErrs := []error{} for _, f := range []string{ "known_hosts", "known_hosts_verify", "sshauth", } { if field := uri.Query().Get(f); field != "" { fieldErrs = append(fieldErrs, fmt.Errorf("%v option invalid with ssh transport, use libssh transport instead", f)) } } if len(fieldErrs) > 0 { return nil, errors.Join(fieldErrs...) } return dialers.NewSSH(uri.Hostname(), options...), nil default: return nil, fmt.Errorf("unsupported libvirt transport %s", transport) } } func noVerifyOption(uri *url.URL) (bool, error) { nv := uri.Query().Get("no_verify") if nv == "" { return false, nil } val, err := strconv.Atoi(nv) if err != nil { return false, fmt.Errorf("invalid value for no_verify: %w", err) } return val != 0, nil } func checkModeOption(uri *url.URL) error { mode := uri.Query().Get("mode") switch strings.ToLower(mode) { case "": case "legacy", "auto": case "direct": return errors.New("cannot connect in direct mode") default: return fmt.Errorf("invalid ssh mode %v", mode) } return nil } func processCommonSSHOptions(uri *url.URL, options []dialers.SSHOption) ([]dialers.SSHOption, error) { if port := uri.Port(); port != "" { options = append(options, dialers.UseSSHPort(port)) } if username := uri.User.Username(); username != "" { options = append(options, dialers.UseSSHUsername(username)) } if password, ok := uri.User.Password(); ok { options = append(options, dialers.UseSSHPassword(password)) } if socket := uri.Query().Get("socket"); socket != "" { options = append(options, dialers.WithRemoteSocket(socket)) } if keyFile := uri.Query().Get("keyfile"); keyFile != "" { options = append(options, dialers.UseKeyFile(keyFile)) } if err := checkModeOption(uri); err != nil { return options, err } return options, nil } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/const.gen.go000066400000000000000000003312521463537555000257240ustar00rootroot00000000000000// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // WARNING: This file has automatically been generated // Code generated by https://git.io/c-for-go. DO NOT EDIT. package libvirt const ( // Deprecated as defined in libvirt/libvirt-common.h:40 Deprecated = 0x5f8b60 // ExportVar as defined in libvirt/libvirt-common.h:57 ExportVar = 0x5f8b60 // TypedParamFieldLength as defined in libvirt/libvirt-common.h:170 TypedParamFieldLength = 80 // DomainSchedulerCPUShares as defined in libvirt/libvirt-domain.h:316 DomainSchedulerCPUShares = "cpu_shares" // DomainSchedulerGlobalPeriod as defined in libvirt/libvirt-domain.h:324 DomainSchedulerGlobalPeriod = "global_period" // DomainSchedulerGlobalQuota as defined in libvirt/libvirt-domain.h:332 DomainSchedulerGlobalQuota = "global_quota" // DomainSchedulerVCPUPeriod as defined in libvirt/libvirt-domain.h:340 DomainSchedulerVCPUPeriod = "vcpu_period" // DomainSchedulerVCPUQuota as defined in libvirt/libvirt-domain.h:348 DomainSchedulerVCPUQuota = "vcpu_quota" // DomainSchedulerEmulatorPeriod as defined in libvirt/libvirt-domain.h:357 DomainSchedulerEmulatorPeriod = "emulator_period" // DomainSchedulerEmulatorQuota as defined in libvirt/libvirt-domain.h:366 DomainSchedulerEmulatorQuota = "emulator_quota" // DomainSchedulerIothreadPeriod as defined in libvirt/libvirt-domain.h:374 DomainSchedulerIothreadPeriod = "iothread_period" // DomainSchedulerIothreadQuota as defined in libvirt/libvirt-domain.h:382 DomainSchedulerIothreadQuota = "iothread_quota" // DomainSchedulerWeight as defined in libvirt/libvirt-domain.h:390 DomainSchedulerWeight = "weight" // DomainSchedulerCap as defined in libvirt/libvirt-domain.h:398 DomainSchedulerCap = "cap" // DomainSchedulerReservation as defined in libvirt/libvirt-domain.h:406 DomainSchedulerReservation = "reservation" // DomainSchedulerLimit as defined in libvirt/libvirt-domain.h:414 DomainSchedulerLimit = "limit" // DomainSchedulerShares as defined in libvirt/libvirt-domain.h:422 DomainSchedulerShares = "shares" // DomainBlockStatsFieldLength as defined in libvirt/libvirt-domain.h:480 DomainBlockStatsFieldLength = TypedParamFieldLength // DomainBlockStatsReadBytes as defined in libvirt/libvirt-domain.h:488 DomainBlockStatsReadBytes = "rd_bytes" // DomainBlockStatsReadReq as defined in libvirt/libvirt-domain.h:496 DomainBlockStatsReadReq = "rd_operations" // DomainBlockStatsReadTotalTimes as defined in libvirt/libvirt-domain.h:504 DomainBlockStatsReadTotalTimes = "rd_total_times" // DomainBlockStatsWriteBytes as defined in libvirt/libvirt-domain.h:512 DomainBlockStatsWriteBytes = "wr_bytes" // DomainBlockStatsWriteReq as defined in libvirt/libvirt-domain.h:520 DomainBlockStatsWriteReq = "wr_operations" // DomainBlockStatsWriteTotalTimes as defined in libvirt/libvirt-domain.h:528 DomainBlockStatsWriteTotalTimes = "wr_total_times" // DomainBlockStatsFlushReq as defined in libvirt/libvirt-domain.h:536 DomainBlockStatsFlushReq = "flush_operations" // DomainBlockStatsFlushTotalTimes as defined in libvirt/libvirt-domain.h:544 DomainBlockStatsFlushTotalTimes = "flush_total_times" // DomainBlockStatsErrs as defined in libvirt/libvirt-domain.h:551 DomainBlockStatsErrs = "errs" // MigrateParamURI as defined in libvirt/libvirt-domain.h:879 MigrateParamURI = "migrate_uri" // MigrateParamDestName as defined in libvirt/libvirt-domain.h:889 MigrateParamDestName = "destination_name" // MigrateParamDestXML as defined in libvirt/libvirt-domain.h:908 MigrateParamDestXML = "destination_xml" // MigrateParamPersistXML as defined in libvirt/libvirt-domain.h:923 MigrateParamPersistXML = "persistent_xml" // MigrateParamBandwidth as defined in libvirt/libvirt-domain.h:933 MigrateParamBandwidth = "bandwidth" // MigrateParamBandwidthPostcopy as defined in libvirt/libvirt-domain.h:942 MigrateParamBandwidthPostcopy = "bandwidth.postcopy" // MigrateParamGraphicsURI as defined in libvirt/libvirt-domain.h:963 MigrateParamGraphicsURI = "graphics_uri" // MigrateParamListenAddress as defined in libvirt/libvirt-domain.h:974 MigrateParamListenAddress = "listen_address" // MigrateParamMigrateDisks as defined in libvirt/libvirt-domain.h:983 MigrateParamMigrateDisks = "migrate_disks" // MigrateParamDisksPort as defined in libvirt/libvirt-domain.h:993 MigrateParamDisksPort = "disks_port" // MigrateParamDisksURI as defined in libvirt/libvirt-domain.h:1006 MigrateParamDisksURI = "disks_uri" // MigrateParamCompression as defined in libvirt/libvirt-domain.h:1016 MigrateParamCompression = "compression" // MigrateParamCompressionMtLevel as defined in libvirt/libvirt-domain.h:1025 MigrateParamCompressionMtLevel = "compression.mt.level" // MigrateParamCompressionMtThreads as defined in libvirt/libvirt-domain.h:1033 MigrateParamCompressionMtThreads = "compression.mt.threads" // MigrateParamCompressionMtDthreads as defined in libvirt/libvirt-domain.h:1041 MigrateParamCompressionMtDthreads = "compression.mt.dthreads" // MigrateParamCompressionXbzrleCache as defined in libvirt/libvirt-domain.h:1049 MigrateParamCompressionXbzrleCache = "compression.xbzrle.cache" // MigrateParamAutoConvergeInitial as defined in libvirt/libvirt-domain.h:1058 MigrateParamAutoConvergeInitial = "auto_converge.initial" // MigrateParamAutoConvergeIncrement as defined in libvirt/libvirt-domain.h:1068 MigrateParamAutoConvergeIncrement = "auto_converge.increment" // MigrateParamParallelConnections as defined in libvirt/libvirt-domain.h:1076 MigrateParamParallelConnections = "parallel.connections" // MigrateParamTLSDestination as defined in libvirt/libvirt-domain.h:1090 MigrateParamTLSDestination = "tls.destination" // DomainCPUStatsCputime as defined in libvirt/libvirt-domain.h:1350 DomainCPUStatsCputime = "cpu_time" // DomainCPUStatsUsertime as defined in libvirt/libvirt-domain.h:1356 DomainCPUStatsUsertime = "user_time" // DomainCPUStatsSystemtime as defined in libvirt/libvirt-domain.h:1362 DomainCPUStatsSystemtime = "system_time" // DomainCPUStatsVcputime as defined in libvirt/libvirt-domain.h:1369 DomainCPUStatsVcputime = "vcpu_time" // DomainBlkioWeight as defined in libvirt/libvirt-domain.h:1398 DomainBlkioWeight = "weight" // DomainBlkioDeviceWeight as defined in libvirt/libvirt-domain.h:1408 DomainBlkioDeviceWeight = "device_weight" // DomainBlkioDeviceReadIops as defined in libvirt/libvirt-domain.h:1419 DomainBlkioDeviceReadIops = "device_read_iops_sec" // DomainBlkioDeviceWriteIops as defined in libvirt/libvirt-domain.h:1430 DomainBlkioDeviceWriteIops = "device_write_iops_sec" // DomainBlkioDeviceReadBps as defined in libvirt/libvirt-domain.h:1441 DomainBlkioDeviceReadBps = "device_read_bytes_sec" // DomainBlkioDeviceWriteBps as defined in libvirt/libvirt-domain.h:1452 DomainBlkioDeviceWriteBps = "device_write_bytes_sec" // DomainMemoryParamUnlimited as defined in libvirt/libvirt-domain.h:1471 DomainMemoryParamUnlimited = int64(9007199254740991) // DomainMemoryHardLimit as defined in libvirt/libvirt-domain.h:1480 DomainMemoryHardLimit = "hard_limit" // DomainMemorySoftLimit as defined in libvirt/libvirt-domain.h:1489 DomainMemorySoftLimit = "soft_limit" // DomainMemoryMinGuarantee as defined in libvirt/libvirt-domain.h:1498 DomainMemoryMinGuarantee = "min_guarantee" // DomainMemorySwapHardLimit as defined in libvirt/libvirt-domain.h:1508 DomainMemorySwapHardLimit = "swap_hard_limit" // DomainNumaNodeset as defined in libvirt/libvirt-domain.h:1554 DomainNumaNodeset = "numa_nodeset" // DomainNumaMode as defined in libvirt/libvirt-domain.h:1562 DomainNumaMode = "numa_mode" // DomainBandwidthInAverage as defined in libvirt/libvirt-domain.h:1684 DomainBandwidthInAverage = "inbound.average" // DomainBandwidthInPeak as defined in libvirt/libvirt-domain.h:1691 DomainBandwidthInPeak = "inbound.peak" // DomainBandwidthInBurst as defined in libvirt/libvirt-domain.h:1698 DomainBandwidthInBurst = "inbound.burst" // DomainBandwidthInFloor as defined in libvirt/libvirt-domain.h:1705 DomainBandwidthInFloor = "inbound.floor" // DomainBandwidthOutAverage as defined in libvirt/libvirt-domain.h:1712 DomainBandwidthOutAverage = "outbound.average" // DomainBandwidthOutPeak as defined in libvirt/libvirt-domain.h:1719 DomainBandwidthOutPeak = "outbound.peak" // DomainBandwidthOutBurst as defined in libvirt/libvirt-domain.h:1726 DomainBandwidthOutBurst = "outbound.burst" // DomainIothreadPollMaxNs as defined in libvirt/libvirt-domain.h:2031 DomainIothreadPollMaxNs = "poll_max_ns" // DomainIothreadPollGrow as defined in libvirt/libvirt-domain.h:2041 DomainIothreadPollGrow = "poll_grow" // DomainIothreadPollShrink as defined in libvirt/libvirt-domain.h:2052 DomainIothreadPollShrink = "poll_shrink" // PerfParamCmt as defined in libvirt/libvirt-domain.h:2245 PerfParamCmt = "cmt" // PerfParamMbmt as defined in libvirt/libvirt-domain.h:2256 PerfParamMbmt = "mbmt" // PerfParamMbml as defined in libvirt/libvirt-domain.h:2266 PerfParamMbml = "mbml" // PerfParamCacheMisses as defined in libvirt/libvirt-domain.h:2276 PerfParamCacheMisses = "cache_misses" // PerfParamCacheReferences as defined in libvirt/libvirt-domain.h:2286 PerfParamCacheReferences = "cache_references" // PerfParamInstructions as defined in libvirt/libvirt-domain.h:2296 PerfParamInstructions = "instructions" // PerfParamCPUCycles as defined in libvirt/libvirt-domain.h:2306 PerfParamCPUCycles = "cpu_cycles" // PerfParamBranchInstructions as defined in libvirt/libvirt-domain.h:2316 PerfParamBranchInstructions = "branch_instructions" // PerfParamBranchMisses as defined in libvirt/libvirt-domain.h:2326 PerfParamBranchMisses = "branch_misses" // PerfParamBusCycles as defined in libvirt/libvirt-domain.h:2336 PerfParamBusCycles = "bus_cycles" // PerfParamStalledCyclesFrontend as defined in libvirt/libvirt-domain.h:2347 PerfParamStalledCyclesFrontend = "stalled_cycles_frontend" // PerfParamStalledCyclesBackend as defined in libvirt/libvirt-domain.h:2358 PerfParamStalledCyclesBackend = "stalled_cycles_backend" // PerfParamRefCPUCycles as defined in libvirt/libvirt-domain.h:2369 PerfParamRefCPUCycles = "ref_cpu_cycles" // PerfParamCPUClock as defined in libvirt/libvirt-domain.h:2380 PerfParamCPUClock = "cpu_clock" // PerfParamTaskClock as defined in libvirt/libvirt-domain.h:2391 PerfParamTaskClock = "task_clock" // PerfParamPageFaults as defined in libvirt/libvirt-domain.h:2401 PerfParamPageFaults = "page_faults" // PerfParamContextSwitches as defined in libvirt/libvirt-domain.h:2411 PerfParamContextSwitches = "context_switches" // PerfParamCPUMigrations as defined in libvirt/libvirt-domain.h:2421 PerfParamCPUMigrations = "cpu_migrations" // PerfParamPageFaultsMin as defined in libvirt/libvirt-domain.h:2431 PerfParamPageFaultsMin = "page_faults_min" // PerfParamPageFaultsMaj as defined in libvirt/libvirt-domain.h:2441 PerfParamPageFaultsMaj = "page_faults_maj" // PerfParamAlignmentFaults as defined in libvirt/libvirt-domain.h:2451 PerfParamAlignmentFaults = "alignment_faults" // PerfParamEmulationFaults as defined in libvirt/libvirt-domain.h:2461 PerfParamEmulationFaults = "emulation_faults" // DomainBlockCopyBandwidth as defined in libvirt/libvirt-domain.h:2634 DomainBlockCopyBandwidth = "bandwidth" // DomainBlockCopyGranularity as defined in libvirt/libvirt-domain.h:2645 DomainBlockCopyGranularity = "granularity" // DomainBlockCopyBufSize as defined in libvirt/libvirt-domain.h:2654 DomainBlockCopyBufSize = "buf-size" // DomainBlockIotuneTotalBytesSec as defined in libvirt/libvirt-domain.h:2695 DomainBlockIotuneTotalBytesSec = "total_bytes_sec" // DomainBlockIotuneReadBytesSec as defined in libvirt/libvirt-domain.h:2703 DomainBlockIotuneReadBytesSec = "read_bytes_sec" // DomainBlockIotuneWriteBytesSec as defined in libvirt/libvirt-domain.h:2711 DomainBlockIotuneWriteBytesSec = "write_bytes_sec" // DomainBlockIotuneTotalIopsSec as defined in libvirt/libvirt-domain.h:2719 DomainBlockIotuneTotalIopsSec = "total_iops_sec" // DomainBlockIotuneReadIopsSec as defined in libvirt/libvirt-domain.h:2727 DomainBlockIotuneReadIopsSec = "read_iops_sec" // DomainBlockIotuneWriteIopsSec as defined in libvirt/libvirt-domain.h:2734 DomainBlockIotuneWriteIopsSec = "write_iops_sec" // DomainBlockIotuneTotalBytesSecMax as defined in libvirt/libvirt-domain.h:2742 DomainBlockIotuneTotalBytesSecMax = "total_bytes_sec_max" // DomainBlockIotuneReadBytesSecMax as defined in libvirt/libvirt-domain.h:2750 DomainBlockIotuneReadBytesSecMax = "read_bytes_sec_max" // DomainBlockIotuneWriteBytesSecMax as defined in libvirt/libvirt-domain.h:2758 DomainBlockIotuneWriteBytesSecMax = "write_bytes_sec_max" // DomainBlockIotuneTotalIopsSecMax as defined in libvirt/libvirt-domain.h:2766 DomainBlockIotuneTotalIopsSecMax = "total_iops_sec_max" // DomainBlockIotuneReadIopsSecMax as defined in libvirt/libvirt-domain.h:2774 DomainBlockIotuneReadIopsSecMax = "read_iops_sec_max" // DomainBlockIotuneWriteIopsSecMax as defined in libvirt/libvirt-domain.h:2781 DomainBlockIotuneWriteIopsSecMax = "write_iops_sec_max" // DomainBlockIotuneTotalBytesSecMaxLength as defined in libvirt/libvirt-domain.h:2789 DomainBlockIotuneTotalBytesSecMaxLength = "total_bytes_sec_max_length" // DomainBlockIotuneReadBytesSecMaxLength as defined in libvirt/libvirt-domain.h:2797 DomainBlockIotuneReadBytesSecMaxLength = "read_bytes_sec_max_length" // DomainBlockIotuneWriteBytesSecMaxLength as defined in libvirt/libvirt-domain.h:2805 DomainBlockIotuneWriteBytesSecMaxLength = "write_bytes_sec_max_length" // DomainBlockIotuneTotalIopsSecMaxLength as defined in libvirt/libvirt-domain.h:2813 DomainBlockIotuneTotalIopsSecMaxLength = "total_iops_sec_max_length" // DomainBlockIotuneReadIopsSecMaxLength as defined in libvirt/libvirt-domain.h:2821 DomainBlockIotuneReadIopsSecMaxLength = "read_iops_sec_max_length" // DomainBlockIotuneWriteIopsSecMaxLength as defined in libvirt/libvirt-domain.h:2829 DomainBlockIotuneWriteIopsSecMaxLength = "write_iops_sec_max_length" // DomainBlockIotuneSizeIopsSec as defined in libvirt/libvirt-domain.h:2836 DomainBlockIotuneSizeIopsSec = "size_iops_sec" // DomainBlockIotuneGroupName as defined in libvirt/libvirt-domain.h:2843 DomainBlockIotuneGroupName = "group_name" // KeycodeSetRfb as defined in libvirt/libvirt-domain.h:2924 KeycodeSetRfb = 0x5f8b60 // DomainSendKeyMaxKeys as defined in libvirt/libvirt-domain.h:2931 DomainSendKeyMaxKeys = 16 // DomainJobOperationStr as defined in libvirt/libvirt-domain.h:3405 DomainJobOperationStr = "operation" // DomainJobTimeElapsed as defined in libvirt/libvirt-domain.h:3415 DomainJobTimeElapsed = "time_elapsed" // DomainJobTimeElapsedNet as defined in libvirt/libvirt-domain.h:3425 DomainJobTimeElapsedNet = "time_elapsed_net" // DomainJobTimeRemaining as defined in libvirt/libvirt-domain.h:3435 DomainJobTimeRemaining = "time_remaining" // DomainJobDowntime as defined in libvirt/libvirt-domain.h:3445 DomainJobDowntime = "downtime" // DomainJobDowntimeNet as defined in libvirt/libvirt-domain.h:3454 DomainJobDowntimeNet = "downtime_net" // DomainJobSetupTime as defined in libvirt/libvirt-domain.h:3463 DomainJobSetupTime = "setup_time" // DomainJobDataTotal as defined in libvirt/libvirt-domain.h:3478 DomainJobDataTotal = "data_total" // DomainJobDataProcessed as defined in libvirt/libvirt-domain.h:3488 DomainJobDataProcessed = "data_processed" // DomainJobDataRemaining as defined in libvirt/libvirt-domain.h:3498 DomainJobDataRemaining = "data_remaining" // DomainJobMemoryTotal as defined in libvirt/libvirt-domain.h:3508 DomainJobMemoryTotal = "memory_total" // DomainJobMemoryProcessed as defined in libvirt/libvirt-domain.h:3518 DomainJobMemoryProcessed = "memory_processed" // DomainJobMemoryRemaining as defined in libvirt/libvirt-domain.h:3528 DomainJobMemoryRemaining = "memory_remaining" // DomainJobMemoryConstant as defined in libvirt/libvirt-domain.h:3540 DomainJobMemoryConstant = "memory_constant" // DomainJobMemoryNormal as defined in libvirt/libvirt-domain.h:3550 DomainJobMemoryNormal = "memory_normal" // DomainJobMemoryNormalBytes as defined in libvirt/libvirt-domain.h:3560 DomainJobMemoryNormalBytes = "memory_normal_bytes" // DomainJobMemoryBps as defined in libvirt/libvirt-domain.h:3568 DomainJobMemoryBps = "memory_bps" // DomainJobMemoryDirtyRate as defined in libvirt/libvirt-domain.h:3576 DomainJobMemoryDirtyRate = "memory_dirty_rate" // DomainJobMemoryPageSize as defined in libvirt/libvirt-domain.h:3587 DomainJobMemoryPageSize = "memory_page_size" // DomainJobMemoryIteration as defined in libvirt/libvirt-domain.h:3598 DomainJobMemoryIteration = "memory_iteration" // DomainJobMemoryPostcopyReqs as defined in libvirt/libvirt-domain.h:3608 DomainJobMemoryPostcopyReqs = "memory_postcopy_requests" // DomainJobDiskTotal as defined in libvirt/libvirt-domain.h:3618 DomainJobDiskTotal = "disk_total" // DomainJobDiskProcessed as defined in libvirt/libvirt-domain.h:3628 DomainJobDiskProcessed = "disk_processed" // DomainJobDiskRemaining as defined in libvirt/libvirt-domain.h:3638 DomainJobDiskRemaining = "disk_remaining" // DomainJobDiskBps as defined in libvirt/libvirt-domain.h:3646 DomainJobDiskBps = "disk_bps" // DomainJobCompressionCache as defined in libvirt/libvirt-domain.h:3655 DomainJobCompressionCache = "compression_cache" // DomainJobCompressionBytes as defined in libvirt/libvirt-domain.h:3663 DomainJobCompressionBytes = "compression_bytes" // DomainJobCompressionPages as defined in libvirt/libvirt-domain.h:3671 DomainJobCompressionPages = "compression_pages" // DomainJobCompressionCacheMisses as defined in libvirt/libvirt-domain.h:3680 DomainJobCompressionCacheMisses = "compression_cache_misses" // DomainJobCompressionOverflow as defined in libvirt/libvirt-domain.h:3690 DomainJobCompressionOverflow = "compression_overflow" // DomainJobAutoConvergeThrottle as defined in libvirt/libvirt-domain.h:3699 DomainJobAutoConvergeThrottle = "auto_converge_throttle" // DomainJobSuccess as defined in libvirt/libvirt-domain.h:3707 DomainJobSuccess = "success" // DomainJobErrmsg as defined in libvirt/libvirt-domain.h:3715 DomainJobErrmsg = "errmsg" // DomainJobDiskTempUsed as defined in libvirt/libvirt-domain.h:3723 DomainJobDiskTempUsed = "disk_temp_used" // DomainJobDiskTempTotal as defined in libvirt/libvirt-domain.h:3730 DomainJobDiskTempTotal = "disk_temp_total" // DomainTunableCPUVcpupin as defined in libvirt/libvirt-domain.h:4285 DomainTunableCPUVcpupin = "cputune.vcpupin%u" // DomainTunableCPUEmulatorpin as defined in libvirt/libvirt-domain.h:4293 DomainTunableCPUEmulatorpin = "cputune.emulatorpin" // DomainTunableCPUIothreadspin as defined in libvirt/libvirt-domain.h:4302 DomainTunableCPUIothreadspin = "cputune.iothreadpin%u" // DomainTunableCPUCpuShares as defined in libvirt/libvirt-domain.h:4310 DomainTunableCPUCpuShares = "cputune.cpu_shares" // DomainTunableCPUGlobalPeriod as defined in libvirt/libvirt-domain.h:4318 DomainTunableCPUGlobalPeriod = "cputune.global_period" // DomainTunableCPUGlobalQuota as defined in libvirt/libvirt-domain.h:4326 DomainTunableCPUGlobalQuota = "cputune.global_quota" // DomainTunableCPUVCPUPeriod as defined in libvirt/libvirt-domain.h:4334 DomainTunableCPUVCPUPeriod = "cputune.vcpu_period" // DomainTunableCPUVCPUQuota as defined in libvirt/libvirt-domain.h:4342 DomainTunableCPUVCPUQuota = "cputune.vcpu_quota" // DomainTunableCPUEmulatorPeriod as defined in libvirt/libvirt-domain.h:4351 DomainTunableCPUEmulatorPeriod = "cputune.emulator_period" // DomainTunableCPUEmulatorQuota as defined in libvirt/libvirt-domain.h:4360 DomainTunableCPUEmulatorQuota = "cputune.emulator_quota" // DomainTunableCPUIothreadPeriod as defined in libvirt/libvirt-domain.h:4368 DomainTunableCPUIothreadPeriod = "cputune.iothread_period" // DomainTunableCPUIothreadQuota as defined in libvirt/libvirt-domain.h:4376 DomainTunableCPUIothreadQuota = "cputune.iothread_quota" // DomainTunableBlkdevDisk as defined in libvirt/libvirt-domain.h:4384 DomainTunableBlkdevDisk = "blkdeviotune.disk" // DomainTunableBlkdevTotalBytesSec as defined in libvirt/libvirt-domain.h:4392 DomainTunableBlkdevTotalBytesSec = "blkdeviotune.total_bytes_sec" // DomainTunableBlkdevReadBytesSec as defined in libvirt/libvirt-domain.h:4400 DomainTunableBlkdevReadBytesSec = "blkdeviotune.read_bytes_sec" // DomainTunableBlkdevWriteBytesSec as defined in libvirt/libvirt-domain.h:4408 DomainTunableBlkdevWriteBytesSec = "blkdeviotune.write_bytes_sec" // DomainTunableBlkdevTotalIopsSec as defined in libvirt/libvirt-domain.h:4416 DomainTunableBlkdevTotalIopsSec = "blkdeviotune.total_iops_sec" // DomainTunableBlkdevReadIopsSec as defined in libvirt/libvirt-domain.h:4424 DomainTunableBlkdevReadIopsSec = "blkdeviotune.read_iops_sec" // DomainTunableBlkdevWriteIopsSec as defined in libvirt/libvirt-domain.h:4432 DomainTunableBlkdevWriteIopsSec = "blkdeviotune.write_iops_sec" // DomainTunableBlkdevTotalBytesSecMax as defined in libvirt/libvirt-domain.h:4440 DomainTunableBlkdevTotalBytesSecMax = "blkdeviotune.total_bytes_sec_max" // DomainTunableBlkdevReadBytesSecMax as defined in libvirt/libvirt-domain.h:4448 DomainTunableBlkdevReadBytesSecMax = "blkdeviotune.read_bytes_sec_max" // DomainTunableBlkdevWriteBytesSecMax as defined in libvirt/libvirt-domain.h:4456 DomainTunableBlkdevWriteBytesSecMax = "blkdeviotune.write_bytes_sec_max" // DomainTunableBlkdevTotalIopsSecMax as defined in libvirt/libvirt-domain.h:4464 DomainTunableBlkdevTotalIopsSecMax = "blkdeviotune.total_iops_sec_max" // DomainTunableBlkdevReadIopsSecMax as defined in libvirt/libvirt-domain.h:4472 DomainTunableBlkdevReadIopsSecMax = "blkdeviotune.read_iops_sec_max" // DomainTunableBlkdevWriteIopsSecMax as defined in libvirt/libvirt-domain.h:4480 DomainTunableBlkdevWriteIopsSecMax = "blkdeviotune.write_iops_sec_max" // DomainTunableBlkdevSizeIopsSec as defined in libvirt/libvirt-domain.h:4488 DomainTunableBlkdevSizeIopsSec = "blkdeviotune.size_iops_sec" // DomainTunableBlkdevGroupName as defined in libvirt/libvirt-domain.h:4496 DomainTunableBlkdevGroupName = "blkdeviotune.group_name" // DomainTunableBlkdevTotalBytesSecMaxLength as defined in libvirt/libvirt-domain.h:4505 DomainTunableBlkdevTotalBytesSecMaxLength = "blkdeviotune.total_bytes_sec_max_length" // DomainTunableBlkdevReadBytesSecMaxLength as defined in libvirt/libvirt-domain.h:4514 DomainTunableBlkdevReadBytesSecMaxLength = "blkdeviotune.read_bytes_sec_max_length" // DomainTunableBlkdevWriteBytesSecMaxLength as defined in libvirt/libvirt-domain.h:4523 DomainTunableBlkdevWriteBytesSecMaxLength = "blkdeviotune.write_bytes_sec_max_length" // DomainTunableBlkdevTotalIopsSecMaxLength as defined in libvirt/libvirt-domain.h:4532 DomainTunableBlkdevTotalIopsSecMaxLength = "blkdeviotune.total_iops_sec_max_length" // DomainTunableBlkdevReadIopsSecMaxLength as defined in libvirt/libvirt-domain.h:4541 DomainTunableBlkdevReadIopsSecMaxLength = "blkdeviotune.read_iops_sec_max_length" // DomainTunableBlkdevWriteIopsSecMaxLength as defined in libvirt/libvirt-domain.h:4550 DomainTunableBlkdevWriteIopsSecMaxLength = "blkdeviotune.write_iops_sec_max_length" // DomainSchedFieldLength as defined in libvirt/libvirt-domain.h:4888 DomainSchedFieldLength = TypedParamFieldLength // DomainBlkioFieldLength as defined in libvirt/libvirt-domain.h:4932 DomainBlkioFieldLength = TypedParamFieldLength // DomainMemoryFieldLength as defined in libvirt/libvirt-domain.h:4976 DomainMemoryFieldLength = TypedParamFieldLength // DomainLaunchSecuritySevMeasurement as defined in libvirt/libvirt-domain.h:5102 DomainLaunchSecuritySevMeasurement = "sev-measurement" // DomainLaunchSecuritySevAPIMajor as defined in libvirt/libvirt-domain.h:5111 DomainLaunchSecuritySevAPIMajor = "sev-api-major" // DomainLaunchSecuritySevAPIMinor as defined in libvirt/libvirt-domain.h:5119 DomainLaunchSecuritySevAPIMinor = "sev-api-minor" // DomainLaunchSecuritySevBuildID as defined in libvirt/libvirt-domain.h:5127 DomainLaunchSecuritySevBuildID = "sev-build-id" // DomainLaunchSecuritySevPolicy as defined in libvirt/libvirt-domain.h:5135 DomainLaunchSecuritySevPolicy = "sev-policy" // DomainLaunchSecuritySevSecretHeader as defined in libvirt/libvirt-domain.h:5146 DomainLaunchSecuritySevSecretHeader = "sev-secret-header" // DomainLaunchSecuritySevSecret as defined in libvirt/libvirt-domain.h:5156 DomainLaunchSecuritySevSecret = "sev-secret" // DomainLaunchSecuritySevSecretSetAddress as defined in libvirt/libvirt-domain.h:5165 DomainLaunchSecuritySevSecretSetAddress = "sev-secret-set-address" // SecurityLabelBuflen as defined in libvirt/libvirt-host.h:84 SecurityLabelBuflen = (4096 + 1) // SecurityModelBuflen as defined in libvirt/libvirt-host.h:112 SecurityModelBuflen = (256 + 1) // SecurityDoiBuflen as defined in libvirt/libvirt-host.h:119 SecurityDoiBuflen = (256 + 1) // NodeCPUStatsFieldLength as defined in libvirt/libvirt-host.h:180 NodeCPUStatsFieldLength = 80 // NodeCPUStatsKernel as defined in libvirt/libvirt-host.h:197 NodeCPUStatsKernel = "kernel" // NodeCPUStatsUser as defined in libvirt/libvirt-host.h:205 NodeCPUStatsUser = "user" // NodeCPUStatsIdle as defined in libvirt/libvirt-host.h:213 NodeCPUStatsIdle = "idle" // NodeCPUStatsIowait as defined in libvirt/libvirt-host.h:221 NodeCPUStatsIowait = "iowait" // NodeCPUStatsIntr as defined in libvirt/libvirt-host.h:229 NodeCPUStatsIntr = "intr" // NodeCPUStatsUtilization as defined in libvirt/libvirt-host.h:238 NodeCPUStatsUtilization = "utilization" // NodeMemoryStatsFieldLength as defined in libvirt/libvirt-host.h:258 NodeMemoryStatsFieldLength = 80 // NodeMemoryStatsTotal as defined in libvirt/libvirt-host.h:275 NodeMemoryStatsTotal = "total" // NodeMemoryStatsFree as defined in libvirt/libvirt-host.h:284 NodeMemoryStatsFree = "free" // NodeMemoryStatsBuffers as defined in libvirt/libvirt-host.h:292 NodeMemoryStatsBuffers = "buffers" // NodeMemoryStatsCached as defined in libvirt/libvirt-host.h:300 NodeMemoryStatsCached = "cached" // NodeMemorySharedPagesToScan as defined in libvirt/libvirt-host.h:321 NodeMemorySharedPagesToScan = "shm_pages_to_scan" // NodeMemorySharedSleepMillisecs as defined in libvirt/libvirt-host.h:329 NodeMemorySharedSleepMillisecs = "shm_sleep_millisecs" // NodeMemorySharedPagesShared as defined in libvirt/libvirt-host.h:337 NodeMemorySharedPagesShared = "shm_pages_shared" // NodeMemorySharedPagesSharing as defined in libvirt/libvirt-host.h:345 NodeMemorySharedPagesSharing = "shm_pages_sharing" // NodeMemorySharedPagesUnshared as defined in libvirt/libvirt-host.h:353 NodeMemorySharedPagesUnshared = "shm_pages_unshared" // NodeMemorySharedPagesVolatile as defined in libvirt/libvirt-host.h:361 NodeMemorySharedPagesVolatile = "shm_pages_volatile" // NodeMemorySharedFullScans as defined in libvirt/libvirt-host.h:369 NodeMemorySharedFullScans = "shm_full_scans" // NodeMemorySharedMergeAcrossNodes as defined in libvirt/libvirt-host.h:381 NodeMemorySharedMergeAcrossNodes = "shm_merge_across_nodes" // NodeSevPdh as defined in libvirt/libvirt-host.h:449 NodeSevPdh = "pdh" // NodeSevCertChain as defined in libvirt/libvirt-host.h:458 NodeSevCertChain = "cert-chain" // NodeSevCbitpos as defined in libvirt/libvirt-host.h:465 NodeSevCbitpos = "cbitpos" // NodeSevReducedPhysBits as defined in libvirt/libvirt-host.h:473 NodeSevReducedPhysBits = "reduced-phys-bits" // NodeSevMaxGuests as defined in libvirt/libvirt-host.h:481 NodeSevMaxGuests = "max-guests" // NodeSevMaxEsGuests as defined in libvirt/libvirt-host.h:489 NodeSevMaxEsGuests = "max-es-guests" // UUIDBuflen as defined in libvirt/libvirt-host.h:574 UUIDBuflen = (16) // UUIDStringBuflen as defined in libvirt/libvirt-host.h:583 UUIDStringBuflen = (36 + 1) // ConnectIdentityUserName as defined in libvirt/libvirt-host.h:608 ConnectIdentityUserName = "user-name" // ConnectIdentityUnixUserID as defined in libvirt/libvirt-host.h:615 ConnectIdentityUnixUserID = "unix-user-id" // ConnectIdentityGroupName as defined in libvirt/libvirt-host.h:622 ConnectIdentityGroupName = "group-name" // ConnectIdentityUnixGroupID as defined in libvirt/libvirt-host.h:629 ConnectIdentityUnixGroupID = "unix-group-id" // ConnectIdentityProcessID as defined in libvirt/libvirt-host.h:636 ConnectIdentityProcessID = "process-id" // ConnectIdentityProcessTime as defined in libvirt/libvirt-host.h:647 ConnectIdentityProcessTime = "process-time" // ConnectIdentitySaslUserName as defined in libvirt/libvirt-host.h:654 ConnectIdentitySaslUserName = "sasl-user-name" // ConnectIdentityX509DistinguishedName as defined in libvirt/libvirt-host.h:661 ConnectIdentityX509DistinguishedName = "x509-distinguished-name" // ConnectIdentitySelinuxContext as defined in libvirt/libvirt-host.h:668 ConnectIdentitySelinuxContext = "selinux-context" // NetworkPortBandwidthInAverage as defined in libvirt/libvirt-network.h:406 NetworkPortBandwidthInAverage = "inbound.average" // NetworkPortBandwidthInPeak as defined in libvirt/libvirt-network.h:413 NetworkPortBandwidthInPeak = "inbound.peak" // NetworkPortBandwidthInBurst as defined in libvirt/libvirt-network.h:420 NetworkPortBandwidthInBurst = "inbound.burst" // NetworkPortBandwidthInFloor as defined in libvirt/libvirt-network.h:427 NetworkPortBandwidthInFloor = "inbound.floor" // NetworkPortBandwidthOutAverage as defined in libvirt/libvirt-network.h:434 NetworkPortBandwidthOutAverage = "outbound.average" // NetworkPortBandwidthOutPeak as defined in libvirt/libvirt-network.h:441 NetworkPortBandwidthOutPeak = "outbound.peak" // NetworkPortBandwidthOutBurst as defined in libvirt/libvirt-network.h:448 NetworkPortBandwidthOutBurst = "outbound.burst" ) // ConnectCloseReason as declared in libvirt/libvirt-common.h:119 type ConnectCloseReason int32 // ConnectCloseReason enumeration from libvirt/libvirt-common.h:119 const ( ConnectCloseReasonError ConnectCloseReason = iota ConnectCloseReasonEOF ConnectCloseReason = 1 ConnectCloseReasonKeepalive ConnectCloseReason = 2 ConnectCloseReasonClient ConnectCloseReason = 3 ) // TypedParameterType as declared in libvirt/libvirt-common.h:138 type TypedParameterType int32 // TypedParameterType enumeration from libvirt/libvirt-common.h:138 const ( TypedParamInt TypedParameterType = 1 TypedParamUint TypedParameterType = 2 TypedParamLlong TypedParameterType = 3 TypedParamUllong TypedParameterType = 4 TypedParamDouble TypedParameterType = 5 TypedParamBoolean TypedParameterType = 6 TypedParamString TypedParameterType = 7 ) // TypedParameterFlags as declared in libvirt/libvirt-common.h:163 type TypedParameterFlags int32 // TypedParameterFlags enumeration from libvirt/libvirt-common.h:163 const ( TypedParamStringOkay TypedParameterFlags = 4 ) // DomainCheckpointCreateFlags as declared in libvirt/libvirt-domain-checkpoint.h:62 type DomainCheckpointCreateFlags int32 // DomainCheckpointCreateFlags enumeration from libvirt/libvirt-domain-checkpoint.h:62 const ( DomainCheckpointCreateRedefine DomainCheckpointCreateFlags = 1 DomainCheckpointCreateQuiesce DomainCheckpointCreateFlags = 2 DomainCheckpointCreateRedefineValidate DomainCheckpointCreateFlags = 4 ) // DomainCheckpointXMLFlags as declared in libvirt/libvirt-domain-checkpoint.h:75 type DomainCheckpointXMLFlags int32 // DomainCheckpointXMLFlags enumeration from libvirt/libvirt-domain-checkpoint.h:75 const ( DomainCheckpointXMLSecure DomainCheckpointXMLFlags = 1 DomainCheckpointXMLNoDomain DomainCheckpointXMLFlags = 2 DomainCheckpointXMLSize DomainCheckpointXMLFlags = 4 ) // DomainCheckpointListFlags as declared in libvirt/libvirt-domain-checkpoint.h:105 type DomainCheckpointListFlags int32 // DomainCheckpointListFlags enumeration from libvirt/libvirt-domain-checkpoint.h:105 const ( DomainCheckpointListRoots DomainCheckpointListFlags = 1 DomainCheckpointListDescendants DomainCheckpointListFlags = 1 DomainCheckpointListTopological DomainCheckpointListFlags = 2 DomainCheckpointListLeaves DomainCheckpointListFlags = 4 DomainCheckpointListNoLeaves DomainCheckpointListFlags = 8 ) // DomainCheckpointDeleteFlags as declared in libvirt/libvirt-domain-checkpoint.h:131 type DomainCheckpointDeleteFlags int32 // DomainCheckpointDeleteFlags enumeration from libvirt/libvirt-domain-checkpoint.h:131 const ( DomainCheckpointDeleteChildren DomainCheckpointDeleteFlags = 1 DomainCheckpointDeleteMetadataOnly DomainCheckpointDeleteFlags = 2 DomainCheckpointDeleteChildrenOnly DomainCheckpointDeleteFlags = 4 ) // DomainSnapshotCreateFlags as declared in libvirt/libvirt-domain-snapshot.h:76 type DomainSnapshotCreateFlags int32 // DomainSnapshotCreateFlags enumeration from libvirt/libvirt-domain-snapshot.h:76 const ( DomainSnapshotCreateRedefine DomainSnapshotCreateFlags = 1 DomainSnapshotCreateCurrent DomainSnapshotCreateFlags = 2 DomainSnapshotCreateNoMetadata DomainSnapshotCreateFlags = 4 DomainSnapshotCreateHalt DomainSnapshotCreateFlags = 8 DomainSnapshotCreateDiskOnly DomainSnapshotCreateFlags = 16 DomainSnapshotCreateReuseExt DomainSnapshotCreateFlags = 32 DomainSnapshotCreateQuiesce DomainSnapshotCreateFlags = 64 DomainSnapshotCreateAtomic DomainSnapshotCreateFlags = 128 DomainSnapshotCreateLive DomainSnapshotCreateFlags = 256 DomainSnapshotCreateValidate DomainSnapshotCreateFlags = 512 ) // DomainSnapshotXMLFlags as declared in libvirt/libvirt-domain-snapshot.h:85 type DomainSnapshotXMLFlags int32 // DomainSnapshotXMLFlags enumeration from libvirt/libvirt-domain-snapshot.h:85 const ( DomainSnapshotXMLSecure DomainSnapshotXMLFlags = 1 ) // DomainSnapshotListFlags as declared in libvirt/libvirt-domain-snapshot.h:144 type DomainSnapshotListFlags int32 // DomainSnapshotListFlags enumeration from libvirt/libvirt-domain-snapshot.h:144 const ( DomainSnapshotListRoots DomainSnapshotListFlags = 1 DomainSnapshotListDescendants DomainSnapshotListFlags = 1 DomainSnapshotListLeaves DomainSnapshotListFlags = 4 DomainSnapshotListNoLeaves DomainSnapshotListFlags = 8 DomainSnapshotListMetadata DomainSnapshotListFlags = 2 DomainSnapshotListNoMetadata DomainSnapshotListFlags = 16 DomainSnapshotListInactive DomainSnapshotListFlags = 32 DomainSnapshotListActive DomainSnapshotListFlags = 64 DomainSnapshotListDiskOnly DomainSnapshotListFlags = 128 DomainSnapshotListInternal DomainSnapshotListFlags = 256 DomainSnapshotListExternal DomainSnapshotListFlags = 512 DomainSnapshotListTopological DomainSnapshotListFlags = 1024 ) // DomainSnapshotRevertFlags as declared in libvirt/libvirt-domain-snapshot.h:201 type DomainSnapshotRevertFlags int32 // DomainSnapshotRevertFlags enumeration from libvirt/libvirt-domain-snapshot.h:201 const ( DomainSnapshotRevertRunning DomainSnapshotRevertFlags = 1 DomainSnapshotRevertPaused DomainSnapshotRevertFlags = 2 DomainSnapshotRevertForce DomainSnapshotRevertFlags = 4 ) // DomainSnapshotDeleteFlags as declared in libvirt/libvirt-domain-snapshot.h:215 type DomainSnapshotDeleteFlags int32 // DomainSnapshotDeleteFlags enumeration from libvirt/libvirt-domain-snapshot.h:215 const ( DomainSnapshotDeleteChildren DomainSnapshotDeleteFlags = 1 DomainSnapshotDeleteMetadataOnly DomainSnapshotDeleteFlags = 2 DomainSnapshotDeleteChildrenOnly DomainSnapshotDeleteFlags = 4 ) // DomainState as declared in libvirt/libvirt-domain.h:70 type DomainState int32 // DomainState enumeration from libvirt/libvirt-domain.h:70 const ( DomainNostate DomainState = iota DomainRunning DomainState = 1 DomainBlocked DomainState = 2 DomainPaused DomainState = 3 DomainShutdown DomainState = 4 DomainShutoff DomainState = 5 DomainCrashed DomainState = 6 DomainPmsuspended DomainState = 7 ) // DomainNostateReason as declared in libvirt/libvirt-domain.h:78 type DomainNostateReason int32 // DomainNostateReason enumeration from libvirt/libvirt-domain.h:78 const ( DomainNostateUnknown DomainNostateReason = iota ) // DomainRunningReason as declared in libvirt/libvirt-domain.h:97 type DomainRunningReason int32 // DomainRunningReason enumeration from libvirt/libvirt-domain.h:97 const ( DomainRunningUnknown DomainRunningReason = iota DomainRunningBooted DomainRunningReason = 1 DomainRunningMigrated DomainRunningReason = 2 DomainRunningRestored DomainRunningReason = 3 DomainRunningFromSnapshot DomainRunningReason = 4 DomainRunningUnpaused DomainRunningReason = 5 DomainRunningMigrationCanceled DomainRunningReason = 6 DomainRunningSaveCanceled DomainRunningReason = 7 DomainRunningWakeup DomainRunningReason = 8 DomainRunningCrashed DomainRunningReason = 9 DomainRunningPostcopy DomainRunningReason = 10 ) // DomainBlockedReason as declared in libvirt/libvirt-domain.h:105 type DomainBlockedReason int32 // DomainBlockedReason enumeration from libvirt/libvirt-domain.h:105 const ( DomainBlockedUnknown DomainBlockedReason = iota ) // DomainPausedReason as declared in libvirt/libvirt-domain.h:126 type DomainPausedReason int32 // DomainPausedReason enumeration from libvirt/libvirt-domain.h:126 const ( DomainPausedUnknown DomainPausedReason = iota DomainPausedUser DomainPausedReason = 1 DomainPausedMigration DomainPausedReason = 2 DomainPausedSave DomainPausedReason = 3 DomainPausedDump DomainPausedReason = 4 DomainPausedIoerror DomainPausedReason = 5 DomainPausedWatchdog DomainPausedReason = 6 DomainPausedFromSnapshot DomainPausedReason = 7 DomainPausedShuttingDown DomainPausedReason = 8 DomainPausedSnapshot DomainPausedReason = 9 DomainPausedCrashed DomainPausedReason = 10 DomainPausedStartingUp DomainPausedReason = 11 DomainPausedPostcopy DomainPausedReason = 12 DomainPausedPostcopyFailed DomainPausedReason = 13 ) // DomainShutdownReason as declared in libvirt/libvirt-domain.h:135 type DomainShutdownReason int32 // DomainShutdownReason enumeration from libvirt/libvirt-domain.h:135 const ( DomainShutdownUnknown DomainShutdownReason = iota DomainShutdownUser DomainShutdownReason = 1 ) // DomainShutoffReason as declared in libvirt/libvirt-domain.h:152 type DomainShutoffReason int32 // DomainShutoffReason enumeration from libvirt/libvirt-domain.h:152 const ( DomainShutoffUnknown DomainShutoffReason = iota DomainShutoffShutdown DomainShutoffReason = 1 DomainShutoffDestroyed DomainShutoffReason = 2 DomainShutoffCrashed DomainShutoffReason = 3 DomainShutoffMigrated DomainShutoffReason = 4 DomainShutoffSaved DomainShutoffReason = 5 DomainShutoffFailed DomainShutoffReason = 6 DomainShutoffFromSnapshot DomainShutoffReason = 7 DomainShutoffDaemon DomainShutoffReason = 8 ) // DomainCrashedReason as declared in libvirt/libvirt-domain.h:161 type DomainCrashedReason int32 // DomainCrashedReason enumeration from libvirt/libvirt-domain.h:161 const ( DomainCrashedUnknown DomainCrashedReason = iota DomainCrashedPanicked DomainCrashedReason = 1 ) // DomainPMSuspendedReason as declared in libvirt/libvirt-domain.h:169 type DomainPMSuspendedReason int32 // DomainPMSuspendedReason enumeration from libvirt/libvirt-domain.h:169 const ( DomainPmsuspendedUnknown DomainPMSuspendedReason = iota ) // DomainPMSuspendedDiskReason as declared in libvirt/libvirt-domain.h:177 type DomainPMSuspendedDiskReason int32 // DomainPMSuspendedDiskReason enumeration from libvirt/libvirt-domain.h:177 const ( DomainPmsuspendedDiskUnknown DomainPMSuspendedDiskReason = iota ) // DomainControlState as declared in libvirt/libvirt-domain.h:197 type DomainControlState int32 // DomainControlState enumeration from libvirt/libvirt-domain.h:197 const ( DomainControlOk DomainControlState = iota DomainControlJob DomainControlState = 1 DomainControlOccupied DomainControlState = 2 DomainControlError DomainControlState = 3 ) // DomainControlErrorReason as declared in libvirt/libvirt-domain.h:217 type DomainControlErrorReason int32 // DomainControlErrorReason enumeration from libvirt/libvirt-domain.h:217 const ( DomainControlErrorReasonNone DomainControlErrorReason = iota DomainControlErrorReasonUnknown DomainControlErrorReason = 1 DomainControlErrorReasonMonitor DomainControlErrorReason = 2 DomainControlErrorReasonInternal DomainControlErrorReason = 3 ) // DomainModificationImpact as declared in libvirt/libvirt-domain.h:265 type DomainModificationImpact int32 // DomainModificationImpact enumeration from libvirt/libvirt-domain.h:265 const ( DomainAffectCurrent DomainModificationImpact = iota DomainAffectLive DomainModificationImpact = 1 DomainAffectConfig DomainModificationImpact = 2 ) // DomainCreateFlags as declared in libvirt/libvirt-domain.h:305 type DomainCreateFlags int32 // DomainCreateFlags enumeration from libvirt/libvirt-domain.h:305 const ( DomainNone DomainCreateFlags = iota DomainStartPaused DomainCreateFlags = 1 DomainStartAutodestroy DomainCreateFlags = 2 DomainStartBypassCache DomainCreateFlags = 4 DomainStartForceBoot DomainCreateFlags = 8 DomainStartValidate DomainCreateFlags = 16 ) // DomainMemoryStatTags as declared in libvirt/libvirt-domain.h:660 type DomainMemoryStatTags int32 // DomainMemoryStatTags enumeration from libvirt/libvirt-domain.h:660 const ( DomainMemoryStatSwapIn DomainMemoryStatTags = iota DomainMemoryStatSwapOut DomainMemoryStatTags = 1 DomainMemoryStatMajorFault DomainMemoryStatTags = 2 DomainMemoryStatMinorFault DomainMemoryStatTags = 3 DomainMemoryStatUnused DomainMemoryStatTags = 4 DomainMemoryStatAvailable DomainMemoryStatTags = 5 DomainMemoryStatActualBalloon DomainMemoryStatTags = 6 DomainMemoryStatRss DomainMemoryStatTags = 7 DomainMemoryStatUsable DomainMemoryStatTags = 8 DomainMemoryStatLastUpdate DomainMemoryStatTags = 9 DomainMemoryStatDiskCaches DomainMemoryStatTags = 10 DomainMemoryStatHugetlbPgalloc DomainMemoryStatTags = 11 DomainMemoryStatHugetlbPgfail DomainMemoryStatTags = 12 DomainMemoryStatNr DomainMemoryStatTags = 13 ) // DomainCoreDumpFlags as declared in libvirt/libvirt-domain.h:679 type DomainCoreDumpFlags int32 // DomainCoreDumpFlags enumeration from libvirt/libvirt-domain.h:679 const ( DumpCrash DomainCoreDumpFlags = 1 DumpLive DomainCoreDumpFlags = 2 DumpBypassCache DomainCoreDumpFlags = 4 DumpReset DomainCoreDumpFlags = 8 DumpMemoryOnly DomainCoreDumpFlags = 16 ) // DomainCoreDumpFormat as declared in libvirt/libvirt-domain.h:703 type DomainCoreDumpFormat int32 // DomainCoreDumpFormat enumeration from libvirt/libvirt-domain.h:703 const ( DomainCoreDumpFormatRaw DomainCoreDumpFormat = iota DomainCoreDumpFormatKdumpZlib DomainCoreDumpFormat = 1 DomainCoreDumpFormatKdumpLzo DomainCoreDumpFormat = 2 DomainCoreDumpFormatKdumpSnappy DomainCoreDumpFormat = 3 DomainCoreDumpFormatWinDmp DomainCoreDumpFormat = 4 ) // DomainMigrateFlags as declared in libvirt/libvirt-domain.h:863 type DomainMigrateFlags int32 // DomainMigrateFlags enumeration from libvirt/libvirt-domain.h:863 const ( MigrateLive DomainMigrateFlags = 1 MigratePeer2peer DomainMigrateFlags = 2 MigrateTunnelled DomainMigrateFlags = 4 MigratePersistDest DomainMigrateFlags = 8 MigrateUndefineSource DomainMigrateFlags = 16 MigratePaused DomainMigrateFlags = 32 MigrateNonSharedDisk DomainMigrateFlags = 64 MigrateNonSharedInc DomainMigrateFlags = 128 MigrateChangeProtection DomainMigrateFlags = 256 MigrateUnsafe DomainMigrateFlags = 512 MigrateOffline DomainMigrateFlags = 1024 MigrateCompressed DomainMigrateFlags = 2048 MigrateAbortOnError DomainMigrateFlags = 4096 MigrateAutoConverge DomainMigrateFlags = 8192 MigrateRdmaPinAll DomainMigrateFlags = 16384 MigratePostcopy DomainMigrateFlags = 32768 MigrateTLS DomainMigrateFlags = 65536 MigrateParallel DomainMigrateFlags = 131072 MigrateNonSharedSynchronousWrites DomainMigrateFlags = 262144 ) // DomainMigrateMaxSpeedFlags as declared in libvirt/libvirt-domain.h:1142 type DomainMigrateMaxSpeedFlags int32 // DomainMigrateMaxSpeedFlags enumeration from libvirt/libvirt-domain.h:1142 const ( DomainMigrateMaxSpeedPostcopy DomainMigrateMaxSpeedFlags = 1 ) // DomainShutdownFlagValues as declared in libvirt/libvirt-domain.h:1208 type DomainShutdownFlagValues int32 // DomainShutdownFlagValues enumeration from libvirt/libvirt-domain.h:1208 const ( DomainShutdownDefault DomainShutdownFlagValues = iota DomainShutdownAcpiPowerBtn DomainShutdownFlagValues = 1 DomainShutdownGuestAgent DomainShutdownFlagValues = 2 DomainShutdownInitctl DomainShutdownFlagValues = 4 DomainShutdownSignal DomainShutdownFlagValues = 8 DomainShutdownParavirt DomainShutdownFlagValues = 16 ) // DomainRebootFlagValues as declared in libvirt/libvirt-domain.h:1221 type DomainRebootFlagValues int32 // DomainRebootFlagValues enumeration from libvirt/libvirt-domain.h:1221 const ( DomainRebootDefault DomainRebootFlagValues = iota DomainRebootAcpiPowerBtn DomainRebootFlagValues = 1 DomainRebootGuestAgent DomainRebootFlagValues = 2 DomainRebootInitctl DomainRebootFlagValues = 4 DomainRebootSignal DomainRebootFlagValues = 8 DomainRebootParavirt DomainRebootFlagValues = 16 ) // DomainDestroyFlagsValues as declared in libvirt/libvirt-domain.h:1239 type DomainDestroyFlagsValues int32 // DomainDestroyFlagsValues enumeration from libvirt/libvirt-domain.h:1239 const ( DomainDestroyDefault DomainDestroyFlagsValues = iota DomainDestroyGraceful DomainDestroyFlagsValues = 1 ) // DomainSaveRestoreFlags as declared in libvirt/libvirt-domain.h:1271 type DomainSaveRestoreFlags int32 // DomainSaveRestoreFlags enumeration from libvirt/libvirt-domain.h:1271 const ( DomainSaveBypassCache DomainSaveRestoreFlags = 1 DomainSaveRunning DomainSaveRestoreFlags = 2 DomainSavePaused DomainSaveRestoreFlags = 4 ) // DomainMemoryModFlags as declared in libvirt/libvirt-domain.h:1527 type DomainMemoryModFlags int32 // DomainMemoryModFlags enumeration from libvirt/libvirt-domain.h:1527 const ( DomainMemCurrent DomainMemoryModFlags = iota DomainMemLive DomainMemoryModFlags = 1 DomainMemConfig DomainMemoryModFlags = 2 DomainMemMaximum DomainMemoryModFlags = 4 ) // DomainNumatuneMemMode as declared in libvirt/libvirt-domain.h:1546 type DomainNumatuneMemMode int32 // DomainNumatuneMemMode enumeration from libvirt/libvirt-domain.h:1546 const ( DomainNumatuneMemStrict DomainNumatuneMemMode = iota DomainNumatuneMemPreferred DomainNumatuneMemMode = 1 DomainNumatuneMemInterleave DomainNumatuneMemMode = 2 DomainNumatuneMemRestrictive DomainNumatuneMemMode = 3 ) // DomainGetHostnameFlags as declared in libvirt/libvirt-domain.h:1599 type DomainGetHostnameFlags int32 // DomainGetHostnameFlags enumeration from libvirt/libvirt-domain.h:1599 const ( DomainGetHostnameLease DomainGetHostnameFlags = 1 DomainGetHostnameAgent DomainGetHostnameFlags = 2 ) // DomainMetadataType as declared in libvirt/libvirt-domain.h:1614 type DomainMetadataType int32 // DomainMetadataType enumeration from libvirt/libvirt-domain.h:1614 const ( DomainMetadataDescription DomainMetadataType = iota DomainMetadataTitle DomainMetadataType = 1 DomainMetadataElement DomainMetadataType = 2 ) // DomainXMLFlags as declared in libvirt/libvirt-domain.h:1644 type DomainXMLFlags int32 // DomainXMLFlags enumeration from libvirt/libvirt-domain.h:1644 const ( DomainXMLSecure DomainXMLFlags = 1 DomainXMLInactive DomainXMLFlags = 2 DomainXMLUpdateCPU DomainXMLFlags = 4 DomainXMLMigratable DomainXMLFlags = 8 ) // DomainSaveImageXMLFlags as declared in libvirt/libvirt-domain.h:1648 type DomainSaveImageXMLFlags int32 // DomainSaveImageXMLFlags enumeration from libvirt/libvirt-domain.h:1648 const ( DomainSaveImageXMLSecure DomainSaveImageXMLFlags = 1 ) // DomainBlockResizeFlags as declared in libvirt/libvirt-domain.h:1753 type DomainBlockResizeFlags int32 // DomainBlockResizeFlags enumeration from libvirt/libvirt-domain.h:1753 const ( DomainBlockResizeBytes DomainBlockResizeFlags = 1 ) // DomainMemoryFlags as declared in libvirt/libvirt-domain.h:1816 type DomainMemoryFlags int32 // DomainMemoryFlags enumeration from libvirt/libvirt-domain.h:1816 const ( MemoryVirtual DomainMemoryFlags = 1 MemoryPhysical DomainMemoryFlags = 2 ) // DomainDefineFlags as declared in libvirt/libvirt-domain.h:1826 type DomainDefineFlags int32 // DomainDefineFlags enumeration from libvirt/libvirt-domain.h:1826 const ( DomainDefineValidate DomainDefineFlags = 1 ) // DomainUndefineFlagsValues as declared in libvirt/libvirt-domain.h:1853 type DomainUndefineFlagsValues int32 // DomainUndefineFlagsValues enumeration from libvirt/libvirt-domain.h:1853 const ( DomainUndefineManagedSave DomainUndefineFlagsValues = 1 DomainUndefineSnapshotsMetadata DomainUndefineFlagsValues = 2 DomainUndefineNvram DomainUndefineFlagsValues = 4 DomainUndefineKeepNvram DomainUndefineFlagsValues = 8 DomainUndefineCheckpointsMetadata DomainUndefineFlagsValues = 16 ) // ConnectListAllDomainsFlags as declared in libvirt/libvirt-domain.h:1892 type ConnectListAllDomainsFlags int32 // ConnectListAllDomainsFlags enumeration from libvirt/libvirt-domain.h:1892 const ( ConnectListDomainsActive ConnectListAllDomainsFlags = 1 ConnectListDomainsInactive ConnectListAllDomainsFlags = 2 ConnectListDomainsPersistent ConnectListAllDomainsFlags = 4 ConnectListDomainsTransient ConnectListAllDomainsFlags = 8 ConnectListDomainsRunning ConnectListAllDomainsFlags = 16 ConnectListDomainsPaused ConnectListAllDomainsFlags = 32 ConnectListDomainsShutoff ConnectListAllDomainsFlags = 64 ConnectListDomainsOther ConnectListAllDomainsFlags = 128 ConnectListDomainsManagedsave ConnectListAllDomainsFlags = 256 ConnectListDomainsNoManagedsave ConnectListAllDomainsFlags = 512 ConnectListDomainsAutostart ConnectListAllDomainsFlags = 1024 ConnectListDomainsNoAutostart ConnectListAllDomainsFlags = 2048 ConnectListDomainsHasSnapshot ConnectListAllDomainsFlags = 4096 ConnectListDomainsNoSnapshot ConnectListAllDomainsFlags = 8192 ConnectListDomainsHasCheckpoint ConnectListAllDomainsFlags = 16384 ConnectListDomainsNoCheckpoint ConnectListAllDomainsFlags = 32768 ) // VCPUState as declared in libvirt/libvirt-domain.h:1923 type VCPUState int32 // VCPUState enumeration from libvirt/libvirt-domain.h:1923 const ( VCPUOffline VCPUState = iota VCPURunning VCPUState = 1 VCPUBlocked VCPUState = 2 ) // VCPUHostCPUState as declared in libvirt/libvirt-domain.h:1928 type VCPUHostCPUState int32 // VCPUHostCPUState enumeration from libvirt/libvirt-domain.h:1928 const ( VCPUInfoCPUOffline VCPUHostCPUState = -1 VCPUInfoCPUUnavailable VCPUHostCPUState = -2 ) // DomainVCPUFlags as declared in libvirt/libvirt-domain.h:1950 type DomainVCPUFlags int32 // DomainVCPUFlags enumeration from libvirt/libvirt-domain.h:1950 const ( DomainVCPUCurrent DomainVCPUFlags = iota DomainVCPULive DomainVCPUFlags = 1 DomainVCPUConfig DomainVCPUFlags = 2 DomainVCPUMaximum DomainVCPUFlags = 4 DomainVCPUGuest DomainVCPUFlags = 8 DomainVCPUHotpluggable DomainVCPUFlags = 16 ) // DomainDeviceModifyFlags as declared in libvirt/libvirt-domain.h:2167 type DomainDeviceModifyFlags int32 // DomainDeviceModifyFlags enumeration from libvirt/libvirt-domain.h:2167 const ( DomainDeviceModifyCurrent DomainDeviceModifyFlags = iota DomainDeviceModifyLive DomainDeviceModifyFlags = 1 DomainDeviceModifyConfig DomainDeviceModifyFlags = 2 DomainDeviceModifyForce DomainDeviceModifyFlags = 4 ) // DomainStatsTypes as declared in libvirt/libvirt-domain.h:2201 type DomainStatsTypes int32 // DomainStatsTypes enumeration from libvirt/libvirt-domain.h:2201 const ( DomainStatsState DomainStatsTypes = 1 DomainStatsCPUTotal DomainStatsTypes = 2 DomainStatsBalloon DomainStatsTypes = 4 DomainStatsVCPU DomainStatsTypes = 8 DomainStatsInterface DomainStatsTypes = 16 DomainStatsBlock DomainStatsTypes = 32 DomainStatsPerf DomainStatsTypes = 64 DomainStatsIothread DomainStatsTypes = 128 DomainStatsMemory DomainStatsTypes = 256 DomainStatsDirtyrate DomainStatsTypes = 512 ) // ConnectGetAllDomainStatsFlags as declared in libvirt/libvirt-domain.h:2219 type ConnectGetAllDomainStatsFlags uint32 // ConnectGetAllDomainStatsFlags enumeration from libvirt/libvirt-domain.h:2219 const ( ConnectGetAllDomainsStatsActive ConnectGetAllDomainStatsFlags = 1 ConnectGetAllDomainsStatsInactive ConnectGetAllDomainStatsFlags = 2 ConnectGetAllDomainsStatsPersistent ConnectGetAllDomainStatsFlags = 4 ConnectGetAllDomainsStatsTransient ConnectGetAllDomainStatsFlags = 8 ConnectGetAllDomainsStatsRunning ConnectGetAllDomainStatsFlags = 16 ConnectGetAllDomainsStatsPaused ConnectGetAllDomainStatsFlags = 32 ConnectGetAllDomainsStatsShutoff ConnectGetAllDomainStatsFlags = 64 ConnectGetAllDomainsStatsOther ConnectGetAllDomainStatsFlags = 128 ConnectGetAllDomainsStatsNowait ConnectGetAllDomainStatsFlags = 536870912 ConnectGetAllDomainsStatsBacking ConnectGetAllDomainStatsFlags = 1073741824 ConnectGetAllDomainsStatsEnforceStats ConnectGetAllDomainStatsFlags = 2147483648 ) // DomainBlockJobType as declared in libvirt/libvirt-domain.h:2507 type DomainBlockJobType int32 // DomainBlockJobType enumeration from libvirt/libvirt-domain.h:2507 const ( DomainBlockJobTypeUnknown DomainBlockJobType = iota DomainBlockJobTypePull DomainBlockJobType = 1 DomainBlockJobTypeCopy DomainBlockJobType = 2 DomainBlockJobTypeCommit DomainBlockJobType = 3 DomainBlockJobTypeActiveCommit DomainBlockJobType = 4 DomainBlockJobTypeBackup DomainBlockJobType = 5 ) // DomainBlockJobAbortFlags as declared in libvirt/libvirt-domain.h:2519 type DomainBlockJobAbortFlags int32 // DomainBlockJobAbortFlags enumeration from libvirt/libvirt-domain.h:2519 const ( DomainBlockJobAbortAsync DomainBlockJobAbortFlags = 1 DomainBlockJobAbortPivot DomainBlockJobAbortFlags = 2 ) // DomainBlockJobInfoFlags as declared in libvirt/libvirt-domain.h:2528 type DomainBlockJobInfoFlags int32 // DomainBlockJobInfoFlags enumeration from libvirt/libvirt-domain.h:2528 const ( DomainBlockJobInfoBandwidthBytes DomainBlockJobInfoFlags = 1 ) // DomainBlockJobSetSpeedFlags as declared in libvirt/libvirt-domain.h:2557 type DomainBlockJobSetSpeedFlags int32 // DomainBlockJobSetSpeedFlags enumeration from libvirt/libvirt-domain.h:2557 const ( DomainBlockJobSpeedBandwidthBytes DomainBlockJobSetSpeedFlags = 1 ) // DomainBlockPullFlags as declared in libvirt/libvirt-domain.h:2567 type DomainBlockPullFlags int32 // DomainBlockPullFlags enumeration from libvirt/libvirt-domain.h:2567 const ( DomainBlockPullBandwidthBytes DomainBlockPullFlags = 64 ) // DomainBlockRebaseFlags as declared in libvirt/libvirt-domain.h:2591 type DomainBlockRebaseFlags int32 // DomainBlockRebaseFlags enumeration from libvirt/libvirt-domain.h:2591 const ( DomainBlockRebaseShallow DomainBlockRebaseFlags = 1 DomainBlockRebaseReuseExt DomainBlockRebaseFlags = 2 DomainBlockRebaseCopyRaw DomainBlockRebaseFlags = 4 DomainBlockRebaseCopy DomainBlockRebaseFlags = 8 DomainBlockRebaseRelative DomainBlockRebaseFlags = 16 DomainBlockRebaseCopyDev DomainBlockRebaseFlags = 32 DomainBlockRebaseBandwidthBytes DomainBlockRebaseFlags = 64 ) // DomainBlockCopyFlags as declared in libvirt/libvirt-domain.h:2615 type DomainBlockCopyFlags int32 // DomainBlockCopyFlags enumeration from libvirt/libvirt-domain.h:2615 const ( DomainBlockCopyShallow DomainBlockCopyFlags = 1 DomainBlockCopyReuseExt DomainBlockCopyFlags = 2 DomainBlockCopyTransientJob DomainBlockCopyFlags = 4 DomainBlockCopySynchronousWrites DomainBlockCopyFlags = 8 ) // DomainBlockCommitFlags as declared in libvirt/libvirt-domain.h:2680 type DomainBlockCommitFlags int32 // DomainBlockCommitFlags enumeration from libvirt/libvirt-domain.h:2680 const ( DomainBlockCommitShallow DomainBlockCommitFlags = 1 DomainBlockCommitDelete DomainBlockCommitFlags = 2 DomainBlockCommitActive DomainBlockCommitFlags = 4 DomainBlockCommitRelative DomainBlockCommitFlags = 8 DomainBlockCommitBandwidthBytes DomainBlockCommitFlags = 16 ) // DomainDiskErrorCode as declared in libvirt/libvirt-domain.h:2871 type DomainDiskErrorCode int32 // DomainDiskErrorCode enumeration from libvirt/libvirt-domain.h:2871 const ( DomainDiskErrorNone DomainDiskErrorCode = iota DomainDiskErrorUnspec DomainDiskErrorCode = 1 DomainDiskErrorNoSpace DomainDiskErrorCode = 2 ) // KeycodeSet as declared in libvirt/libvirt-domain.h:2917 type KeycodeSet int32 // KeycodeSet enumeration from libvirt/libvirt-domain.h:2917 const ( KeycodeSetLinux KeycodeSet = iota KeycodeSetXt KeycodeSet = 1 KeycodeSetAtset1 KeycodeSet = 2 KeycodeSetAtset2 KeycodeSet = 3 KeycodeSetAtset3 KeycodeSet = 4 KeycodeSetOsx KeycodeSet = 5 KeycodeSetXtKbd KeycodeSet = 6 KeycodeSetUsb KeycodeSet = 7 KeycodeSetWin32 KeycodeSet = 8 KeycodeSetQnum KeycodeSet = 9 ) // DomainProcessSignal as declared in libvirt/libvirt-domain.h:3026 type DomainProcessSignal int32 // DomainProcessSignal enumeration from libvirt/libvirt-domain.h:3026 const ( DomainProcessSignalNop DomainProcessSignal = iota DomainProcessSignalHup DomainProcessSignal = 1 DomainProcessSignalInt DomainProcessSignal = 2 DomainProcessSignalQuit DomainProcessSignal = 3 DomainProcessSignalIll DomainProcessSignal = 4 DomainProcessSignalTrap DomainProcessSignal = 5 DomainProcessSignalAbrt DomainProcessSignal = 6 DomainProcessSignalBus DomainProcessSignal = 7 DomainProcessSignalFpe DomainProcessSignal = 8 DomainProcessSignalKill DomainProcessSignal = 9 DomainProcessSignalUsr1 DomainProcessSignal = 10 DomainProcessSignalSegv DomainProcessSignal = 11 DomainProcessSignalUsr2 DomainProcessSignal = 12 DomainProcessSignalPipe DomainProcessSignal = 13 DomainProcessSignalAlrm DomainProcessSignal = 14 DomainProcessSignalTerm DomainProcessSignal = 15 DomainProcessSignalStkflt DomainProcessSignal = 16 DomainProcessSignalChld DomainProcessSignal = 17 DomainProcessSignalCont DomainProcessSignal = 18 DomainProcessSignalStop DomainProcessSignal = 19 DomainProcessSignalTstp DomainProcessSignal = 20 DomainProcessSignalTtin DomainProcessSignal = 21 DomainProcessSignalTtou DomainProcessSignal = 22 DomainProcessSignalUrg DomainProcessSignal = 23 DomainProcessSignalXcpu DomainProcessSignal = 24 DomainProcessSignalXfsz DomainProcessSignal = 25 DomainProcessSignalVtalrm DomainProcessSignal = 26 DomainProcessSignalProf DomainProcessSignal = 27 DomainProcessSignalWinch DomainProcessSignal = 28 DomainProcessSignalPoll DomainProcessSignal = 29 DomainProcessSignalPwr DomainProcessSignal = 30 DomainProcessSignalSys DomainProcessSignal = 31 DomainProcessSignalRt0 DomainProcessSignal = 32 DomainProcessSignalRt1 DomainProcessSignal = 33 DomainProcessSignalRt2 DomainProcessSignal = 34 DomainProcessSignalRt3 DomainProcessSignal = 35 DomainProcessSignalRt4 DomainProcessSignal = 36 DomainProcessSignalRt5 DomainProcessSignal = 37 DomainProcessSignalRt6 DomainProcessSignal = 38 DomainProcessSignalRt7 DomainProcessSignal = 39 DomainProcessSignalRt8 DomainProcessSignal = 40 DomainProcessSignalRt9 DomainProcessSignal = 41 DomainProcessSignalRt10 DomainProcessSignal = 42 DomainProcessSignalRt11 DomainProcessSignal = 43 DomainProcessSignalRt12 DomainProcessSignal = 44 DomainProcessSignalRt13 DomainProcessSignal = 45 DomainProcessSignalRt14 DomainProcessSignal = 46 DomainProcessSignalRt15 DomainProcessSignal = 47 DomainProcessSignalRt16 DomainProcessSignal = 48 DomainProcessSignalRt17 DomainProcessSignal = 49 DomainProcessSignalRt18 DomainProcessSignal = 50 DomainProcessSignalRt19 DomainProcessSignal = 51 DomainProcessSignalRt20 DomainProcessSignal = 52 DomainProcessSignalRt21 DomainProcessSignal = 53 DomainProcessSignalRt22 DomainProcessSignal = 54 DomainProcessSignalRt23 DomainProcessSignal = 55 DomainProcessSignalRt24 DomainProcessSignal = 56 DomainProcessSignalRt25 DomainProcessSignal = 57 DomainProcessSignalRt26 DomainProcessSignal = 58 DomainProcessSignalRt27 DomainProcessSignal = 59 DomainProcessSignalRt28 DomainProcessSignal = 60 DomainProcessSignalRt29 DomainProcessSignal = 61 DomainProcessSignalRt30 DomainProcessSignal = 62 DomainProcessSignalRt31 DomainProcessSignal = 63 DomainProcessSignalRt32 DomainProcessSignal = 64 ) // DomainEventType as declared in libvirt/libvirt-domain.h:3064 type DomainEventType int32 // DomainEventType enumeration from libvirt/libvirt-domain.h:3064 const ( DomainEventDefined DomainEventType = iota DomainEventUndefined DomainEventType = 1 DomainEventStarted DomainEventType = 2 DomainEventSuspended DomainEventType = 3 DomainEventResumed DomainEventType = 4 DomainEventStopped DomainEventType = 5 DomainEventShutdown DomainEventType = 6 DomainEventPmsuspended DomainEventType = 7 DomainEventCrashed DomainEventType = 8 ) // DomainEventDefinedDetailType as declared in libvirt/libvirt-domain.h:3080 type DomainEventDefinedDetailType int32 // DomainEventDefinedDetailType enumeration from libvirt/libvirt-domain.h:3080 const ( DomainEventDefinedAdded DomainEventDefinedDetailType = iota DomainEventDefinedUpdated DomainEventDefinedDetailType = 1 DomainEventDefinedRenamed DomainEventDefinedDetailType = 2 DomainEventDefinedFromSnapshot DomainEventDefinedDetailType = 3 ) // DomainEventUndefinedDetailType as declared in libvirt/libvirt-domain.h:3094 type DomainEventUndefinedDetailType int32 // DomainEventUndefinedDetailType enumeration from libvirt/libvirt-domain.h:3094 const ( DomainEventUndefinedRemoved DomainEventUndefinedDetailType = iota DomainEventUndefinedRenamed DomainEventUndefinedDetailType = 1 ) // DomainEventStartedDetailType as declared in libvirt/libvirt-domain.h:3111 type DomainEventStartedDetailType int32 // DomainEventStartedDetailType enumeration from libvirt/libvirt-domain.h:3111 const ( DomainEventStartedBooted DomainEventStartedDetailType = iota DomainEventStartedMigrated DomainEventStartedDetailType = 1 DomainEventStartedRestored DomainEventStartedDetailType = 2 DomainEventStartedFromSnapshot DomainEventStartedDetailType = 3 DomainEventStartedWakeup DomainEventStartedDetailType = 4 ) // DomainEventSuspendedDetailType as declared in libvirt/libvirt-domain.h:3132 type DomainEventSuspendedDetailType int32 // DomainEventSuspendedDetailType enumeration from libvirt/libvirt-domain.h:3132 const ( DomainEventSuspendedPaused DomainEventSuspendedDetailType = iota DomainEventSuspendedMigrated DomainEventSuspendedDetailType = 1 DomainEventSuspendedIoerror DomainEventSuspendedDetailType = 2 DomainEventSuspendedWatchdog DomainEventSuspendedDetailType = 3 DomainEventSuspendedRestored DomainEventSuspendedDetailType = 4 DomainEventSuspendedFromSnapshot DomainEventSuspendedDetailType = 5 DomainEventSuspendedAPIError DomainEventSuspendedDetailType = 6 DomainEventSuspendedPostcopy DomainEventSuspendedDetailType = 7 DomainEventSuspendedPostcopyFailed DomainEventSuspendedDetailType = 8 ) // DomainEventResumedDetailType as declared in libvirt/libvirt-domain.h:3149 type DomainEventResumedDetailType int32 // DomainEventResumedDetailType enumeration from libvirt/libvirt-domain.h:3149 const ( DomainEventResumedUnpaused DomainEventResumedDetailType = iota DomainEventResumedMigrated DomainEventResumedDetailType = 1 DomainEventResumedFromSnapshot DomainEventResumedDetailType = 2 DomainEventResumedPostcopy DomainEventResumedDetailType = 3 ) // DomainEventStoppedDetailType as declared in libvirt/libvirt-domain.h:3168 type DomainEventStoppedDetailType int32 // DomainEventStoppedDetailType enumeration from libvirt/libvirt-domain.h:3168 const ( DomainEventStoppedShutdown DomainEventStoppedDetailType = iota DomainEventStoppedDestroyed DomainEventStoppedDetailType = 1 DomainEventStoppedCrashed DomainEventStoppedDetailType = 2 DomainEventStoppedMigrated DomainEventStoppedDetailType = 3 DomainEventStoppedSaved DomainEventStoppedDetailType = 4 DomainEventStoppedFailed DomainEventStoppedDetailType = 5 DomainEventStoppedFromSnapshot DomainEventStoppedDetailType = 6 ) // DomainEventShutdownDetailType as declared in libvirt/libvirt-domain.h:3191 type DomainEventShutdownDetailType int32 // DomainEventShutdownDetailType enumeration from libvirt/libvirt-domain.h:3191 const ( DomainEventShutdownFinished DomainEventShutdownDetailType = iota DomainEventShutdownGuest DomainEventShutdownDetailType = 1 DomainEventShutdownHost DomainEventShutdownDetailType = 2 ) // DomainEventPMSuspendedDetailType as declared in libvirt/libvirt-domain.h:3205 type DomainEventPMSuspendedDetailType int32 // DomainEventPMSuspendedDetailType enumeration from libvirt/libvirt-domain.h:3205 const ( DomainEventPmsuspendedMemory DomainEventPMSuspendedDetailType = iota DomainEventPmsuspendedDisk DomainEventPMSuspendedDetailType = 1 ) // DomainEventCrashedDetailType as declared in libvirt/libvirt-domain.h:3219 type DomainEventCrashedDetailType int32 // DomainEventCrashedDetailType enumeration from libvirt/libvirt-domain.h:3219 const ( DomainEventCrashedPanicked DomainEventCrashedDetailType = iota DomainEventCrashedCrashloaded DomainEventCrashedDetailType = 1 ) // DomainMemoryFailureRecipientType as declared in libvirt/libvirt-domain.h:3236 type DomainMemoryFailureRecipientType int32 // DomainMemoryFailureRecipientType enumeration from libvirt/libvirt-domain.h:3236 const ( DomainEventMemoryFailureRecipientHypervisor DomainMemoryFailureRecipientType = iota DomainEventMemoryFailureRecipientGuest DomainMemoryFailureRecipientType = 1 ) // DomainMemoryFailureActionType as declared in libvirt/libvirt-domain.h:3265 type DomainMemoryFailureActionType int32 // DomainMemoryFailureActionType enumeration from libvirt/libvirt-domain.h:3265 const ( DomainEventMemoryFailureActionIgnore DomainMemoryFailureActionType = iota DomainEventMemoryFailureActionInject DomainMemoryFailureActionType = 1 DomainEventMemoryFailureActionFatal DomainMemoryFailureActionType = 2 DomainEventMemoryFailureActionReset DomainMemoryFailureActionType = 3 ) // DomainMemoryFailureFlags as declared in libvirt/libvirt-domain.h:3276 type DomainMemoryFailureFlags int32 // DomainMemoryFailureFlags enumeration from libvirt/libvirt-domain.h:3276 const ( DomainMemoryFailureActionRequired DomainMemoryFailureFlags = 1 DomainMemoryFailureRecursive DomainMemoryFailureFlags = 2 ) // DomainJobType as declared in libvirt/libvirt-domain.h:3321 type DomainJobType int32 // DomainJobType enumeration from libvirt/libvirt-domain.h:3321 const ( DomainJobNone DomainJobType = iota DomainJobBounded DomainJobType = 1 DomainJobUnbounded DomainJobType = 2 DomainJobCompleted DomainJobType = 3 DomainJobFailed DomainJobType = 4 DomainJobCancelled DomainJobType = 5 ) // DomainGetJobStatsFlags as declared in libvirt/libvirt-domain.h:3370 type DomainGetJobStatsFlags int32 // DomainGetJobStatsFlags enumeration from libvirt/libvirt-domain.h:3370 const ( DomainJobStatsCompleted DomainGetJobStatsFlags = 1 DomainJobStatsKeepCompleted DomainGetJobStatsFlags = 2 ) // DomainJobOperation as declared in libvirt/libvirt-domain.h:3396 type DomainJobOperation int32 // DomainJobOperation enumeration from libvirt/libvirt-domain.h:3396 const ( DomainJobOperationStrUnknown DomainJobOperation = iota DomainJobOperationStrStart DomainJobOperation = 1 DomainJobOperationStrSave DomainJobOperation = 2 DomainJobOperationStrRestore DomainJobOperation = 3 DomainJobOperationStrMigrationIn DomainJobOperation = 4 DomainJobOperationStrMigrationOut DomainJobOperation = 5 DomainJobOperationStrSnapshot DomainJobOperation = 6 DomainJobOperationStrSnapshotRevert DomainJobOperation = 7 DomainJobOperationStrDump DomainJobOperation = 8 DomainJobOperationStrBackup DomainJobOperation = 9 ) // DomainEventWatchdogAction as declared in libvirt/libvirt-domain.h:3780 type DomainEventWatchdogAction int32 // DomainEventWatchdogAction enumeration from libvirt/libvirt-domain.h:3780 const ( DomainEventWatchdogNone DomainEventWatchdogAction = iota DomainEventWatchdogPause DomainEventWatchdogAction = 1 DomainEventWatchdogReset DomainEventWatchdogAction = 2 DomainEventWatchdogPoweroff DomainEventWatchdogAction = 3 DomainEventWatchdogShutdown DomainEventWatchdogAction = 4 DomainEventWatchdogDebug DomainEventWatchdogAction = 5 DomainEventWatchdogInjectnmi DomainEventWatchdogAction = 6 ) // DomainEventIOErrorAction as declared in libvirt/libvirt-domain.h:3811 type DomainEventIOErrorAction int32 // DomainEventIOErrorAction enumeration from libvirt/libvirt-domain.h:3811 const ( DomainEventIoErrorNone DomainEventIOErrorAction = iota DomainEventIoErrorPause DomainEventIOErrorAction = 1 DomainEventIoErrorReport DomainEventIOErrorAction = 2 ) // DomainEventGraphicsPhase as declared in libvirt/libvirt-domain.h:3874 type DomainEventGraphicsPhase int32 // DomainEventGraphicsPhase enumeration from libvirt/libvirt-domain.h:3874 const ( DomainEventGraphicsConnect DomainEventGraphicsPhase = iota DomainEventGraphicsInitialize DomainEventGraphicsPhase = 1 DomainEventGraphicsDisconnect DomainEventGraphicsPhase = 2 ) // DomainEventGraphicsAddressType as declared in libvirt/libvirt-domain.h:3889 type DomainEventGraphicsAddressType int32 // DomainEventGraphicsAddressType enumeration from libvirt/libvirt-domain.h:3889 const ( DomainEventGraphicsAddressIpv4 DomainEventGraphicsAddressType = iota DomainEventGraphicsAddressIpv6 DomainEventGraphicsAddressType = 1 DomainEventGraphicsAddressUnix DomainEventGraphicsAddressType = 2 ) // ConnectDomainEventBlockJobStatus as declared in libvirt/libvirt-domain.h:3977 type ConnectDomainEventBlockJobStatus int32 // ConnectDomainEventBlockJobStatus enumeration from libvirt/libvirt-domain.h:3977 const ( DomainBlockJobCompleted ConnectDomainEventBlockJobStatus = iota DomainBlockJobFailed ConnectDomainEventBlockJobStatus = 1 DomainBlockJobCanceled ConnectDomainEventBlockJobStatus = 2 DomainBlockJobReady ConnectDomainEventBlockJobStatus = 3 ) // ConnectDomainEventDiskChangeReason as declared in libvirt/libvirt-domain.h:4027 type ConnectDomainEventDiskChangeReason int32 // ConnectDomainEventDiskChangeReason enumeration from libvirt/libvirt-domain.h:4027 const ( DomainEventDiskChangeMissingOnStart ConnectDomainEventDiskChangeReason = iota DomainEventDiskDropMissingOnStart ConnectDomainEventDiskChangeReason = 1 ) // DomainEventTrayChangeReason as declared in libvirt/libvirt-domain.h:4068 type DomainEventTrayChangeReason int32 // DomainEventTrayChangeReason enumeration from libvirt/libvirt-domain.h:4068 const ( DomainEventTrayChangeOpen DomainEventTrayChangeReason = iota DomainEventTrayChangeClose DomainEventTrayChangeReason = 1 ) // ConnectDomainEventAgentLifecycleState as declared in libvirt/libvirt-domain.h:4585 type ConnectDomainEventAgentLifecycleState int32 // ConnectDomainEventAgentLifecycleState enumeration from libvirt/libvirt-domain.h:4585 const ( ConnectDomainEventAgentLifecycleStateConnected ConnectDomainEventAgentLifecycleState = 1 ConnectDomainEventAgentLifecycleStateDisconnected ConnectDomainEventAgentLifecycleState = 2 ) // ConnectDomainEventAgentLifecycleReason as declared in libvirt/libvirt-domain.h:4595 type ConnectDomainEventAgentLifecycleReason int32 // ConnectDomainEventAgentLifecycleReason enumeration from libvirt/libvirt-domain.h:4595 const ( ConnectDomainEventAgentLifecycleReasonUnknown ConnectDomainEventAgentLifecycleReason = iota ConnectDomainEventAgentLifecycleReasonDomainStarted ConnectDomainEventAgentLifecycleReason = 1 ConnectDomainEventAgentLifecycleReasonChannel ConnectDomainEventAgentLifecycleReason = 2 ) // DomainEventID as declared in libvirt/libvirt-domain.h:4749 type DomainEventID int32 // DomainEventID enumeration from libvirt/libvirt-domain.h:4749 const ( DomainEventIDLifecycle DomainEventID = iota DomainEventIDReboot DomainEventID = 1 DomainEventIDRtcChange DomainEventID = 2 DomainEventIDWatchdog DomainEventID = 3 DomainEventIDIoError DomainEventID = 4 DomainEventIDGraphics DomainEventID = 5 DomainEventIDIoErrorReason DomainEventID = 6 DomainEventIDControlError DomainEventID = 7 DomainEventIDBlockJob DomainEventID = 8 DomainEventIDDiskChange DomainEventID = 9 DomainEventIDTrayChange DomainEventID = 10 DomainEventIDPmwakeup DomainEventID = 11 DomainEventIDPmsuspend DomainEventID = 12 DomainEventIDBalloonChange DomainEventID = 13 DomainEventIDPmsuspendDisk DomainEventID = 14 DomainEventIDDeviceRemoved DomainEventID = 15 DomainEventIDBlockJob2 DomainEventID = 16 DomainEventIDTunable DomainEventID = 17 DomainEventIDAgentLifecycle DomainEventID = 18 DomainEventIDDeviceAdded DomainEventID = 19 DomainEventIDMigrationIteration DomainEventID = 20 DomainEventIDJobCompleted DomainEventID = 21 DomainEventIDDeviceRemovalFailed DomainEventID = 22 DomainEventIDMetadataChange DomainEventID = 23 DomainEventIDBlockThreshold DomainEventID = 24 DomainEventIDMemoryFailure DomainEventID = 25 DomainEventIDMemoryDeviceSizeChange DomainEventID = 26 ) // DomainConsoleFlags as declared in libvirt/libvirt-domain.h:4776 type DomainConsoleFlags int32 // DomainConsoleFlags enumeration from libvirt/libvirt-domain.h:4776 const ( DomainConsoleForce DomainConsoleFlags = 1 DomainConsoleSafe DomainConsoleFlags = 2 ) // DomainChannelFlags as declared in libvirt/libvirt-domain.h:4792 type DomainChannelFlags int32 // DomainChannelFlags enumeration from libvirt/libvirt-domain.h:4792 const ( DomainChannelForce DomainChannelFlags = 1 ) // DomainOpenGraphicsFlags as declared in libvirt/libvirt-domain.h:4801 type DomainOpenGraphicsFlags int32 // DomainOpenGraphicsFlags enumeration from libvirt/libvirt-domain.h:4801 const ( DomainOpenGraphicsSkipauth DomainOpenGraphicsFlags = 1 ) // DomainSetTimeFlags as declared in libvirt/libvirt-domain.h:4858 type DomainSetTimeFlags int32 // DomainSetTimeFlags enumeration from libvirt/libvirt-domain.h:4858 const ( DomainTimeSync DomainSetTimeFlags = 1 ) // SchedParameterType as declared in libvirt/libvirt-domain.h:4879 type SchedParameterType int32 // SchedParameterType enumeration from libvirt/libvirt-domain.h:4879 const ( DomainSchedFieldInt SchedParameterType = 1 DomainSchedFieldUint SchedParameterType = 2 DomainSchedFieldLlong SchedParameterType = 3 DomainSchedFieldUllong SchedParameterType = 4 DomainSchedFieldDouble SchedParameterType = 5 DomainSchedFieldBoolean SchedParameterType = 6 ) // BlkioParameterType as declared in libvirt/libvirt-domain.h:4923 type BlkioParameterType int32 // BlkioParameterType enumeration from libvirt/libvirt-domain.h:4923 const ( DomainBlkioParamInt BlkioParameterType = 1 DomainBlkioParamUint BlkioParameterType = 2 DomainBlkioParamLlong BlkioParameterType = 3 DomainBlkioParamUllong BlkioParameterType = 4 DomainBlkioParamDouble BlkioParameterType = 5 DomainBlkioParamBoolean BlkioParameterType = 6 ) // MemoryParameterType as declared in libvirt/libvirt-domain.h:4967 type MemoryParameterType int32 // MemoryParameterType enumeration from libvirt/libvirt-domain.h:4967 const ( DomainMemoryParamInt MemoryParameterType = 1 DomainMemoryParamUint MemoryParameterType = 2 DomainMemoryParamLlong MemoryParameterType = 3 DomainMemoryParamUllong MemoryParameterType = 4 DomainMemoryParamDouble MemoryParameterType = 5 DomainMemoryParamBoolean MemoryParameterType = 6 ) // DomainInterfaceAddressesSource as declared in libvirt/libvirt-domain.h:5005 type DomainInterfaceAddressesSource int32 // DomainInterfaceAddressesSource enumeration from libvirt/libvirt-domain.h:5005 const ( DomainInterfaceAddressesSrcLease DomainInterfaceAddressesSource = iota DomainInterfaceAddressesSrcAgent DomainInterfaceAddressesSource = 1 DomainInterfaceAddressesSrcArp DomainInterfaceAddressesSource = 2 ) // DomainSetUserPasswordFlags as declared in libvirt/libvirt-domain.h:5033 type DomainSetUserPasswordFlags int32 // DomainSetUserPasswordFlags enumeration from libvirt/libvirt-domain.h:5033 const ( DomainPasswordEncrypted DomainSetUserPasswordFlags = 1 ) // DomainLifecycle as declared in libvirt/libvirt-domain.h:5072 type DomainLifecycle int32 // DomainLifecycle enumeration from libvirt/libvirt-domain.h:5072 const ( DomainLifecyclePoweroff DomainLifecycle = iota DomainLifecycleReboot DomainLifecycle = 1 DomainLifecycleCrash DomainLifecycle = 2 ) // DomainLifecycleAction as declared in libvirt/libvirt-domain.h:5085 type DomainLifecycleAction int32 // DomainLifecycleAction enumeration from libvirt/libvirt-domain.h:5085 const ( DomainLifecycleActionDestroy DomainLifecycleAction = iota DomainLifecycleActionRestart DomainLifecycleAction = 1 DomainLifecycleActionRestartRename DomainLifecycleAction = 2 DomainLifecycleActionPreserve DomainLifecycleAction = 3 DomainLifecycleActionCoredumpDestroy DomainLifecycleAction = 4 DomainLifecycleActionCoredumpRestart DomainLifecycleAction = 5 ) // DomainGuestInfoTypes as declared in libvirt/libvirt-domain.h:5185 type DomainGuestInfoTypes int32 // DomainGuestInfoTypes enumeration from libvirt/libvirt-domain.h:5185 const ( DomainGuestInfoUsers DomainGuestInfoTypes = 1 DomainGuestInfoOs DomainGuestInfoTypes = 2 DomainGuestInfoTimezone DomainGuestInfoTypes = 4 DomainGuestInfoHostname DomainGuestInfoTypes = 8 DomainGuestInfoFilesystem DomainGuestInfoTypes = 16 DomainGuestInfoDisks DomainGuestInfoTypes = 32 DomainGuestInfoInterfaces DomainGuestInfoTypes = 64 ) // DomainAgentResponseTimeoutValues as declared in libvirt/libvirt-domain.h:5197 type DomainAgentResponseTimeoutValues int32 // DomainAgentResponseTimeoutValues enumeration from libvirt/libvirt-domain.h:5197 const ( DomainAgentResponseTimeoutBlock DomainAgentResponseTimeoutValues = -2 DomainAgentResponseTimeoutDefault DomainAgentResponseTimeoutValues = -1 DomainAgentResponseTimeoutNowait DomainAgentResponseTimeoutValues = 0 ) // DomainBackupBeginFlags as declared in libvirt/libvirt-domain.h:5206 type DomainBackupBeginFlags int32 // DomainBackupBeginFlags enumeration from libvirt/libvirt-domain.h:5206 const ( DomainBackupBeginReuseExternal DomainBackupBeginFlags = 1 ) // DomainAuthorizedSSHKeysSetFlags as declared in libvirt/libvirt-domain.h:5225 type DomainAuthorizedSSHKeysSetFlags int32 // DomainAuthorizedSSHKeysSetFlags enumeration from libvirt/libvirt-domain.h:5225 const ( DomainAuthorizedSSHKeysSetAppend DomainAuthorizedSSHKeysSetFlags = 1 DomainAuthorizedSSHKeysSetRemove DomainAuthorizedSSHKeysSetFlags = 2 ) // DomainMessageType as declared in libvirt/libvirt-domain.h:5236 type DomainMessageType int32 // DomainMessageType enumeration from libvirt/libvirt-domain.h:5236 const ( DomainMessageDeprecation DomainMessageType = 1 DomainMessageTainting DomainMessageType = 2 ) // DomainDirtyRateStatus as declared in libvirt/libvirt-domain.h:5258 type DomainDirtyRateStatus int32 // DomainDirtyRateStatus enumeration from libvirt/libvirt-domain.h:5258 const ( DomainDirtyrateUnstarted DomainDirtyRateStatus = iota DomainDirtyrateMeasuring DomainDirtyRateStatus = 1 DomainDirtyrateMeasured DomainDirtyRateStatus = 2 ) // EventHandleType as declared in libvirt/libvirt-event.h:43 type EventHandleType int32 // EventHandleType enumeration from libvirt/libvirt-event.h:43 const ( EventHandleReadable EventHandleType = 1 EventHandleWritable EventHandleType = 2 EventHandleError EventHandleType = 4 EventHandleHangup EventHandleType = 8 ) // NodeSuspendTarget as declared in libvirt/libvirt-host.h:61 type NodeSuspendTarget int32 // NodeSuspendTarget enumeration from libvirt/libvirt-host.h:61 const ( NodeSuspendTargetMem NodeSuspendTarget = iota NodeSuspendTargetDisk NodeSuspendTarget = 1 NodeSuspendTargetHybrid NodeSuspendTarget = 2 ) // NodeGetCPUStatsAllCPUs as declared in libvirt/libvirt-host.h:189 type NodeGetCPUStatsAllCPUs int32 // NodeGetCPUStatsAllCPUs enumeration from libvirt/libvirt-host.h:189 const ( NodeCPUStatsAllCpus NodeGetCPUStatsAllCPUs = -1 ) // NodeGetMemoryStatsAllCells as declared in libvirt/libvirt-host.h:267 type NodeGetMemoryStatsAllCells int32 // NodeGetMemoryStatsAllCells enumeration from libvirt/libvirt-host.h:267 const ( NodeMemoryStatsAllCells NodeGetMemoryStatsAllCells = -1 ) // ConnectFlags as declared in libvirt/libvirt-host.h:504 type ConnectFlags int32 // ConnectFlags enumeration from libvirt/libvirt-host.h:504 const ( ConnectRo ConnectFlags = 1 ConnectNoAliases ConnectFlags = 2 ) // ConnectCredentialType as declared in libvirt/libvirt-host.h:521 type ConnectCredentialType int32 // ConnectCredentialType enumeration from libvirt/libvirt-host.h:521 const ( CredUsername ConnectCredentialType = 1 CredAuthname ConnectCredentialType = 2 CredLanguage ConnectCredentialType = 3 CredCnonce ConnectCredentialType = 4 CredPassphrase ConnectCredentialType = 5 CredEchoprompt ConnectCredentialType = 6 CredNoechoprompt ConnectCredentialType = 7 CredRealm ConnectCredentialType = 8 CredExternal ConnectCredentialType = 9 ) // CPUCompareResult as declared in libvirt/libvirt-host.h:768 type CPUCompareResult int32 // CPUCompareResult enumeration from libvirt/libvirt-host.h:768 const ( CPUCompareError CPUCompareResult = -1 CPUCompareIncompatible CPUCompareResult = 0 CPUCompareIdentical CPUCompareResult = 1 CPUCompareSuperset CPUCompareResult = 2 ) // ConnectCompareCPUFlags as declared in libvirt/libvirt-host.h:775 type ConnectCompareCPUFlags int32 // ConnectCompareCPUFlags enumeration from libvirt/libvirt-host.h:775 const ( ConnectCompareCPUFailIncompatible ConnectCompareCPUFlags = 1 ConnectCompareCPUValidateXML ConnectCompareCPUFlags = 2 ) // ConnectBaselineCPUFlags as declared in libvirt/libvirt-host.h:801 type ConnectBaselineCPUFlags int32 // ConnectBaselineCPUFlags enumeration from libvirt/libvirt-host.h:801 const ( ConnectBaselineCPUExpandFeatures ConnectBaselineCPUFlags = 1 ConnectBaselineCPUMigratable ConnectBaselineCPUFlags = 2 ) // NodeAllocPagesFlags as declared in libvirt/libvirt-host.h:831 type NodeAllocPagesFlags int32 // NodeAllocPagesFlags enumeration from libvirt/libvirt-host.h:831 const ( NodeAllocPagesAdd NodeAllocPagesFlags = iota NodeAllocPagesSet NodeAllocPagesFlags = 1 ) // ConnectListAllInterfacesFlags as declared in libvirt/libvirt-interface.h:64 type ConnectListAllInterfacesFlags int32 // ConnectListAllInterfacesFlags enumeration from libvirt/libvirt-interface.h:64 const ( ConnectListInterfacesInactive ConnectListAllInterfacesFlags = 1 ConnectListInterfacesActive ConnectListAllInterfacesFlags = 2 ) // InterfaceXMLFlags as declared in libvirt/libvirt-interface.h:80 type InterfaceXMLFlags int32 // InterfaceXMLFlags enumeration from libvirt/libvirt-interface.h:80 const ( InterfaceXMLInactive InterfaceXMLFlags = 1 ) // InterfaceDefineFlags as declared in libvirt/libvirt-interface.h:84 type InterfaceDefineFlags int32 // InterfaceDefineFlags enumeration from libvirt/libvirt-interface.h:84 const ( InterfaceDefineValidate InterfaceDefineFlags = 1 ) // NetworkXMLFlags as declared in libvirt/libvirt-network.h:32 type NetworkXMLFlags int32 // NetworkXMLFlags enumeration from libvirt/libvirt-network.h:32 const ( NetworkXMLInactive NetworkXMLFlags = 1 ) // ConnectListAllNetworksFlags as declared in libvirt/libvirt-network.h:100 type ConnectListAllNetworksFlags int32 // ConnectListAllNetworksFlags enumeration from libvirt/libvirt-network.h:100 const ( ConnectListNetworksInactive ConnectListAllNetworksFlags = 1 ConnectListNetworksActive ConnectListAllNetworksFlags = 2 ConnectListNetworksPersistent ConnectListAllNetworksFlags = 4 ConnectListNetworksTransient ConnectListAllNetworksFlags = 8 ConnectListNetworksAutostart ConnectListAllNetworksFlags = 16 ConnectListNetworksNoAutostart ConnectListAllNetworksFlags = 32 ) // NetworkCreateFlags as declared in libvirt/libvirt-network.h:118 type NetworkCreateFlags int32 // NetworkCreateFlags enumeration from libvirt/libvirt-network.h:118 const ( NetworkCreateValidate NetworkCreateFlags = 1 ) // NetworkDefineFlags as declared in libvirt/libvirt-network.h:131 type NetworkDefineFlags int32 // NetworkDefineFlags enumeration from libvirt/libvirt-network.h:131 const ( NetworkDefineValidate NetworkDefineFlags = 1 ) // NetworkUpdateCommand as declared in libvirt/libvirt-network.h:163 type NetworkUpdateCommand int32 // NetworkUpdateCommand enumeration from libvirt/libvirt-network.h:163 const ( NetworkUpdateCommandNone NetworkUpdateCommand = iota NetworkUpdateCommandModify NetworkUpdateCommand = 1 NetworkUpdateCommandDelete NetworkUpdateCommand = 2 NetworkUpdateCommandAddLast NetworkUpdateCommand = 3 NetworkUpdateCommandAddFirst NetworkUpdateCommand = 4 ) // NetworkUpdateSection as declared in libvirt/libvirt-network.h:189 type NetworkUpdateSection int32 // NetworkUpdateSection enumeration from libvirt/libvirt-network.h:189 const ( NetworkSectionNone NetworkUpdateSection = iota NetworkSectionBridge NetworkUpdateSection = 1 NetworkSectionDomain NetworkUpdateSection = 2 NetworkSectionIP NetworkUpdateSection = 3 NetworkSectionIPDhcpHost NetworkUpdateSection = 4 NetworkSectionIPDhcpRange NetworkUpdateSection = 5 NetworkSectionForward NetworkUpdateSection = 6 NetworkSectionForwardInterface NetworkUpdateSection = 7 NetworkSectionForwardPf NetworkUpdateSection = 8 NetworkSectionPortgroup NetworkUpdateSection = 9 NetworkSectionDNSHost NetworkUpdateSection = 10 NetworkSectionDNSTxt NetworkUpdateSection = 11 NetworkSectionDNSSrv NetworkUpdateSection = 12 ) // NetworkUpdateFlags as declared in libvirt/libvirt-network.h:201 type NetworkUpdateFlags int32 // NetworkUpdateFlags enumeration from libvirt/libvirt-network.h:201 const ( NetworkUpdateAffectCurrent NetworkUpdateFlags = iota NetworkUpdateAffectLive NetworkUpdateFlags = 1 NetworkUpdateAffectConfig NetworkUpdateFlags = 2 ) // NetworkEventLifecycleType as declared in libvirt/libvirt-network.h:259 type NetworkEventLifecycleType int32 // NetworkEventLifecycleType enumeration from libvirt/libvirt-network.h:259 const ( NetworkEventDefined NetworkEventLifecycleType = iota NetworkEventUndefined NetworkEventLifecycleType = 1 NetworkEventStarted NetworkEventLifecycleType = 2 NetworkEventStopped NetworkEventLifecycleType = 3 ) // NetworkEventID as declared in libvirt/libvirt-network.h:307 type NetworkEventID int32 // NetworkEventID enumeration from libvirt/libvirt-network.h:307 const ( NetworkEventIDLifecycle NetworkEventID = iota ) // IPAddrType as declared in libvirt/libvirt-network.h:316 type IPAddrType int32 // IPAddrType enumeration from libvirt/libvirt-network.h:316 const ( IPAddrTypeIpv4 IPAddrType = iota IPAddrTypeIpv6 IPAddrType = 1 ) // NetworkPortCreateFlags as declared in libvirt/libvirt-network.h:378 type NetworkPortCreateFlags int32 // NetworkPortCreateFlags enumeration from libvirt/libvirt-network.h:378 const ( NetworkPortCreateReclaim NetworkPortCreateFlags = 1 NetworkPortCreateValidate NetworkPortCreateFlags = 2 ) // ConnectListAllNodeDeviceFlags as declared in libvirt/libvirt-nodedev.h:92 type ConnectListAllNodeDeviceFlags uint32 // ConnectListAllNodeDeviceFlags enumeration from libvirt/libvirt-nodedev.h:92 const ( ConnectListNodeDevicesCapSystem ConnectListAllNodeDeviceFlags = 1 ConnectListNodeDevicesCapPciDev ConnectListAllNodeDeviceFlags = 2 ConnectListNodeDevicesCapUsbDev ConnectListAllNodeDeviceFlags = 4 ConnectListNodeDevicesCapUsbInterface ConnectListAllNodeDeviceFlags = 8 ConnectListNodeDevicesCapNet ConnectListAllNodeDeviceFlags = 16 ConnectListNodeDevicesCapScsiHost ConnectListAllNodeDeviceFlags = 32 ConnectListNodeDevicesCapScsiTarget ConnectListAllNodeDeviceFlags = 64 ConnectListNodeDevicesCapScsi ConnectListAllNodeDeviceFlags = 128 ConnectListNodeDevicesCapStorage ConnectListAllNodeDeviceFlags = 256 ConnectListNodeDevicesCapFcHost ConnectListAllNodeDeviceFlags = 512 ConnectListNodeDevicesCapVports ConnectListAllNodeDeviceFlags = 1024 ConnectListNodeDevicesCapScsiGeneric ConnectListAllNodeDeviceFlags = 2048 ConnectListNodeDevicesCapDrm ConnectListAllNodeDeviceFlags = 4096 ConnectListNodeDevicesCapMdevTypes ConnectListAllNodeDeviceFlags = 8192 ConnectListNodeDevicesCapMdev ConnectListAllNodeDeviceFlags = 16384 ConnectListNodeDevicesCapCcwDev ConnectListAllNodeDeviceFlags = 32768 ConnectListNodeDevicesCapCssDev ConnectListAllNodeDeviceFlags = 65536 ConnectListNodeDevicesCapVdpa ConnectListAllNodeDeviceFlags = 131072 ConnectListNodeDevicesCapApCard ConnectListAllNodeDeviceFlags = 262144 ConnectListNodeDevicesCapApQueue ConnectListAllNodeDeviceFlags = 524288 ConnectListNodeDevicesCapApMatrix ConnectListAllNodeDeviceFlags = 1048576 ConnectListNodeDevicesCapVpd ConnectListAllNodeDeviceFlags = 2097152 ConnectListNodeDevicesInactive ConnectListAllNodeDeviceFlags = 1073741824 ConnectListNodeDevicesActive ConnectListAllNodeDeviceFlags = 2147483648 ) // NodeDeviceEventID as declared in libvirt/libvirt-nodedev.h:182 type NodeDeviceEventID int32 // NodeDeviceEventID enumeration from libvirt/libvirt-nodedev.h:182 const ( NodeDeviceEventIDLifecycle NodeDeviceEventID = iota NodeDeviceEventIDUpdate NodeDeviceEventID = 1 ) // NodeDeviceEventLifecycleType as declared in libvirt/libvirt-nodedev.h:226 type NodeDeviceEventLifecycleType int32 // NodeDeviceEventLifecycleType enumeration from libvirt/libvirt-nodedev.h:226 const ( NodeDeviceEventCreated NodeDeviceEventLifecycleType = iota NodeDeviceEventDeleted NodeDeviceEventLifecycleType = 1 NodeDeviceEventDefined NodeDeviceEventLifecycleType = 2 NodeDeviceEventUndefined NodeDeviceEventLifecycleType = 3 ) // NWFilterDefineFlags as declared in libvirt/libvirt-nwfilter.h:85 type NWFilterDefineFlags int32 // NWFilterDefineFlags enumeration from libvirt/libvirt-nwfilter.h:85 const ( NwfilterDefineValidate NWFilterDefineFlags = 1 ) // NWFilterBindingCreateFlags as declared in libvirt/libvirt-nwfilter.h:113 type NWFilterBindingCreateFlags int32 // NWFilterBindingCreateFlags enumeration from libvirt/libvirt-nwfilter.h:113 const ( NwfilterBindingCreateValidate NWFilterBindingCreateFlags = 1 ) // SecretUsageType as declared in libvirt/libvirt-secret.h:56 type SecretUsageType int32 // SecretUsageType enumeration from libvirt/libvirt-secret.h:56 const ( SecretUsageTypeNone SecretUsageType = iota SecretUsageTypeVolume SecretUsageType = 1 SecretUsageTypeCeph SecretUsageType = 2 SecretUsageTypeIscsi SecretUsageType = 3 SecretUsageTypeTLS SecretUsageType = 4 SecretUsageTypeVtpm SecretUsageType = 5 ) // ConnectListAllSecretsFlags as declared in libvirt/libvirt-secret.h:79 type ConnectListAllSecretsFlags int32 // ConnectListAllSecretsFlags enumeration from libvirt/libvirt-secret.h:79 const ( ConnectListSecretsEphemeral ConnectListAllSecretsFlags = 1 ConnectListSecretsNoEphemeral ConnectListAllSecretsFlags = 2 ConnectListSecretsPrivate ConnectListAllSecretsFlags = 4 ConnectListSecretsNoPrivate ConnectListAllSecretsFlags = 8 ) // SecretDefineFlags as declared in libvirt/libvirt-secret.h:94 type SecretDefineFlags int32 // SecretDefineFlags enumeration from libvirt/libvirt-secret.h:94 const ( SecretDefineValidate SecretDefineFlags = 1 ) // SecretEventID as declared in libvirt/libvirt-secret.h:145 type SecretEventID int32 // SecretEventID enumeration from libvirt/libvirt-secret.h:145 const ( SecretEventIDLifecycle SecretEventID = iota SecretEventIDValueChanged SecretEventID = 1 ) // SecretEventLifecycleType as declared in libvirt/libvirt-secret.h:187 type SecretEventLifecycleType int32 // SecretEventLifecycleType enumeration from libvirt/libvirt-secret.h:187 const ( SecretEventDefined SecretEventLifecycleType = iota SecretEventUndefined SecretEventLifecycleType = 1 ) // StoragePoolState as declared in libvirt/libvirt-storage.h:57 type StoragePoolState int32 // StoragePoolState enumeration from libvirt/libvirt-storage.h:57 const ( StoragePoolInactive StoragePoolState = iota StoragePoolBuilding StoragePoolState = 1 StoragePoolRunning StoragePoolState = 2 StoragePoolDegraded StoragePoolState = 3 StoragePoolInaccessible StoragePoolState = 4 ) // StoragePoolBuildFlags as declared in libvirt/libvirt-storage.h:65 type StoragePoolBuildFlags int32 // StoragePoolBuildFlags enumeration from libvirt/libvirt-storage.h:65 const ( StoragePoolBuildNew StoragePoolBuildFlags = iota StoragePoolBuildRepair StoragePoolBuildFlags = 1 StoragePoolBuildResize StoragePoolBuildFlags = 2 StoragePoolBuildNoOverwrite StoragePoolBuildFlags = 4 StoragePoolBuildOverwrite StoragePoolBuildFlags = 8 ) // StoragePoolDeleteFlags as declared in libvirt/libvirt-storage.h:70 type StoragePoolDeleteFlags int32 // StoragePoolDeleteFlags enumeration from libvirt/libvirt-storage.h:70 const ( StoragePoolDeleteNormal StoragePoolDeleteFlags = iota StoragePoolDeleteZeroed StoragePoolDeleteFlags = 1 ) // StoragePoolCreateFlags as declared in libvirt/libvirt-storage.h:88 type StoragePoolCreateFlags int32 // StoragePoolCreateFlags enumeration from libvirt/libvirt-storage.h:88 const ( StoragePoolCreateNormal StoragePoolCreateFlags = iota StoragePoolCreateWithBuild StoragePoolCreateFlags = 1 StoragePoolCreateWithBuildOverwrite StoragePoolCreateFlags = 2 StoragePoolCreateWithBuildNoOverwrite StoragePoolCreateFlags = 4 ) // StorageVolType as declared in libvirt/libvirt-storage.h:130 type StorageVolType int32 // StorageVolType enumeration from libvirt/libvirt-storage.h:130 const ( StorageVolFile StorageVolType = iota StorageVolBlock StorageVolType = 1 StorageVolDir StorageVolType = 2 StorageVolNetwork StorageVolType = 3 StorageVolNetdir StorageVolType = 4 StorageVolPloop StorageVolType = 5 ) // StorageVolDeleteFlags as declared in libvirt/libvirt-storage.h:136 type StorageVolDeleteFlags int32 // StorageVolDeleteFlags enumeration from libvirt/libvirt-storage.h:136 const ( StorageVolDeleteNormal StorageVolDeleteFlags = iota StorageVolDeleteZeroed StorageVolDeleteFlags = 1 StorageVolDeleteWithSnapshots StorageVolDeleteFlags = 2 ) // StorageVolWipeAlgorithm as declared in libvirt/libvirt-storage.h:168 type StorageVolWipeAlgorithm int32 // StorageVolWipeAlgorithm enumeration from libvirt/libvirt-storage.h:168 const ( StorageVolWipeAlgZero StorageVolWipeAlgorithm = iota StorageVolWipeAlgNnsa StorageVolWipeAlgorithm = 1 StorageVolWipeAlgDod StorageVolWipeAlgorithm = 2 StorageVolWipeAlgBsi StorageVolWipeAlgorithm = 3 StorageVolWipeAlgGutmann StorageVolWipeAlgorithm = 4 StorageVolWipeAlgSchneier StorageVolWipeAlgorithm = 5 StorageVolWipeAlgPfitzner7 StorageVolWipeAlgorithm = 6 StorageVolWipeAlgPfitzner33 StorageVolWipeAlgorithm = 7 StorageVolWipeAlgRandom StorageVolWipeAlgorithm = 8 StorageVolWipeAlgTrim StorageVolWipeAlgorithm = 9 ) // StorageVolInfoFlags as declared in libvirt/libvirt-storage.h:176 type StorageVolInfoFlags int32 // StorageVolInfoFlags enumeration from libvirt/libvirt-storage.h:176 const ( StorageVolUseAllocation StorageVolInfoFlags = iota StorageVolGetPhysical StorageVolInfoFlags = 1 ) // StorageXMLFlags as declared in libvirt/libvirt-storage.h:190 type StorageXMLFlags int32 // StorageXMLFlags enumeration from libvirt/libvirt-storage.h:190 const ( StorageXMLInactive StorageXMLFlags = 1 ) // ConnectListAllStoragePoolsFlags as declared in libvirt/libvirt-storage.h:249 type ConnectListAllStoragePoolsFlags int32 // ConnectListAllStoragePoolsFlags enumeration from libvirt/libvirt-storage.h:249 const ( ConnectListStoragePoolsInactive ConnectListAllStoragePoolsFlags = 1 ConnectListStoragePoolsActive ConnectListAllStoragePoolsFlags = 2 ConnectListStoragePoolsPersistent ConnectListAllStoragePoolsFlags = 4 ConnectListStoragePoolsTransient ConnectListAllStoragePoolsFlags = 8 ConnectListStoragePoolsAutostart ConnectListAllStoragePoolsFlags = 16 ConnectListStoragePoolsNoAutostart ConnectListAllStoragePoolsFlags = 32 ConnectListStoragePoolsDir ConnectListAllStoragePoolsFlags = 64 ConnectListStoragePoolsFs ConnectListAllStoragePoolsFlags = 128 ConnectListStoragePoolsNetfs ConnectListAllStoragePoolsFlags = 256 ConnectListStoragePoolsLogical ConnectListAllStoragePoolsFlags = 512 ConnectListStoragePoolsDisk ConnectListAllStoragePoolsFlags = 1024 ConnectListStoragePoolsIscsi ConnectListAllStoragePoolsFlags = 2048 ConnectListStoragePoolsScsi ConnectListAllStoragePoolsFlags = 4096 ConnectListStoragePoolsMpath ConnectListAllStoragePoolsFlags = 8192 ConnectListStoragePoolsRbd ConnectListAllStoragePoolsFlags = 16384 ConnectListStoragePoolsSheepdog ConnectListAllStoragePoolsFlags = 32768 ConnectListStoragePoolsGluster ConnectListAllStoragePoolsFlags = 65536 ConnectListStoragePoolsZfs ConnectListAllStoragePoolsFlags = 131072 ConnectListStoragePoolsVstorage ConnectListAllStoragePoolsFlags = 262144 ConnectListStoragePoolsIscsiDirect ConnectListAllStoragePoolsFlags = 524288 ) // StoragePoolDefineFlags as declared in libvirt/libvirt-storage.h:277 type StoragePoolDefineFlags int32 // StoragePoolDefineFlags enumeration from libvirt/libvirt-storage.h:277 const ( StoragePoolDefineValidate StoragePoolDefineFlags = 1 ) // StorageVolCreateFlags as declared in libvirt/libvirt-storage.h:351 type StorageVolCreateFlags int32 // StorageVolCreateFlags enumeration from libvirt/libvirt-storage.h:351 const ( StorageVolCreatePreallocMetadata StorageVolCreateFlags = 1 StorageVolCreateReflink StorageVolCreateFlags = 2 ) // StorageVolDownloadFlags as declared in libvirt/libvirt-storage.h:363 type StorageVolDownloadFlags int32 // StorageVolDownloadFlags enumeration from libvirt/libvirt-storage.h:363 const ( StorageVolDownloadSparseStream StorageVolDownloadFlags = 1 ) // StorageVolUploadFlags as declared in libvirt/libvirt-storage.h:372 type StorageVolUploadFlags int32 // StorageVolUploadFlags enumeration from libvirt/libvirt-storage.h:372 const ( StorageVolUploadSparseStream StorageVolUploadFlags = 1 ) // StorageVolResizeFlags as declared in libvirt/libvirt-storage.h:403 type StorageVolResizeFlags int32 // StorageVolResizeFlags enumeration from libvirt/libvirt-storage.h:403 const ( StorageVolResizeAllocate StorageVolResizeFlags = 1 StorageVolResizeDelta StorageVolResizeFlags = 2 StorageVolResizeShrink StorageVolResizeFlags = 4 ) // StoragePoolEventID as declared in libvirt/libvirt-storage.h:439 type StoragePoolEventID int32 // StoragePoolEventID enumeration from libvirt/libvirt-storage.h:439 const ( StoragePoolEventIDLifecycle StoragePoolEventID = iota StoragePoolEventIDRefresh StoragePoolEventID = 1 ) // StoragePoolEventLifecycleType as declared in libvirt/libvirt-storage.h:485 type StoragePoolEventLifecycleType int32 // StoragePoolEventLifecycleType enumeration from libvirt/libvirt-storage.h:485 const ( StoragePoolEventDefined StoragePoolEventLifecycleType = iota StoragePoolEventUndefined StoragePoolEventLifecycleType = 1 StoragePoolEventStarted StoragePoolEventLifecycleType = 2 StoragePoolEventStopped StoragePoolEventLifecycleType = 3 StoragePoolEventCreated StoragePoolEventLifecycleType = 4 StoragePoolEventDeleted StoragePoolEventLifecycleType = 5 ) // StreamFlags as declared in libvirt/libvirt-stream.h:33 type StreamFlags int32 // StreamFlags enumeration from libvirt/libvirt-stream.h:33 const ( StreamNonblock StreamFlags = 1 ) // StreamRecvFlagsValues as declared in libvirt/libvirt-stream.h:49 type StreamRecvFlagsValues int32 // StreamRecvFlagsValues enumeration from libvirt/libvirt-stream.h:49 const ( StreamRecvStopAtHole StreamRecvFlagsValues = 1 ) // StreamEventType as declared in libvirt/libvirt-stream.h:237 type StreamEventType int32 // StreamEventType enumeration from libvirt/libvirt-stream.h:237 const ( StreamEventReadable StreamEventType = 1 StreamEventWritable StreamEventType = 2 StreamEventError StreamEventType = 4 StreamEventHangup StreamEventType = 8 ) // ErrorLevel as declared in libvirt/virterror.h:42 type ErrorLevel int32 // ErrorLevel enumeration from libvirt/virterror.h:42 const ( ErrNone ErrorLevel = iota ErrWarning ErrorLevel = 1 ErrError ErrorLevel = 2 ) // ErrorDomain as declared in libvirt/virterror.h:144 type ErrorDomain int32 // ErrorDomain enumeration from libvirt/virterror.h:144 const ( fromNone ErrorDomain = iota fromXen ErrorDomain = 1 fromXend ErrorDomain = 2 fromXenstore ErrorDomain = 3 fromSexpr ErrorDomain = 4 fromXML ErrorDomain = 5 fromDom ErrorDomain = 6 fromRPC ErrorDomain = 7 fromProxy ErrorDomain = 8 fromConf ErrorDomain = 9 fromQemu ErrorDomain = 10 fromNet ErrorDomain = 11 fromTest ErrorDomain = 12 fromRemote ErrorDomain = 13 fromOpenvz ErrorDomain = 14 fromXenxm ErrorDomain = 15 fromStatsLinux ErrorDomain = 16 fromLxc ErrorDomain = 17 fromStorage ErrorDomain = 18 fromNetwork ErrorDomain = 19 fromDomain ErrorDomain = 20 fromUml ErrorDomain = 21 fromNodedev ErrorDomain = 22 fromXenInotify ErrorDomain = 23 fromSecurity ErrorDomain = 24 fromVbox ErrorDomain = 25 fromInterface ErrorDomain = 26 fromOne ErrorDomain = 27 fromEsx ErrorDomain = 28 fromPhyp ErrorDomain = 29 fromSecret ErrorDomain = 30 fromCPU ErrorDomain = 31 fromXenapi ErrorDomain = 32 fromNwfilter ErrorDomain = 33 fromHook ErrorDomain = 34 fromDomainSnapshot ErrorDomain = 35 fromAudit ErrorDomain = 36 fromSysinfo ErrorDomain = 37 fromStreams ErrorDomain = 38 fromVmware ErrorDomain = 39 fromEvent ErrorDomain = 40 fromLibxl ErrorDomain = 41 fromLocking ErrorDomain = 42 fromHyperv ErrorDomain = 43 fromCapabilities ErrorDomain = 44 fromURI ErrorDomain = 45 fromAuth ErrorDomain = 46 fromDbus ErrorDomain = 47 fromParallels ErrorDomain = 48 fromDevice ErrorDomain = 49 fromSSH ErrorDomain = 50 fromLockspace ErrorDomain = 51 fromInitctl ErrorDomain = 52 fromIdentity ErrorDomain = 53 fromCgroup ErrorDomain = 54 fromAccess ErrorDomain = 55 fromSystemd ErrorDomain = 56 fromBhyve ErrorDomain = 57 fromCrypto ErrorDomain = 58 fromFirewall ErrorDomain = 59 fromPolkit ErrorDomain = 60 fromThread ErrorDomain = 61 fromAdmin ErrorDomain = 62 fromLogging ErrorDomain = 63 fromXenxl ErrorDomain = 64 fromPerf ErrorDomain = 65 fromLibssh ErrorDomain = 66 fromResctrl ErrorDomain = 67 fromFirewalld ErrorDomain = 68 fromDomainCheckpoint ErrorDomain = 69 fromTpm ErrorDomain = 70 fromBpf ErrorDomain = 71 fromCh ErrorDomain = 72 ) // ErrorNumber as declared in libvirt/virterror.h:342 type ErrorNumber int32 // ErrorNumber enumeration from libvirt/virterror.h:342 const ( ErrOk ErrorNumber = iota ErrInternalError ErrorNumber = 1 ErrNoMemory ErrorNumber = 2 ErrNoSupport ErrorNumber = 3 ErrUnknownHost ErrorNumber = 4 ErrNoConnect ErrorNumber = 5 ErrInvalidConn ErrorNumber = 6 ErrInvalidDomain ErrorNumber = 7 ErrInvalidArg ErrorNumber = 8 ErrOperationFailed ErrorNumber = 9 ErrGetFailed ErrorNumber = 10 ErrPostFailed ErrorNumber = 11 ErrHTTPError ErrorNumber = 12 ErrSexprSerial ErrorNumber = 13 ErrNoXen ErrorNumber = 14 ErrXenCall ErrorNumber = 15 ErrOsType ErrorNumber = 16 ErrNoKernel ErrorNumber = 17 ErrNoRoot ErrorNumber = 18 ErrNoSource ErrorNumber = 19 ErrNoTarget ErrorNumber = 20 ErrNoName ErrorNumber = 21 ErrNoOs ErrorNumber = 22 ErrNoDevice ErrorNumber = 23 ErrNoXenstore ErrorNumber = 24 ErrDriverFull ErrorNumber = 25 ErrCallFailed ErrorNumber = 26 ErrXMLError ErrorNumber = 27 ErrDomExist ErrorNumber = 28 ErrOperationDenied ErrorNumber = 29 ErrOpenFailed ErrorNumber = 30 ErrReadFailed ErrorNumber = 31 ErrParseFailed ErrorNumber = 32 ErrConfSyntax ErrorNumber = 33 ErrWriteFailed ErrorNumber = 34 ErrXMLDetail ErrorNumber = 35 ErrInvalidNetwork ErrorNumber = 36 ErrNetworkExist ErrorNumber = 37 ErrSystemError ErrorNumber = 38 ErrRPC ErrorNumber = 39 ErrGnutlsError ErrorNumber = 40 WarNoNetwork ErrorNumber = 41 ErrNoDomain ErrorNumber = 42 ErrNoNetwork ErrorNumber = 43 ErrInvalidMac ErrorNumber = 44 ErrAuthFailed ErrorNumber = 45 ErrInvalidStoragePool ErrorNumber = 46 ErrInvalidStorageVol ErrorNumber = 47 WarNoStorage ErrorNumber = 48 ErrNoStoragePool ErrorNumber = 49 ErrNoStorageVol ErrorNumber = 50 WarNoNode ErrorNumber = 51 ErrInvalidNodeDevice ErrorNumber = 52 ErrNoNodeDevice ErrorNumber = 53 ErrNoSecurityModel ErrorNumber = 54 ErrOperationInvalid ErrorNumber = 55 WarNoInterface ErrorNumber = 56 ErrNoInterface ErrorNumber = 57 ErrInvalidInterface ErrorNumber = 58 ErrMultipleInterfaces ErrorNumber = 59 WarNoNwfilter ErrorNumber = 60 ErrInvalidNwfilter ErrorNumber = 61 ErrNoNwfilter ErrorNumber = 62 ErrBuildFirewall ErrorNumber = 63 WarNoSecret ErrorNumber = 64 ErrInvalidSecret ErrorNumber = 65 ErrNoSecret ErrorNumber = 66 ErrConfigUnsupported ErrorNumber = 67 ErrOperationTimeout ErrorNumber = 68 ErrMigratePersistFailed ErrorNumber = 69 ErrHookScriptFailed ErrorNumber = 70 ErrInvalidDomainSnapshot ErrorNumber = 71 ErrNoDomainSnapshot ErrorNumber = 72 ErrInvalidStream ErrorNumber = 73 ErrArgumentUnsupported ErrorNumber = 74 ErrStorageProbeFailed ErrorNumber = 75 ErrStoragePoolBuilt ErrorNumber = 76 ErrSnapshotRevertRisky ErrorNumber = 77 ErrOperationAborted ErrorNumber = 78 ErrAuthCancelled ErrorNumber = 79 ErrNoDomainMetadata ErrorNumber = 80 ErrMigrateUnsafe ErrorNumber = 81 ErrOverflow ErrorNumber = 82 ErrBlockCopyActive ErrorNumber = 83 ErrOperationUnsupported ErrorNumber = 84 ErrSSH ErrorNumber = 85 ErrAgentUnresponsive ErrorNumber = 86 ErrResourceBusy ErrorNumber = 87 ErrAccessDenied ErrorNumber = 88 ErrDbusService ErrorNumber = 89 ErrStorageVolExist ErrorNumber = 90 ErrCPUIncompatible ErrorNumber = 91 ErrXMLInvalidSchema ErrorNumber = 92 ErrMigrateFinishOk ErrorNumber = 93 ErrAuthUnavailable ErrorNumber = 94 ErrNoServer ErrorNumber = 95 ErrNoClient ErrorNumber = 96 ErrAgentUnsynced ErrorNumber = 97 ErrLibssh ErrorNumber = 98 ErrDeviceMissing ErrorNumber = 99 ErrInvalidNwfilterBinding ErrorNumber = 100 ErrNoNwfilterBinding ErrorNumber = 101 ErrInvalidDomainCheckpoint ErrorNumber = 102 ErrNoDomainCheckpoint ErrorNumber = 103 ErrNoDomainBackup ErrorNumber = 104 ErrInvalidNetworkPort ErrorNumber = 105 ErrNetworkPortExist ErrorNumber = 106 ErrNoNetworkPort ErrorNumber = 107 ErrNoHostname ErrorNumber = 108 ErrCheckpointInconsistent ErrorNumber = 109 ErrMultipleDomains ErrorNumber = 110 ) golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/doc.go000066400000000000000000000035371463537555000245750ustar00rootroot00000000000000// Copyright 2016 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Package libvirt is a pure Go interface to libvirt. // // Rather than using Libvirt's C bindings, this package makes use of Libvirt's // RPC interface, as documented here: https://libvirt.org/internals/rpc.html. // Connections to the libvirt server may be local, or remote. RPC packets are // encoded using the XDR standard as defined by RFC 4506. // // Example usage: // // package main // // import ( // "fmt" // "log" // "net" // "net/url" // "time" // // "github.com/digitalocean/go-libvirt" // ) // // func main() { // uri, _ := url.Parse(string(libvirt.QEMUSystem)) // l, err := libvirt.ConnectToURI(uri) // if err != nil { // log.Fatalf("failed to connect: %v", err) // } // // v, err := l.Version() // if err != nil { // log.Fatalf("failed to retrieve libvirt version: %v", err) // } // fmt.Println("Version:", v) // // domains, err := l.Domains() // if err != nil { // log.Fatalf("failed to retrieve domains: %v", err) // } // // fmt.Println("ID\tName\t\tUUID") // fmt.Printf("--------------------------------------------------------\n") // for _, d := range domains { // fmt.Printf("%d\t%s\t%x\n", d.ID, d.Name, d.UUID) // } // // if err := l.Disconnect(); err != nil { // log.Fatalf("failed to disconnect: %v", err) // } // } package libvirt golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/go.mod000066400000000000000000000005261463537555000246020ustar00rootroot00000000000000module github.com/digitalocean/go-libvirt go 1.21 require ( github.com/stretchr/testify v1.9.0 golang.org/x/crypto v0.24.0 golang.org/x/tools v0.22.0 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/sys v0.21.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/go.sum000066400000000000000000000034231463537555000246260ustar00rootroot00000000000000github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/mod v0.18.0 h1:5+9lSbEzPSdWkH32vYPBwEpX8KwDbM52Ud9xBUvNlb0= golang.org/x/mod v0.18.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= golang.org/x/tools v0.22.0 h1:gqSGLZqv+AI9lIQzniJ0nZDRG5GBPsSi+DRNHWNz6yA= golang.org/x/tools v0.22.0/go.mod h1:aCwcsjqvq7Yqt6TNyX7QMU2enbQ/Gt0bo6krSeEri+c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/000077500000000000000000000000001463537555000253055ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/constants/000077500000000000000000000000001463537555000273215ustar00rootroot00000000000000qemu_protocol.gen.go000066400000000000000000000034771463537555000332440ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/constants// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Code generated by internal/lvgen/generate.go. DO NOT EDIT. // // To regenerate, run 'go generate' in internal/lvgen. // package constants // These are libvirt procedure numbers which correspond to each respective // API call between remote_internal driver and libvirtd. Each procedure is // identified by a unique number. const ( // From enums: // QEMUProcDomainMonitorCommand is libvirt's QEMU_PROC_DOMAIN_MONITOR_COMMAND QEMUProcDomainMonitorCommand = 1 // QEMUProcDomainAttach is libvirt's QEMU_PROC_DOMAIN_ATTACH QEMUProcDomainAttach = 2 // QEMUProcDomainAgentCommand is libvirt's QEMU_PROC_DOMAIN_AGENT_COMMAND QEMUProcDomainAgentCommand = 3 // QEMUProcConnectDomainMonitorEventRegister is libvirt's QEMU_PROC_CONNECT_DOMAIN_MONITOR_EVENT_REGISTER QEMUProcConnectDomainMonitorEventRegister = 4 // QEMUProcConnectDomainMonitorEventDeregister is libvirt's QEMU_PROC_CONNECT_DOMAIN_MONITOR_EVENT_DEREGISTER QEMUProcConnectDomainMonitorEventDeregister = 5 // QEMUProcDomainMonitorEvent is libvirt's QEMU_PROC_DOMAIN_MONITOR_EVENT QEMUProcDomainMonitorEvent = 6 // From consts: // QEMUProgram is libvirt's QEMU_PROGRAM QEMUProgram = 0x20008087 // QEMUProtocolVersion is libvirt's QEMU_PROTOCOL_VERSION QEMUProtocolVersion = 1 ) remote_protocol.gen.go000066400000000000000000001600661463537555000335660ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/constants// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Code generated by internal/lvgen/generate.go. DO NOT EDIT. // // To regenerate, run 'go generate' in internal/lvgen. // package constants // These are libvirt procedure numbers which correspond to each respective // API call between remote_internal driver and libvirtd. Each procedure is // identified by a unique number. const ( // From enums: // AuthNone is libvirt's REMOTE_AUTH_NONE AuthNone = 0 // AuthSasl is libvirt's REMOTE_AUTH_SASL AuthSasl = 1 // AuthPolkit is libvirt's REMOTE_AUTH_POLKIT AuthPolkit = 2 // ProcConnectOpen is libvirt's REMOTE_PROC_CONNECT_OPEN ProcConnectOpen = 1 // ProcConnectClose is libvirt's REMOTE_PROC_CONNECT_CLOSE ProcConnectClose = 2 // ProcConnectGetType is libvirt's REMOTE_PROC_CONNECT_GET_TYPE ProcConnectGetType = 3 // ProcConnectGetVersion is libvirt's REMOTE_PROC_CONNECT_GET_VERSION ProcConnectGetVersion = 4 // ProcConnectGetMaxVcpus is libvirt's REMOTE_PROC_CONNECT_GET_MAX_VCPUS ProcConnectGetMaxVcpus = 5 // ProcNodeGetInfo is libvirt's REMOTE_PROC_NODE_GET_INFO ProcNodeGetInfo = 6 // ProcConnectGetCapabilities is libvirt's REMOTE_PROC_CONNECT_GET_CAPABILITIES ProcConnectGetCapabilities = 7 // ProcDomainAttachDevice is libvirt's REMOTE_PROC_DOMAIN_ATTACH_DEVICE ProcDomainAttachDevice = 8 // ProcDomainCreate is libvirt's REMOTE_PROC_DOMAIN_CREATE ProcDomainCreate = 9 // ProcDomainCreateXML is libvirt's REMOTE_PROC_DOMAIN_CREATE_XML ProcDomainCreateXML = 10 // ProcDomainDefineXML is libvirt's REMOTE_PROC_DOMAIN_DEFINE_XML ProcDomainDefineXML = 11 // ProcDomainDestroy is libvirt's REMOTE_PROC_DOMAIN_DESTROY ProcDomainDestroy = 12 // ProcDomainDetachDevice is libvirt's REMOTE_PROC_DOMAIN_DETACH_DEVICE ProcDomainDetachDevice = 13 // ProcDomainGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_GET_XML_DESC ProcDomainGetXMLDesc = 14 // ProcDomainGetAutostart is libvirt's REMOTE_PROC_DOMAIN_GET_AUTOSTART ProcDomainGetAutostart = 15 // ProcDomainGetInfo is libvirt's REMOTE_PROC_DOMAIN_GET_INFO ProcDomainGetInfo = 16 // ProcDomainGetMaxMemory is libvirt's REMOTE_PROC_DOMAIN_GET_MAX_MEMORY ProcDomainGetMaxMemory = 17 // ProcDomainGetMaxVcpus is libvirt's REMOTE_PROC_DOMAIN_GET_MAX_VCPUS ProcDomainGetMaxVcpus = 18 // ProcDomainGetOsType is libvirt's REMOTE_PROC_DOMAIN_GET_OS_TYPE ProcDomainGetOsType = 19 // ProcDomainGetVcpus is libvirt's REMOTE_PROC_DOMAIN_GET_VCPUS ProcDomainGetVcpus = 20 // ProcConnectListDefinedDomains is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_DOMAINS ProcConnectListDefinedDomains = 21 // ProcDomainLookupByID is libvirt's REMOTE_PROC_DOMAIN_LOOKUP_BY_ID ProcDomainLookupByID = 22 // ProcDomainLookupByName is libvirt's REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME ProcDomainLookupByName = 23 // ProcDomainLookupByUUID is libvirt's REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID ProcDomainLookupByUUID = 24 // ProcConnectNumOfDefinedDomains is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_DOMAINS ProcConnectNumOfDefinedDomains = 25 // ProcDomainPinVcpu is libvirt's REMOTE_PROC_DOMAIN_PIN_VCPU ProcDomainPinVcpu = 26 // ProcDomainReboot is libvirt's REMOTE_PROC_DOMAIN_REBOOT ProcDomainReboot = 27 // ProcDomainResume is libvirt's REMOTE_PROC_DOMAIN_RESUME ProcDomainResume = 28 // ProcDomainSetAutostart is libvirt's REMOTE_PROC_DOMAIN_SET_AUTOSTART ProcDomainSetAutostart = 29 // ProcDomainSetMaxMemory is libvirt's REMOTE_PROC_DOMAIN_SET_MAX_MEMORY ProcDomainSetMaxMemory = 30 // ProcDomainSetMemory is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY ProcDomainSetMemory = 31 // ProcDomainSetVcpus is libvirt's REMOTE_PROC_DOMAIN_SET_VCPUS ProcDomainSetVcpus = 32 // ProcDomainShutdown is libvirt's REMOTE_PROC_DOMAIN_SHUTDOWN ProcDomainShutdown = 33 // ProcDomainSuspend is libvirt's REMOTE_PROC_DOMAIN_SUSPEND ProcDomainSuspend = 34 // ProcDomainUndefine is libvirt's REMOTE_PROC_DOMAIN_UNDEFINE ProcDomainUndefine = 35 // ProcConnectListDefinedNetworks is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_NETWORKS ProcConnectListDefinedNetworks = 36 // ProcConnectListDomains is libvirt's REMOTE_PROC_CONNECT_LIST_DOMAINS ProcConnectListDomains = 37 // ProcConnectListNetworks is libvirt's REMOTE_PROC_CONNECT_LIST_NETWORKS ProcConnectListNetworks = 38 // ProcNetworkCreate is libvirt's REMOTE_PROC_NETWORK_CREATE ProcNetworkCreate = 39 // ProcNetworkCreateXML is libvirt's REMOTE_PROC_NETWORK_CREATE_XML ProcNetworkCreateXML = 40 // ProcNetworkDefineXML is libvirt's REMOTE_PROC_NETWORK_DEFINE_XML ProcNetworkDefineXML = 41 // ProcNetworkDestroy is libvirt's REMOTE_PROC_NETWORK_DESTROY ProcNetworkDestroy = 42 // ProcNetworkGetXMLDesc is libvirt's REMOTE_PROC_NETWORK_GET_XML_DESC ProcNetworkGetXMLDesc = 43 // ProcNetworkGetAutostart is libvirt's REMOTE_PROC_NETWORK_GET_AUTOSTART ProcNetworkGetAutostart = 44 // ProcNetworkGetBridgeName is libvirt's REMOTE_PROC_NETWORK_GET_BRIDGE_NAME ProcNetworkGetBridgeName = 45 // ProcNetworkLookupByName is libvirt's REMOTE_PROC_NETWORK_LOOKUP_BY_NAME ProcNetworkLookupByName = 46 // ProcNetworkLookupByUUID is libvirt's REMOTE_PROC_NETWORK_LOOKUP_BY_UUID ProcNetworkLookupByUUID = 47 // ProcNetworkSetAutostart is libvirt's REMOTE_PROC_NETWORK_SET_AUTOSTART ProcNetworkSetAutostart = 48 // ProcNetworkUndefine is libvirt's REMOTE_PROC_NETWORK_UNDEFINE ProcNetworkUndefine = 49 // ProcConnectNumOfDefinedNetworks is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_NETWORKS ProcConnectNumOfDefinedNetworks = 50 // ProcConnectNumOfDomains is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DOMAINS ProcConnectNumOfDomains = 51 // ProcConnectNumOfNetworks is libvirt's REMOTE_PROC_CONNECT_NUM_OF_NETWORKS ProcConnectNumOfNetworks = 52 // ProcDomainCoreDump is libvirt's REMOTE_PROC_DOMAIN_CORE_DUMP ProcDomainCoreDump = 53 // ProcDomainRestore is libvirt's REMOTE_PROC_DOMAIN_RESTORE ProcDomainRestore = 54 // ProcDomainSave is libvirt's REMOTE_PROC_DOMAIN_SAVE ProcDomainSave = 55 // ProcDomainGetSchedulerType is libvirt's REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE ProcDomainGetSchedulerType = 56 // ProcDomainGetSchedulerParameters is libvirt's REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS ProcDomainGetSchedulerParameters = 57 // ProcDomainSetSchedulerParameters is libvirt's REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS ProcDomainSetSchedulerParameters = 58 // ProcConnectGetHostname is libvirt's REMOTE_PROC_CONNECT_GET_HOSTNAME ProcConnectGetHostname = 59 // ProcConnectSupportsFeature is libvirt's REMOTE_PROC_CONNECT_SUPPORTS_FEATURE ProcConnectSupportsFeature = 60 // ProcDomainMigratePrepare is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE ProcDomainMigratePrepare = 61 // ProcDomainMigratePerform is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PERFORM ProcDomainMigratePerform = 62 // ProcDomainMigrateFinish is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH ProcDomainMigrateFinish = 63 // ProcDomainBlockStats is libvirt's REMOTE_PROC_DOMAIN_BLOCK_STATS ProcDomainBlockStats = 64 // ProcDomainInterfaceStats is libvirt's REMOTE_PROC_DOMAIN_INTERFACE_STATS ProcDomainInterfaceStats = 65 // ProcAuthList is libvirt's REMOTE_PROC_AUTH_LIST ProcAuthList = 66 // ProcAuthSaslInit is libvirt's REMOTE_PROC_AUTH_SASL_INIT ProcAuthSaslInit = 67 // ProcAuthSaslStart is libvirt's REMOTE_PROC_AUTH_SASL_START ProcAuthSaslStart = 68 // ProcAuthSaslStep is libvirt's REMOTE_PROC_AUTH_SASL_STEP ProcAuthSaslStep = 69 // ProcAuthPolkit is libvirt's REMOTE_PROC_AUTH_POLKIT ProcAuthPolkit = 70 // ProcConnectNumOfStoragePools is libvirt's REMOTE_PROC_CONNECT_NUM_OF_STORAGE_POOLS ProcConnectNumOfStoragePools = 71 // ProcConnectListStoragePools is libvirt's REMOTE_PROC_CONNECT_LIST_STORAGE_POOLS ProcConnectListStoragePools = 72 // ProcConnectNumOfDefinedStoragePools is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_STORAGE_POOLS ProcConnectNumOfDefinedStoragePools = 73 // ProcConnectListDefinedStoragePools is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_STORAGE_POOLS ProcConnectListDefinedStoragePools = 74 // ProcConnectFindStoragePoolSources is libvirt's REMOTE_PROC_CONNECT_FIND_STORAGE_POOL_SOURCES ProcConnectFindStoragePoolSources = 75 // ProcStoragePoolCreateXML is libvirt's REMOTE_PROC_STORAGE_POOL_CREATE_XML ProcStoragePoolCreateXML = 76 // ProcStoragePoolDefineXML is libvirt's REMOTE_PROC_STORAGE_POOL_DEFINE_XML ProcStoragePoolDefineXML = 77 // ProcStoragePoolCreate is libvirt's REMOTE_PROC_STORAGE_POOL_CREATE ProcStoragePoolCreate = 78 // ProcStoragePoolBuild is libvirt's REMOTE_PROC_STORAGE_POOL_BUILD ProcStoragePoolBuild = 79 // ProcStoragePoolDestroy is libvirt's REMOTE_PROC_STORAGE_POOL_DESTROY ProcStoragePoolDestroy = 80 // ProcStoragePoolDelete is libvirt's REMOTE_PROC_STORAGE_POOL_DELETE ProcStoragePoolDelete = 81 // ProcStoragePoolUndefine is libvirt's REMOTE_PROC_STORAGE_POOL_UNDEFINE ProcStoragePoolUndefine = 82 // ProcStoragePoolRefresh is libvirt's REMOTE_PROC_STORAGE_POOL_REFRESH ProcStoragePoolRefresh = 83 // ProcStoragePoolLookupByName is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME ProcStoragePoolLookupByName = 84 // ProcStoragePoolLookupByUUID is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID ProcStoragePoolLookupByUUID = 85 // ProcStoragePoolLookupByVolume is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME ProcStoragePoolLookupByVolume = 86 // ProcStoragePoolGetInfo is libvirt's REMOTE_PROC_STORAGE_POOL_GET_INFO ProcStoragePoolGetInfo = 87 // ProcStoragePoolGetXMLDesc is libvirt's REMOTE_PROC_STORAGE_POOL_GET_XML_DESC ProcStoragePoolGetXMLDesc = 88 // ProcStoragePoolGetAutostart is libvirt's REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART ProcStoragePoolGetAutostart = 89 // ProcStoragePoolSetAutostart is libvirt's REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART ProcStoragePoolSetAutostart = 90 // ProcStoragePoolNumOfVolumes is libvirt's REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES ProcStoragePoolNumOfVolumes = 91 // ProcStoragePoolListVolumes is libvirt's REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES ProcStoragePoolListVolumes = 92 // ProcStorageVolCreateXML is libvirt's REMOTE_PROC_STORAGE_VOL_CREATE_XML ProcStorageVolCreateXML = 93 // ProcStorageVolDelete is libvirt's REMOTE_PROC_STORAGE_VOL_DELETE ProcStorageVolDelete = 94 // ProcStorageVolLookupByName is libvirt's REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME ProcStorageVolLookupByName = 95 // ProcStorageVolLookupByKey is libvirt's REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY ProcStorageVolLookupByKey = 96 // ProcStorageVolLookupByPath is libvirt's REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH ProcStorageVolLookupByPath = 97 // ProcStorageVolGetInfo is libvirt's REMOTE_PROC_STORAGE_VOL_GET_INFO ProcStorageVolGetInfo = 98 // ProcStorageVolGetXMLDesc is libvirt's REMOTE_PROC_STORAGE_VOL_GET_XML_DESC ProcStorageVolGetXMLDesc = 99 // ProcStorageVolGetPath is libvirt's REMOTE_PROC_STORAGE_VOL_GET_PATH ProcStorageVolGetPath = 100 // ProcNodeGetCellsFreeMemory is libvirt's REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY ProcNodeGetCellsFreeMemory = 101 // ProcNodeGetFreeMemory is libvirt's REMOTE_PROC_NODE_GET_FREE_MEMORY ProcNodeGetFreeMemory = 102 // ProcDomainBlockPeek is libvirt's REMOTE_PROC_DOMAIN_BLOCK_PEEK ProcDomainBlockPeek = 103 // ProcDomainMemoryPeek is libvirt's REMOTE_PROC_DOMAIN_MEMORY_PEEK ProcDomainMemoryPeek = 104 // ProcConnectDomainEventRegister is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER ProcConnectDomainEventRegister = 105 // ProcConnectDomainEventDeregister is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER ProcConnectDomainEventDeregister = 106 // ProcDomainEventLifecycle is libvirt's REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE ProcDomainEventLifecycle = 107 // ProcDomainMigratePrepare2 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2 ProcDomainMigratePrepare2 = 108 // ProcDomainMigrateFinish2 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH2 ProcDomainMigrateFinish2 = 109 // ProcConnectGetUri is libvirt's REMOTE_PROC_CONNECT_GET_URI ProcConnectGetUri = 110 // ProcNodeNumOfDevices is libvirt's REMOTE_PROC_NODE_NUM_OF_DEVICES ProcNodeNumOfDevices = 111 // ProcNodeListDevices is libvirt's REMOTE_PROC_NODE_LIST_DEVICES ProcNodeListDevices = 112 // ProcNodeDeviceLookupByName is libvirt's REMOTE_PROC_NODE_DEVICE_LOOKUP_BY_NAME ProcNodeDeviceLookupByName = 113 // ProcNodeDeviceGetXMLDesc is libvirt's REMOTE_PROC_NODE_DEVICE_GET_XML_DESC ProcNodeDeviceGetXMLDesc = 114 // ProcNodeDeviceGetParent is libvirt's REMOTE_PROC_NODE_DEVICE_GET_PARENT ProcNodeDeviceGetParent = 115 // ProcNodeDeviceNumOfCaps is libvirt's REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS ProcNodeDeviceNumOfCaps = 116 // ProcNodeDeviceListCaps is libvirt's REMOTE_PROC_NODE_DEVICE_LIST_CAPS ProcNodeDeviceListCaps = 117 // ProcNodeDeviceDettach is libvirt's REMOTE_PROC_NODE_DEVICE_DETTACH ProcNodeDeviceDettach = 118 // ProcNodeDeviceReAttach is libvirt's REMOTE_PROC_NODE_DEVICE_RE_ATTACH ProcNodeDeviceReAttach = 119 // ProcNodeDeviceReset is libvirt's REMOTE_PROC_NODE_DEVICE_RESET ProcNodeDeviceReset = 120 // ProcDomainGetSecurityLabel is libvirt's REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL ProcDomainGetSecurityLabel = 121 // ProcNodeGetSecurityModel is libvirt's REMOTE_PROC_NODE_GET_SECURITY_MODEL ProcNodeGetSecurityModel = 122 // ProcNodeDeviceCreateXML is libvirt's REMOTE_PROC_NODE_DEVICE_CREATE_XML ProcNodeDeviceCreateXML = 123 // ProcNodeDeviceDestroy is libvirt's REMOTE_PROC_NODE_DEVICE_DESTROY ProcNodeDeviceDestroy = 124 // ProcStorageVolCreateXMLFrom is libvirt's REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM ProcStorageVolCreateXMLFrom = 125 // ProcConnectNumOfInterfaces is libvirt's REMOTE_PROC_CONNECT_NUM_OF_INTERFACES ProcConnectNumOfInterfaces = 126 // ProcConnectListInterfaces is libvirt's REMOTE_PROC_CONNECT_LIST_INTERFACES ProcConnectListInterfaces = 127 // ProcInterfaceLookupByName is libvirt's REMOTE_PROC_INTERFACE_LOOKUP_BY_NAME ProcInterfaceLookupByName = 128 // ProcInterfaceLookupByMacString is libvirt's REMOTE_PROC_INTERFACE_LOOKUP_BY_MAC_STRING ProcInterfaceLookupByMacString = 129 // ProcInterfaceGetXMLDesc is libvirt's REMOTE_PROC_INTERFACE_GET_XML_DESC ProcInterfaceGetXMLDesc = 130 // ProcInterfaceDefineXML is libvirt's REMOTE_PROC_INTERFACE_DEFINE_XML ProcInterfaceDefineXML = 131 // ProcInterfaceUndefine is libvirt's REMOTE_PROC_INTERFACE_UNDEFINE ProcInterfaceUndefine = 132 // ProcInterfaceCreate is libvirt's REMOTE_PROC_INTERFACE_CREATE ProcInterfaceCreate = 133 // ProcInterfaceDestroy is libvirt's REMOTE_PROC_INTERFACE_DESTROY ProcInterfaceDestroy = 134 // ProcConnectDomainXMLFromNative is libvirt's REMOTE_PROC_CONNECT_DOMAIN_XML_FROM_NATIVE ProcConnectDomainXMLFromNative = 135 // ProcConnectDomainXMLToNative is libvirt's REMOTE_PROC_CONNECT_DOMAIN_XML_TO_NATIVE ProcConnectDomainXMLToNative = 136 // ProcConnectNumOfDefinedInterfaces is libvirt's REMOTE_PROC_CONNECT_NUM_OF_DEFINED_INTERFACES ProcConnectNumOfDefinedInterfaces = 137 // ProcConnectListDefinedInterfaces is libvirt's REMOTE_PROC_CONNECT_LIST_DEFINED_INTERFACES ProcConnectListDefinedInterfaces = 138 // ProcConnectNumOfSecrets is libvirt's REMOTE_PROC_CONNECT_NUM_OF_SECRETS ProcConnectNumOfSecrets = 139 // ProcConnectListSecrets is libvirt's REMOTE_PROC_CONNECT_LIST_SECRETS ProcConnectListSecrets = 140 // ProcSecretLookupByUUID is libvirt's REMOTE_PROC_SECRET_LOOKUP_BY_UUID ProcSecretLookupByUUID = 141 // ProcSecretDefineXML is libvirt's REMOTE_PROC_SECRET_DEFINE_XML ProcSecretDefineXML = 142 // ProcSecretGetXMLDesc is libvirt's REMOTE_PROC_SECRET_GET_XML_DESC ProcSecretGetXMLDesc = 143 // ProcSecretSetValue is libvirt's REMOTE_PROC_SECRET_SET_VALUE ProcSecretSetValue = 144 // ProcSecretGetValue is libvirt's REMOTE_PROC_SECRET_GET_VALUE ProcSecretGetValue = 145 // ProcSecretUndefine is libvirt's REMOTE_PROC_SECRET_UNDEFINE ProcSecretUndefine = 146 // ProcSecretLookupByUsage is libvirt's REMOTE_PROC_SECRET_LOOKUP_BY_USAGE ProcSecretLookupByUsage = 147 // ProcDomainMigratePrepareTunnel is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL ProcDomainMigratePrepareTunnel = 148 // ProcConnectIsSecure is libvirt's REMOTE_PROC_CONNECT_IS_SECURE ProcConnectIsSecure = 149 // ProcDomainIsActive is libvirt's REMOTE_PROC_DOMAIN_IS_ACTIVE ProcDomainIsActive = 150 // ProcDomainIsPersistent is libvirt's REMOTE_PROC_DOMAIN_IS_PERSISTENT ProcDomainIsPersistent = 151 // ProcNetworkIsActive is libvirt's REMOTE_PROC_NETWORK_IS_ACTIVE ProcNetworkIsActive = 152 // ProcNetworkIsPersistent is libvirt's REMOTE_PROC_NETWORK_IS_PERSISTENT ProcNetworkIsPersistent = 153 // ProcStoragePoolIsActive is libvirt's REMOTE_PROC_STORAGE_POOL_IS_ACTIVE ProcStoragePoolIsActive = 154 // ProcStoragePoolIsPersistent is libvirt's REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT ProcStoragePoolIsPersistent = 155 // ProcInterfaceIsActive is libvirt's REMOTE_PROC_INTERFACE_IS_ACTIVE ProcInterfaceIsActive = 156 // ProcConnectGetLibVersion is libvirt's REMOTE_PROC_CONNECT_GET_LIB_VERSION ProcConnectGetLibVersion = 157 // ProcConnectCompareCPU is libvirt's REMOTE_PROC_CONNECT_COMPARE_CPU ProcConnectCompareCPU = 158 // ProcDomainMemoryStats is libvirt's REMOTE_PROC_DOMAIN_MEMORY_STATS ProcDomainMemoryStats = 159 // ProcDomainAttachDeviceFlags is libvirt's REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS ProcDomainAttachDeviceFlags = 160 // ProcDomainDetachDeviceFlags is libvirt's REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS ProcDomainDetachDeviceFlags = 161 // ProcConnectBaselineCPU is libvirt's REMOTE_PROC_CONNECT_BASELINE_CPU ProcConnectBaselineCPU = 162 // ProcDomainGetJobInfo is libvirt's REMOTE_PROC_DOMAIN_GET_JOB_INFO ProcDomainGetJobInfo = 163 // ProcDomainAbortJob is libvirt's REMOTE_PROC_DOMAIN_ABORT_JOB ProcDomainAbortJob = 164 // ProcStorageVolWipe is libvirt's REMOTE_PROC_STORAGE_VOL_WIPE ProcStorageVolWipe = 165 // ProcDomainMigrateSetMaxDowntime is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME ProcDomainMigrateSetMaxDowntime = 166 // ProcConnectDomainEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY ProcConnectDomainEventRegisterAny = 167 // ProcConnectDomainEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER_ANY ProcConnectDomainEventDeregisterAny = 168 // ProcDomainEventReboot is libvirt's REMOTE_PROC_DOMAIN_EVENT_REBOOT ProcDomainEventReboot = 169 // ProcDomainEventRtcChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE ProcDomainEventRtcChange = 170 // ProcDomainEventWatchdog is libvirt's REMOTE_PROC_DOMAIN_EVENT_WATCHDOG ProcDomainEventWatchdog = 171 // ProcDomainEventIOError is libvirt's REMOTE_PROC_DOMAIN_EVENT_IO_ERROR ProcDomainEventIOError = 172 // ProcDomainEventGraphics is libvirt's REMOTE_PROC_DOMAIN_EVENT_GRAPHICS ProcDomainEventGraphics = 173 // ProcDomainUpdateDeviceFlags is libvirt's REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS ProcDomainUpdateDeviceFlags = 174 // ProcNwfilterLookupByName is libvirt's REMOTE_PROC_NWFILTER_LOOKUP_BY_NAME ProcNwfilterLookupByName = 175 // ProcNwfilterLookupByUUID is libvirt's REMOTE_PROC_NWFILTER_LOOKUP_BY_UUID ProcNwfilterLookupByUUID = 176 // ProcNwfilterGetXMLDesc is libvirt's REMOTE_PROC_NWFILTER_GET_XML_DESC ProcNwfilterGetXMLDesc = 177 // ProcConnectNumOfNwfilters is libvirt's REMOTE_PROC_CONNECT_NUM_OF_NWFILTERS ProcConnectNumOfNwfilters = 178 // ProcConnectListNwfilters is libvirt's REMOTE_PROC_CONNECT_LIST_NWFILTERS ProcConnectListNwfilters = 179 // ProcNwfilterDefineXML is libvirt's REMOTE_PROC_NWFILTER_DEFINE_XML ProcNwfilterDefineXML = 180 // ProcNwfilterUndefine is libvirt's REMOTE_PROC_NWFILTER_UNDEFINE ProcNwfilterUndefine = 181 // ProcDomainManagedSave is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE ProcDomainManagedSave = 182 // ProcDomainHasManagedSaveImage is libvirt's REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE ProcDomainHasManagedSaveImage = 183 // ProcDomainManagedSaveRemove is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE ProcDomainManagedSaveRemove = 184 // ProcDomainSnapshotCreateXML is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML ProcDomainSnapshotCreateXML = 185 // ProcDomainSnapshotGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_GET_XML_DESC ProcDomainSnapshotGetXMLDesc = 186 // ProcDomainSnapshotNum is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_NUM ProcDomainSnapshotNum = 187 // ProcDomainSnapshotListNames is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_NAMES ProcDomainSnapshotListNames = 188 // ProcDomainSnapshotLookupByName is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LOOKUP_BY_NAME ProcDomainSnapshotLookupByName = 189 // ProcDomainHasCurrentSnapshot is libvirt's REMOTE_PROC_DOMAIN_HAS_CURRENT_SNAPSHOT ProcDomainHasCurrentSnapshot = 190 // ProcDomainSnapshotCurrent is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT ProcDomainSnapshotCurrent = 191 // ProcDomainRevertToSnapshot is libvirt's REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT ProcDomainRevertToSnapshot = 192 // ProcDomainSnapshotDelete is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE ProcDomainSnapshotDelete = 193 // ProcDomainGetBlockInfo is libvirt's REMOTE_PROC_DOMAIN_GET_BLOCK_INFO ProcDomainGetBlockInfo = 194 // ProcDomainEventIOErrorReason is libvirt's REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON ProcDomainEventIOErrorReason = 195 // ProcDomainCreateWithFlags is libvirt's REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS ProcDomainCreateWithFlags = 196 // ProcDomainSetMemoryParameters is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS ProcDomainSetMemoryParameters = 197 // ProcDomainGetMemoryParameters is libvirt's REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS ProcDomainGetMemoryParameters = 198 // ProcDomainSetVcpusFlags is libvirt's REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS ProcDomainSetVcpusFlags = 199 // ProcDomainGetVcpusFlags is libvirt's REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS ProcDomainGetVcpusFlags = 200 // ProcDomainOpenConsole is libvirt's REMOTE_PROC_DOMAIN_OPEN_CONSOLE ProcDomainOpenConsole = 201 // ProcDomainIsUpdated is libvirt's REMOTE_PROC_DOMAIN_IS_UPDATED ProcDomainIsUpdated = 202 // ProcConnectGetSysinfo is libvirt's REMOTE_PROC_CONNECT_GET_SYSINFO ProcConnectGetSysinfo = 203 // ProcDomainSetMemoryFlags is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS ProcDomainSetMemoryFlags = 204 // ProcDomainSetBlkioParameters is libvirt's REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS ProcDomainSetBlkioParameters = 205 // ProcDomainGetBlkioParameters is libvirt's REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS ProcDomainGetBlkioParameters = 206 // ProcDomainMigrateSetMaxSpeed is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED ProcDomainMigrateSetMaxSpeed = 207 // ProcStorageVolUpload is libvirt's REMOTE_PROC_STORAGE_VOL_UPLOAD ProcStorageVolUpload = 208 // ProcStorageVolDownload is libvirt's REMOTE_PROC_STORAGE_VOL_DOWNLOAD ProcStorageVolDownload = 209 // ProcDomainInjectNmi is libvirt's REMOTE_PROC_DOMAIN_INJECT_NMI ProcDomainInjectNmi = 210 // ProcDomainScreenshot is libvirt's REMOTE_PROC_DOMAIN_SCREENSHOT ProcDomainScreenshot = 211 // ProcDomainGetState is libvirt's REMOTE_PROC_DOMAIN_GET_STATE ProcDomainGetState = 212 // ProcDomainMigrateBegin3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3 ProcDomainMigrateBegin3 = 213 // ProcDomainMigratePrepare3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3 ProcDomainMigratePrepare3 = 214 // ProcDomainMigratePrepareTunnel3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3 ProcDomainMigratePrepareTunnel3 = 215 // ProcDomainMigratePerform3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3 ProcDomainMigratePerform3 = 216 // ProcDomainMigrateFinish3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH3 ProcDomainMigrateFinish3 = 217 // ProcDomainMigrateConfirm3 is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3 ProcDomainMigrateConfirm3 = 218 // ProcDomainSetSchedulerParametersFlags is libvirt's REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS ProcDomainSetSchedulerParametersFlags = 219 // ProcInterfaceChangeBegin is libvirt's REMOTE_PROC_INTERFACE_CHANGE_BEGIN ProcInterfaceChangeBegin = 220 // ProcInterfaceChangeCommit is libvirt's REMOTE_PROC_INTERFACE_CHANGE_COMMIT ProcInterfaceChangeCommit = 221 // ProcInterfaceChangeRollback is libvirt's REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK ProcInterfaceChangeRollback = 222 // ProcDomainGetSchedulerParametersFlags is libvirt's REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS ProcDomainGetSchedulerParametersFlags = 223 // ProcDomainEventControlError is libvirt's REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR ProcDomainEventControlError = 224 // ProcDomainPinVcpuFlags is libvirt's REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS ProcDomainPinVcpuFlags = 225 // ProcDomainSendKey is libvirt's REMOTE_PROC_DOMAIN_SEND_KEY ProcDomainSendKey = 226 // ProcNodeGetCPUStats is libvirt's REMOTE_PROC_NODE_GET_CPU_STATS ProcNodeGetCPUStats = 227 // ProcNodeGetMemoryStats is libvirt's REMOTE_PROC_NODE_GET_MEMORY_STATS ProcNodeGetMemoryStats = 228 // ProcDomainGetControlInfo is libvirt's REMOTE_PROC_DOMAIN_GET_CONTROL_INFO ProcDomainGetControlInfo = 229 // ProcDomainGetVcpuPinInfo is libvirt's REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO ProcDomainGetVcpuPinInfo = 230 // ProcDomainUndefineFlags is libvirt's REMOTE_PROC_DOMAIN_UNDEFINE_FLAGS ProcDomainUndefineFlags = 231 // ProcDomainSaveFlags is libvirt's REMOTE_PROC_DOMAIN_SAVE_FLAGS ProcDomainSaveFlags = 232 // ProcDomainRestoreFlags is libvirt's REMOTE_PROC_DOMAIN_RESTORE_FLAGS ProcDomainRestoreFlags = 233 // ProcDomainDestroyFlags is libvirt's REMOTE_PROC_DOMAIN_DESTROY_FLAGS ProcDomainDestroyFlags = 234 // ProcDomainSaveImageGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC ProcDomainSaveImageGetXMLDesc = 235 // ProcDomainSaveImageDefineXML is libvirt's REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML ProcDomainSaveImageDefineXML = 236 // ProcDomainBlockJobAbort is libvirt's REMOTE_PROC_DOMAIN_BLOCK_JOB_ABORT ProcDomainBlockJobAbort = 237 // ProcDomainGetBlockJobInfo is libvirt's REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO ProcDomainGetBlockJobInfo = 238 // ProcDomainBlockJobSetSpeed is libvirt's REMOTE_PROC_DOMAIN_BLOCK_JOB_SET_SPEED ProcDomainBlockJobSetSpeed = 239 // ProcDomainBlockPull is libvirt's REMOTE_PROC_DOMAIN_BLOCK_PULL ProcDomainBlockPull = 240 // ProcDomainEventBlockJob is libvirt's REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB ProcDomainEventBlockJob = 241 // ProcDomainMigrateGetMaxSpeed is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED ProcDomainMigrateGetMaxSpeed = 242 // ProcDomainBlockStatsFlags is libvirt's REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS ProcDomainBlockStatsFlags = 243 // ProcDomainSnapshotGetParent is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT ProcDomainSnapshotGetParent = 244 // ProcDomainReset is libvirt's REMOTE_PROC_DOMAIN_RESET ProcDomainReset = 245 // ProcDomainSnapshotNumChildren is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_NUM_CHILDREN ProcDomainSnapshotNumChildren = 246 // ProcDomainSnapshotListChildrenNames is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_CHILDREN_NAMES ProcDomainSnapshotListChildrenNames = 247 // ProcDomainEventDiskChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE ProcDomainEventDiskChange = 248 // ProcDomainOpenGraphics is libvirt's REMOTE_PROC_DOMAIN_OPEN_GRAPHICS ProcDomainOpenGraphics = 249 // ProcNodeSuspendForDuration is libvirt's REMOTE_PROC_NODE_SUSPEND_FOR_DURATION ProcNodeSuspendForDuration = 250 // ProcDomainBlockResize is libvirt's REMOTE_PROC_DOMAIN_BLOCK_RESIZE ProcDomainBlockResize = 251 // ProcDomainSetBlockIOTune is libvirt's REMOTE_PROC_DOMAIN_SET_BLOCK_IO_TUNE ProcDomainSetBlockIOTune = 252 // ProcDomainGetBlockIOTune is libvirt's REMOTE_PROC_DOMAIN_GET_BLOCK_IO_TUNE ProcDomainGetBlockIOTune = 253 // ProcDomainSetNumaParameters is libvirt's REMOTE_PROC_DOMAIN_SET_NUMA_PARAMETERS ProcDomainSetNumaParameters = 254 // ProcDomainGetNumaParameters is libvirt's REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS ProcDomainGetNumaParameters = 255 // ProcDomainSetInterfaceParameters is libvirt's REMOTE_PROC_DOMAIN_SET_INTERFACE_PARAMETERS ProcDomainSetInterfaceParameters = 256 // ProcDomainGetInterfaceParameters is libvirt's REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS ProcDomainGetInterfaceParameters = 257 // ProcDomainShutdownFlags is libvirt's REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS ProcDomainShutdownFlags = 258 // ProcStorageVolWipePattern is libvirt's REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN ProcStorageVolWipePattern = 259 // ProcStorageVolResize is libvirt's REMOTE_PROC_STORAGE_VOL_RESIZE ProcStorageVolResize = 260 // ProcDomainPmSuspendForDuration is libvirt's REMOTE_PROC_DOMAIN_PM_SUSPEND_FOR_DURATION ProcDomainPmSuspendForDuration = 261 // ProcDomainGetCPUStats is libvirt's REMOTE_PROC_DOMAIN_GET_CPU_STATS ProcDomainGetCPUStats = 262 // ProcDomainGetDiskErrors is libvirt's REMOTE_PROC_DOMAIN_GET_DISK_ERRORS ProcDomainGetDiskErrors = 263 // ProcDomainSetMetadata is libvirt's REMOTE_PROC_DOMAIN_SET_METADATA ProcDomainSetMetadata = 264 // ProcDomainGetMetadata is libvirt's REMOTE_PROC_DOMAIN_GET_METADATA ProcDomainGetMetadata = 265 // ProcDomainBlockRebase is libvirt's REMOTE_PROC_DOMAIN_BLOCK_REBASE ProcDomainBlockRebase = 266 // ProcDomainPmWakeup is libvirt's REMOTE_PROC_DOMAIN_PM_WAKEUP ProcDomainPmWakeup = 267 // ProcDomainEventTrayChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE ProcDomainEventTrayChange = 268 // ProcDomainEventPmwakeup is libvirt's REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP ProcDomainEventPmwakeup = 269 // ProcDomainEventPmsuspend is libvirt's REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND ProcDomainEventPmsuspend = 270 // ProcDomainSnapshotIsCurrent is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_IS_CURRENT ProcDomainSnapshotIsCurrent = 271 // ProcDomainSnapshotHasMetadata is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA ProcDomainSnapshotHasMetadata = 272 // ProcConnectListAllDomains is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS ProcConnectListAllDomains = 273 // ProcDomainListAllSnapshots is libvirt's REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS ProcDomainListAllSnapshots = 274 // ProcDomainSnapshotListAllChildren is libvirt's REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN ProcDomainSnapshotListAllChildren = 275 // ProcDomainEventBalloonChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE ProcDomainEventBalloonChange = 276 // ProcDomainGetHostname is libvirt's REMOTE_PROC_DOMAIN_GET_HOSTNAME ProcDomainGetHostname = 277 // ProcDomainGetSecurityLabelList is libvirt's REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST ProcDomainGetSecurityLabelList = 278 // ProcDomainPinEmulator is libvirt's REMOTE_PROC_DOMAIN_PIN_EMULATOR ProcDomainPinEmulator = 279 // ProcDomainGetEmulatorPinInfo is libvirt's REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO ProcDomainGetEmulatorPinInfo = 280 // ProcConnectListAllStoragePools is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS ProcConnectListAllStoragePools = 281 // ProcStoragePoolListAllVolumes is libvirt's REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES ProcStoragePoolListAllVolumes = 282 // ProcConnectListAllNetworks is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS ProcConnectListAllNetworks = 283 // ProcConnectListAllInterfaces is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES ProcConnectListAllInterfaces = 284 // ProcConnectListAllNodeDevices is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NODE_DEVICES ProcConnectListAllNodeDevices = 285 // ProcConnectListAllNwfilters is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NWFILTERS ProcConnectListAllNwfilters = 286 // ProcConnectListAllSecrets is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_SECRETS ProcConnectListAllSecrets = 287 // ProcNodeSetMemoryParameters is libvirt's REMOTE_PROC_NODE_SET_MEMORY_PARAMETERS ProcNodeSetMemoryParameters = 288 // ProcNodeGetMemoryParameters is libvirt's REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS ProcNodeGetMemoryParameters = 289 // ProcDomainBlockCommit is libvirt's REMOTE_PROC_DOMAIN_BLOCK_COMMIT ProcDomainBlockCommit = 290 // ProcNetworkUpdate is libvirt's REMOTE_PROC_NETWORK_UPDATE ProcNetworkUpdate = 291 // ProcDomainEventPmsuspendDisk is libvirt's REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_DISK ProcDomainEventPmsuspendDisk = 292 // ProcNodeGetCPUMap is libvirt's REMOTE_PROC_NODE_GET_CPU_MAP ProcNodeGetCPUMap = 293 // ProcDomainFstrim is libvirt's REMOTE_PROC_DOMAIN_FSTRIM ProcDomainFstrim = 294 // ProcDomainSendProcessSignal is libvirt's REMOTE_PROC_DOMAIN_SEND_PROCESS_SIGNAL ProcDomainSendProcessSignal = 295 // ProcDomainOpenChannel is libvirt's REMOTE_PROC_DOMAIN_OPEN_CHANNEL ProcDomainOpenChannel = 296 // ProcNodeDeviceLookupScsiHostByWwn is libvirt's REMOTE_PROC_NODE_DEVICE_LOOKUP_SCSI_HOST_BY_WWN ProcNodeDeviceLookupScsiHostByWwn = 297 // ProcDomainGetJobStats is libvirt's REMOTE_PROC_DOMAIN_GET_JOB_STATS ProcDomainGetJobStats = 298 // ProcDomainMigrateGetCompressionCache is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_GET_COMPRESSION_CACHE ProcDomainMigrateGetCompressionCache = 299 // ProcDomainMigrateSetCompressionCache is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_SET_COMPRESSION_CACHE ProcDomainMigrateSetCompressionCache = 300 // ProcNodeDeviceDetachFlags is libvirt's REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS ProcNodeDeviceDetachFlags = 301 // ProcDomainMigrateBegin3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3_PARAMS ProcDomainMigrateBegin3Params = 302 // ProcDomainMigratePrepare3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3_PARAMS ProcDomainMigratePrepare3Params = 303 // ProcDomainMigratePrepareTunnel3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS ProcDomainMigratePrepareTunnel3Params = 304 // ProcDomainMigratePerform3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3_PARAMS ProcDomainMigratePerform3Params = 305 // ProcDomainMigrateFinish3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_FINISH3_PARAMS ProcDomainMigrateFinish3Params = 306 // ProcDomainMigrateConfirm3Params is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3_PARAMS ProcDomainMigrateConfirm3Params = 307 // ProcDomainSetMemoryStatsPeriod is libvirt's REMOTE_PROC_DOMAIN_SET_MEMORY_STATS_PERIOD ProcDomainSetMemoryStatsPeriod = 308 // ProcDomainCreateXMLWithFiles is libvirt's REMOTE_PROC_DOMAIN_CREATE_XML_WITH_FILES ProcDomainCreateXMLWithFiles = 309 // ProcDomainCreateWithFiles is libvirt's REMOTE_PROC_DOMAIN_CREATE_WITH_FILES ProcDomainCreateWithFiles = 310 // ProcDomainEventDeviceRemoved is libvirt's REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED ProcDomainEventDeviceRemoved = 311 // ProcConnectGetCPUModelNames is libvirt's REMOTE_PROC_CONNECT_GET_CPU_MODEL_NAMES ProcConnectGetCPUModelNames = 312 // ProcConnectNetworkEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_NETWORK_EVENT_REGISTER_ANY ProcConnectNetworkEventRegisterAny = 313 // ProcConnectNetworkEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_NETWORK_EVENT_DEREGISTER_ANY ProcConnectNetworkEventDeregisterAny = 314 // ProcNetworkEventLifecycle is libvirt's REMOTE_PROC_NETWORK_EVENT_LIFECYCLE ProcNetworkEventLifecycle = 315 // ProcConnectDomainEventCallbackRegisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY ProcConnectDomainEventCallbackRegisterAny = 316 // ProcConnectDomainEventCallbackDeregisterAny is libvirt's REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY ProcConnectDomainEventCallbackDeregisterAny = 317 // ProcDomainEventCallbackLifecycle is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE ProcDomainEventCallbackLifecycle = 318 // ProcDomainEventCallbackReboot is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT ProcDomainEventCallbackReboot = 319 // ProcDomainEventCallbackRtcChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE ProcDomainEventCallbackRtcChange = 320 // ProcDomainEventCallbackWatchdog is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG ProcDomainEventCallbackWatchdog = 321 // ProcDomainEventCallbackIOError is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR ProcDomainEventCallbackIOError = 322 // ProcDomainEventCallbackGraphics is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS ProcDomainEventCallbackGraphics = 323 // ProcDomainEventCallbackIOErrorReason is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON ProcDomainEventCallbackIOErrorReason = 324 // ProcDomainEventCallbackControlError is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR ProcDomainEventCallbackControlError = 325 // ProcDomainEventCallbackBlockJob is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB ProcDomainEventCallbackBlockJob = 326 // ProcDomainEventCallbackDiskChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE ProcDomainEventCallbackDiskChange = 327 // ProcDomainEventCallbackTrayChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE ProcDomainEventCallbackTrayChange = 328 // ProcDomainEventCallbackPmwakeup is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP ProcDomainEventCallbackPmwakeup = 329 // ProcDomainEventCallbackPmsuspend is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND ProcDomainEventCallbackPmsuspend = 330 // ProcDomainEventCallbackBalloonChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE ProcDomainEventCallbackBalloonChange = 331 // ProcDomainEventCallbackPmsuspendDisk is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK ProcDomainEventCallbackPmsuspendDisk = 332 // ProcDomainEventCallbackDeviceRemoved is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED ProcDomainEventCallbackDeviceRemoved = 333 // ProcDomainCoreDumpWithFormat is libvirt's REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT ProcDomainCoreDumpWithFormat = 334 // ProcDomainFsfreeze is libvirt's REMOTE_PROC_DOMAIN_FSFREEZE ProcDomainFsfreeze = 335 // ProcDomainFsthaw is libvirt's REMOTE_PROC_DOMAIN_FSTHAW ProcDomainFsthaw = 336 // ProcDomainGetTime is libvirt's REMOTE_PROC_DOMAIN_GET_TIME ProcDomainGetTime = 337 // ProcDomainSetTime is libvirt's REMOTE_PROC_DOMAIN_SET_TIME ProcDomainSetTime = 338 // ProcDomainEventBlockJob2 is libvirt's REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2 ProcDomainEventBlockJob2 = 339 // ProcNodeGetFreePages is libvirt's REMOTE_PROC_NODE_GET_FREE_PAGES ProcNodeGetFreePages = 340 // ProcNetworkGetDhcpLeases is libvirt's REMOTE_PROC_NETWORK_GET_DHCP_LEASES ProcNetworkGetDhcpLeases = 341 // ProcConnectGetDomainCapabilities is libvirt's REMOTE_PROC_CONNECT_GET_DOMAIN_CAPABILITIES ProcConnectGetDomainCapabilities = 342 // ProcDomainOpenGraphicsFd is libvirt's REMOTE_PROC_DOMAIN_OPEN_GRAPHICS_FD ProcDomainOpenGraphicsFd = 343 // ProcConnectGetAllDomainStats is libvirt's REMOTE_PROC_CONNECT_GET_ALL_DOMAIN_STATS ProcConnectGetAllDomainStats = 344 // ProcDomainBlockCopy is libvirt's REMOTE_PROC_DOMAIN_BLOCK_COPY ProcDomainBlockCopy = 345 // ProcDomainEventCallbackTunable is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABLE ProcDomainEventCallbackTunable = 346 // ProcNodeAllocPages is libvirt's REMOTE_PROC_NODE_ALLOC_PAGES ProcNodeAllocPages = 347 // ProcDomainEventCallbackAgentLifecycle is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_AGENT_LIFECYCLE ProcDomainEventCallbackAgentLifecycle = 348 // ProcDomainGetFsinfo is libvirt's REMOTE_PROC_DOMAIN_GET_FSINFO ProcDomainGetFsinfo = 349 // ProcDomainDefineXMLFlags is libvirt's REMOTE_PROC_DOMAIN_DEFINE_XML_FLAGS ProcDomainDefineXMLFlags = 350 // ProcDomainGetIothreadInfo is libvirt's REMOTE_PROC_DOMAIN_GET_IOTHREAD_INFO ProcDomainGetIothreadInfo = 351 // ProcDomainPinIothread is libvirt's REMOTE_PROC_DOMAIN_PIN_IOTHREAD ProcDomainPinIothread = 352 // ProcDomainInterfaceAddresses is libvirt's REMOTE_PROC_DOMAIN_INTERFACE_ADDRESSES ProcDomainInterfaceAddresses = 353 // ProcDomainEventCallbackDeviceAdded is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_ADDED ProcDomainEventCallbackDeviceAdded = 354 // ProcDomainAddIothread is libvirt's REMOTE_PROC_DOMAIN_ADD_IOTHREAD ProcDomainAddIothread = 355 // ProcDomainDelIothread is libvirt's REMOTE_PROC_DOMAIN_DEL_IOTHREAD ProcDomainDelIothread = 356 // ProcDomainSetUserPassword is libvirt's REMOTE_PROC_DOMAIN_SET_USER_PASSWORD ProcDomainSetUserPassword = 357 // ProcDomainRename is libvirt's REMOTE_PROC_DOMAIN_RENAME ProcDomainRename = 358 // ProcDomainEventCallbackMigrationIteration is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_MIGRATION_ITERATION ProcDomainEventCallbackMigrationIteration = 359 // ProcConnectRegisterCloseCallback is libvirt's REMOTE_PROC_CONNECT_REGISTER_CLOSE_CALLBACK ProcConnectRegisterCloseCallback = 360 // ProcConnectUnregisterCloseCallback is libvirt's REMOTE_PROC_CONNECT_UNREGISTER_CLOSE_CALLBACK ProcConnectUnregisterCloseCallback = 361 // ProcConnectEventConnectionClosed is libvirt's REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLOSED ProcConnectEventConnectionClosed = 362 // ProcDomainEventCallbackJobCompleted is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_COMPLETED ProcDomainEventCallbackJobCompleted = 363 // ProcDomainMigrateStartPostCopy is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_START_POST_COPY ProcDomainMigrateStartPostCopy = 364 // ProcDomainGetPerfEvents is libvirt's REMOTE_PROC_DOMAIN_GET_PERF_EVENTS ProcDomainGetPerfEvents = 365 // ProcDomainSetPerfEvents is libvirt's REMOTE_PROC_DOMAIN_SET_PERF_EVENTS ProcDomainSetPerfEvents = 366 // ProcDomainEventCallbackDeviceRemovalFailed is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVAL_FAILED ProcDomainEventCallbackDeviceRemovalFailed = 367 // ProcConnectStoragePoolEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_REGISTER_ANY ProcConnectStoragePoolEventRegisterAny = 368 // ProcConnectStoragePoolEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_DEREGISTER_ANY ProcConnectStoragePoolEventDeregisterAny = 369 // ProcStoragePoolEventLifecycle is libvirt's REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE ProcStoragePoolEventLifecycle = 370 // ProcDomainGetGuestVcpus is libvirt's REMOTE_PROC_DOMAIN_GET_GUEST_VCPUS ProcDomainGetGuestVcpus = 371 // ProcDomainSetGuestVcpus is libvirt's REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS ProcDomainSetGuestVcpus = 372 // ProcStoragePoolEventRefresh is libvirt's REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH ProcStoragePoolEventRefresh = 373 // ProcConnectNodeDeviceEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_REGISTER_ANY ProcConnectNodeDeviceEventRegisterAny = 374 // ProcConnectNodeDeviceEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_DEREGISTER_ANY ProcConnectNodeDeviceEventDeregisterAny = 375 // ProcNodeDeviceEventLifecycle is libvirt's REMOTE_PROC_NODE_DEVICE_EVENT_LIFECYCLE ProcNodeDeviceEventLifecycle = 376 // ProcNodeDeviceEventUpdate is libvirt's REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE ProcNodeDeviceEventUpdate = 377 // ProcStorageVolGetInfoFlags is libvirt's REMOTE_PROC_STORAGE_VOL_GET_INFO_FLAGS ProcStorageVolGetInfoFlags = 378 // ProcDomainEventCallbackMetadataChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE ProcDomainEventCallbackMetadataChange = 379 // ProcConnectSecretEventRegisterAny is libvirt's REMOTE_PROC_CONNECT_SECRET_EVENT_REGISTER_ANY ProcConnectSecretEventRegisterAny = 380 // ProcConnectSecretEventDeregisterAny is libvirt's REMOTE_PROC_CONNECT_SECRET_EVENT_DEREGISTER_ANY ProcConnectSecretEventDeregisterAny = 381 // ProcSecretEventLifecycle is libvirt's REMOTE_PROC_SECRET_EVENT_LIFECYCLE ProcSecretEventLifecycle = 382 // ProcSecretEventValueChanged is libvirt's REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED ProcSecretEventValueChanged = 383 // ProcDomainSetVcpu is libvirt's REMOTE_PROC_DOMAIN_SET_VCPU ProcDomainSetVcpu = 384 // ProcDomainEventBlockThreshold is libvirt's REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD ProcDomainEventBlockThreshold = 385 // ProcDomainSetBlockThreshold is libvirt's REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD ProcDomainSetBlockThreshold = 386 // ProcDomainMigrateGetMaxDowntime is libvirt's REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME ProcDomainMigrateGetMaxDowntime = 387 // ProcDomainManagedSaveGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC ProcDomainManagedSaveGetXMLDesc = 388 // ProcDomainManagedSaveDefineXML is libvirt's REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML ProcDomainManagedSaveDefineXML = 389 // ProcDomainSetLifecycleAction is libvirt's REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION ProcDomainSetLifecycleAction = 390 // ProcStoragePoolLookupByTargetPath is libvirt's REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH ProcStoragePoolLookupByTargetPath = 391 // ProcDomainDetachDeviceAlias is libvirt's REMOTE_PROC_DOMAIN_DETACH_DEVICE_ALIAS ProcDomainDetachDeviceAlias = 392 // ProcConnectCompareHypervisorCPU is libvirt's REMOTE_PROC_CONNECT_COMPARE_HYPERVISOR_CPU ProcConnectCompareHypervisorCPU = 393 // ProcConnectBaselineHypervisorCPU is libvirt's REMOTE_PROC_CONNECT_BASELINE_HYPERVISOR_CPU ProcConnectBaselineHypervisorCPU = 394 // ProcNodeGetSevInfo is libvirt's REMOTE_PROC_NODE_GET_SEV_INFO ProcNodeGetSevInfo = 395 // ProcDomainGetLaunchSecurityInfo is libvirt's REMOTE_PROC_DOMAIN_GET_LAUNCH_SECURITY_INFO ProcDomainGetLaunchSecurityInfo = 396 // ProcNwfilterBindingLookupByPortDev is libvirt's REMOTE_PROC_NWFILTER_BINDING_LOOKUP_BY_PORT_DEV ProcNwfilterBindingLookupByPortDev = 397 // ProcNwfilterBindingGetXMLDesc is libvirt's REMOTE_PROC_NWFILTER_BINDING_GET_XML_DESC ProcNwfilterBindingGetXMLDesc = 398 // ProcNwfilterBindingCreateXML is libvirt's REMOTE_PROC_NWFILTER_BINDING_CREATE_XML ProcNwfilterBindingCreateXML = 399 // ProcNwfilterBindingDelete is libvirt's REMOTE_PROC_NWFILTER_BINDING_DELETE ProcNwfilterBindingDelete = 400 // ProcConnectListAllNwfilterBindings is libvirt's REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS ProcConnectListAllNwfilterBindings = 401 // ProcDomainSetIothreadParams is libvirt's REMOTE_PROC_DOMAIN_SET_IOTHREAD_PARAMS ProcDomainSetIothreadParams = 402 // ProcConnectGetStoragePoolCapabilities is libvirt's REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES ProcConnectGetStoragePoolCapabilities = 403 // ProcNetworkListAllPorts is libvirt's REMOTE_PROC_NETWORK_LIST_ALL_PORTS ProcNetworkListAllPorts = 404 // ProcNetworkPortLookupByUUID is libvirt's REMOTE_PROC_NETWORK_PORT_LOOKUP_BY_UUID ProcNetworkPortLookupByUUID = 405 // ProcNetworkPortCreateXML is libvirt's REMOTE_PROC_NETWORK_PORT_CREATE_XML ProcNetworkPortCreateXML = 406 // ProcNetworkPortGetParameters is libvirt's REMOTE_PROC_NETWORK_PORT_GET_PARAMETERS ProcNetworkPortGetParameters = 407 // ProcNetworkPortSetParameters is libvirt's REMOTE_PROC_NETWORK_PORT_SET_PARAMETERS ProcNetworkPortSetParameters = 408 // ProcNetworkPortGetXMLDesc is libvirt's REMOTE_PROC_NETWORK_PORT_GET_XML_DESC ProcNetworkPortGetXMLDesc = 409 // ProcNetworkPortDelete is libvirt's REMOTE_PROC_NETWORK_PORT_DELETE ProcNetworkPortDelete = 410 // ProcDomainCheckpointCreateXML is libvirt's REMOTE_PROC_DOMAIN_CHECKPOINT_CREATE_XML ProcDomainCheckpointCreateXML = 411 // ProcDomainCheckpointGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_CHECKPOINT_GET_XML_DESC ProcDomainCheckpointGetXMLDesc = 412 // ProcDomainListAllCheckpoints is libvirt's REMOTE_PROC_DOMAIN_LIST_ALL_CHECKPOINTS ProcDomainListAllCheckpoints = 413 // ProcDomainCheckpointListAllChildren is libvirt's REMOTE_PROC_DOMAIN_CHECKPOINT_LIST_ALL_CHILDREN ProcDomainCheckpointListAllChildren = 414 // ProcDomainCheckpointLookupByName is libvirt's REMOTE_PROC_DOMAIN_CHECKPOINT_LOOKUP_BY_NAME ProcDomainCheckpointLookupByName = 415 // ProcDomainCheckpointGetParent is libvirt's REMOTE_PROC_DOMAIN_CHECKPOINT_GET_PARENT ProcDomainCheckpointGetParent = 416 // ProcDomainCheckpointDelete is libvirt's REMOTE_PROC_DOMAIN_CHECKPOINT_DELETE ProcDomainCheckpointDelete = 417 // ProcDomainGetGuestInfo is libvirt's REMOTE_PROC_DOMAIN_GET_GUEST_INFO ProcDomainGetGuestInfo = 418 // ProcConnectSetIdentity is libvirt's REMOTE_PROC_CONNECT_SET_IDENTITY ProcConnectSetIdentity = 419 // ProcDomainAgentSetResponseTimeout is libvirt's REMOTE_PROC_DOMAIN_AGENT_SET_RESPONSE_TIMEOUT ProcDomainAgentSetResponseTimeout = 420 // ProcDomainBackupBegin is libvirt's REMOTE_PROC_DOMAIN_BACKUP_BEGIN ProcDomainBackupBegin = 421 // ProcDomainBackupGetXMLDesc is libvirt's REMOTE_PROC_DOMAIN_BACKUP_GET_XML_DESC ProcDomainBackupGetXMLDesc = 422 // ProcDomainEventMemoryFailure is libvirt's REMOTE_PROC_DOMAIN_EVENT_MEMORY_FAILURE ProcDomainEventMemoryFailure = 423 // ProcDomainAuthorizedSshKeysGet is libvirt's REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_GET ProcDomainAuthorizedSshKeysGet = 424 // ProcDomainAuthorizedSshKeysSet is libvirt's REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_SET ProcDomainAuthorizedSshKeysSet = 425 // ProcDomainGetMessages is libvirt's REMOTE_PROC_DOMAIN_GET_MESSAGES ProcDomainGetMessages = 426 // ProcDomainStartDirtyRateCalc is libvirt's REMOTE_PROC_DOMAIN_START_DIRTY_RATE_CALC ProcDomainStartDirtyRateCalc = 427 // ProcNodeDeviceDefineXML is libvirt's REMOTE_PROC_NODE_DEVICE_DEFINE_XML ProcNodeDeviceDefineXML = 428 // ProcNodeDeviceUndefine is libvirt's REMOTE_PROC_NODE_DEVICE_UNDEFINE ProcNodeDeviceUndefine = 429 // ProcNodeDeviceCreate is libvirt's REMOTE_PROC_NODE_DEVICE_CREATE ProcNodeDeviceCreate = 430 // ProcNwfilterDefineXMLFlags is libvirt's REMOTE_PROC_NWFILTER_DEFINE_XML_FLAGS ProcNwfilterDefineXMLFlags = 431 // ProcNetworkDefineXMLFlags is libvirt's REMOTE_PROC_NETWORK_DEFINE_XML_FLAGS ProcNetworkDefineXMLFlags = 432 // ProcNodeDeviceGetAutostart is libvirt's REMOTE_PROC_NODE_DEVICE_GET_AUTOSTART ProcNodeDeviceGetAutostart = 433 // ProcNodeDeviceSetAutostart is libvirt's REMOTE_PROC_NODE_DEVICE_SET_AUTOSTART ProcNodeDeviceSetAutostart = 434 // ProcNodeDeviceIsPersistent is libvirt's REMOTE_PROC_NODE_DEVICE_IS_PERSISTENT ProcNodeDeviceIsPersistent = 435 // ProcNodeDeviceIsActive is libvirt's REMOTE_PROC_NODE_DEVICE_IS_ACTIVE ProcNodeDeviceIsActive = 436 // ProcNetworkCreateXMLFlags is libvirt's REMOTE_PROC_NETWORK_CREATE_XML_FLAGS ProcNetworkCreateXMLFlags = 437 // ProcDomainEventMemoryDeviceSizeChange is libvirt's REMOTE_PROC_DOMAIN_EVENT_MEMORY_DEVICE_SIZE_CHANGE ProcDomainEventMemoryDeviceSizeChange = 438 // ProcDomainSetLaunchSecurityState is libvirt's REMOTE_PROC_DOMAIN_SET_LAUNCH_SECURITY_STATE ProcDomainSetLaunchSecurityState = 439 // From consts: // StringMax is libvirt's REMOTE_STRING_MAX StringMax = 4194304 // ConnectIdentityParamsMax is libvirt's REMOTE_CONNECT_IDENTITY_PARAMS_MAX ConnectIdentityParamsMax = 20 // DomainListMax is libvirt's REMOTE_DOMAIN_LIST_MAX DomainListMax = 16384 // CpumapMax is libvirt's REMOTE_CPUMAP_MAX CpumapMax = 2048 // VcpuinfoMax is libvirt's REMOTE_VCPUINFO_MAX VcpuinfoMax = 16384 // CpumapsMax is libvirt's REMOTE_CPUMAPS_MAX CpumapsMax = 8388608 // IothreadInfoMax is libvirt's REMOTE_IOTHREAD_INFO_MAX IothreadInfoMax = 16384 // MigrateCookieMax is libvirt's REMOTE_MIGRATE_COOKIE_MAX MigrateCookieMax = 4194304 // NetworkListMax is libvirt's REMOTE_NETWORK_LIST_MAX NetworkListMax = 16384 // NetworkPortListMax is libvirt's REMOTE_NETWORK_PORT_LIST_MAX NetworkPortListMax = 16384 // InterfaceListMax is libvirt's REMOTE_INTERFACE_LIST_MAX InterfaceListMax = 16384 // StoragePoolListMax is libvirt's REMOTE_STORAGE_POOL_LIST_MAX StoragePoolListMax = 16384 // StorageVolListMax is libvirt's REMOTE_STORAGE_VOL_LIST_MAX StorageVolListMax = 16384 // NodeDeviceListMax is libvirt's REMOTE_NODE_DEVICE_LIST_MAX NodeDeviceListMax = 65536 // NodeDeviceCapsListMax is libvirt's REMOTE_NODE_DEVICE_CAPS_LIST_MAX NodeDeviceCapsListMax = 65536 // NwfilterListMax is libvirt's REMOTE_NWFILTER_LIST_MAX NwfilterListMax = 16384 // NwfilterBindingListMax is libvirt's REMOTE_NWFILTER_BINDING_LIST_MAX NwfilterBindingListMax = 16384 // DomainSchedulerParametersMax is libvirt's REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX DomainSchedulerParametersMax = 16 // DomainBlkioParametersMax is libvirt's REMOTE_DOMAIN_BLKIO_PARAMETERS_MAX DomainBlkioParametersMax = 16 // DomainMemoryParametersMax is libvirt's REMOTE_DOMAIN_MEMORY_PARAMETERS_MAX DomainMemoryParametersMax = 16 // DomainBlockIOTuneParametersMax is libvirt's REMOTE_DOMAIN_BLOCK_IO_TUNE_PARAMETERS_MAX DomainBlockIOTuneParametersMax = 32 // DomainNumaParametersMax is libvirt's REMOTE_DOMAIN_NUMA_PARAMETERS_MAX DomainNumaParametersMax = 16 // DomainPerfEventsMax is libvirt's REMOTE_DOMAIN_PERF_EVENTS_MAX DomainPerfEventsMax = 64 // DomainBlockCopyParametersMax is libvirt's REMOTE_DOMAIN_BLOCK_COPY_PARAMETERS_MAX DomainBlockCopyParametersMax = 16 // NodeCPUStatsMax is libvirt's REMOTE_NODE_CPU_STATS_MAX NodeCPUStatsMax = 16 // NodeMemoryStatsMax is libvirt's REMOTE_NODE_MEMORY_STATS_MAX NodeMemoryStatsMax = 16 // DomainBlockStatsParametersMax is libvirt's REMOTE_DOMAIN_BLOCK_STATS_PARAMETERS_MAX DomainBlockStatsParametersMax = 16 // NodeMaxCells is libvirt's REMOTE_NODE_MAX_CELLS NodeMaxCells = 1024 // AuthSaslDataMax is libvirt's REMOTE_AUTH_SASL_DATA_MAX AuthSaslDataMax = 65536 // AuthTypeListMax is libvirt's REMOTE_AUTH_TYPE_LIST_MAX AuthTypeListMax = 20 // DomainMemoryStatsMax is libvirt's REMOTE_DOMAIN_MEMORY_STATS_MAX DomainMemoryStatsMax = 1024 // DomainCheckpointListMax is libvirt's REMOTE_DOMAIN_CHECKPOINT_LIST_MAX DomainCheckpointListMax = 16384 // DomainSnapshotListMax is libvirt's REMOTE_DOMAIN_SNAPSHOT_LIST_MAX DomainSnapshotListMax = 16384 // DomainBlockPeekBufferMax is libvirt's REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX DomainBlockPeekBufferMax = 4194304 // DomainMemoryPeekBufferMax is libvirt's REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX DomainMemoryPeekBufferMax = 4194304 // SecurityLabelListMax is libvirt's REMOTE_SECURITY_LABEL_LIST_MAX SecurityLabelListMax = 64 // SecretValueMax is libvirt's REMOTE_SECRET_VALUE_MAX SecretValueMax = 65536 // SecretListMax is libvirt's REMOTE_SECRET_LIST_MAX SecretListMax = 16384 // CPUBaselineMax is libvirt's REMOTE_CPU_BASELINE_MAX CPUBaselineMax = 256 // DomainSendKeyMax is libvirt's REMOTE_DOMAIN_SEND_KEY_MAX DomainSendKeyMax = 16 // DomainInterfaceParametersMax is libvirt's REMOTE_DOMAIN_INTERFACE_PARAMETERS_MAX DomainInterfaceParametersMax = 16 // DomainGetCPUStatsNcpusMax is libvirt's REMOTE_DOMAIN_GET_CPU_STATS_NCPUS_MAX DomainGetCPUStatsNcpusMax = 128 // DomainGetCPUStatsMax is libvirt's REMOTE_DOMAIN_GET_CPU_STATS_MAX DomainGetCPUStatsMax = 2048 // DomainDiskErrorsMax is libvirt's REMOTE_DOMAIN_DISK_ERRORS_MAX DomainDiskErrorsMax = 256 // NodeMemoryParametersMax is libvirt's REMOTE_NODE_MEMORY_PARAMETERS_MAX NodeMemoryParametersMax = 64 // DomainMigrateParamListMax is libvirt's REMOTE_DOMAIN_MIGRATE_PARAM_LIST_MAX DomainMigrateParamListMax = 64 // DomainJobStatsMax is libvirt's REMOTE_DOMAIN_JOB_STATS_MAX DomainJobStatsMax = 64 // ConnectCPUModelsMax is libvirt's REMOTE_CONNECT_CPU_MODELS_MAX ConnectCPUModelsMax = 8192 // DomainFsfreezeMountpointsMax is libvirt's REMOTE_DOMAIN_FSFREEZE_MOUNTPOINTS_MAX DomainFsfreezeMountpointsMax = 256 // NetworkDhcpLeasesMax is libvirt's REMOTE_NETWORK_DHCP_LEASES_MAX NetworkDhcpLeasesMax = 65536 // ConnectGetAllDomainStatsMax is libvirt's REMOTE_CONNECT_GET_ALL_DOMAIN_STATS_MAX ConnectGetAllDomainStatsMax = 262144 // DomainEventTunableMax is libvirt's REMOTE_DOMAIN_EVENT_TUNABLE_MAX DomainEventTunableMax = 2048 // DomainFsinfoMax is libvirt's REMOTE_DOMAIN_FSINFO_MAX DomainFsinfoMax = 256 // DomainFsinfoDisksMax is libvirt's REMOTE_DOMAIN_FSINFO_DISKS_MAX DomainFsinfoDisksMax = 256 // DomainInterfaceMax is libvirt's REMOTE_DOMAIN_INTERFACE_MAX DomainInterfaceMax = 2048 // DomainIPAddrMax is libvirt's REMOTE_DOMAIN_IP_ADDR_MAX DomainIPAddrMax = 2048 // DomainGuestVcpuParamsMax is libvirt's REMOTE_DOMAIN_GUEST_VCPU_PARAMS_MAX DomainGuestVcpuParamsMax = 64 // DomainIothreadParamsMax is libvirt's REMOTE_DOMAIN_IOTHREAD_PARAMS_MAX DomainIothreadParamsMax = 64 // NodeSevInfoMax is libvirt's REMOTE_NODE_SEV_INFO_MAX NodeSevInfoMax = 64 // DomainLaunchSecurityInfoParamsMax is libvirt's REMOTE_DOMAIN_LAUNCH_SECURITY_INFO_PARAMS_MAX DomainLaunchSecurityInfoParamsMax = 64 // DomainLaunchSecurityStateParamsMax is libvirt's REMOTE_DOMAIN_LAUNCH_SECURITY_STATE_PARAMS_MAX DomainLaunchSecurityStateParamsMax = 64 // DomainGuestInfoParamsMax is libvirt's REMOTE_DOMAIN_GUEST_INFO_PARAMS_MAX DomainGuestInfoParamsMax = 2048 // NetworkPortParametersMax is libvirt's REMOTE_NETWORK_PORT_PARAMETERS_MAX NetworkPortParametersMax = 16 // DomainAuthorizedSshKeysMax is libvirt's REMOTE_DOMAIN_AUTHORIZED_SSH_KEYS_MAX DomainAuthorizedSshKeysMax = 2048 // DomainMessagesMax is libvirt's REMOTE_DOMAIN_MESSAGES_MAX DomainMessagesMax = 2048 // DomainEventGraphicsIdentityMax is libvirt's REMOTE_DOMAIN_EVENT_GRAPHICS_IDENTITY_MAX DomainEventGraphicsIdentityMax = 20 // Program is libvirt's REMOTE_PROGRAM Program = 0x20008086 // ProtocolVersion is libvirt's REMOTE_PROTOCOL_VERSION ProtocolVersion = 1 ) golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/event/000077500000000000000000000000001463537555000264265ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/event/event.go000066400000000000000000000012751463537555000301030ustar00rootroot00000000000000// Copyright 2020 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package event // Event represents an internal Event. type Event interface { GetCallbackID() int32 } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/event/stream.go000066400000000000000000000114151463537555000302520ustar00rootroot00000000000000// Copyright 2020 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package event import ( "context" ) // emptyEvent is used as a zero-value. Clients will never receive one of these; // they are only here to satisfy the compiler. See the comments in process() for // more information. type emptyEvent struct{} func (emptyEvent) GetCallbackID() int32 { return 0 } // Stream is an unbounded buffered event channel. The implementation // consists of a pair of unbuffered channels and a goroutine to manage them. // Client behavior will not cause incoming events to block. type Stream struct { // Program specifies the source of the events - libvirt or QEMU. Program uint32 // CallbackID is returned by the event registration call. CallbackID int32 // manage unbounded channel behavior. queue []Event qlen chan (chan int) in, out chan Event // terminates processing shutdown context.CancelFunc } // NewStream configures a new Event Stream. Incoming events are appended to a // queue, which is then relayed to the listening client. Client behavior will // not cause incoming events to block. It is the responsibility of the caller // to terminate the Stream via Shutdown() when no longer in use. func NewStream(program uint32, cbID int32) *Stream { s := &Stream{ Program: program, CallbackID: cbID, in: make(chan Event), out: make(chan Event), qlen: make(chan (chan int)), } // Start the processing loop, which will return a routine we can use to // shut the queue down later. s.shutdown = s.start() return s } // Len will return the current count of events in the internal queue for a // stream. It does this by sending a message to the stream's process() loop, // which will then write the current length to the channel contained in that // message. func (s *Stream) Len() int { // Send a request to the process() loop to get the current length of the // queue ch := make(chan int) s.qlen <- ch return <-ch } // Recv returns the next available event from the Stream's queue. func (s *Stream) Recv() chan Event { return s.out } // Push appends a new event to the queue. func (s *Stream) Push(e Event) { s.in <- e } // Shutdown gracefully terminates Stream processing, releasing all internal // resources. Events which have not yet been received by the client will be // dropped. Subsequent calls to Shutdown() are idempotent. func (s *Stream) Shutdown() { if s.shutdown != nil { s.shutdown() } } // start starts the event processing loop, which will continue to run until // terminated by the returned context.CancelFunc. func (s *Stream) start() context.CancelFunc { ctx, cancel := context.WithCancel(context.Background()) go s.process(ctx) return cancel } // process manages an Stream's lifecycle until canceled by the provided context. // Incoming events are appended to a queue which is then relayed to the // listening client. New events pushed onto the queue will not block if the // client is not actively polling for them; the stream will buffer them // internally. func (s *Stream) process(ctx context.Context) { // Close the output channel so that clients know this stream is finished. // We don't close s.in to avoid creating a race with the stream's Push() // function. defer close(s.out) // This function is used to retrieve the next event from the queue, to be // sent to the client. If there are no more events to send, it returns a nil // channel and a zero-value event. nextEvent := func() (chan Event, Event) { sendCh := chan Event(nil) next := Event(emptyEvent{}) if len(s.queue) > 0 { sendCh = s.out next = s.queue[0] } return sendCh, next } // The select statement in this loop relies on the fact that a send to a nil // channel will block forever. If we have no entries in the queue, the // sendCh variable will be nil, so the clause that attempts to send an event // to the client will never complete. Clients will never receive an // emptyEvent. for { sendCh, nextEvt := nextEvent() select { // new event received, append to queue case e := <-s.in: s.queue = append(s.queue, e) case lenCh := <-s.qlen: lenCh <- len(s.queue) // client received an event, pop from queue case sendCh <- nextEvt: s.queue = s.queue[1:] // shutdown requested case <-ctx.Done(): return } } } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/event/stream_test.go000066400000000000000000000031641463537555000313130ustar00rootroot00000000000000package event import ( "fmt" "sync" "testing" "github.com/stretchr/testify/assert" ) type testEvent struct{ id int32 } func (e testEvent) GetCallbackID() int32 { return e.id } func testEvents(count int) []Event { ev := make([]Event, count) for i := 0; i < count; i++ { ev[i] = testEvent{int32(i)} } return ev } // TestStreamSequential tests the stream objects by first writing some entries // the stream, then reading them back. func TestStreamSequential(t *testing.T) { const evCount = 100000 s := NewStream(1, 2) defer s.Shutdown() events := testEvents(evCount) // send a bunch of "events", and make sure we receive them all. fmt.Println("sending test events to queue") for i, e := range events { assert.Equal(t, int32(i), e.GetCallbackID()) s.Push(e) assert.Equal(t, i+1, s.Len()) } assert.Equal(t, evCount, s.Len()) fmt.Println("reading events from queue") for _, e := range events { qe, ok := <-s.Recv() assert.True(t, ok) assert.Equal(t, e, qe) } assert.Zero(t, s.Len()) } // TestStreamParallel tests the stream object with a pair of goroutines, one // writing to the queue, the other reading from it. func TestStreamParallel(t *testing.T) { const evCount = 10000 s := NewStream(1, 2) defer s.Shutdown() events := testEvents(evCount) wg := sync.WaitGroup{} wg.Add(2) // Start 2 goroutines, one to send, the other to receive. go func() { defer wg.Done() for _, e := range events { s.Push(e) } }() go func() { defer wg.Done() for i := 0; i < evCount; i++ { e := <-s.Recv() assert.Equal(t, int32(i), e.GetCallbackID()) } }() wg.Wait() assert.Zero(t, s.Len()) } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/000077500000000000000000000000001463537555000265055ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/LICENSE000066400000000000000000000013551463537555000275160ustar00rootroot00000000000000Copyright (c) 2012-2014 Dave Collins Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/README.md000066400000000000000000000074071463537555000277740ustar00rootroot00000000000000go-xdr ====== [![Build Status](https://travis-ci.org/davecgh/go-xdr.png?branch=master)] (https://travis-ci.org/davecgh/go-xdr) [![Coverage Status] (https://coveralls.io/repos/davecgh/go-xdr/badge.png?branch=master)] (https://coveralls.io/r/davecgh/go-xdr?branch=master) Go-xdr implements the data representation portion of the External Data Representation (XDR) standard protocol as specified in RFC 4506 (obsoletes RFC 1832 and RFC 1014) in Pure Go (Golang). A comprehensive suite of tests are provided to ensure proper functionality. It is licensed under the liberal ISC license, so it may be used in open source or commercial projects. NOTE: Version 1 of this package is still available via the github.com/davecgh/go-xdr/xdr import path to avoid breaking existing clients. However, it is highly recommended that all old clients upgrade to version 2 and all new clients use version 2. In addition to some speed optimizations, version 2 has been been updated to work with standard the io.Reader and io.Writer interfaces instead of raw byte slices. This allows it to be much more flexible and work directly with files, network connections, etc. ## Documentation [![GoDoc](https://godoc.org/github.com/davecgh/go-xdr/xdr2?status.png)] (http://godoc.org/github.com/davecgh/go-xdr/xdr2) Full `go doc` style documentation for the project can be viewed online without installing this package by using the excellent GoDoc site here: http://godoc.org/github.com/davecgh/go-xdr/xdr2 You can also view the documentation locally once the package is installed with the `godoc` tool by running `godoc -http=":6060"` and pointing your browser to http://localhost:6060/pkg/github.com/davecgh/go-xdr/xdr2/ ## Installation ```bash $ go get github.com/davecgh/go-xdr/xdr2 ``` ## Sample Decode Program ```Go package main import ( "bytes" "fmt" "github.com/davecgh/go-xdr/xdr2" ) func main() { // Hypothetical image header format. type ImageHeader struct { Signature [3]byte Version uint32 IsGrayscale bool NumSections uint32 } // XDR encoded data described by the above structure. Typically this would // be read from a file or across the network, but use a manual byte array // here as an example. encodedData := []byte{ 0xAB, 0xCD, 0xEF, 0x00, // Signature 0x00, 0x00, 0x00, 0x02, // Version 0x00, 0x00, 0x00, 0x01, // IsGrayscale 0x00, 0x00, 0x00, 0x0A, // NumSections } // Declare a variable to provide Unmarshal with a concrete type and instance // to decode into. var h ImageHeader bytesRead, err := xdr.Unmarshal(bytes.NewReader(encodedData), &h) if err != nil { fmt.Println(err) return } fmt.Println("bytes read:", bytesRead) fmt.Printf("h: %+v", h) } ``` The struct instance, `h`, will then contain the following values: ```Go h.Signature = [3]byte{0xAB, 0xCD, 0xEF} h.Version = 2 h.IsGrayscale = true h.NumSections = 10 ``` ## Sample Encode Program ```Go package main import ( "bytes" "fmt" "github.com/davecgh/go-xdr/xdr2" ) func main() { // Hypothetical image header format. type ImageHeader struct { Signature [3]byte Version uint32 IsGrayscale bool NumSections uint32 } // Sample image header data. h := ImageHeader{[3]byte{0xAB, 0xCD, 0xEF}, 2, true, 10} // Use marshal to automatically determine the appropriate underlying XDR // types and encode. var w bytes.Buffer bytesWritten, err := xdr.Marshal(&w, &h) if err != nil { fmt.Println(err) return } encodedData := w.Bytes() fmt.Println("bytes written:", bytesWritten) fmt.Println("encoded data:", encodedData) } ``` The result, `encodedData`, will then contain the following XDR encoded byte sequence: ``` 0xAB, 0xCD, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, ``` ## License Go-xdr is licensed under the liberal ISC License. golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/goclean.sh000077500000000000000000000024201463537555000304520ustar00rootroot00000000000000#!/bin/bash # The script does automatic checking on a Go package and its sub-packages, including: # 1. gofmt (http://golang.org/cmd/gofmt/) # 2. goimports (https://github.com/bradfitz/goimports) # 3. golint (https://github.com/golang/lint) # 4. go vet (http://golang.org/cmd/vet) # 5. test coverage (http://blog.golang.org/cover) set -e # Automatic checks cd xdr2 test -z "$(gofmt -l -w . | tee /dev/stderr)" test -z "$(goimports -l -w . | tee /dev/stderr)" test -z "$(golint . | tee /dev/stderr)" go vet ./... env GORACE="halt_on_error=1" go test -v -race ./... # Run test coverage on each subdirectories and merge the coverage profile. echo "mode: count" > profile.cov # Standard go tooling behavior is to ignore dirs with leading underscores. for dir in $(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); do if ls $dir/*.go &> /dev/null; then go test -covermode=count -coverprofile=$dir/profile.tmp $dir if [ -f $dir/profile.tmp ]; then cat $dir/profile.tmp | tail -n +2 >> profile.cov rm $dir/profile.tmp fi fi done go tool cover -func profile.cov # To submit the test coverage result to coveralls.io, # use goveralls (https://github.com/mattn/goveralls) # goveralls -coverprofile=profile.cov -service=travis-ci golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/000077500000000000000000000000001463537555000273645ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/bench_test.go000066400000000000000000000040701463537555000320320ustar00rootroot00000000000000/* * Copyright (c) 2012-2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package xdr_test import ( "bytes" "testing" "unsafe" "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" ) // BenchmarkUnmarshal benchmarks the Unmarshal function by using a dummy // ImageHeader structure. func BenchmarkUnmarshal(b *testing.B) { b.StopTimer() // Hypothetical image header format. type ImageHeader struct { Signature [3]byte Version uint32 IsGrayscale bool NumSections uint32 } // XDR encoded data described by the above structure. encodedData := []byte{ 0xAB, 0xCD, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, } var h ImageHeader b.StartTimer() for i := 0; i < b.N; i++ { r := bytes.NewReader(encodedData) _, _ = xdr.Unmarshal(r, &h) } b.SetBytes(int64(len(encodedData))) } // BenchmarkMarshal benchmarks the Marshal function by using a dummy ImageHeader // structure. func BenchmarkMarshal(b *testing.B) { b.StopTimer() // Hypothetical image header format. type ImageHeader struct { Signature [3]byte Version uint32 IsGrayscale bool NumSections uint32 } h := ImageHeader{[3]byte{0xAB, 0xCD, 0xEF}, 2, true, 10} size := unsafe.Sizeof(h) w := bytes.NewBuffer(nil) b.StartTimer() for i := 0; i < b.N; i++ { w.Reset() _, _ = xdr.Marshal(w, &h) } b.SetBytes(int64(size)) } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/decode.go000066400000000000000000000660601463537555000311460ustar00rootroot00000000000000/* * Copyright (c) 2012-2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package xdr import ( "fmt" "io" "math" "reflect" "time" ) var ( errMaxSlice = "data exceeds max slice limit" errIODecode = "%s while decoding %d bytes" ) /* Unmarshal parses XDR-encoded data into the value pointed to by v reading from reader r and returning the total number of bytes read. An addressable pointer must be provided since Unmarshal needs to both store the result of the decode as well as obtain target type information. Unmarhsal traverses v recursively and automatically indirects pointers through arbitrary depth, allocating them as necessary, to decode the data into the underlying value pointed to. Unmarshal uses reflection to determine the type of the concrete value contained by v and performs a mapping of underlying XDR types to Go types as follows: Go Type <- XDR Type -------------------- int8, int16, int32, int <- XDR Integer uint8, uint16, uint32, uint <- XDR Unsigned Integer int64 <- XDR Hyper Integer uint64 <- XDR Unsigned Hyper Integer bool <- XDR Boolean float32 <- XDR Floating-Point float64 <- XDR Double-Precision Floating-Point string <- XDR String byte <- XDR Integer []byte <- XDR Variable-Length Opaque Data [#]byte <- XDR Fixed-Length Opaque Data [] <- XDR Variable-Length Array [#] <- XDR Fixed-Length Array struct <- XDR Structure map <- XDR Variable-Length Array of two-element XDR Structures time.Time <- XDR String encoded with RFC3339 nanosecond precision Notes and Limitations: * Automatic unmarshalling of variable and fixed-length arrays of uint8s requires a special struct tag `xdropaque:"false"` since byte slices and byte arrays are assumed to be opaque data and byte is a Go alias for uint8 thus indistinguishable under reflection * Cyclic data structures are not supported and will result in infinite loops If any issues are encountered during the unmarshalling process, an UnmarshalError is returned with a human readable description as well as an ErrorCode value for further inspection from sophisticated callers. Some potential issues are unsupported Go types, attempting to decode a value which is too large to fit into a specified Go type, and exceeding max slice limitations. */ func Unmarshal(r io.Reader, v interface{}) (int, error) { d := Decoder{r: r} return d.Decode(v) } // UnmarshalLimited is identical to Unmarshal but it sets maxReadSize in order // to cap reads. func UnmarshalLimited(r io.Reader, v interface{}, maxSize uint) (int, error) { d := Decoder{r: r, maxReadSize: maxSize} return d.Decode(v) } // TypeDecoder lets a caller provide a custom decode routine for a custom type. type TypeDecoder interface { Decode(*Decoder, reflect.Value) (int, error) } // A Decoder wraps an io.Reader that is expected to provide an XDR-encoded byte // stream and provides several exposed methods to manually decode various XDR // primitives without relying on reflection. The NewDecoder function can be // used to get a new Decoder directly. // // Typically, Unmarshal should be used instead of manual decoding. A Decoder // is exposed so it is possible to perform manual decoding should it be // necessary in complex scenarios where automatic reflection-based decoding // won't work. type Decoder struct { r io.Reader // maxReadSize is the default maximum bytes an element can contain. 0 // is unlimited and provides backwards compatability. Setting it to a // non-zero value caps reads. maxReadSize uint // customTypes is a map allowing the caller to provide decoder routines for // custom types known only to itself. customTypes map[string]TypeDecoder } // DecodeInt treats the next 4 bytes as an XDR encoded integer and returns the // result as an int32 along with the number of bytes actually read. // // An UnmarshalError is returned if there are insufficient bytes remaining. // // Reference: // RFC Section 4.1 - Integer // 32-bit big-endian signed integer in range [-2147483648, 2147483647] func (d *Decoder) DecodeInt() (int32, int, error) { var buf [4]byte n, err := io.ReadFull(d.r, buf[:]) if err != nil { msg := fmt.Sprintf(errIODecode, err.Error(), 4) err := unmarshalError("DecodeInt", ErrIO, msg, buf[:n], err) return 0, n, err } rv := int32(buf[3]) | int32(buf[2])<<8 | int32(buf[1])<<16 | int32(buf[0])<<24 return rv, n, nil } // DecodeUint treats the next 4 bytes as an XDR encoded unsigned integer and // returns the result as a uint32 along with the number of bytes actually read. // // An UnmarshalError is returned if there are insufficient bytes remaining. // // Reference: // RFC Section 4.2 - Unsigned Integer // 32-bit big-endian unsigned integer in range [0, 4294967295] func (d *Decoder) DecodeUint() (uint32, int, error) { var buf [4]byte n, err := io.ReadFull(d.r, buf[:]) if err != nil { msg := fmt.Sprintf(errIODecode, err.Error(), 4) err := unmarshalError("DecodeUint", ErrIO, msg, buf[:n], err) return 0, n, err } rv := uint32(buf[3]) | uint32(buf[2])<<8 | uint32(buf[1])<<16 | uint32(buf[0])<<24 return rv, n, nil } // DecodeEnum treats the next 4 bytes as an XDR encoded enumeration value and // returns the result as an int32 after verifying that the value is in the // provided map of valid values. It also returns the number of bytes actually // read. // // An UnmarshalError is returned if there are insufficient bytes remaining or // the parsed enumeration value is not one of the provided valid values. // // Reference: // RFC Section 4.3 - Enumeration // Represented as an XDR encoded signed integer func (d *Decoder) DecodeEnum(validEnums map[int32]bool) (int32, int, error) { val, n, err := d.DecodeInt() if err != nil { return 0, n, err } if !validEnums[val] { err := unmarshalError("DecodeEnum", ErrBadEnumValue, "invalid enum", val, nil) return 0, n, err } return val, n, nil } // DecodeBool treats the next 4 bytes as an XDR encoded boolean value and // returns the result as a bool along with the number of bytes actually read. // // An UnmarshalError is returned if there are insufficient bytes remaining or // the parsed value is not a 0 or 1. // // Reference: // RFC Section 4.4 - Boolean // Represented as an XDR encoded enumeration where 0 is false and 1 is true func (d *Decoder) DecodeBool() (bool, int, error) { val, n, err := d.DecodeInt() if err != nil { return false, n, err } switch val { case 0: return false, n, nil case 1: return true, n, nil } err = unmarshalError("DecodeBool", ErrBadEnumValue, "bool not 0 or 1", val, nil) return false, n, err } // DecodeHyper treats the next 8 bytes as an XDR encoded hyper value and // returns the result as an int64 along with the number of bytes actually read. // // An UnmarshalError is returned if there are insufficient bytes remaining. // // Reference: // RFC Section 4.5 - Hyper Integer // 64-bit big-endian signed integer in range [-9223372036854775808, 9223372036854775807] func (d *Decoder) DecodeHyper() (int64, int, error) { var buf [8]byte n, err := io.ReadFull(d.r, buf[:]) if err != nil { msg := fmt.Sprintf(errIODecode, err.Error(), 8) err := unmarshalError("DecodeHyper", ErrIO, msg, buf[:n], err) return 0, n, err } rv := int64(buf[7]) | int64(buf[6])<<8 | int64(buf[5])<<16 | int64(buf[4])<<24 | int64(buf[3])<<32 | int64(buf[2])<<40 | int64(buf[1])<<48 | int64(buf[0])<<56 return rv, n, err } // DecodeUhyper treats the next 8 bytes as an XDR encoded unsigned hyper value // and returns the result as a uint64 along with the number of bytes actually // read. // // An UnmarshalError is returned if there are insufficient bytes remaining. // // Reference: // RFC Section 4.5 - Unsigned Hyper Integer // 64-bit big-endian unsigned integer in range [0, 18446744073709551615] func (d *Decoder) DecodeUhyper() (uint64, int, error) { var buf [8]byte n, err := io.ReadFull(d.r, buf[:]) if err != nil { msg := fmt.Sprintf(errIODecode, err.Error(), 8) err := unmarshalError("DecodeUhyper", ErrIO, msg, buf[:n], err) return 0, n, err } rv := uint64(buf[7]) | uint64(buf[6])<<8 | uint64(buf[5])<<16 | uint64(buf[4])<<24 | uint64(buf[3])<<32 | uint64(buf[2])<<40 | uint64(buf[1])<<48 | uint64(buf[0])<<56 return rv, n, nil } // DecodeFloat treats the next 4 bytes as an XDR encoded floating point and // returns the result as a float32 along with the number of bytes actually read. // // An UnmarshalError is returned if there are insufficient bytes remaining. // // Reference: // RFC Section 4.6 - Floating Point // 32-bit single-precision IEEE 754 floating point func (d *Decoder) DecodeFloat() (float32, int, error) { var buf [4]byte n, err := io.ReadFull(d.r, buf[:]) if err != nil { msg := fmt.Sprintf(errIODecode, err.Error(), 4) err := unmarshalError("DecodeFloat", ErrIO, msg, buf[:n], err) return 0, n, err } val := uint32(buf[3]) | uint32(buf[2])<<8 | uint32(buf[1])<<16 | uint32(buf[0])<<24 return math.Float32frombits(val), n, nil } // DecodeDouble treats the next 8 bytes as an XDR encoded double-precision // floating point and returns the result as a float64 along with the number of // bytes actually read. // // An UnmarshalError is returned if there are insufficient bytes remaining. // // Reference: // RFC Section 4.7 - Double-Precision Floating Point // 64-bit double-precision IEEE 754 floating point func (d *Decoder) DecodeDouble() (float64, int, error) { var buf [8]byte n, err := io.ReadFull(d.r, buf[:]) if err != nil { msg := fmt.Sprintf(errIODecode, err.Error(), 8) err := unmarshalError("DecodeDouble", ErrIO, msg, buf[:n], err) return 0, n, err } val := uint64(buf[7]) | uint64(buf[6])<<8 | uint64(buf[5])<<16 | uint64(buf[4])<<24 | uint64(buf[3])<<32 | uint64(buf[2])<<40 | uint64(buf[1])<<48 | uint64(buf[0])<<56 return math.Float64frombits(val), n, nil } // RFC Section 4.8 - Quadruple-Precision Floating Point // 128-bit quadruple-precision floating point // Not Implemented // DecodeFixedOpaque treats the next 'size' bytes as XDR encoded opaque data and // returns the result as a byte slice along with the number of bytes actually // read. // // An UnmarshalError is returned if there are insufficient bytes remaining to // satisfy the passed size, including the necessary padding to make it a // multiple of 4. // // Reference: // RFC Section 4.9 - Fixed-Length Opaque Data // Fixed-length uninterpreted data zero-padded to a multiple of four func (d *Decoder) DecodeFixedOpaque(size int32) ([]byte, int, error) { // Nothing to do if size is 0. if size == 0 { return nil, 0, nil } pad := (4 - (size % 4)) % 4 paddedSize := size + pad if uint(paddedSize) > uint(math.MaxInt32) { err := unmarshalError("DecodeFixedOpaque", ErrOverflow, errMaxSlice, paddedSize, nil) return nil, 0, err } buf := make([]byte, paddedSize) n, err := io.ReadFull(d.r, buf) if err != nil { msg := fmt.Sprintf(errIODecode, err.Error(), paddedSize) err := unmarshalError("DecodeFixedOpaque", ErrIO, msg, buf[:n], err) return nil, n, err } return buf[0:size], n, nil } // DecodeOpaque treats the next bytes as variable length XDR encoded opaque // data and returns the result as a byte slice along with the number of bytes // actually read. // // An UnmarshalError is returned if there are insufficient bytes remaining or // the opaque data is larger than the max length of a Go slice. // // Reference: // RFC Section 4.10 - Variable-Length Opaque Data // Unsigned integer length followed by fixed opaque data of that length func (d *Decoder) DecodeOpaque() ([]byte, int, error) { dataLen, n, err := d.DecodeUint() if err != nil { return nil, n, err } if uint(dataLen) > uint(math.MaxInt32) || (d.maxReadSize != 0 && uint(dataLen) > d.maxReadSize) { err := unmarshalError("DecodeOpaque", ErrOverflow, errMaxSlice, dataLen, nil) return nil, n, err } rv, n2, err := d.DecodeFixedOpaque(int32(dataLen)) n += n2 if err != nil { return nil, n, err } return rv, n, nil } // DecodeString treats the next bytes as a variable length XDR encoded string // and returns the result as a string along with the number of bytes actually // read. Character encoding is assumed to be UTF-8 and therefore ASCII // compatible. If the underlying character encoding is not compatibile with // this assumption, the data can instead be read as variable-length opaque data // (DecodeOpaque) and manually converted as needed. // // An UnmarshalError is returned if there are insufficient bytes remaining or // the string data is larger than the max length of a Go slice. // // Reference: // RFC Section 4.11 - String // Unsigned integer length followed by bytes zero-padded to a multiple of // four func (d *Decoder) DecodeString() (string, int, error) { dataLen, n, err := d.DecodeUint() if err != nil { return "", n, err } if uint(dataLen) > uint(math.MaxInt32) || (d.maxReadSize != 0 && uint(dataLen) > d.maxReadSize) { err = unmarshalError("DecodeString", ErrOverflow, errMaxSlice, dataLen, nil) return "", n, err } opaque, n2, err := d.DecodeFixedOpaque(int32(dataLen)) n += n2 if err != nil { return "", n, err } return string(opaque), n, nil } // decodeFixedArray treats the next bytes as a series of XDR encoded elements // of the same type as the array represented by the reflection value and decodes // each element into the passed array. The ignoreOpaque flag controls whether // or not uint8 (byte) elements should be decoded individually or as a fixed // sequence of opaque data. It returns the the number of bytes actually read. // // An UnmarshalError is returned if any issues are encountered while decoding // the array elements. // // Reference: // RFC Section 4.12 - Fixed-Length Array // Individually XDR encoded array elements func (d *Decoder) decodeFixedArray(v reflect.Value, ignoreOpaque bool) (int, error) { // Treat [#]byte (byte is alias for uint8) as opaque data unless // ignored. if !ignoreOpaque && v.Type().Elem().Kind() == reflect.Uint8 { data, n, err := d.DecodeFixedOpaque(int32(v.Len())) if err != nil { return n, err } reflect.Copy(v, reflect.ValueOf(data)) return n, nil } // Decode each array element. var n int for i := 0; i < v.Len(); i++ { n2, err := d.decode(v.Index(i)) n += n2 if err != nil { return n, err } } return n, nil } // decodeArray treats the next bytes as a variable length series of XDR encoded // elements of the same type as the array represented by the reflection value. // The number of elements is obtained by first decoding the unsigned integer // element count. Then each element is decoded into the passed array. The // ignoreOpaque flag controls whether or not uint8 (byte) elements should be // decoded individually or as a variable sequence of opaque data. It returns // the number of bytes actually read. // // An UnmarshalError is returned if any issues are encountered while decoding // the array elements. // // Reference: // RFC Section 4.13 - Variable-Length Array // Unsigned integer length followed by individually XDR encoded array // elements func (d *Decoder) decodeArray(v reflect.Value, ignoreOpaque bool) (int, error) { dataLen, n, err := d.DecodeUint() if err != nil { return n, err } if uint(dataLen) > uint(math.MaxInt32) || (d.maxReadSize != 0 && uint(dataLen) > d.maxReadSize) { err := unmarshalError("decodeArray", ErrOverflow, errMaxSlice, dataLen, nil) return n, err } // Allocate storage for the slice elements (the underlying array) if // existing slice does not have enough capacity. sliceLen := int(dataLen) if v.Cap() < sliceLen { v.Set(reflect.MakeSlice(v.Type(), sliceLen, sliceLen)) } if v.Len() < sliceLen { v.SetLen(sliceLen) } // Treat []byte (byte is alias for uint8) as opaque data unless ignored. if !ignoreOpaque && v.Type().Elem().Kind() == reflect.Uint8 { data, n2, err := d.DecodeFixedOpaque(int32(sliceLen)) n += n2 if err != nil { return n, err } v.SetBytes(data) return n, nil } // Decode each slice element. for i := 0; i < sliceLen; i++ { n2, err := d.decode(v.Index(i)) n += n2 if err != nil { return n, err } } return n, nil } // decodeStruct treats the next bytes as a series of XDR encoded elements // of the same type as the exported fields of the struct represented by the // passed reflection value. Pointers are automatically indirected and // allocated as necessary. It returns the the number of bytes actually read. // // An UnmarshalError is returned if any issues are encountered while decoding // the elements. // // Reference: // RFC Section 4.14 - Structure // XDR encoded elements in the order of their declaration in the struct func (d *Decoder) decodeStruct(v reflect.Value) (int, error) { var n int vt := v.Type() for i := 0; i < v.NumField(); i++ { // Skip unexported fields. vtf := vt.Field(i) if vtf.PkgPath != "" { continue } // Indirect through pointers allocating them as needed and // ensure the field is settable. vf := v.Field(i) vf, err := d.indirect(vf) if err != nil { return n, err } if !vf.CanSet() { msg := fmt.Sprintf("can't decode to unsettable '%v'", vf.Type().String()) err := unmarshalError("decodeStruct", ErrNotSettable, msg, nil, nil) return n, err } // Handle non-opaque data to []uint8 and [#]uint8 based on // struct tag. tag := vtf.Tag.Get("xdropaque") if tag == "false" { switch vf.Kind() { case reflect.Slice: n2, err := d.decodeArray(vf, true) n += n2 if err != nil { return n, err } continue case reflect.Array: n2, err := d.decodeFixedArray(vf, true) n += n2 if err != nil { return n, err } continue } } // Decode each struct field. n2, err := d.decode(vf) n += n2 if err != nil { return n, err } } return n, nil } // RFC Section 4.15 - Discriminated Union // RFC Section 4.16 - Void // RFC Section 4.17 - Constant // RFC Section 4.18 - Typedef // RFC Section 4.19 - Optional data // RFC Sections 4.15 though 4.19 only apply to the data specification language // which is not implemented by this package. In the case of discriminated // unions, struct tags are used to perform a similar function. // decodeMap treats the next bytes as an XDR encoded variable array of 2-element // structures whose fields are of the same type as the map keys and elements // represented by the passed reflection value. Pointers are automatically // indirected and allocated as necessary. It returns the the number of bytes // actually read. // // An UnmarshalError is returned if any issues are encountered while decoding // the elements. func (d *Decoder) decodeMap(v reflect.Value) (int, error) { dataLen, n, err := d.DecodeUint() if err != nil { return n, err } // Allocate storage for the underlying map if needed. vt := v.Type() if v.IsNil() { v.Set(reflect.MakeMap(vt)) } // Decode each key and value according to their type. keyType := vt.Key() elemType := vt.Elem() for i := uint32(0); i < dataLen; i++ { key := reflect.New(keyType).Elem() n2, err := d.decode(key) n += n2 if err != nil { return n, err } val := reflect.New(elemType).Elem() n2, err = d.decode(val) n += n2 if err != nil { return n, err } v.SetMapIndex(key, val) } return n, nil } // decodeInterface examines the interface represented by the passed reflection // value to detect whether it is an interface that can be decoded into and // if it is, extracts the underlying value to pass back into the decode function // for decoding according to its type. It returns the the number of bytes // actually read. // // An UnmarshalError is returned if any issues are encountered while decoding // the interface. func (d *Decoder) decodeInterface(v reflect.Value) (int, error) { if v.IsNil() || !v.CanInterface() { msg := fmt.Sprintf("can't decode to nil interface") err := unmarshalError("decodeInterface", ErrNilInterface, msg, nil, nil) return 0, err } // Extract underlying value from the interface and indirect through // pointers allocating them as needed. ve := reflect.ValueOf(v.Interface()) ve, err := d.indirect(ve) if err != nil { return 0, err } if !ve.CanSet() { msg := fmt.Sprintf("can't decode to unsettable '%v'", ve.Type().String()) err := unmarshalError("decodeInterface", ErrNotSettable, msg, nil, nil) return 0, err } return d.decode(ve) } // decode is the main workhorse for unmarshalling via reflection. It uses // the passed reflection value to choose the XDR primitives to decode from // the encapsulated reader. It is a recursive function, // so cyclic data structures are not supported and will result in an infinite // loop. It returns the the number of bytes actually read. func (d *Decoder) decode(v reflect.Value) (int, error) { if !v.IsValid() { msg := fmt.Sprintf("type '%s' is not valid", v.Kind().String()) err := unmarshalError("decode", ErrUnsupportedType, msg, nil, nil) return 0, err } // Indirect through pointers allocating them as needed. ve, err := d.indirect(v) if err != nil { return 0, err } // Handle time.Time values by decoding them as an RFC3339 formatted // string with nanosecond precision. Check the type string rather // than doing a full blown conversion to interface and type assertion // since checking a string is much quicker. switch ve.Type().String() { case "time.Time": // Read the value as a string and parse it. timeString, n, err := d.DecodeString() if err != nil { return n, err } ttv, err := time.Parse(time.RFC3339, timeString) if err != nil { err := unmarshalError("decode", ErrParseTime, err.Error(), timeString, err) return n, err } ve.Set(reflect.ValueOf(ttv)) return n, nil } // If this type is in our custom types map, call the decode routine set up // for it. if dt, ok := d.customTypes[ve.Type().String()]; ok { return dt.Decode(d, v) } // Handle native Go types. switch ve.Kind() { case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int: i, n, err := d.DecodeInt() if err != nil { return n, err } if ve.OverflowInt(int64(i)) { msg := fmt.Sprintf("signed integer too large to fit '%s'", ve.Kind().String()) err = unmarshalError("decode", ErrOverflow, msg, i, nil) return n, err } ve.SetInt(int64(i)) return n, nil case reflect.Int64: i, n, err := d.DecodeHyper() if err != nil { return n, err } ve.SetInt(i) return n, nil case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint: ui, n, err := d.DecodeUint() if err != nil { return n, err } if ve.OverflowUint(uint64(ui)) { msg := fmt.Sprintf("unsigned integer too large to fit '%s'", ve.Kind().String()) err = unmarshalError("decode", ErrOverflow, msg, ui, nil) return n, err } ve.SetUint(uint64(ui)) return n, nil case reflect.Uint64: ui, n, err := d.DecodeUhyper() if err != nil { return n, err } ve.SetUint(ui) return n, nil case reflect.Bool: b, n, err := d.DecodeBool() if err != nil { return n, err } ve.SetBool(b) return n, nil case reflect.Float32: f, n, err := d.DecodeFloat() if err != nil { return n, err } ve.SetFloat(float64(f)) return n, nil case reflect.Float64: f, n, err := d.DecodeDouble() if err != nil { return n, err } ve.SetFloat(f) return n, nil case reflect.String: s, n, err := d.DecodeString() if err != nil { return n, err } ve.SetString(s) return n, nil case reflect.Array: n, err := d.decodeFixedArray(ve, false) if err != nil { return n, err } return n, nil case reflect.Slice: n, err := d.decodeArray(ve, false) if err != nil { return n, err } return n, nil case reflect.Struct: n, err := d.decodeStruct(ve) if err != nil { return n, err } return n, nil case reflect.Map: n, err := d.decodeMap(ve) if err != nil { return n, err } return n, nil case reflect.Interface: n, err := d.decodeInterface(ve) if err != nil { return n, err } return n, nil } // The only unhandled types left are unsupported. At the time of this // writing the only remaining unsupported types that exist are // reflect.Uintptr and reflect.UnsafePointer. msg := fmt.Sprintf("unsupported Go type '%s'", ve.Kind().String()) err = unmarshalError("decode", ErrUnsupportedType, msg, nil, nil) return 0, err } // indirect dereferences pointers allocating them as needed until it reaches // a non-pointer. This allows transparent decoding through arbitrary levels // of indirection. func (d *Decoder) indirect(v reflect.Value) (reflect.Value, error) { rv := v for rv.Kind() == reflect.Ptr { // Allocate pointer if needed. isNil := rv.IsNil() if isNil && !rv.CanSet() { msg := fmt.Sprintf("unable to allocate pointer for '%v'", rv.Type().String()) err := unmarshalError("indirect", ErrNotSettable, msg, nil, nil) return rv, err } if isNil { rv.Set(reflect.New(rv.Type().Elem())) } rv = rv.Elem() } return rv, nil } // Decode operates identically to the Unmarshal function with the exception of // using the reader associated with the Decoder as the source of XDR-encoded // data instead of a user-supplied reader. See the Unmarhsal documentation for // specifics. func (d *Decoder) Decode(v interface{}) (int, error) { if v == nil { msg := "can't unmarshal to nil interface" return 0, unmarshalError("Unmarshal", ErrNilInterface, msg, nil, nil) } vv := reflect.ValueOf(v) if vv.Kind() != reflect.Ptr { msg := fmt.Sprintf("can't unmarshal to non-pointer '%v' - use "+ "& operator", vv.Type().String()) err := unmarshalError("Unmarshal", ErrBadArguments, msg, nil, nil) return 0, err } if vv.IsNil() && !vv.CanSet() { msg := fmt.Sprintf("can't unmarshal to unsettable '%v' - use "+ "& operator", vv.Type().String()) err := unmarshalError("Unmarshal", ErrNotSettable, msg, nil, nil) return 0, err } return d.decode(vv) } // NewDecoder returns a Decoder that can be used to manually decode XDR data // from a provided reader. Typically, Unmarshal should be used instead of // manually creating a Decoder. func NewDecoder(r io.Reader) *Decoder { return &Decoder{r: r} } // NewDecoderLimited is identical to NewDecoder but it sets maxReadSize in // order to cap reads. func NewDecoderLimited(r io.Reader, maxSize uint) *Decoder { return &Decoder{r: r, maxReadSize: maxSize} } // NewDecoderCustomTypes returns a decoder with support for custom types known // to the caller. The second parameter is a map of the type name to the decoder // routine. When the decoder finds a type matching one of the entries in the map // it will call the custom routine for that type. func NewDecoderCustomTypes(r io.Reader, maxSize uint, ct map[string]TypeDecoder) *Decoder { return &Decoder{r: r, maxReadSize: maxSize, customTypes: ct} } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/decode_test.go000066400000000000000000001016631463537555000322040ustar00rootroot00000000000000/* * Copyright (c) 2012-2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package xdr_test import ( "bytes" "fmt" "math" "reflect" "testing" "time" . "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" ) // subTest is used to allow testing of the Unmarshal function into struct fields // which are structs themselves. type subTest struct { A string B uint8 } // allTypesTest is used to allow testing of the Unmarshal function into struct // fields of all supported types. type allTypesTest struct { A int8 B uint8 C int16 D uint16 E int32 F uint32 G int64 H uint64 I bool J float32 K float64 L string M []byte N [3]byte O []int16 P [2]subTest Q *subTest R map[string]uint32 S time.Time } // opaqueStruct is used to test handling of uint8 slices and arrays. type opaqueStruct struct { Slice []uint8 `xdropaque:"false"` Array [1]uint8 `xdropaque:"false"` } // testExpectedURet is a convenience method to test an expected number of bytes // read and error for an unmarshal. func testExpectedURet(t *testing.T, name string, n, wantN int, err, wantErr error) bool { // First ensure the number of bytes read is the expected value. The // byes read should be accurate even when an error occurs. if n != wantN { t.Errorf("%s: unexpected num bytes read - got: %v want: %v\n", name, n, wantN) return false } // Next check for the expected error. if reflect.TypeOf(err) != reflect.TypeOf(wantErr) { t.Errorf("%s: failed to detect error - got: %v <%[2]T> want: %T", name, err, wantErr) return false } if rerr, ok := err.(*UnmarshalError); ok { if werr, ok := wantErr.(*UnmarshalError); ok { if rerr.ErrorCode != werr.ErrorCode { t.Errorf("%s: failed to detect error code - "+ "got: %v want: %v", name, rerr.ErrorCode, werr.ErrorCode) return false } } } return true } // TestUnmarshal ensures the Unmarshal function works properly with all types. func TestUnmarshal(t *testing.T) { // Variables for various unsupported Unmarshal types. var nilInterface interface{} var testChan chan int var testFunc func() var testComplex64 complex64 var testComplex128 complex128 // structTestIn is input data for the big struct test of all supported // types. structTestIn := []byte{ 0x00, 0x00, 0x00, 0x7F, // A 0x00, 0x00, 0x00, 0xFF, // B 0x00, 0x00, 0x7F, 0xFF, // C 0x00, 0x00, 0xFF, 0xFF, // D 0x7F, 0xFF, 0xFF, 0xFF, // E 0xFF, 0xFF, 0xFF, 0xFF, // F 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // G 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // H 0x00, 0x00, 0x00, 0x01, // I 0x40, 0x48, 0xF5, 0xC3, // J 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18, // K 0x00, 0x00, 0x00, 0x03, 0x78, 0x64, 0x72, 0x00, // L 0x00, 0x00, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04, // M 0x01, 0x02, 0x03, 0x00, // N 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, // O 0x00, 0x00, 0x00, 0x03, 0x6F, 0x6E, 0x65, 0x00, // P[0].A 0x00, 0x00, 0x00, 0x01, // P[0].B 0x00, 0x00, 0x00, 0x03, 0x74, 0x77, 0x6F, 0x00, // P[1].A 0x00, 0x00, 0x00, 0x02, // P[1].B 0x00, 0x00, 0x00, 0x03, 0x62, 0x61, 0x72, 0x00, // Q.A 0x00, 0x00, 0x00, 0x03, // Q.B 0x00, 0x00, 0x00, 0x02, // R length 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x70, 0x31, // R key map1 0x00, 0x00, 0x00, 0x01, // R value map1 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x70, 0x32, // R key map2 0x00, 0x00, 0x00, 0x02, // R value map2 0x00, 0x00, 0x00, 0x14, 0x32, 0x30, 0x31, 0x34, 0x2d, 0x30, 0x34, 0x2d, 0x30, 0x34, 0x54, 0x30, 0x33, 0x3a, 0x32, 0x34, 0x3a, 0x34, 0x38, 0x5a, // S } // structTestWant is the expected output after unmarshalling // structTestIn. structTestWant := allTypesTest{ 127, // A 255, // B 32767, // C 65535, // D 2147483647, // E 4294967295, // F 9223372036854775807, // G 18446744073709551615, // H true, // I 3.14, // J 3.141592653589793, // K "xdr", // L []byte{1, 2, 3, 4}, // M [3]byte{1, 2, 3}, // N []int16{512, 1024, 2048}, // O [2]subTest{{"one", 1}, {"two", 2}}, // P &subTest{"bar", 3}, // Q map[string]uint32{"map1": 1, "map2": 2}, // R time.Unix(1396581888, 0).UTC(), // S } tests := []struct { in []byte // input bytes wantVal interface{} // expected value wantN int // expected number of bytes read err error // expected error }{ // int8 - XDR Integer {[]byte{0x00, 0x00, 0x00, 0x00}, int8(0), 4, nil}, {[]byte{0x00, 0x00, 0x00, 0x40}, int8(64), 4, nil}, {[]byte{0x00, 0x00, 0x00, 0x7F}, int8(127), 4, nil}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF}, int8(-1), 4, nil}, {[]byte{0xFF, 0xFF, 0xFF, 0x80}, int8(-128), 4, nil}, // Expected Failures -- 128, -129 overflow int8 and not enough // bytes {[]byte{0x00, 0x00, 0x00, 0x80}, int8(0), 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0xFF, 0xFF, 0xFF, 0x7F}, int8(0), 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0x00, 0x00, 0x00}, int8(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, // uint8 - XDR Unsigned Integer {[]byte{0x00, 0x00, 0x00, 0x00}, uint8(0), 4, nil}, {[]byte{0x00, 0x00, 0x00, 0x40}, uint8(64), 4, nil}, {[]byte{0x00, 0x00, 0x00, 0xFF}, uint8(255), 4, nil}, // Expected Failures -- 256, -1 overflow uint8 and not enough // bytes {[]byte{0x00, 0x00, 0x01, 0x00}, uint8(0), 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF}, uint8(0), 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0x00, 0x00, 0x00}, uint8(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, // int16 - XDR Integer {[]byte{0x00, 0x00, 0x00, 0x00}, int16(0), 4, nil}, {[]byte{0x00, 0x00, 0x04, 0x00}, int16(1024), 4, nil}, {[]byte{0x00, 0x00, 0x7F, 0xFF}, int16(32767), 4, nil}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF}, int16(-1), 4, nil}, {[]byte{0xFF, 0xFF, 0x80, 0x00}, int16(-32768), 4, nil}, // Expected Failures -- 32768, -32769 overflow int16 and not // enough bytes {[]byte{0x00, 0x00, 0x80, 0x00}, int16(0), 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0xFF, 0xFF, 0x7F, 0xFF}, int16(0), 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0x00, 0x00, 0x00}, uint16(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, // uint16 - XDR Unsigned Integer {[]byte{0x00, 0x00, 0x00, 0x00}, uint16(0), 4, nil}, {[]byte{0x00, 0x00, 0x04, 0x00}, uint16(1024), 4, nil}, {[]byte{0x00, 0x00, 0xFF, 0xFF}, uint16(65535), 4, nil}, // Expected Failures -- 65536, -1 overflow uint16 and not enough // bytes {[]byte{0x00, 0x01, 0x00, 0x00}, uint16(0), 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF}, uint16(0), 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0x00, 0x00, 0x00}, uint16(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, // int32 - XDR Integer {[]byte{0x00, 0x00, 0x00, 0x00}, int32(0), 4, nil}, {[]byte{0x00, 0x04, 0x00, 0x00}, int32(262144), 4, nil}, {[]byte{0x7F, 0xFF, 0xFF, 0xFF}, int32(2147483647), 4, nil}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF}, int32(-1), 4, nil}, {[]byte{0x80, 0x00, 0x00, 0x00}, int32(-2147483648), 4, nil}, // Expected Failure -- not enough bytes {[]byte{0x00, 0x00, 0x00}, int32(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, // uint32 - XDR Unsigned Integer {[]byte{0x00, 0x00, 0x00, 0x00}, uint32(0), 4, nil}, {[]byte{0x00, 0x04, 0x00, 0x00}, uint32(262144), 4, nil}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF}, uint32(4294967295), 4, nil}, // Expected Failure -- not enough bytes {[]byte{0x00, 0x00, 0x00}, uint32(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, // int64 - XDR Hyper Integer {[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, int64(0), 8, nil}, {[]byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, int64(1 << 34), 8, nil}, {[]byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, int64(1 << 42), 8, nil}, {[]byte{0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, int64(9223372036854775807), 8, nil}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, int64(-1), 8, nil}, {[]byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, int64(-9223372036854775808), 8, nil}, // Expected Failures -- not enough bytes {[]byte{0x7f, 0xff, 0xff}, int64(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0x7f, 0x00, 0xff, 0x00}, int64(0), 4, &UnmarshalError{ErrorCode: ErrIO}}, // uint64 - XDR Unsigned Hyper Integer {[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, uint64(0), 8, nil}, {[]byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, uint64(1 << 34), 8, nil}, {[]byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, uint64(1 << 42), 8, nil}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, uint64(18446744073709551615), 8, nil}, {[]byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, uint64(9223372036854775808), 8, nil}, // Expected Failures -- not enough bytes {[]byte{0xff, 0xff, 0xff}, uint64(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0xff, 0x00, 0xff, 0x00}, uint64(0), 4, &UnmarshalError{ErrorCode: ErrIO}}, // bool - XDR Integer {[]byte{0x00, 0x00, 0x00, 0x00}, false, 4, nil}, {[]byte{0x00, 0x00, 0x00, 0x01}, true, 4, nil}, // Expected Failures -- only 0 or 1 is a valid bool {[]byte{0x01, 0x00, 0x00, 0x00}, true, 4, &UnmarshalError{ErrorCode: ErrBadEnumValue}}, {[]byte{0x00, 0x00, 0x40, 0x00}, true, 4, &UnmarshalError{ErrorCode: ErrBadEnumValue}}, // float32 - XDR Floating-Point {[]byte{0x00, 0x00, 0x00, 0x00}, float32(0), 4, nil}, {[]byte{0x40, 0x48, 0xF5, 0xC3}, float32(3.14), 4, nil}, {[]byte{0x49, 0x96, 0xB4, 0x38}, float32(1234567.0), 4, nil}, {[]byte{0xFF, 0x80, 0x00, 0x00}, float32(math.Inf(-1)), 4, nil}, {[]byte{0x7F, 0x80, 0x00, 0x00}, float32(math.Inf(0)), 4, nil}, // Expected Failures -- not enough bytes {[]byte{0xff, 0xff}, float32(0), 2, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0xff, 0x00, 0xff}, float32(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, // float64 - XDR Double-precision Floating-Point {[]byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, float64(0), 8, nil}, {[]byte{0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18}, float64(3.141592653589793), 8, nil}, {[]byte{0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, float64(math.Inf(-1)), 8, nil}, {[]byte{0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, float64(math.Inf(0)), 8, nil}, // Expected Failures -- not enough bytes {[]byte{0xff, 0xff, 0xff}, float64(0), 3, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0xff, 0x00, 0xff, 0x00}, float64(0), 4, &UnmarshalError{ErrorCode: ErrIO}}, // string - XDR String {[]byte{0x00, 0x00, 0x00, 0x00}, "", 4, nil}, {[]byte{0x00, 0x00, 0x00, 0x03, 0x78, 0x64, 0x72, 0x00}, "xdr", 8, nil}, {[]byte{0x00, 0x00, 0x00, 0x06, 0xCF, 0x84, 0x3D, 0x32, 0xCF, 0x80, 0x00, 0x00}, "τ=2π", 12, nil}, // Expected Failures -- not enough bytes for length, length // larger than allowed, and len larger than available bytes. {[]byte{0x00, 0x00, 0xFF}, "", 3, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF}, "", 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0x00, 0x00, 0x00, 0xFF}, "", 4, &UnmarshalError{ErrorCode: ErrIO}}, // []byte - XDR Variable Opaque {[]byte{0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}, []byte{0x01}, 8, nil}, {[]byte{0x00, 0x00, 0x00, 0x03, 0x01, 0x02, 0x03, 0x00}, []byte{0x01, 0x02, 0x03}, 8, nil}, // Expected Failures -- not enough bytes for length, length // larger than allowed, and data larger than available bytes. {[]byte{0x00, 0x00, 0xFF}, []byte{}, 3, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0xFF, 0xFF, 0xFF, 0xFF}, []byte{}, 4, &UnmarshalError{ErrorCode: ErrOverflow}}, {[]byte{0x00, 0x00, 0x00, 0xFF}, []byte{}, 4, &UnmarshalError{ErrorCode: ErrIO}}, // [#]byte - XDR Fixed Opaque {[]byte{0x01, 0x00, 0x00, 0x00}, [1]byte{0x01}, 4, nil}, {[]byte{0x01, 0x02, 0x00, 0x00}, [2]byte{0x01, 0x02}, 4, nil}, {[]byte{0x01, 0x02, 0x03, 0x00}, [3]byte{0x01, 0x02, 0x03}, 4, nil}, {[]byte{0x01, 0x02, 0x03, 0x04}, [4]byte{0x01, 0x02, 0x03, 0x04}, 4, nil}, {[]byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00}, [5]byte{0x01, 0x02, 0x03, 0x04, 0x05}, 8, nil}, // Expected Failure -- fixed opaque data not padded {[]byte{0x01}, [1]byte{}, 1, &UnmarshalError{ErrorCode: ErrIO}}, // [] - XDR Variable-Length Array {[]byte{0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00}, []int16{512, 1024, 2048}, 16, nil}, {[]byte{0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, []bool{true, false}, 12, nil}, // Expected Failure -- 2 entries in array - not enough bytes {[]byte{0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}, []bool{}, 8, &UnmarshalError{ErrorCode: ErrIO}}, // [#] - XDR Fixed-Length Array {[]byte{0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00}, [2]uint32{512, 1024}, 8, nil}, // Expected Failure -- 2 entries in array - not enough bytes {[]byte{0x00, 0x00, 0x00, 0x02}, [2]uint32{}, 4, &UnmarshalError{ErrorCode: ErrIO}}, // map[string]uint32 {[]byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x70, 0x31, 0x00, 0x00, 0x00, 0x01}, map[string]uint32{"map1": 1}, 16, nil}, // Expected Failures -- not enough bytes in length, 1 map // element no extra bytes, 1 map element not enough bytes for // key, 1 map element not enough bytes for value. {[]byte{0x00, 0x00, 0x00}, map[string]uint32{}, 3, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0x00, 0x00, 0x00, 0x01}, map[string]uint32{}, 4, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}, map[string]uint32{}, 7, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x70, 0x31}, map[string]uint32{}, 12, &UnmarshalError{ErrorCode: ErrIO}}, // time.Time - XDR String per RFC3339 {[]byte{ 0x00, 0x00, 0x00, 0x14, 0x32, 0x30, 0x31, 0x34, 0x2d, 0x30, 0x34, 0x2d, 0x30, 0x34, 0x54, 0x30, 0x33, 0x3a, 0x32, 0x34, 0x3a, 0x34, 0x38, 0x5a, }, time.Unix(1396581888, 0).UTC(), 24, nil}, // Expected Failures -- not enough bytes, improperly formatted // time {[]byte{0x00, 0x00, 0x00}, time.Time{}, 3, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0x00, 0x00, 0x00, 0x00}, time.Time{}, 4, &UnmarshalError{ErrorCode: ErrParseTime}}, // struct - XDR Structure -- test struct contains all supported types {structTestIn, structTestWant, len(structTestIn), nil}, {[]byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02}, opaqueStruct{[]uint8{1}, [1]uint8{2}}, 12, nil}, // Expected Failures -- normal struct not enough bytes, non // opaque data not enough bytes for slice, non opaque data not // enough bytes for slice. {[]byte{0x00, 0x00}, allTypesTest{}, 2, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0x00, 0x00, 0x00}, opaqueStruct{}, 3, &UnmarshalError{ErrorCode: ErrIO}}, {[]byte{0x00, 0x00, 0x00, 0x00, 0x00}, opaqueStruct{}, 5, &UnmarshalError{ErrorCode: ErrIO}}, // Expected errors {nil, nilInterface, 0, &UnmarshalError{ErrorCode: ErrNilInterface}}, {nil, &nilInterface, 0, &UnmarshalError{ErrorCode: ErrNilInterface}}, {nil, testChan, 0, &UnmarshalError{ErrorCode: ErrUnsupportedType}}, {nil, &testChan, 0, &UnmarshalError{ErrorCode: ErrUnsupportedType}}, {nil, testFunc, 0, &UnmarshalError{ErrorCode: ErrUnsupportedType}}, {nil, &testFunc, 0, &UnmarshalError{ErrorCode: ErrUnsupportedType}}, {nil, testComplex64, 0, &UnmarshalError{ErrorCode: ErrUnsupportedType}}, {nil, &testComplex64, 0, &UnmarshalError{ErrorCode: ErrUnsupportedType}}, {nil, testComplex128, 0, &UnmarshalError{ErrorCode: ErrUnsupportedType}}, {nil, &testComplex128, 0, &UnmarshalError{ErrorCode: ErrUnsupportedType}}, } for i, test := range tests { // Attempt to unmarshal to a non-pointer version of each // positive test type to ensure the appropriate error is // returned. if test.err == nil && test.wantVal != nil { testName := fmt.Sprintf("Unmarshal #%d (non-pointer)", i) wantErr := &UnmarshalError{ErrorCode: ErrBadArguments} wvt := reflect.TypeOf(test.wantVal) want := reflect.New(wvt).Elem().Interface() n, err := Unmarshal(bytes.NewReader(test.in), want) if !testExpectedURet(t, testName, n, 0, err, wantErr) { continue } } testName := fmt.Sprintf("Unmarshal #%d", i) // Create a new pointer to the appropriate type. var want interface{} if test.wantVal != nil { wvt := reflect.TypeOf(test.wantVal) want = reflect.New(wvt).Interface() } n, err := Unmarshal(bytes.NewReader(test.in), want) // First ensure the number of bytes read is the expected value // and the error is the expected one. if !testExpectedURet(t, testName, n, test.wantN, err, test.err) { continue } if test.err != nil { continue } // Finally, ensure the read value is the expected one. wantElem := reflect.Indirect(reflect.ValueOf(want)).Interface() if !reflect.DeepEqual(wantElem, test.wantVal) { t.Errorf("%s: unexpected result - got: %v want: %v\n", testName, wantElem, test.wantVal) continue } } } // decodeFunc is used to identify which public function of the Decoder object // a test applies to. type decodeFunc int const ( fDecodeBool decodeFunc = iota fDecodeDouble fDecodeEnum fDecodeFixedOpaque fDecodeFloat fDecodeHyper fDecodeInt fDecodeOpaque fDecodeString fDecodeUhyper fDecodeUint ) // Map of decodeFunc values to names for pretty printing. var decodeFuncStrings = map[decodeFunc]string{ fDecodeBool: "DecodeBool", fDecodeDouble: "DecodeDouble", fDecodeEnum: "DecodeEnum", fDecodeFixedOpaque: "DecodeFixedOpaque", fDecodeFloat: "DecodeFloat", fDecodeHyper: "DecodeHyper", fDecodeInt: "DecodeInt", fDecodeOpaque: "DecodeOpaque", fDecodeString: "DecodeString", fDecodeUhyper: "DecodeUhyper", fDecodeUint: "DecodeUint", } // String implements the fmt.Stringer interface and returns the encode function // as a human-readable string. func (f decodeFunc) String() string { if s := decodeFuncStrings[f]; s != "" { return s } return fmt.Sprintf("Unknown decodeFunc (%d)", f) } // TestDecoder ensures a Decoder works as intended. func TestDecoder(t *testing.T) { type test struct { f decodeFunc // function to use to decode in []byte // input bytes wantVal interface{} // expected value wantN int // expected number of bytes read maxSize uint // read limiter value err error // expected error } tests := []test{ // Bool {fDecodeBool, []byte{0x00, 0x00, 0x00, 0x00}, false, 4, 0, nil}, {fDecodeBool, []byte{0x00, 0x00, 0x00, 0x01}, true, 4, 0, nil}, // Expected Failures -- only 0 or 1 is a valid bool {fDecodeBool, []byte{0x01, 0x00, 0x00, 0x00}, true, 4, 0, &UnmarshalError{ErrorCode: ErrBadEnumValue}}, {fDecodeBool, []byte{0x00, 0x00, 0x40, 0x00}, true, 4, 0, &UnmarshalError{ErrorCode: ErrBadEnumValue}}, // Double {fDecodeDouble, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, float64(0), 8, 0, nil}, {fDecodeDouble, []byte{0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18}, float64(3.141592653589793), 8, 0, nil}, {fDecodeDouble, []byte{0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, float64(math.Inf(-1)), 8, 0, nil}, {fDecodeDouble, []byte{0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, float64(math.Inf(0)), 8, 0, nil}, // Enum {fDecodeEnum, []byte{0x00, 0x00, 0x00, 0x00}, int32(0), 4, 0, nil}, {fDecodeEnum, []byte{0x00, 0x00, 0x00, 0x01}, int32(1), 4, 0, nil}, {fDecodeEnum, []byte{0x00, 0x00, 0x00, 0x02}, nil, 4, 0, &UnmarshalError{ErrorCode: ErrBadEnumValue}}, {fDecodeEnum, []byte{0x12, 0x34, 0x56, 0x78}, nil, 4, 0, &UnmarshalError{ErrorCode: ErrBadEnumValue}}, {fDecodeEnum, []byte{0x00}, nil, 1, 0, &UnmarshalError{ErrorCode: ErrIO}}, // FixedOpaque {fDecodeFixedOpaque, []byte{0x01, 0x00, 0x00, 0x00}, []byte{0x01}, 4, 0, nil}, {fDecodeFixedOpaque, []byte{0x01, 0x02, 0x00, 0x00}, []byte{0x01, 0x02}, 4, 0, nil}, {fDecodeFixedOpaque, []byte{0x01, 0x02, 0x03, 0x00}, []byte{0x01, 0x02, 0x03}, 4, 0, nil}, {fDecodeFixedOpaque, []byte{0x01, 0x02, 0x03, 0x04}, []byte{0x01, 0x02, 0x03, 0x04}, 4, 0, nil}, {fDecodeFixedOpaque, []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00}, []byte{0x01, 0x02, 0x03, 0x04, 0x05}, 8, 0, nil}, // Expected Failure -- fixed opaque data not padded {fDecodeFixedOpaque, []byte{0x01}, []byte{0x00}, 1, 0, &UnmarshalError{ErrorCode: ErrIO}}, // Float {fDecodeFloat, []byte{0x00, 0x00, 0x00, 0x00}, float32(0), 4, 0, nil}, {fDecodeFloat, []byte{0x40, 0x48, 0xF5, 0xC3}, float32(3.14), 4, 0, nil}, {fDecodeFloat, []byte{0x49, 0x96, 0xB4, 0x38}, float32(1234567.0), 4, 0, nil}, {fDecodeFloat, []byte{0xFF, 0x80, 0x00, 0x00}, float32(math.Inf(-1)), 4, 0, nil}, {fDecodeFloat, []byte{0x7F, 0x80, 0x00, 0x00}, float32(math.Inf(0)), 4, 0, nil}, // Hyper {fDecodeHyper, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, int64(0), 8, 0, nil}, {fDecodeHyper, []byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, int64(1 << 34), 8, 0, nil}, {fDecodeHyper, []byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, int64(1 << 42), 8, 0, nil}, {fDecodeHyper, []byte{0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, int64(9223372036854775807), 8, 0, nil}, {fDecodeHyper, []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, int64(-1), 8, 0, nil}, {fDecodeHyper, []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, int64(-9223372036854775808), 8, 0, nil}, // Int {fDecodeInt, []byte{0x00, 0x00, 0x00, 0x00}, int32(0), 4, 0, nil}, {fDecodeInt, []byte{0x00, 0x04, 0x00, 0x00}, int32(262144), 4, 0, nil}, {fDecodeInt, []byte{0x7F, 0xFF, 0xFF, 0xFF}, int32(2147483647), 4, 0, nil}, {fDecodeInt, []byte{0xFF, 0xFF, 0xFF, 0xFF}, int32(-1), 4, 0, nil}, {fDecodeInt, []byte{0x80, 0x00, 0x00, 0x00}, int32(-2147483648), 4, 0, nil}, // Opaque {fDecodeOpaque, []byte{0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}, []byte{0x01}, 8, 0, nil}, {fDecodeOpaque, []byte{0x00, 0x00, 0x00, 0x03, 0x01, 0x02, 0x03, 0x00}, []byte{0x01, 0x02, 0x03}, 8, 0, nil}, // Expected Failures -- not enough bytes for length, length // larger than allowed, and data larger than available bytes. {fDecodeOpaque, []byte{0x00, 0x00, 0xFF}, []byte{}, 3, 0, &UnmarshalError{ErrorCode: ErrIO}}, {fDecodeOpaque, []byte{0xFF, 0xFF, 0xFF, 0xFF}, []byte{}, 4, 0, &UnmarshalError{ErrorCode: ErrOverflow}}, {fDecodeOpaque, []byte{0x7F, 0xFF, 0xFF, 0xFD}, []byte{}, 4, 0, &UnmarshalError{ErrorCode: ErrOverflow}}, {fDecodeOpaque, []byte{0x00, 0x00, 0x00, 0xFF}, []byte{}, 4, 0, &UnmarshalError{ErrorCode: ErrIO}}, // Hit maxReadSize in opaque {fDecodeOpaque, []byte{0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}, []byte{0x01}, 8, 4, nil}, {fDecodeOpaque, []byte{0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00}, []byte{}, 4, 4, &UnmarshalError{ErrorCode: ErrOverflow}}, // String {fDecodeString, []byte{0x00, 0x00, 0x00, 0x00}, "", 4, 0, nil}, {fDecodeString, []byte{0x00, 0x00, 0x00, 0x03, 0x78, 0x64, 0x72, 0x00}, "xdr", 8, 0, nil}, {fDecodeString, []byte{0x00, 0x00, 0x00, 0x06, 0xCF, 0x84, 0x3D, 0x32, 0xCF, 0x80, 0x00, 0x00}, "τ=2π", 12, 0, nil}, // Expected Failures -- not enough bytes for length, length // larger than allowed, and len larger than available bytes. {fDecodeString, []byte{0x00, 0x00, 0xFF}, "", 3, 0, &UnmarshalError{ErrorCode: ErrIO}}, {fDecodeString, []byte{0xFF, 0xFF, 0xFF, 0xFF}, "", 4, 0, &UnmarshalError{ErrorCode: ErrOverflow}}, {fDecodeString, []byte{0x00, 0x00, 0x00, 0xFF}, "", 4, 0, &UnmarshalError{ErrorCode: ErrIO}}, // Hit maxReadSize in string {fDecodeString, []byte{0x00, 0x00, 0x00, 0x03, 0x78, 0x64, 0x72, 0x00}, "xdr", 8, 4, nil}, {fDecodeString, []byte{0x00, 0x00, 0x00, 0x03, 0x78, 0x64, 0x72, 0x00}, "xdr", 4, 2, &UnmarshalError{ErrorCode: ErrOverflow}}, // Uhyper {fDecodeUhyper, []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, uint64(0), 8, 0, nil}, {fDecodeUhyper, []byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, uint64(1 << 34), 8, 0, nil}, {fDecodeUhyper, []byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, uint64(1 << 42), 8, 0, nil}, {fDecodeUhyper, []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, uint64(18446744073709551615), 8, 0, nil}, {fDecodeUhyper, []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, uint64(9223372036854775808), 8, 0, nil}, // Uint {fDecodeUint, []byte{0x00, 0x00, 0x00, 0x00}, uint32(0), 4, 0, nil}, {fDecodeUint, []byte{0x00, 0x04, 0x00, 0x00}, uint32(262144), 4, 0, nil}, {fDecodeUint, []byte{0xFF, 0xFF, 0xFF, 0xFF}, uint32(4294967295), 4, 0, nil}, } validEnums := make(map[int32]bool) validEnums[0] = true validEnums[1] = true var rv interface{} var n int var err error decoders := []func(test) *Decoder{ func(t test) *Decoder { // return DecoderLimited for test cases that can't succeed. if t.maxSize == 0 { return NewDecoder(bytes.NewReader(t.in)) } return NewDecoderLimited(bytes.NewReader(t.in), t.maxSize) }, func(t test) *Decoder { return NewDecoderLimited(bytes.NewReader(t.in), t.maxSize) }, } for _, decoder := range decoders { for i, test := range tests { dec := decoder(test) switch test.f { case fDecodeBool: rv, n, err = dec.DecodeBool() case fDecodeDouble: rv, n, err = dec.DecodeDouble() case fDecodeEnum: rv, n, err = dec.DecodeEnum(validEnums) case fDecodeFixedOpaque: want := test.wantVal.([]byte) rv, n, err = dec.DecodeFixedOpaque(int32(len(want))) case fDecodeFloat: rv, n, err = dec.DecodeFloat() case fDecodeHyper: rv, n, err = dec.DecodeHyper() case fDecodeInt: rv, n, err = dec.DecodeInt() case fDecodeOpaque: rv, n, err = dec.DecodeOpaque() case fDecodeString: rv, n, err = dec.DecodeString() case fDecodeUhyper: rv, n, err = dec.DecodeUhyper() case fDecodeUint: rv, n, err = dec.DecodeUint() default: t.Errorf("%v #%d unrecognized function", test.f, i) continue } // First ensure the number of bytes read is the expected value // and the error is the expected one. testName := fmt.Sprintf("%v #%d", test.f, i) if !testExpectedURet(t, testName, n, test.wantN, err, test.err) { continue } if test.err != nil { continue } // Finally, ensure the read value is the expected one. if !reflect.DeepEqual(rv, test.wantVal) { t.Errorf("%s: unexpected result - got: %v want: %v\n", testName, rv, test.wantVal) continue } } } } // TestUnmarshalLimited ensures the UnmarshalLimited function properly handles // various cases not already covered by the other tests. func TestUnmarshalLimited(t *testing.T) { buf := []byte{ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, } testName := "UnmarshalLimited to capped slice" cappedSlice := make([]bool, 0, 1) expectedN := 8 expectedErr := error(nil) expectedVal := []bool{true} n, err := UnmarshalLimited(bytes.NewReader(buf), &cappedSlice, 8) if testExpectedURet(t, testName, n, expectedN, err, expectedErr) { if !reflect.DeepEqual(cappedSlice, expectedVal) { t.Errorf("%s: unexpected result - got: %v want: %v\n", testName, cappedSlice, expectedVal) } } // Positive map test. buf = []byte{ 0x00, 0x00, 0x00, 0x02, // R length 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x70, 0x31, // R key map1 0x00, 0x00, 0x00, 0x01, // R value map1 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x70, 0x32, // R key map2 0x00, 0x00, 0x00, 0x02, // R value map2 } type myMap struct { R map[string]uint32 } expectedMapVal := &myMap{ R: map[string]uint32{"map1": 1, "map2": 2}, // R } var m myMap n, err = UnmarshalLimited(bytes.NewReader(buf), &m, 28) expectedN = 28 if testExpectedURet(t, testName, n, expectedN, err, expectedErr) { if !reflect.DeepEqual(&m, expectedMapVal) { t.Errorf("%s: unexpected result - got: %v want: %v\n", testName, m, expectedMapVal) } } } // TestUnmarshalCorners ensures the Unmarshal function properly handles various // cases not already covered by the other tests. func TestUnmarshalCorners(t *testing.T) { buf := []byte{ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, } // Ensure unmarshal to unsettable pointer returns the expected error. testName := "Unmarshal to unsettable pointer" var i32p *int32 expectedN := 0 expectedErr := error(&UnmarshalError{ErrorCode: ErrNotSettable}) n, err := Unmarshal(bytes.NewReader(buf), i32p) testExpectedURet(t, testName, n, expectedN, err, expectedErr) // Ensure decode of unsettable pointer returns the expected error. testName = "Decode to unsettable pointer" expectedN = 0 expectedErr = &UnmarshalError{ErrorCode: ErrNotSettable} n, err = TstDecode(bytes.NewReader(buf))(reflect.ValueOf(i32p)) testExpectedURet(t, testName, n, expectedN, err, expectedErr) // Ensure unmarshal to indirected unsettable pointer returns the // expected error. testName = "Unmarshal to indirected unsettable pointer" ii32p := interface{}(i32p) expectedN = 0 expectedErr = &UnmarshalError{ErrorCode: ErrNotSettable} n, err = Unmarshal(bytes.NewReader(buf), &ii32p) testExpectedURet(t, testName, n, expectedN, err, expectedErr) // Ensure unmarshal to embedded unsettable interface value returns the // expected error. testName = "Unmarshal to embedded unsettable interface value" var i32 int32 ii32 := interface{}(i32) expectedN = 0 expectedErr = &UnmarshalError{ErrorCode: ErrNotSettable} n, err = Unmarshal(bytes.NewReader(buf), &ii32) testExpectedURet(t, testName, n, expectedN, err, expectedErr) // Ensure unmarshal to embedded interface value works properly. testName = "Unmarshal to embedded interface value" ii32vp := interface{}(&i32) expectedN = 4 expectedErr = nil ii32vpr := int32(1) expectedVal := interface{}(&ii32vpr) n, err = Unmarshal(bytes.NewReader(buf), &ii32vp) if testExpectedURet(t, testName, n, expectedN, err, expectedErr) { if !reflect.DeepEqual(ii32vp, expectedVal) { t.Errorf("%s: unexpected result - got: %v want: %v\n", testName, ii32vp, expectedVal) } } // Ensure decode of an invalid reflect value returns the expected // error. testName = "Decode invalid reflect value" expectedN = 0 expectedErr = error(&UnmarshalError{ErrorCode: ErrUnsupportedType}) n, err = TstDecode(bytes.NewReader(buf))(reflect.Value{}) testExpectedURet(t, testName, n, expectedN, err, expectedErr) // Ensure unmarshal to a slice with a cap and 0 length adjusts the // length properly. testName = "Unmarshal to capped slice" cappedSlice := make([]bool, 0, 1) expectedN = 8 expectedErr = nil expectedVal = []bool{true} n, err = Unmarshal(bytes.NewReader(buf), &cappedSlice) if testExpectedURet(t, testName, n, expectedN, err, expectedErr) { if !reflect.DeepEqual(cappedSlice, expectedVal) { t.Errorf("%s: unexpected result - got: %v want: %v\n", testName, cappedSlice, expectedVal) } } // Ensure unmarshal to struct with both exported and unexported fields // skips the unexported fields but still unmarshals to the exported // fields. type unexportedStruct struct { unexported int Exported int } testName = "Unmarshal to struct with exported and unexported fields" var tstruct unexportedStruct expectedN = 4 expectedErr = nil expectedVal = unexportedStruct{0, 1} n, err = Unmarshal(bytes.NewReader(buf), &tstruct) if testExpectedURet(t, testName, n, expectedN, err, expectedErr) { if !reflect.DeepEqual(tstruct, expectedVal) { t.Errorf("%s: unexpected result - got: %v want: %v\n", testName, tstruct, expectedVal) } } // Ensure decode to struct with unsettable fields return expected error. type unsettableStruct struct { Exported int } testName = "Decode to struct with unsettable fields" var ustruct unsettableStruct expectedN = 0 expectedErr = error(&UnmarshalError{ErrorCode: ErrNotSettable}) n, err = TstDecode(bytes.NewReader(buf))(reflect.ValueOf(ustruct)) testExpectedURet(t, testName, n, expectedN, err, expectedErr) // Ensure decode to struct with unsettable pointer fields return // expected error. type unsettablePointerStruct struct { Exported *int } testName = "Decode to struct with unsettable pointer fields" var upstruct unsettablePointerStruct expectedN = 0 expectedErr = error(&UnmarshalError{ErrorCode: ErrNotSettable}) n, err = TstDecode(bytes.NewReader(buf))(reflect.ValueOf(upstruct)) testExpectedURet(t, testName, n, expectedN, err, expectedErr) } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/doc.go000066400000000000000000000146441463537555000304710ustar00rootroot00000000000000/* * Copyright (c) 2012-2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* Package xdr implements the data representation portion of the External Data Representation (XDR) standard protocol as specified in RFC 4506 (obsoletes RFC 1832 and RFC 1014). The XDR RFC defines both a data specification language and a data representation standard. This package implements methods to encode and decode XDR data per the data representation standard with the exception of 128-bit quadruple-precision floating points. It does not currently implement parsing of the data specification language. In other words, the ability to automatically generate Go code by parsing an XDR data specification file (typically .x extension) is not supported. In practice, this limitation of the package is fairly minor since it is largely unnecessary due to the reflection capabilities of Go as described below. This package provides two approaches for encoding and decoding XDR data: 1) Marshal/Unmarshal functions which automatically map between XDR and Go types 2) Individual Encoder/Decoder objects to manually work with XDR primitives For the Marshal/Unmarshal functions, Go reflection capabilities are used to choose the type of the underlying XDR data based upon the Go type to encode or the target Go type to decode into. A description of how each type is mapped is provided below, however one important type worth reviewing is Go structs. In the case of structs, each exported field (first letter capitalized) is reflected and mapped in order. As a result, this means a Go struct with exported fields of the appropriate types listed in the expected order can be used to automatically encode / decode the XDR data thereby eliminating the need to write a lot of boilerplate code to encode/decode and error check each piece of XDR data as is typically required with C based XDR libraries. Go Type to XDR Type Mappings The following chart shows an overview of how Go types are mapped to XDR types for automatic marshalling and unmarshalling. The documentation for the Marshal and Unmarshal functions has specific details of how the mapping proceeds. Go Type <-> XDR Type -------------------- int8, int16, int32, int <-> XDR Integer uint8, uint16, uint32, uint <-> XDR Unsigned Integer int64 <-> XDR Hyper Integer uint64 <-> XDR Unsigned Hyper Integer bool <-> XDR Boolean float32 <-> XDR Floating-Point float64 <-> XDR Double-Precision Floating-Point string <-> XDR String byte <-> XDR Integer []byte <-> XDR Variable-Length Opaque Data [#]byte <-> XDR Fixed-Length Opaque Data [] <-> XDR Variable-Length Array [#] <-> XDR Fixed-Length Array struct <-> XDR Structure map <-> XDR Variable-Length Array of two-element XDR Structures time.Time <-> XDR String encoded with RFC3339 nanosecond precision Notes and Limitations: * Automatic marshalling and unmarshalling of variable and fixed-length arrays of uint8s require a special struct tag `xdropaque:"false"` since byte slices and byte arrays are assumed to be opaque data and byte is a Go alias for uint8 thus indistinguishable under reflection * Channel, complex, and function types cannot be encoded * Interfaces without a concrete value cannot be encoded * Cyclic data structures are not supported and will result in infinite loops * Strings are marshalled and unmarshalled with UTF-8 character encoding which differs from the XDR specification of ASCII, however UTF-8 is backwards compatible with ASCII so this should rarely cause issues Encoding To encode XDR data, use the Marshal function. func Marshal(w io.Writer, v interface{}) (int, error) For example, given the following code snippet: type ImageHeader struct { Signature [3]byte Version uint32 IsGrayscale bool NumSections uint32 } h := ImageHeader{[3]byte{0xAB, 0xCD, 0xEF}, 2, true, 10} var w bytes.Buffer bytesWritten, err := xdr.Marshal(&w, &h) // Error check elided The result, encodedData, will then contain the following XDR encoded byte sequence: 0xAB, 0xCD, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0A In addition, while the automatic marshalling discussed above will work for the vast majority of cases, an Encoder object is provided that can be used to manually encode XDR primitives for complex scenarios where automatic reflection-based encoding won't work. The included examples provide a sample of manual usage via an Encoder. Decoding To decode XDR data, use the Unmarshal function. func Unmarshal(r io.Reader, v interface{}) (int, error) For example, given the following code snippet: type ImageHeader struct { Signature [3]byte Version uint32 IsGrayscale bool NumSections uint32 } // Using output from the Encoding section above. encodedData := []byte{ 0xAB, 0xCD, 0xEF, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, } var h ImageHeader bytesRead, err := xdr.Unmarshal(bytes.NewReader(encodedData), &h) // Error check elided The struct instance, h, will then contain the following values: h.Signature = [3]byte{0xAB, 0xCD, 0xEF} h.Version = 2 h.IsGrayscale = true h.NumSections = 10 In addition, while the automatic unmarshalling discussed above will work for the vast majority of cases, a Decoder object is provided that can be used to manually decode XDR primitives for complex scenarios where automatic reflection-based decoding won't work. The included examples provide a sample of manual usage via a Decoder. Errors All errors are either of type UnmarshalError or MarshalError. Both provide human-readable output as well as an ErrorCode field which can be inspected by sophisticated callers if necessary. See the documentation of UnmarshalError, MarshalError, and ErrorCode for further details. */ package xdr golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/encode.go000066400000000000000000000512511463537555000311540ustar00rootroot00000000000000/* * Copyright (c) 2012-2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package xdr import ( "fmt" "io" "math" "reflect" "time" ) var errIOEncode = "%s while encoding %d bytes" /* Marshal writes the XDR encoding of v to writer w and returns the number of bytes written. It traverses v recursively and automatically indirects pointers through arbitrary depth to encode the actual value pointed to. Marshal uses reflection to determine the type of the concrete value contained by v and performs a mapping of Go types to the underlying XDR types as follows: Go Type -> XDR Type -------------------- int8, int16, int32, int -> XDR Integer uint8, uint16, uint32, uint -> XDR Unsigned Integer int64 -> XDR Hyper Integer uint64 -> XDR Unsigned Hyper Integer bool -> XDR Boolean float32 -> XDR Floating-Point float64 -> XDR Double-Precision Floating-Point string -> XDR String byte -> XDR Integer []byte -> XDR Variable-Length Opaque Data [#]byte -> XDR Fixed-Length Opaque Data [] -> XDR Variable-Length Array [#] -> XDR Fixed-Length Array struct -> XDR Structure map -> XDR Variable-Length Array of two-element XDR Structures time.Time -> XDR String encoded with RFC3339 nanosecond precision Notes and Limitations: * Automatic marshalling of variable and fixed-length arrays of uint8s requires a special struct tag `xdropaque:"false"` since byte slices and byte arrays are assumed to be opaque data and byte is a Go alias for uint8 thus indistinguishable under reflection * Channel, complex, and function types cannot be encoded * Interfaces without a concrete value cannot be encoded * Cyclic data structures are not supported and will result in infinite loops * Strings are marshalled with UTF-8 character encoding which differs from the XDR specification of ASCII, however UTF-8 is backwards compatible with ASCII so this should rarely cause issues If any issues are encountered during the marshalling process, a MarshalError is returned with a human readable description as well as an ErrorCode value for further inspection from sophisticated callers. Some potential issues are unsupported Go types, attempting to encode more opaque data than can be represented by a single opaque XDR entry, and exceeding max slice limitations. */ func Marshal(w io.Writer, v interface{}) (int, error) { enc := Encoder{w: w} return enc.Encode(v) } // An Encoder wraps an io.Writer that will receive the XDR encoded byte stream. // See NewEncoder. type Encoder struct { w io.Writer } // EncodeInt writes the XDR encoded representation of the passed 32-bit signed // integer to the encapsulated writer and returns the number of bytes written. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.1 - Integer // 32-bit big-endian signed integer in range [-2147483648, 2147483647] func (enc *Encoder) EncodeInt(v int32) (int, error) { var b [4]byte b[0] = byte(v >> 24) b[1] = byte(v >> 16) b[2] = byte(v >> 8) b[3] = byte(v) n, err := enc.w.Write(b[:]) if err != nil { msg := fmt.Sprintf(errIOEncode, err.Error(), 4) err := marshalError("EncodeInt", ErrIO, msg, b[:n], err) return n, err } return n, nil } // EncodeUint writes the XDR encoded representation of the passed 32-bit // unsigned integer to the encapsulated writer and returns the number of bytes // written. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.2 - Unsigned Integer // 32-bit big-endian unsigned integer in range [0, 4294967295] func (enc *Encoder) EncodeUint(v uint32) (int, error) { var b [4]byte b[0] = byte(v >> 24) b[1] = byte(v >> 16) b[2] = byte(v >> 8) b[3] = byte(v) n, err := enc.w.Write(b[:]) if err != nil { msg := fmt.Sprintf(errIOEncode, err.Error(), 4) err := marshalError("EncodeUint", ErrIO, msg, b[:n], err) return n, err } return n, nil } // EncodeEnum treats the passed 32-bit signed integer as an enumeration value // and, if it is in the list of passed valid enumeration values, writes the XDR // encoded representation of it to the encapsulated writer. It returns the // number of bytes written. // // A MarshalError is returned if the enumeration value is not one of the // provided valid values or if writing the data fails. // // Reference: // RFC Section 4.3 - Enumeration // Represented as an XDR encoded signed integer func (enc *Encoder) EncodeEnum(v int32, validEnums map[int32]bool) (int, error) { if !validEnums[v] { err := marshalError("EncodeEnum", ErrBadEnumValue, "invalid enum", v, nil) return 0, err } return enc.EncodeInt(v) } // EncodeBool writes the XDR encoded representation of the passed boolean to the // encapsulated writer and returns the number of bytes written. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.4 - Boolean // Represented as an XDR encoded enumeration where 0 is false and 1 is true func (enc *Encoder) EncodeBool(v bool) (int, error) { i := int32(0) if v == true { i = 1 } return enc.EncodeInt(i) } // EncodeHyper writes the XDR encoded representation of the passed 64-bit // signed integer to the encapsulated writer and returns the number of bytes // written. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.5 - Hyper Integer // 64-bit big-endian signed integer in range [-9223372036854775808, 9223372036854775807] func (enc *Encoder) EncodeHyper(v int64) (int, error) { var b [8]byte b[0] = byte(v >> 56) b[1] = byte(v >> 48) b[2] = byte(v >> 40) b[3] = byte(v >> 32) b[4] = byte(v >> 24) b[5] = byte(v >> 16) b[6] = byte(v >> 8) b[7] = byte(v) n, err := enc.w.Write(b[:]) if err != nil { msg := fmt.Sprintf(errIOEncode, err.Error(), 8) err := marshalError("EncodeHyper", ErrIO, msg, b[:n], err) return n, err } return n, nil } // EncodeUhyper writes the XDR encoded representation of the passed 64-bit // unsigned integer to the encapsulated writer and returns the number of bytes // written. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.5 - Unsigned Hyper Integer // 64-bit big-endian unsigned integer in range [0, 18446744073709551615] func (enc *Encoder) EncodeUhyper(v uint64) (int, error) { var b [8]byte b[0] = byte(v >> 56) b[1] = byte(v >> 48) b[2] = byte(v >> 40) b[3] = byte(v >> 32) b[4] = byte(v >> 24) b[5] = byte(v >> 16) b[6] = byte(v >> 8) b[7] = byte(v) n, err := enc.w.Write(b[:]) if err != nil { msg := fmt.Sprintf(errIOEncode, err.Error(), 8) err := marshalError("EncodeUhyper", ErrIO, msg, b[:n], err) return n, err } return n, nil } // EncodeFloat writes the XDR encoded representation of the passed 32-bit // (single-precision) floating point to the encapsulated writer and returns the // number of bytes written. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.6 - Floating Point // 32-bit single-precision IEEE 754 floating point func (enc *Encoder) EncodeFloat(v float32) (int, error) { ui := math.Float32bits(v) return enc.EncodeUint(ui) } // EncodeDouble writes the XDR encoded representation of the passed 64-bit // (double-precision) floating point to the encapsulated writer and returns the // number of bytes written. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.7 - Double-Precision Floating Point // 64-bit double-precision IEEE 754 floating point func (enc *Encoder) EncodeDouble(v float64) (int, error) { ui := math.Float64bits(v) return enc.EncodeUhyper(ui) } // RFC Section 4.8 - Quadruple-Precision Floating Point // 128-bit quadruple-precision floating point // Not Implemented // EncodeFixedOpaque treats the passed byte slice as opaque data of a fixed // size and writes the XDR encoded representation of it to the encapsulated // writer. It returns the number of bytes written. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.9 - Fixed-Length Opaque Data // Fixed-length uninterpreted data zero-padded to a multiple of four func (enc *Encoder) EncodeFixedOpaque(v []byte) (int, error) { l := len(v) pad := (4 - (l % 4)) % 4 // Write the actual bytes. n, err := enc.w.Write(v) if err != nil { msg := fmt.Sprintf(errIOEncode, err.Error(), len(v)) err := marshalError("EncodeFixedOpaque", ErrIO, msg, v[:n], err) return n, err } // Write any padding if needed. if pad > 0 { b := make([]byte, pad) n2, err := enc.w.Write(b) n += n2 if err != nil { written := make([]byte, l+n2) copy(written, v) copy(written[l:], b[:n2]) msg := fmt.Sprintf(errIOEncode, err.Error(), l+pad) err := marshalError("EncodeFixedOpaque", ErrIO, msg, written, err) return n, err } } return n, nil } // EncodeOpaque treats the passed byte slice as opaque data of a variable // size and writes the XDR encoded representation of it to the encapsulated // writer. It returns the number of bytes written. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.10 - Variable-Length Opaque Data // Unsigned integer length followed by fixed opaque data of that length func (enc *Encoder) EncodeOpaque(v []byte) (int, error) { // Length of opaque data. n, err := enc.EncodeUint(uint32(len(v))) if err != nil { return n, err } n2, err := enc.EncodeFixedOpaque(v) n += n2 return n, err } // EncodeString writes the XDR encoded representation of the passed string // to the encapsulated writer and returns the number of bytes written. // Character encoding is assumed to be UTF-8 and therefore ASCII compatible. If // the underlying character encoding is not compatible with this assumption, the // data can instead be written as variable-length opaque data (EncodeOpaque) and // manually converted as needed. // // A MarshalError with an error code of ErrIO is returned if writing the data // fails. // // Reference: // RFC Section 4.11 - String // Unsigned integer length followed by bytes zero-padded to a multiple of four func (enc *Encoder) EncodeString(v string) (int, error) { // Length of string. n, err := enc.EncodeUint(uint32(len(v))) if err != nil { return n, err } n2, err := enc.EncodeFixedOpaque([]byte(v)) n += n2 return n, err } // encodeFixedArray writes the XDR encoded representation of each element // in the passed array represented by the reflection value to the encapsulated // writer and returns the number of bytes written. The ignoreOpaque flag // controls whether or not uint8 (byte) elements should be encoded individually // or as a fixed sequence of opaque data. // // A MarshalError is returned if any issues are encountered while encoding // the array elements. // // Reference: // RFC Section 4.12 - Fixed-Length Array // Individually XDR encoded array elements func (enc *Encoder) encodeFixedArray(v reflect.Value, ignoreOpaque bool) (int, error) { // Treat [#]byte (byte is alias for uint8) as opaque data unless ignored. if !ignoreOpaque && v.Type().Elem().Kind() == reflect.Uint8 { // Create a slice of the underlying array for better efficiency // when possible. Can't create a slice of an unaddressable // value. if v.CanAddr() { return enc.EncodeFixedOpaque(v.Slice(0, v.Len()).Bytes()) } // When the underlying array isn't addressable fall back to // copying the array into a new slice. This is rather ugly, but // the inability to create a constant slice from an // unaddressable array is a limitation of Go. slice := make([]byte, v.Len(), v.Len()) reflect.Copy(reflect.ValueOf(slice), v) return enc.EncodeFixedOpaque(slice) } // Encode each array element. var n int for i := 0; i < v.Len(); i++ { n2, err := enc.encode(v.Index(i)) n += n2 if err != nil { return n, err } } return n, nil } // encodeArray writes an XDR encoded integer representing the number of // elements in the passed slice represented by the reflection value followed by // the XDR encoded representation of each element in slice to the encapsulated // writer and returns the number of bytes written. The ignoreOpaque flag // controls whether or not uint8 (byte) elements should be encoded individually // or as a variable sequence of opaque data. // // A MarshalError is returned if any issues are encountered while encoding // the array elements. // // Reference: // RFC Section 4.13 - Variable-Length Array // Unsigned integer length followed by individually XDR encoded array elements func (enc *Encoder) encodeArray(v reflect.Value, ignoreOpaque bool) (int, error) { numItems := uint32(v.Len()) n, err := enc.EncodeUint(numItems) if err != nil { return n, err } n2, err := enc.encodeFixedArray(v, ignoreOpaque) n += n2 return n, err } // encodeStruct writes an XDR encoded representation of each value in the // exported fields of the struct represented by the passed reflection value to // the encapsulated writer and returns the number of bytes written. Pointers // are automatically indirected through arbitrary depth to encode the actual // value pointed to. // // A MarshalError is returned if any issues are encountered while encoding // the elements. // // Reference: // RFC Section 4.14 - Structure // XDR encoded elements in the order of their declaration in the struct func (enc *Encoder) encodeStruct(v reflect.Value) (int, error) { var n int vt := v.Type() for i := 0; i < v.NumField(); i++ { // Skip unexported fields and indirect through pointers. vtf := vt.Field(i) if vtf.PkgPath != "" { continue } vf := v.Field(i) vf = enc.indirect(vf) // Handle non-opaque data to []uint8 and [#]uint8 based on struct tag. tag := vtf.Tag.Get("xdropaque") if tag == "false" { switch vf.Kind() { case reflect.Slice: n2, err := enc.encodeArray(vf, true) n += n2 if err != nil { return n, err } continue case reflect.Array: n2, err := enc.encodeFixedArray(vf, true) n += n2 if err != nil { return n, err } continue } } // Encode each struct field. n2, err := enc.encode(vf) n += n2 if err != nil { return n, err } } return n, nil } // RFC Section 4.15 - Discriminated Union // RFC Section 4.16 - Void // RFC Section 4.17 - Constant // RFC Section 4.18 - Typedef // RFC Section 4.19 - Optional data // RFC Sections 4.15 though 4.19 only apply to the data specification language // which is not implemented by this package. In the case of discriminated // unions, struct tags are used to perform a similar function. // encodeMap treats the map represented by the passed reflection value as a // variable-length array of 2-element structures whose fields are of the same // type as the map keys and elements and writes its XDR encoded representation // to the encapsulated writer. It returns the number of bytes written. // // A MarshalError is returned if any issues are encountered while encoding // the elements. func (enc *Encoder) encodeMap(v reflect.Value) (int, error) { // Number of elements. n, err := enc.EncodeUint(uint32(v.Len())) if err != nil { return n, err } // Encode each key and value according to their type. for _, key := range v.MapKeys() { n2, err := enc.encode(key) n += n2 if err != nil { return n, err } n2, err = enc.encode(v.MapIndex(key)) n += n2 if err != nil { return n, err } } return n, nil } // encodeInterface examines the interface represented by the passed reflection // value to detect whether it is an interface that can be encoded if it is, // extracts the underlying value to pass back into the encode function for // encoding according to its type. // // A MarshalError is returned if any issues are encountered while encoding // the interface. func (enc *Encoder) encodeInterface(v reflect.Value) (int, error) { if v.IsNil() || !v.CanInterface() { msg := fmt.Sprintf("can't encode nil interface") err := marshalError("encodeInterface", ErrNilInterface, msg, nil, nil) return 0, err } // Extract underlying value from the interface and indirect through pointers. ve := reflect.ValueOf(v.Interface()) ve = enc.indirect(ve) return enc.encode(ve) } // encode is the main workhorse for marshalling via reflection. It uses // the passed reflection value to choose the XDR primitives to encode into // the encapsulated writer and returns the number of bytes written. It is a // recursive function, so cyclic data structures are not supported and will // result in an infinite loop. func (enc *Encoder) encode(v reflect.Value) (int, error) { if !v.IsValid() { msg := fmt.Sprintf("type '%s' is not valid", v.Kind().String()) err := marshalError("encode", ErrUnsupportedType, msg, nil, nil) return 0, err } // Indirect through pointers to get at the concrete value. ve := enc.indirect(v) // Handle time.Time values by encoding them as an RFC3339 formatted // string with nanosecond precision. Check the type string before // doing a full blown conversion to interface and type assertion since // checking a string is much quicker. if ve.Type().String() == "time.Time" && ve.CanInterface() { viface := ve.Interface() if tv, ok := viface.(time.Time); ok { return enc.EncodeString(tv.Format(time.RFC3339Nano)) } } // Handle native Go types. switch ve.Kind() { case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int: return enc.EncodeInt(int32(ve.Int())) case reflect.Int64: return enc.EncodeHyper(ve.Int()) case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint: return enc.EncodeUint(uint32(ve.Uint())) case reflect.Uint64: return enc.EncodeUhyper(ve.Uint()) case reflect.Bool: return enc.EncodeBool(ve.Bool()) case reflect.Float32: return enc.EncodeFloat(float32(ve.Float())) case reflect.Float64: return enc.EncodeDouble(ve.Float()) case reflect.String: return enc.EncodeString(ve.String()) case reflect.Array: return enc.encodeFixedArray(ve, false) case reflect.Slice: return enc.encodeArray(ve, false) case reflect.Struct: return enc.encodeStruct(ve) case reflect.Map: return enc.encodeMap(ve) case reflect.Interface: return enc.encodeInterface(ve) } // The only unhandled types left are unsupported. At the time of this // writing the only remaining unsupported types that exist are // reflect.Uintptr and reflect.UnsafePointer. msg := fmt.Sprintf("unsupported Go type '%s'", ve.Kind().String()) err := marshalError("encode", ErrUnsupportedType, msg, nil, nil) return 0, err } // indirect dereferences pointers until it reaches a non-pointer. This allows // transparent encoding through arbitrary levels of indirection. func (enc *Encoder) indirect(v reflect.Value) reflect.Value { rv := v for rv.Kind() == reflect.Ptr { rv = rv.Elem() } return rv } // Encode operates identically to the Marshal function with the exception of // using the writer associated with the Encoder for the destination of the // XDR-encoded data instead of a user-supplied writer. See the Marshal // documentation for specifics. func (enc *Encoder) Encode(v interface{}) (int, error) { if v == nil { msg := "can't marshal nil interface" err := marshalError("Marshal", ErrNilInterface, msg, nil, nil) return 0, err } vv := reflect.ValueOf(v) vve := vv for vve.Kind() == reflect.Ptr { if vve.IsNil() { msg := fmt.Sprintf("can't marshal nil pointer '%v'", vv.Type().String()) err := marshalError("Marshal", ErrBadArguments, msg, nil, nil) return 0, err } vve = vve.Elem() } return enc.encode(vve) } // NewEncoder returns an object that can be used to manually choose fields to // XDR encode to the passed writer w. Typically, Marshal should be used instead // of manually creating an Encoder. An Encoder, along with several of its // methods to encode XDR primitives, is exposed so it is possible to perform // manual encoding of data without relying on reflection should it be necessary // in complex scenarios where automatic reflection-based encoding won't work. func NewEncoder(w io.Writer) *Encoder { return &Encoder{w: w} } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/encode_test.go000066400000000000000000000627321463537555000322210ustar00rootroot00000000000000/* * Copyright (c) 2012-2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package xdr_test import ( "fmt" "math" "reflect" "testing" "time" . "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" ) // testExpectedMRet is a convenience method to test an expected number of bytes // written and error for a marshal. func testExpectedMRet(t *testing.T, name string, n, wantN int, err, wantErr error) bool { // First ensure the number of bytes written is the expected value. The // bytes read should be accurate even when an error occurs. if n != wantN { t.Errorf("%s: unexpected num bytes written - got: %v want: %v\n", name, n, wantN) return false } // Next check for the expected error. if reflect.TypeOf(err) != reflect.TypeOf(wantErr) { t.Errorf("%s: failed to detect error - got: %v <%[2]T> want: %T", name, err, wantErr) return false } if rerr, ok := err.(*MarshalError); ok { if werr, ok := wantErr.(*MarshalError); ok { if rerr.ErrorCode != werr.ErrorCode { t.Errorf("%s: failed to detect error code - "+ "got: %v want: %v", name, rerr.ErrorCode, werr.ErrorCode) return false } } } return true } // TestMarshal ensures the Marshal function works properly with all types. func TestMarshal(t *testing.T) { // Variables for various unsupported Marshal types. var nilInterface interface{} var testChan chan int var testFunc func() var testComplex64 complex64 var testComplex128 complex128 // testInterface is used to test Marshal with values nested in an // interface. testInterface := interface{}(17) // structMarshalTestIn is input data for the big struct test of all // supported types. structMarshalTestIn := allTypesTest{ 127, // A 255, // B 32767, // C 65535, // D 2147483647, // E 4294967295, // F 9223372036854775807, // G 18446744073709551615, // H true, // I 3.14, // J 3.141592653589793, // K "xdr", // L []byte{1, 2, 3, 4}, // M [3]byte{1, 2, 3}, // N []int16{512, 1024, 2048}, // O [2]subTest{{"one", 1}, {"two", 2}}, // P &subTest{"bar", 3}, // Q map[string]uint32{"map1": 1}, // R time.Unix(1396581888, 0).UTC(), // S } // structMarshalTestWant is the expected output after marshalling // structMarshalTestIn. structMarshalTestWant := []byte{ 0x00, 0x00, 0x00, 0x7F, // A 0x00, 0x00, 0x00, 0xFF, // B 0x00, 0x00, 0x7F, 0xFF, // C 0x00, 0x00, 0xFF, 0xFF, // D 0x7F, 0xFF, 0xFF, 0xFF, // E 0xFF, 0xFF, 0xFF, 0xFF, // F 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // G 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // H 0x00, 0x00, 0x00, 0x01, // I 0x40, 0x48, 0xF5, 0xC3, // J 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18, // K 0x00, 0x00, 0x00, 0x03, 0x78, 0x64, 0x72, 0x00, // L 0x00, 0x00, 0x00, 0x04, 0x01, 0x02, 0x03, 0x04, // M 0x01, 0x02, 0x03, 0x00, // N 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, // O 0x00, 0x00, 0x00, 0x03, 0x6F, 0x6E, 0x65, 0x00, // P[0].A 0x00, 0x00, 0x00, 0x01, // P[0].B 0x00, 0x00, 0x00, 0x03, 0x74, 0x77, 0x6F, 0x00, // P[1].A 0x00, 0x00, 0x00, 0x02, // P[1].B 0x00, 0x00, 0x00, 0x03, 0x62, 0x61, 0x72, 0x00, // Q.A 0x00, 0x00, 0x00, 0x03, // Q.B 0x00, 0x00, 0x00, 0x01, // R length 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x70, 0x31, // R key map1 0x00, 0x00, 0x00, 0x01, // R value map1 0x00, 0x00, 0x00, 0x14, 0x32, 0x30, 0x31, 0x34, 0x2d, 0x30, 0x34, 0x2d, 0x30, 0x34, 0x54, 0x30, 0x33, 0x3a, 0x32, 0x34, 0x3a, 0x34, 0x38, 0x5a, // S } tests := []struct { in interface{} // input value wantBytes []byte // expected bytes wantN int // expected/max number of bytes written err error // expected error }{ // interface {testInterface, []byte{0x00, 0x00, 0x00, 0x11}, 4, nil}, {&testInterface, []byte{0x00, 0x00, 0x00, 0x11}, 4, nil}, // int8 - XDR Integer {int8(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {int8(64), []byte{0x00, 0x00, 0x00, 0x40}, 4, nil}, {int8(127), []byte{0x00, 0x00, 0x00, 0x7F}, 4, nil}, {int8(-1), []byte{0xFF, 0xFF, 0xFF, 0xFF}, 4, nil}, {int8(-128), []byte{0xFF, 0xFF, 0xFF, 0x80}, 4, nil}, // Expected Failure -- Short write {int8(127), []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, // uint8 - XDR Unsigned Integer {uint8(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {uint8(64), []byte{0x00, 0x00, 0x00, 0x40}, 4, nil}, {uint8(255), []byte{0x00, 0x00, 0x00, 0xFF}, 4, nil}, // Expected Failure -- Short write {uint8(255), []byte{0x00, 0x00}, 2, &MarshalError{ErrorCode: ErrIO}}, // int16 - XDR Integer {int16(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {int16(1024), []byte{0x00, 0x00, 0x04, 0x00}, 4, nil}, {int16(32767), []byte{0x00, 0x00, 0x7F, 0xFF}, 4, nil}, {int16(-1), []byte{0xFF, 0xFF, 0xFF, 0xFF}, 4, nil}, {int16(-32768), []byte{0xFF, 0xFF, 0x80, 0x00}, 4, nil}, // Expected Failure -- Short write {int16(-32768), []byte{0xFF}, 1, &MarshalError{ErrorCode: ErrIO}}, // uint16 - XDR Unsigned Integer {uint16(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {uint16(1024), []byte{0x00, 0x00, 0x04, 0x00}, 4, nil}, {uint16(65535), []byte{0x00, 0x00, 0xFF, 0xFF}, 4, nil}, // Expected Failure -- Short write {uint16(65535), []byte{0x00, 0x00}, 2, &MarshalError{ErrorCode: ErrIO}}, // int32 - XDR Integer {int32(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {int32(262144), []byte{0x00, 0x04, 0x00, 0x00}, 4, nil}, {int32(2147483647), []byte{0x7F, 0xFF, 0xFF, 0xFF}, 4, nil}, {int32(-1), []byte{0xFF, 0xFF, 0xFF, 0xFF}, 4, nil}, {int32(-2147483648), []byte{0x80, 0x00, 0x00, 0x00}, 4, nil}, // Expected Failure -- Short write {int32(2147483647), []byte{0x7F, 0xFF, 0xFF}, 3, &MarshalError{ErrorCode: ErrIO}}, // uint32 - XDR Unsigned Integer {uint32(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {uint32(262144), []byte{0x00, 0x04, 0x00, 0x00}, 4, nil}, {uint32(4294967295), []byte{0xFF, 0xFF, 0xFF, 0xFF}, 4, nil}, // Expected Failure -- Short write {uint32(262144), []byte{0x00, 0x04, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, // int64 - XDR Hyper Integer {int64(0), []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {int64(1 << 34), []byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {int64(1 << 42), []byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {int64(9223372036854775807), []byte{0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 8, nil}, {int64(-1), []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 8, nil}, {int64(-9223372036854775808), []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, // Expected Failure -- Short write {int64(-9223372036854775808), []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 7, &MarshalError{ErrorCode: ErrIO}}, // uint64 - XDR Unsigned Hyper Integer {uint64(0), []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {uint64(1 << 34), []byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {uint64(1 << 42), []byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {uint64(18446744073709551615), []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 8, nil}, {uint64(9223372036854775808), []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, // Expected Failure -- Short write {uint64(9223372036854775808), []byte{0x80}, 1, &MarshalError{ErrorCode: ErrIO}}, // bool - XDR Integer {false, []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {true, []byte{0x00, 0x00, 0x00, 0x01}, 4, nil}, // Expected Failure -- Short write {true, []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, // float32 - XDR Floating-Point {float32(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {float32(3.14), []byte{0x40, 0x48, 0xF5, 0xC3}, 4, nil}, {float32(1234567.0), []byte{0x49, 0x96, 0xB4, 0x38}, 4, nil}, {float32(math.Inf(-1)), []byte{0xFF, 0x80, 0x00, 0x00}, 4, nil}, {float32(math.Inf(0)), []byte{0x7F, 0x80, 0x00, 0x00}, 4, nil}, // Expected Failure -- Short write {float32(3.14), []byte{0x40, 0x48, 0xF5}, 3, &MarshalError{ErrorCode: ErrIO}}, // float64 - XDR Double-precision Floating-Point {float64(0), []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {float64(3.141592653589793), []byte{0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18}, 8, nil}, {float64(math.Inf(-1)), []byte{0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {float64(math.Inf(0)), []byte{0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, // Expected Failure -- Short write {float64(3.141592653589793), []byte{0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d}, 7, &MarshalError{ErrorCode: ErrIO}}, // string - XDR String {"", []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {"xdr", []byte{0x00, 0x00, 0x00, 0x03, 0x78, 0x64, 0x72, 0x00}, 8, nil}, {"τ=2π", []byte{0x00, 0x00, 0x00, 0x06, 0xCF, 0x84, 0x3D, 0x32, 0xCF, 0x80, 0x00, 0x00}, 12, nil}, // Expected Failures -- Short write in length and payload {"xdr", []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, {"xdr", []byte{0x00, 0x00, 0x00, 0x03, 0x78}, 5, &MarshalError{ErrorCode: ErrIO}}, // []byte - XDR Variable Opaque {[]byte{0x01}, []byte{0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}, 8, nil}, {[]byte{0x01, 0x02, 0x03}, []byte{0x00, 0x00, 0x00, 0x03, 0x01, 0x02, 0x03, 0x00}, 8, nil}, // Expected Failures -- Short write in length and payload {[]byte{0x01}, []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, {[]byte{0x01}, []byte{0x00, 0x00, 0x00, 0x01, 0x01}, 5, &MarshalError{ErrorCode: ErrIO}}, // [#]byte - XDR Fixed Opaque {[1]byte{0x01}, []byte{0x01, 0x00, 0x00, 0x00}, 4, nil}, // No & here to test unaddressable arrays {&[2]byte{0x01, 0x02}, []byte{0x01, 0x02, 0x00, 0x00}, 4, nil}, {&[3]byte{0x01, 0x02, 0x03}, []byte{0x01, 0x02, 0x03, 0x00}, 4, nil}, {&[4]byte{0x01, 0x02, 0x03, 0x04}, []byte{0x01, 0x02, 0x03, 0x04}, 4, nil}, {&[5]byte{0x01, 0x02, 0x03, 0x04, 0x05}, []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00}, 8, nil}, // Expected Failure -- Short write {[1]byte{0x01}, []byte{0x01, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, // [] - XDR Variable-Length Array {&[]int16{512, 1024, 2048}, []byte{0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00}, 16, nil}, {[]bool{true, false}, []byte{0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00}, 12, nil}, // Expected Failures -- Short write in number of elements and // payload {[]bool{true, false}, []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, {[]bool{true, false}, []byte{0x00, 0x00, 0x00, 0x02, 0x00}, 5, &MarshalError{ErrorCode: ErrIO}}, // [#] - XDR Fixed-Length Array {&[2]uint32{512, 1024}, []byte{0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00}, 8, nil}, // Expected Failures -- Short write in number of elements and // payload {[2]uint32{512, 1024}, []byte{0x00, 0x00, 0x02}, 3, &MarshalError{ErrorCode: ErrIO}}, {[2]uint32{512, 1024}, []byte{0x00, 0x00, 0x02, 0x00, 0x00}, 5, &MarshalError{ErrorCode: ErrIO}}, // map[string]uint32 {map[string]uint32{"map1": 1}, []byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x70, 0x31, 0x00, 0x00, 0x00, 0x01}, 16, nil}, // Expected Failures -- Short write in number of elements, key, // and payload {map[string]uint32{"map1": 1}, []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, {map[string]uint32{"map1": 1}, []byte{0x00, 0x00, 0x00, 0x01, 0x00}, 5, &MarshalError{ErrorCode: ErrIO}}, {map[string]uint32{"map1": 1}, []byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04}, 8, &MarshalError{ErrorCode: ErrIO}}, {map[string]uint32{"map1": 1}, []byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x6D, 0x61, 0x70, 0x31}, 12, &MarshalError{ErrorCode: ErrIO}}, // time.Time - XDR String per RFC3339 {time.Unix(1396581888, 0).UTC(), []byte{ 0x00, 0x00, 0x00, 0x14, 0x32, 0x30, 0x31, 0x34, 0x2d, 0x30, 0x34, 0x2d, 0x30, 0x34, 0x54, 0x30, 0x33, 0x3a, 0x32, 0x34, 0x3a, 0x34, 0x38, 0x5a, }, 24, nil}, // Expected Failure -- Short write {time.Unix(1396581888, 0).UTC(), []byte{0x00, 0x00, 0x00, 0x14, 0x32, 0x30, 0x31, 0x34}, 8, &MarshalError{ErrorCode: ErrIO}}, // struct - XDR Structure -- test struct contains all supported types {&structMarshalTestIn, structMarshalTestWant, len(structMarshalTestWant), nil}, {opaqueStruct{[]uint8{1}, [1]uint8{2}}, []byte{ 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, }, 12, nil}, // Expected Failures -- Short write in variable length, // variable payload, and fixed payload. {structMarshalTestIn, structMarshalTestWant[:3], 3, &MarshalError{ErrorCode: ErrIO}}, {opaqueStruct{[]uint8{1}, [1]uint8{2}}, []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, {opaqueStruct{[]uint8{1}, [1]uint8{2}}, []byte{0x00, 0x00, 0x00, 0x01}, 4, &MarshalError{ErrorCode: ErrIO}}, {opaqueStruct{[]uint8{1}, [1]uint8{2}}, []byte{0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01}, 8, &MarshalError{ErrorCode: ErrIO}}, // Expected errors {nilInterface, []byte{}, 0, &MarshalError{ErrorCode: ErrNilInterface}}, {&nilInterface, []byte{}, 0, &MarshalError{ErrorCode: ErrNilInterface}}, {(*interface{})(nil), []byte{}, 0, &MarshalError{ErrorCode: ErrBadArguments}}, {testChan, []byte{}, 0, &MarshalError{ErrorCode: ErrUnsupportedType}}, {&testChan, []byte{}, 0, &MarshalError{ErrorCode: ErrUnsupportedType}}, {testFunc, []byte{}, 0, &MarshalError{ErrorCode: ErrUnsupportedType}}, {&testFunc, []byte{}, 0, &MarshalError{ErrorCode: ErrUnsupportedType}}, {testComplex64, []byte{}, 0, &MarshalError{ErrorCode: ErrUnsupportedType}}, {&testComplex64, []byte{}, 0, &MarshalError{ErrorCode: ErrUnsupportedType}}, {testComplex128, []byte{}, 0, &MarshalError{ErrorCode: ErrUnsupportedType}}, {&testComplex128, []byte{}, 0, &MarshalError{ErrorCode: ErrUnsupportedType}}, } for i, test := range tests { data := newFixedWriter(test.wantN) n, err := Marshal(data, test.in) // First ensure the number of bytes written is the expected // value and the error is the expected one. testName := fmt.Sprintf("Marshal #%d", i) testExpectedMRet(t, testName, n, test.wantN, err, test.err) rv := data.Bytes() if len(rv) != len(test.wantBytes) { t.Errorf("%s: unexpected len - got: %v want: %v\n", testName, len(rv), len(test.wantBytes)) continue } if !reflect.DeepEqual(rv, test.wantBytes) { t.Errorf("%s: unexpected result - got: %v want: %v\n", testName, rv, test.wantBytes) continue } } } // encodeFunc is used to identify which public function of the Encoder object // a test applies to. type encodeFunc int const ( fEncodeBool encodeFunc = iota fEncodeDouble fEncodeEnum fEncodeFixedOpaque fEncodeFloat fEncodeHyper fEncodeInt fEncodeOpaque fEncodeString fEncodeUhyper fEncodeUint ) // Map of encodeFunc values to names for pretty printing. var encodeFuncStrings = map[encodeFunc]string{ fEncodeBool: "EncodeBool", fEncodeDouble: "EncodeDouble", fEncodeEnum: "EncodeEnum", fEncodeFixedOpaque: "EncodeFixedOpaque", fEncodeFloat: "EncodeFloat", fEncodeHyper: "EncodeHyper", fEncodeInt: "EncodeInt", fEncodeOpaque: "EncodeOpaque", fEncodeString: "EncodeString", fEncodeUhyper: "EncodeUhyper", fEncodeUint: "EncodeUint", } // String implements the fmt.Stringer interface and returns the encode function // as a human-readable string. func (f encodeFunc) String() string { if s := encodeFuncStrings[f]; s != "" { return s } return fmt.Sprintf("Unknown encodeFunc (%d)", f) } // TestEncoder ensures an Encoder works as intended. func TestEncoder(t *testing.T) { tests := []struct { f encodeFunc // function to use to encode in interface{} // input value wantBytes []byte // expected bytes wantN int // expected number of bytes written err error // expected error }{ // Bool {fEncodeBool, false, []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {fEncodeBool, true, []byte{0x00, 0x00, 0x00, 0x01}, 4, nil}, // Expected Failure -- Short write {fEncodeBool, true, []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, // Double {fEncodeDouble, float64(0), []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {fEncodeDouble, float64(3.141592653589793), []byte{0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18}, 8, nil}, {fEncodeDouble, float64(math.Inf(-1)), []byte{0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {fEncodeDouble, float64(math.Inf(0)), []byte{0x7F, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, // Expected Failure -- Short write {fEncodeDouble, float64(3.141592653589793), []byte{0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d}, 7, &MarshalError{ErrorCode: ErrIO}}, // Enum {fEncodeEnum, int32(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {fEncodeEnum, int32(1), []byte{0x00, 0x00, 0x00, 0x01}, 4, nil}, // Expected Failures -- Invalid enum values {fEncodeEnum, int32(2), []byte{}, 0, &MarshalError{ErrorCode: ErrBadEnumValue}}, {fEncodeEnum, int32(1234), []byte{}, 0, &MarshalError{ErrorCode: ErrBadEnumValue}}, // FixedOpaque {fEncodeFixedOpaque, []byte{0x01}, []byte{0x01, 0x00, 0x00, 0x00}, 4, nil}, {fEncodeFixedOpaque, []byte{0x01, 0x02}, []byte{0x01, 0x02, 0x00, 0x00}, 4, nil}, {fEncodeFixedOpaque, []byte{0x01, 0x02, 0x03}, []byte{0x01, 0x02, 0x03, 0x00}, 4, nil}, {fEncodeFixedOpaque, []byte{0x01, 0x02, 0x03, 0x04}, []byte{0x01, 0x02, 0x03, 0x04}, 4, nil}, {fEncodeFixedOpaque, []byte{0x01, 0x02, 0x03, 0x04, 0x05}, []byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x00, 0x00}, 8, nil}, // Expected Failure -- Short write {fEncodeFixedOpaque, []byte{0x01}, []byte{0x01, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, // Float {fEncodeFloat, float32(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {fEncodeFloat, float32(3.14), []byte{0x40, 0x48, 0xF5, 0xC3}, 4, nil}, {fEncodeFloat, float32(1234567.0), []byte{0x49, 0x96, 0xB4, 0x38}, 4, nil}, {fEncodeFloat, float32(math.Inf(-1)), []byte{0xFF, 0x80, 0x00, 0x00}, 4, nil}, {fEncodeFloat, float32(math.Inf(0)), []byte{0x7F, 0x80, 0x00, 0x00}, 4, nil}, // Expected Failure -- Short write {fEncodeFloat, float32(3.14), []byte{0x40, 0x48, 0xF5}, 3, &MarshalError{ErrorCode: ErrIO}}, // Hyper {fEncodeHyper, int64(0), []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {fEncodeHyper, int64(1 << 34), []byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {fEncodeHyper, int64(1 << 42), []byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {fEncodeHyper, int64(9223372036854775807), []byte{0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 8, nil}, {fEncodeHyper, int64(-1), []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 8, nil}, {fEncodeHyper, int64(-9223372036854775808), []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, // Expected Failure -- Short write {fEncodeHyper, int64(-9223372036854775808), []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 7, &MarshalError{ErrorCode: ErrIO}}, // Int {fEncodeInt, int32(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {fEncodeInt, int32(262144), []byte{0x00, 0x04, 0x00, 0x00}, 4, nil}, {fEncodeInt, int32(2147483647), []byte{0x7F, 0xFF, 0xFF, 0xFF}, 4, nil}, {fEncodeInt, int32(-1), []byte{0xFF, 0xFF, 0xFF, 0xFF}, 4, nil}, {fEncodeInt, int32(-2147483648), []byte{0x80, 0x00, 0x00, 0x00}, 4, nil}, // Expected Failure -- Short write {fEncodeInt, int32(2147483647), []byte{0x7F, 0xFF, 0xFF}, 3, &MarshalError{ErrorCode: ErrIO}}, // Opaque {fEncodeOpaque, []byte{0x01}, []byte{0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}, 8, nil}, {fEncodeOpaque, []byte{0x01, 0x02, 0x03}, []byte{0x00, 0x00, 0x00, 0x03, 0x01, 0x02, 0x03, 0x00}, 8, nil}, // Expected Failures -- Short write in length and payload {fEncodeOpaque, []byte{0x01}, []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, {fEncodeOpaque, []byte{0x01}, []byte{0x00, 0x00, 0x00, 0x01, 0x01}, 5, &MarshalError{ErrorCode: ErrIO}}, // String {fEncodeString, "", []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {fEncodeString, "xdr", []byte{0x00, 0x00, 0x00, 0x03, 0x78, 0x64, 0x72, 0x00}, 8, nil}, {fEncodeString, "τ=2π", []byte{0x00, 0x00, 0x00, 0x06, 0xCF, 0x84, 0x3D, 0x32, 0xCF, 0x80, 0x00, 0x00}, 12, nil}, // Expected Failures -- Short write in length and payload {fEncodeString, "xdr", []byte{0x00, 0x00, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, {fEncodeString, "xdr", []byte{0x00, 0x00, 0x00, 0x03, 0x78}, 5, &MarshalError{ErrorCode: ErrIO}}, // Uhyper {fEncodeUhyper, uint64(0), []byte{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {fEncodeUhyper, uint64(1 << 34), []byte{0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {fEncodeUhyper, uint64(1 << 42), []byte{0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, {fEncodeUhyper, uint64(18446744073709551615), []byte{0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, 8, nil}, {fEncodeUhyper, uint64(9223372036854775808), []byte{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 8, nil}, // Expected Failure -- Short write {fEncodeUhyper, uint64(9223372036854775808), []byte{0x80}, 1, &MarshalError{ErrorCode: ErrIO}}, // Uint {fEncodeUint, uint32(0), []byte{0x00, 0x00, 0x00, 0x00}, 4, nil}, {fEncodeUint, uint32(262144), []byte{0x00, 0x04, 0x00, 0x00}, 4, nil}, {fEncodeUint, uint32(4294967295), []byte{0xFF, 0xFF, 0xFF, 0xFF}, 4, nil}, // Expected Failure -- Short write {fEncodeUint, uint32(262144), []byte{0x00, 0x04, 0x00}, 3, &MarshalError{ErrorCode: ErrIO}}, } validEnums := make(map[int32]bool) validEnums[0] = true validEnums[1] = true var err error var n int for i, test := range tests { data := newFixedWriter(test.wantN) enc := NewEncoder(data) switch test.f { case fEncodeBool: in := test.in.(bool) n, err = enc.EncodeBool(in) case fEncodeDouble: in := test.in.(float64) n, err = enc.EncodeDouble(in) case fEncodeEnum: in := test.in.(int32) n, err = enc.EncodeEnum(in, validEnums) case fEncodeFixedOpaque: in := test.in.([]byte) n, err = enc.EncodeFixedOpaque(in) case fEncodeFloat: in := test.in.(float32) n, err = enc.EncodeFloat(in) case fEncodeHyper: in := test.in.(int64) n, err = enc.EncodeHyper(in) case fEncodeInt: in := test.in.(int32) n, err = enc.EncodeInt(in) case fEncodeOpaque: in := test.in.([]byte) n, err = enc.EncodeOpaque(in) case fEncodeString: in := test.in.(string) n, err = enc.EncodeString(in) case fEncodeUhyper: in := test.in.(uint64) n, err = enc.EncodeUhyper(in) case fEncodeUint: in := test.in.(uint32) n, err = enc.EncodeUint(in) default: t.Errorf("%v #%d unrecognized function", test.f, i) continue } // First ensure the number of bytes written is the expected // value and the error is the expected one. testName := fmt.Sprintf("%v #%d", test.f, i) testExpectedMRet(t, testName, n, test.wantN, err, test.err) // Finally, ensure the written bytes are what is expected. rv := data.Bytes() if len(rv) != len(test.wantBytes) { t.Errorf("%s: unexpected len - got: %v want: %v\n", testName, len(rv), len(test.wantBytes)) continue } if !reflect.DeepEqual(rv, test.wantBytes) { t.Errorf("%s: unexpected result - got: %v want: %v\n", testName, rv, test.wantBytes) continue } } } // TestMarshalCorners ensures the Marshal function properly handles various // cases not already covered by the other tests. func TestMarshalCorners(t *testing.T) { // Ensure encode of an invalid reflect value returns the expected // error. testName := "Encode invalid reflect value" expectedN := 0 expectedErr := error(&MarshalError{ErrorCode: ErrUnsupportedType}) expectedVal := []byte{} data := newFixedWriter(expectedN) n, err := TstEncode(data)(reflect.Value{}) testExpectedMRet(t, testName, n, expectedN, err, expectedErr) if !reflect.DeepEqual(data.Bytes(), expectedVal) { t.Errorf("%s: unexpected result - got: %x want: %x\n", testName, data.Bytes(), expectedVal) } // Ensure marshal of a struct with both exported and unexported fields // skips the unexported fields but still marshals to the exported // fields. type unexportedStruct struct { unexported int Exported int } testName = "Marshal struct with exported and unexported fields" tstruct := unexportedStruct{0, 1} expectedN = 4 expectedErr = nil expectedVal = []byte{0x00, 0x00, 0x00, 0x01} data = newFixedWriter(expectedN) n, err = Marshal(data, tstruct) testExpectedMRet(t, testName, n, expectedN, err, expectedErr) if !reflect.DeepEqual(data.Bytes(), expectedVal) { t.Errorf("%s: unexpected result - got: %x want: %x\n", testName, data.Bytes(), expectedVal) } } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/error.go000066400000000000000000000142351463537555000310510ustar00rootroot00000000000000/* * Copyright (c) 2012-2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package xdr import "fmt" // ErrorCode identifies a kind of error. type ErrorCode int const ( // ErrBadArguments indicates arguments passed to the function are not // what was expected. ErrBadArguments ErrorCode = iota // ErrUnsupportedType indicates the Go type is not a supported type for // marshalling and unmarshalling XDR data. ErrUnsupportedType // ErrBadEnumValue indicates an enumeration value is not in the list of // valid values. ErrBadEnumValue // ErrNotSettable indicates an interface value cannot be written to. // This usually means the interface value was not passed with the & // operator, but it can also happen if automatic pointer allocation // fails. ErrNotSettable // ErrOverflow indicates that the data in question is too large to fit // into the corresponding Go or XDR data type. For example, an integer // decoded from XDR that is too large to fit into a target type of int8, // or opaque data that exceeds the max length of a Go slice. ErrOverflow // ErrNilInterface indicates an interface with no concrete type // information was encountered. Type information is necessary to // perform mapping between XDR and Go types. ErrNilInterface // ErrIO indicates an error was encountered while reading or writing to // an io.Reader or io.Writer, respectively. The actual underlying error // will be available via the Err field of the MarshalError or // UnmarshalError struct. ErrIO // ErrParseTime indicates an error was encountered while parsing an // RFC3339 formatted time value. The actual underlying error will be // available via the Err field of the UnmarshalError struct. ErrParseTime ) // Map of ErrorCode values back to their constant names for pretty printing. var errorCodeStrings = map[ErrorCode]string{ ErrBadArguments: "ErrBadArguments", ErrUnsupportedType: "ErrUnsupportedType", ErrBadEnumValue: "ErrBadEnumValue", ErrNotSettable: "ErrNotSettable", ErrOverflow: "ErrOverflow", ErrNilInterface: "ErrNilInterface", ErrIO: "ErrIO", ErrParseTime: "ErrParseTime", } // String returns the ErrorCode as a human-readable name. func (e ErrorCode) String() string { if s := errorCodeStrings[e]; s != "" { return s } return fmt.Sprintf("Unknown ErrorCode (%d)", e) } // UnmarshalError describes a problem encountered while unmarshaling data. // Some potential issues are unsupported Go types, attempting to decode a value // which is too large to fit into a specified Go type, and exceeding max slice // limitations. type UnmarshalError struct { ErrorCode ErrorCode // Describes the kind of error Func string // Function name Value interface{} // Value actually parsed where appropriate Description string // Human readable description of the issue Err error // The underlying error for IO errors } // Error satisfies the error interface and prints human-readable errors. func (e *UnmarshalError) Error() string { switch e.ErrorCode { case ErrBadEnumValue, ErrOverflow, ErrIO, ErrParseTime: return fmt.Sprintf("xdr:%s: %s - read: '%v'", e.Func, e.Description, e.Value) } return fmt.Sprintf("xdr:%s: %s", e.Func, e.Description) } // unmarshalError creates an error given a set of arguments and will copy byte // slices into the Value field since they might otherwise be changed from from // the original value. func unmarshalError(f string, c ErrorCode, desc string, v interface{}, err error) *UnmarshalError { e := &UnmarshalError{ErrorCode: c, Func: f, Description: desc, Err: err} switch t := v.(type) { case []byte: slice := make([]byte, len(t)) copy(slice, t) e.Value = slice default: e.Value = v } return e } // IsIO returns a boolean indicating whether the error is known to report that // the underlying reader or writer encountered an ErrIO. func IsIO(err error) bool { switch e := err.(type) { case *UnmarshalError: return e.ErrorCode == ErrIO case *MarshalError: return e.ErrorCode == ErrIO } return false } // MarshalError describes a problem encountered while marshaling data. // Some potential issues are unsupported Go types, attempting to encode more // opaque data than can be represented by a single opaque XDR entry, and // exceeding max slice limitations. type MarshalError struct { ErrorCode ErrorCode // Describes the kind of error Func string // Function name Value interface{} // Value actually parsed where appropriate Description string // Human readable description of the issue Err error // The underlying error for IO errors } // Error satisfies the error interface and prints human-readable errors. func (e *MarshalError) Error() string { switch e.ErrorCode { case ErrIO: return fmt.Sprintf("xdr:%s: %s - wrote: '%v'", e.Func, e.Description, e.Value) case ErrBadEnumValue: return fmt.Sprintf("xdr:%s: %s - value: '%v'", e.Func, e.Description, e.Value) } return fmt.Sprintf("xdr:%s: %s", e.Func, e.Description) } // marshalError creates an error given a set of arguments and will copy byte // slices into the Value field since they might otherwise be changed from from // the original value. func marshalError(f string, c ErrorCode, desc string, v interface{}, err error) *MarshalError { e := &MarshalError{ErrorCode: c, Func: f, Description: desc, Err: err} switch t := v.(type) { case []byte: slice := make([]byte, len(t)) copy(slice, t) e.Value = slice default: e.Value = v } return e } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/error_test.go000066400000000000000000000110661463537555000321070ustar00rootroot00000000000000/* * Copyright (c) 2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package xdr_test import ( "errors" "testing" . "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" ) // TestErrorCodeStringer tests the stringized output for the ErrorCode type. func TestErrorCodeStringer(t *testing.T) { tests := []struct { in ErrorCode want string }{ {ErrBadArguments, "ErrBadArguments"}, {ErrUnsupportedType, "ErrUnsupportedType"}, {ErrBadEnumValue, "ErrBadEnumValue"}, {ErrNotSettable, "ErrNotSettable"}, {ErrOverflow, "ErrOverflow"}, {ErrNilInterface, "ErrNilInterface"}, {ErrIO, "ErrIO"}, {ErrParseTime, "ErrParseTime"}, {0xffff, "Unknown ErrorCode (65535)"}, } for i, test := range tests { result := test.in.String() if result != test.want { t.Errorf("String #%d\n got: %s want: %s", i, result, test.want) continue } } } // TestUnmarshalError tests the error output for the UnmarshalError type. func TestUnmarshalError(t *testing.T) { tests := []struct { in UnmarshalError want string }{ { UnmarshalError{ ErrorCode: ErrIO, Func: "test", Description: "EOF while decoding 5 bytes", Value: "testval", }, "xdr:test: EOF while decoding 5 bytes - read: 'testval'", }, { UnmarshalError{ ErrorCode: ErrBadEnumValue, Func: "test", Description: "invalid enum", Value: "testenum", }, "xdr:test: invalid enum - read: 'testenum'", }, { UnmarshalError{ ErrorCode: ErrNilInterface, Func: "test", Description: "can't unmarshal to nil interface", Value: nil, }, "xdr:test: can't unmarshal to nil interface", }, } for i, test := range tests { result := test.in.Error() if result != test.want { t.Errorf("Error #%d\n got: %s want: %s", i, result, test.want) continue } } } // TestMarshalError tests the error output for the MarshalError type. func TestMarshalError(t *testing.T) { tests := []struct { in MarshalError want string }{ { MarshalError{ ErrorCode: ErrIO, Func: "test", Description: "EOF while encoding 5 bytes", Value: []byte{0x01, 0x02}, }, "xdr:test: EOF while encoding 5 bytes - wrote: '[1 2]'", }, { MarshalError{ ErrorCode: ErrBadEnumValue, Func: "test", Description: "invalid enum", Value: "testenum", }, "xdr:test: invalid enum - value: 'testenum'", }, { MarshalError{ ErrorCode: ErrNilInterface, Func: "test", Description: "can't marshal to nil interface", Value: nil, }, "xdr:test: can't marshal to nil interface", }, } for i, test := range tests { result := test.in.Error() if result != test.want { t.Errorf("Error #%d\n got: %s want: %s", i, result, test.want) continue } } } // TestIOErr ensures the IsIO function behaves as expected given different error // types. func TestIOErr(t *testing.T) { tests := []struct { in error want bool }{ { &MarshalError{ ErrorCode: ErrIO, Func: "test", Description: "EOF while encoding 5 bytes", Value: []byte{0x01, 0x02}, }, true, }, { &MarshalError{ ErrorCode: ErrUnsupportedType, Func: "test", Description: "ErrUnsupportedType", Value: []byte{}, }, false, }, { &UnmarshalError{ ErrorCode: ErrIO, Func: "test", Description: "EOF while decoding 5 bytes", Value: []byte{0x01, 0x02}, }, true, }, { &UnmarshalError{ ErrorCode: ErrUnsupportedType, Func: "test", Description: "ErrUnsupportedType", Value: []byte{}, }, false, }, { errors.New("boom"), false, }, } for i, test := range tests { result := IsIO(test.in) if result != test.want { t.Errorf("Error #%d\n got: %v want: %v", i, result, test.want) continue } } } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/example_test.go000066400000000000000000000121101463537555000324000ustar00rootroot00000000000000/* * Copyright (c) 2012-2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package xdr_test import ( "bytes" "fmt" "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" ) // This example demonstrates how to use Marshal to automatically XDR encode // data using reflection. func ExampleMarshal() { // Hypothetical image header format. type ImageHeader struct { Signature [3]byte Version uint32 IsGrayscale bool NumSections uint32 } // Sample image header data. h := ImageHeader{[3]byte{0xAB, 0xCD, 0xEF}, 2, true, 10} // Use marshal to automatically determine the appropriate underlying XDR // types and encode. var w bytes.Buffer bytesWritten, err := xdr.Marshal(&w, &h) if err != nil { fmt.Println(err) return } fmt.Println("bytes written:", bytesWritten) fmt.Println("encoded data:", w.Bytes()) // Output: // bytes written: 16 // encoded data: [171 205 239 0 0 0 0 2 0 0 0 1 0 0 0 10] } // This example demonstrates how to use Unmarshal to decode XDR encoded data // from a byte slice into a struct. func ExampleUnmarshal() { // Hypothetical image header format. type ImageHeader struct { Signature [3]byte Version uint32 IsGrayscale bool NumSections uint32 } // XDR encoded data described by the above structure. Typically this // would be read from a file or across the network, but use a manual // byte array here as an example. encodedData := []byte{ 0xAB, 0xCD, 0xEF, 0x00, // Signature 0x00, 0x00, 0x00, 0x02, // Version 0x00, 0x00, 0x00, 0x01, // IsGrayscale 0x00, 0x00, 0x00, 0x0A, // NumSections } // Declare a variable to provide Unmarshal with a concrete type and // instance to decode into. var h ImageHeader bytesRead, err := xdr.Unmarshal(bytes.NewReader(encodedData), &h) if err != nil { fmt.Println(err) return } fmt.Println("bytes read:", bytesRead) fmt.Printf("h: %+v", h) // Output: // bytes read: 16 // h: {Signature:[171 205 239] Version:2 IsGrayscale:true NumSections:10} } // This example demonstrates how to manually decode XDR encoded data from a // reader. Compare this example with the Unmarshal example which performs the // same task automatically by utilizing a struct type definition and reflection. func ExampleNewDecoder() { // XDR encoded data for a hypothetical ImageHeader struct as follows: // type ImageHeader struct { // Signature [3]byte // Version uint32 // IsGrayscale bool // NumSections uint32 // } encodedData := []byte{ 0xAB, 0xCD, 0xEF, 0x00, // Signature 0x00, 0x00, 0x00, 0x02, // Version 0x00, 0x00, 0x00, 0x01, // IsGrayscale 0x00, 0x00, 0x00, 0x0A, // NumSections } // Get a new decoder for manual decoding. dec := xdr.NewDecoder(bytes.NewReader(encodedData)) signature, _, err := dec.DecodeFixedOpaque(3) if err != nil { fmt.Println(err) return } version, _, err := dec.DecodeUint() if err != nil { fmt.Println(err) return } isGrayscale, _, err := dec.DecodeBool() if err != nil { fmt.Println(err) return } numSections, _, err := dec.DecodeUint() if err != nil { fmt.Println(err) return } fmt.Println("signature:", signature) fmt.Println("version:", version) fmt.Println("isGrayscale:", isGrayscale) fmt.Println("numSections:", numSections) // Output: // signature: [171 205 239] // version: 2 // isGrayscale: true // numSections: 10 } // This example demonstrates how to manually encode XDR data from Go variables. // Compare this example with the Marshal example which performs the same task // automatically by utilizing a struct type definition and reflection. func ExampleNewEncoder() { // Data for a hypothetical ImageHeader struct as follows: // type ImageHeader struct { // Signature [3]byte // Version uint32 // IsGrayscale bool // NumSections uint32 // } signature := []byte{0xAB, 0xCD, 0xEF} version := uint32(2) isGrayscale := true numSections := uint32(10) // Get a new encoder for manual encoding. var w bytes.Buffer enc := xdr.NewEncoder(&w) _, err := enc.EncodeFixedOpaque(signature) if err != nil { fmt.Println(err) return } _, err = enc.EncodeUint(version) if err != nil { fmt.Println(err) return } _, err = enc.EncodeBool(isGrayscale) if err != nil { fmt.Println(err) return } _, err = enc.EncodeUint(numSections) if err != nil { fmt.Println(err) return } fmt.Println("encoded data:", w.Bytes()) // Output: // encoded data: [171 205 239 0 0 0 0 2 0 0 0 1 0 0 0 10] } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/fixedIO_test.go000066400000000000000000000035411463537555000323040ustar00rootroot00000000000000/* * Copyright (c) 2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ package xdr_test import ( "io" ) // fixedWriter implements the io.Writer interface and intentially allows // testing of error paths by forcing short writes. type fixedWriter struct { b []byte pos int } // Write writes the contents of p to w. When the contents of p would cause // the writer to exceed the maximum allowed size of the fixed writer, the writer // writes as many bytes as possible to reach the maximum allowed size and // io.ErrShortWrite is returned. // // This satisfies the io.Writer interface. func (w *fixedWriter) Write(p []byte) (int, error) { if w.pos+len(p) > cap(w.b) { n := copy(w.b[w.pos:], p[:cap(w.b)-w.pos]) w.pos += n return n, io.ErrShortWrite } n := copy(w.b[w.pos:], p) w.pos += n return n, nil } // Bytes returns the bytes already written to the fixed writer. func (w *fixedWriter) Bytes() []byte { return w.b } // newFixedWriter returns a new io.Writer that will error once more bytes than // the specified max have been written. func newFixedWriter(max int) *fixedWriter { b := make([]byte, max, max) fw := fixedWriter{b, 0} return &fw } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/go-xdr/xdr2/internal_test.go000066400000000000000000000030611463537555000325660ustar00rootroot00000000000000/* * Copyright (c) 2012-2014 Dave Collins * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* This test file is part of the xdr package rather than than the xdr_test package so it can bridge access to the internals to properly test cases which are either not possible or can't reliably be tested via the public interface. The functions are only exported while the tests are being run. */ package xdr import ( "io" "reflect" ) // TstEncode creates a new Encoder to the passed writer and returns the internal // encode function on the Encoder. func TstEncode(w io.Writer) func(v reflect.Value) (int, error) { enc := NewEncoder(w) return enc.encode } // TstDecode creates a new Decoder for the passed reader and returns the // internal decode function on the Decoder. func TstDecode(r io.Reader) func(v reflect.Value) (int, error) { dec := NewDecoder(r) return dec.decode } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/000077500000000000000000000000001463537555000264205ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/constants.tmpl000066400000000000000000000021751463537555000313370ustar00rootroot00000000000000// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Code generated by internal/lvgen/generate.go. DO NOT EDIT. // // To regenerate, run 'go generate' in internal/lvgen. // package constants // These are libvirt procedure numbers which correspond to each respective // API call between remote_internal driver and libvirtd. Each procedure is // identified by a unique number. const ( // From enums: {{range .EnumVals}} // {{.Name}} is libvirt's {{.LVName}} {{.Name}} = {{.Val}} {{end}} // From consts: {{range .Consts}} // {{.Name}} is libvirt's {{.LVName}} {{.Name}} = {{.Val}} {{end -}} ) golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/gen/000077500000000000000000000000001463537555000271715ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/gen/main.go000066400000000000000000000031651463537555000304510ustar00rootroot00000000000000// Copyright 2017 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package main import ( "fmt" "os" "path/filepath" "strings" "github.com/digitalocean/go-libvirt/internal/lvgen" ) var protoPaths = [...]string{ "src/remote/remote_protocol.x", "src/remote/qemu_protocol.x", } func main() { lvPath := os.Getenv("LIBVIRT_SOURCE") if lvPath == "" { fmt.Println("set $LIBVIRT_SOURCE to point to the root of the libvirt sources and retry") os.Exit(1) } fmt.Println("protocol file processing") for _, p := range protoPaths { protoPath := filepath.Join(lvPath, p) fmt.Println(" processing", p) err := processProto(protoPath) if err != nil { fmt.Println("go-libvirt code generator failed:", err) os.Exit(1) } } } func processProto(lvFile string) error { rdr, err := os.Open(lvFile) if err != nil { fmt.Printf("failed to open protocol file at %v: %v\n", lvFile, err) os.Exit(1) } defer rdr.Close() // extract the base filename, without extension, for the generator to use. name := strings.TrimSuffix(filepath.Base(lvFile), filepath.Ext(lvFile)) return lvgen.Generate(name, rdr) } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/generate.go000066400000000000000000000706431463537555000305530ustar00rootroot00000000000000// Copyright 2017 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package lvgen import ( "fmt" "go/ast" "io" "os" "strconv" "strings" "text/template" "unicode" "unicode/utf8" "golang.org/x/tools/go/loader" ) // If you're making changes to the generator, or troubleshooting the generated // code, the docs for sunrpc and xdr (the line encoding) are helpful: // https://docs.oracle.com/cd/E26502_01/html/E35597/ // ConstItem stores an const's symbol and value from the parser. This struct is // also used for enums. type ConstItem struct { Name string LVName string Val string } // Generator holds all the information parsed out of the protocol file. type Generator struct { // Enums holds the enum declarations. The type of enums is always int32. Enums []Decl // EnumVals holds the list of enum values found by the parser. In sunrpc as // in go, these are not separately namespaced. EnumVals []ConstItem // Consts holds all the const items found by the parser. Consts []ConstItem // Structs holds a list of all the structs found by the parser Structs []Structure // StructMap is a map of the structs we find for quick searching. StructMap map[string]int // Typedefs holds all the type definitions from 'typedef ...' lines. Typedefs []Typedef // Unions holds all the discriminated unions. Unions []Union // UnionMap is a map of the unions we find for quick searching. UnionMap map[string]int // Procs holds all the discovered libvirt procedures. Procs []Proc } func newGenerator() Generator { return Generator{ StructMap: make(map[string]int), UnionMap: make(map[string]int), } } // Gen accumulates items as the parser runs, and is then used to produce the // output. var Gen Generator // CurrentEnumVal is the auto-incrementing value assigned to enums that aren't // explicitly given a value. var CurrentEnumVal int64 // goEquivTypes maps the basic types defined in the rpc spec to their golang // equivalents. var goEquivTypes = map[string]string{ // Some of the identifiers in the rpc specification are reserved words or // pre-existing types in go. This renames them to something safe. "type": "lvtype", "error": "lverror", "nil": "lvnil", // The libvirt spec uses this NonnullString type, which is a string with a // specified maximum length. This makes the go code more confusing, and // we're not enforcing the limit anyway, so collapse it here. This also // requires us to ditch the typedef that would otherwise be generated. "NonnullString": "string", // We rename Error to remote_error in order to use libvirt.Error as the exposed // type, only with necessary fields exposed "Error": "remote_error", // TODO: Get rid of these. They're only needed because we lose information // that the parser has (the parser knows it has emitted a go type), and then // we capitalize types to make them public. "Int": "int", "Uint": "uint", "Int8": "int8", "Uint8": "uint8", "Int16": "int16", "Uint16": "uint16", "Int32": "int32", "Uint32": "uint32", "Int64": "int64", "Uint64": "uint64", "Float32": "float32", "Float64": "float64", "Bool": "bool", "Byte": "byte", } // These defines are from libvirt-common.h. They should be fetched from there, // but for now they're hardcoded here. (These are the discriminant values for // TypedParams.) var lvTypedParams = map[string]uint32{ "VIR_TYPED_PARAM_INT": 1, "VIR_TYPED_PARAM_UINT": 2, "VIR_TYPED_PARAM_LLONG": 3, "VIR_TYPED_PARAM_ULLONG": 4, "VIR_TYPED_PARAM_DOUBLE": 5, "VIR_TYPED_PARAM_BOOLEAN": 6, "VIR_TYPED_PARAM_STRING": 7, } // Decl records a declaration, like 'int x' or 'remote_nonnull_string str' type Decl struct { Name, LVName, Type string } // NewDecl returns a new declaration struct. func NewDecl(identifier, itype string) *Decl { goidentifier := identifierTransform(identifier) itype = typeTransform(itype) return &Decl{Name: goidentifier, LVName: identifier, Type: itype} } // Structure records the name and members of a struct definition. type Structure struct { Name string LVName string Members []Decl } // Typedef holds the name and underlying type for a typedef. type Typedef struct { Decl } // Union holds a "discriminated union", which consists of a discriminant, which // tells you what kind of thing you're looking at, and a number of encodings. type Union struct { Name string DiscriminantType string Cases []Case } // Case holds a single case of a discriminated union. type Case struct { CaseName string DiscriminantVal string Decl } // Proc holds information about a libvirt procedure the parser has found. type Proc struct { Program string // The program name. Blank for REMOTE_ procs. Num int64 // The libvirt procedure number. Name string // The name of the go func. LVName string // The name of the libvirt proc this wraps. Args []Decl // The contents of the args struct for this procedure. Ret []Decl // The contents of the ret struct for this procedure. ArgsStruct string // The name of the args struct for this procedure. RetStruct string // The name of the ret struct for this procedure. ReadStreamIdx int // The index of read stream in function argument list WriteStreamIdx int // The index of read stream in function argument list } // ProcMeta holds information about a libvirt procedure, and is used during code // generation. type ProcMeta struct { ReadStream int WriteStream int } type structStack []*Structure // CurrentStruct will point to a struct record if we're in a struct declaration. // When the parser adds a declaration, it will be added to the open struct if // there is one. var CurrentStruct structStack // Since it's possible to have an embedded struct definition, this implements // a stack to keep track of the current structure. func (s *structStack) empty() bool { return len(*s) == 0 } func (s *structStack) push(st *Structure) { *s = append(*s, st) } func (s *structStack) pop() *Structure { if s.empty() { return nil } st := (*s)[len(*s)-1] *s = (*s)[:len(*s)-1] return st } func (s *structStack) peek() *Structure { if s.empty() { return nil } return (*s)[len(*s)-1] } // CurrentTypedef will point to a typedef record if we're parsing one. Typedefs // can define a struct or union type, but the preferred for is struct xxx{...}, // so we may never see the typedef form in practice. var CurrentTypedef *Typedef // CurrentUnion holds the current discriminated union record. var CurrentUnion *Union // CurrentCase holds the current case record while the parser is in a union and // a case statement. var CurrentCase *Case // Generate will output go bindings for libvirt. The lvPath parameter should be // the path to the root of the libvirt source directory to use for the // generation. func Generate(name string, proto io.Reader) error { // Start with a clean state Gen = newGenerator() lexer, err := NewLexer(proto) if err != nil { return err } go lexer.Run() parser := yyNewParser() yyErrorVerbose = true // Turn this on if you're debugging. // yyDebug = 3 rv := parser.Parse(lexer) if rv != 0 { return fmt.Errorf("failed to parse libvirt protocol: %v", rv) } // When parsing is done, we can link the procedures we've found to their // argument types. procLink() // Generate and write the output. constsName := fmt.Sprintf("../constants/%v.gen.go", name) constFile, err := os.Create(constsName) if err != nil { return err } defer constFile.Close() procName := fmt.Sprintf("../../%v.gen.go", name) procFile, err := os.Create(procName) if err != nil { return err } defer procFile.Close() return genGo(constFile, procFile) } // genGo is called when the parsing is done; it generates the golang output // files using templates. func genGo(constFile, procFile io.Writer) error { t, err := template.ParseFiles("constants.tmpl") if err != nil { return err } if err = t.Execute(constFile, Gen); err != nil { return err } t, err = template.ParseFiles("procedures.tmpl") if err != nil { return err } return t.Execute(procFile, Gen) } // constNameTransform changes an upcased, snake-style name like // REMOTE_PROTOCOL_VERSION to a comfortable Go name like ProtocolVersion. It // also tries to upcase abbreviations so a name like DOMAIN_GET_XML becomes // DomainGetXML, not DomainGetXml. func constNameTransform(name string) string { decamelize := strings.ContainsRune(name, '_') name = strings.TrimPrefix(name, "REMOTE_") if decamelize { name = fromSnakeToCamel(name) } name = fixAbbrevs(name) return name } // procNameTransform returns a Go name for a remote procedure. func procNameTransform(name string) string { // Remove "PROC_" from the name, then transform it like a const name. nn := strings.Replace(name, "PROC_", "", 1) return constNameTransform(nn) } // procProgramName returns the program associated with a remote procedure. // Procedure names follow the pattern, "_PROC_". This // returns the part, as a camel-cased value. This value will be empty // for REMOTE_PROC procedures because we trim REMOTE_, but that's OK. func procProgramName(name string) string { ix := strings.Index(name, "PROC_") return constNameTransform(name[:ix]) } func identifierTransform(name string) string { decamelize := strings.ContainsRune(name, '_') nn := strings.TrimPrefix(name, "remote_") nn = strings.TrimPrefix(nn, "VIR_") if decamelize { nn = fromSnakeToCamel(nn) } else { nn = publicize(nn) } nn = fixAbbrevs(nn) nn = checkIdentifier(nn) // Many types in libvirt are prefixed with "Nonnull" to distinguish them // from optional values. We add "Opt" to optional values and strip "Nonnull" // because this makes the go code clearer. nn = strings.TrimPrefix(nn, "Nonnull") return nn } func typeTransform(name string) string { nn := strings.TrimLeft(name, "*[]") diff := len(name) - len(nn) nn = identifierTransform(nn) return name[0:diff] + nn } func publicize(name string) string { if len(name) <= 0 { return name } r, n := utf8.DecodeRuneInString(name) name = string(unicode.ToUpper(r)) + name[n:] return name } // fromSnakeToCamel transmutes a snake-cased string to a camel-cased one. All // runes that follow an underscore are up-cased, and the underscores themselves // are omitted. // // ex: "PROC_DOMAIN_GET_METADATA" -> "ProcDomainGetMetadata" func fromSnakeToCamel(s string) string { buf := make([]rune, 0, len(s)) // Start rune will be upper case - we generate all public symbols. hump := true for _, r := range s { if r == '_' { hump = true } else { var transform func(rune) rune if hump == true { transform = unicode.ToUpper } else { transform = unicode.ToLower } buf = append(buf, transform(r)) hump = false } } return string(buf) } // abbrevs is a list of abbreviations which should be all upper-case in a name. // (This is really just to keep the go linters happy and to produce names that // are intuitive to a go developer.) var abbrevs = []string{"Xml", "Io", "Uuid", "Cpu", "Id", "Ip", "Qemu"} // fixAbbrevs up-cases all instances of anything in the 'abbrevs' array. This // would be a simple matter, but we don't want to upcase an abbreviation if it's // actually part of a larger word, so it's not so simple. func fixAbbrevs(s string) string { for _, a := range abbrevs { for loc := 0; ; { loc = strings.Index(s[loc:], a) if loc == -1 { break } r := 'A' if len(a) < len(s[loc:]) { r, _ = utf8.DecodeRune([]byte(s[loc+len(a):])) } if unicode.IsLower(r) == false { s = s[:loc] + strings.Replace(s[loc:], a, strings.ToUpper(a), 1) } loc++ } } return s } // procLink associates a libvirt procedure with the types that are its arguments // and return values, filling out those fields in the procedure struct. These // types are extracted by iterating through the argument and return structures // defined in the protocol file. If one or both of these structs is not defined // then either the args or return values are empty. func procLink() { flagTypes := mapFlagTypes() for ix, proc := range Gen.Procs { argsName := proc.Name + "Args" retName := proc.Name + "Ret" argsIx, hasArgs := Gen.StructMap[argsName] retIx, hasRet := Gen.StructMap[retName] if hasArgs { argsStruct := Gen.Structs[argsIx] Gen.Procs[ix].ArgsStruct = argsStruct.Name changeFlagType(proc.Name, &argsStruct, flagTypes) Gen.Procs[ix].Args = argsStruct.Members } if hasRet { retStruct := Gen.Structs[retIx] Gen.Procs[ix].RetStruct = retStruct.Name Gen.Procs[ix].Ret = retStruct.Members } } } // mapFlagTypes builds a map of the C types which appear to correspond to the // various flags fields in libvirt calls. Determining whether a type actually // corresponds to a set of flags is done by pattern matching the type name; // libvirt isn't completely consistent about the names of flag types, but they // all seem to have one of three suffixes, so that's what we look for here. // // This code uses the loader package to load the constants file generated by // c-for-go, which runs against libvirt's C sources. This file is generated by // 'go generate ./...' prior to the lvgen/ generator being run. func mapFlagTypes() map[string]ast.Expr { pconf := loader.Config{} f, err := pconf.ParseFile("../../const.gen.go", nil) if err != nil { panic(fmt.Sprintln("failed to read constants file: ", err)) } pconf.CreateFromFiles("const", f) prog, err := pconf.Load() if err != nil { panic(fmt.Sprintln("failed to load package: ", err)) } cpkg := prog.Package("const") tmap := make(map[string]ast.Expr) ast.Inspect(cpkg.Files[0], func(n ast.Node) bool { switch t := n.(type) { case *ast.TypeSpec: // There isn't a single name pattern that covers all of the flag // types, so we'll collect all the types that map to int32 here. if fmt.Sprintf("%s", t.Type) == "int32" { tmap[t.Name.String()] = t.Type } } return true }) return tmap } // Many libvirt calls use flags whose values come from a set of definitions // whose name we can't predict. So this map exists to do the translation for us. // The only way to remove this fragile map would be to use the comments from the // .c files in libvirt, which contain doxygen-style parameter comments that // specify the valid value types for flags. var flagMap = map[string]string{ "ConnectOpen": "ConnectFlags", "DomainAddIothread": "DomainModificationImpact", "DomainCoreDumpWithFormat": "DomainCoreDumpFlags", "DomainCreateXML": "DomainCreateFlags", "DomainCreateWithFiles": "DomainCreateFlags", "DomainCreateXMLWithFiles": "DomainCreateFlags", "DomainDefineXMLFlags": "DomainDefineFlags", "DomainDelIothread": "DomainModificationImpact", "DomainDestroyFlags": "DomainDestroyFlagsValues", "DomainGetCPUStats": "TypedParameterFlags", "DomainGetEmulatorPinInfo": "DomainModificationImpact", "DomainGetInterfaceParameters": "DomainModificationImpact", "DomainGetIothreadInfo": "DomainModificationImpact", "DomainGetMetadata": "DomainModificationImpact", "DomainGetPerfEvents": "DomainModificationImpact", "DomainGetXMLDesc": "DomainXMLFlags", "DomainManagedSaveDefineXML": "DomainSaveRestoreFlags", "DomainManagedSaveGetXMLDesc": "DomainXMLFlags", "DomainMemoryPeek": "DomainMemoryFlags", "DomainMigratePerform3Params": "DomainMigrateFlags", "DomainOpenChannel": "DomainChannelFlags", "DomainOpenGraphicsFd": "DomainOpenGraphicsFlags", "DomainPinEmulator": "DomainModificationImpact", "DomainPinIothread": "DomainModificationImpact", "DomainSetLifecycleAction": "DomainModificationImpact", "DomainSetMemoryStatsPeriod": "DomainMemoryModFlags", "DomainSetMetadata": "DomainModificationImpact", "DomainSetPerfEvents": "DomainModificationImpact", "DomainSetVcpu": "DomainModificationImpact", "DomainShutdownFlags": "DomainShutdownFlagValues", "DomainUndefineFlags": "DomainUndefineFlagsValues", "DomainUpdateDeviceFlags": "DomainDeviceModifyFlags", "StoragePoolCreateXML": "StoragePoolCreateFlags", "StoragePoolGetXMLDesc": "StorageXMLFlags", "StorageVolCreateXML": "StorageVolCreateFlags", "StorageVolCreateXMLFrom": "StorageVolCreateFlags", } // findFlagType attempts to find a real type for the flags passed to a given // libvirt routine. func findFlagType(procName string, flagTypes map[string]ast.Expr) (string, bool) { flagName, ok := flagMap[procName] if ok { // Verify the mapped name exists if _, ok = flagTypes[flagName]; ok == false { // If one of the manual flag mappings is wrong, complain but // continue. This happens with older versions of libvirt. fmt.Printf("manual flag type %v for %v not found, continuing", flagName, procName) return "", false } return flagName, true } // Not in the manual map, so do a search using the 3 patterns libvirt uses. tnames := [...]string{procName + "Flags", procName + "FlagValues", procName + "FlagsValues"} for _, n := range tnames { if _, ok := flagTypes[n]; ok == true { return n, true } } return "", false } // changeFlagType looks up the go type for a libvirt call's flags field. In C // these flags are all uint32, and you have to consult the documentation to // determine what the valid set of flags is for a given libvirt call. For Go // we're attempting to do better by specifying an actual type so that the // possible values are easier to determine. This is a heuristic, however, based // on naming patterns in the libvirt code. To do better we would need to look at // the doxygen-style comments in the libvirt sources. // // Failing to find a flags type isn't a fatal error, it just means that we'll // leave the flags with a type of uint32. func changeFlagType(procName string, s *Structure, flagTypes map[string]ast.Expr) { for ix, d := range s.Members { if d.Name == "Flags" { tname, found := findFlagType(procName, flagTypes) if found { s.Members[ix].Type = tname } else { // If you're adding procedures to to the manual map, you may // want to uncomment this to see what flag types are not found. // fmt.Println("flags type for", procName, "not found") } } } } //--------------------------------------------------------------------------- // Routines called by the parser's actions. //--------------------------------------------------------------------------- // StartEnum is called when the parser has found a valid enum. func StartEnum(name string) { // Enums are always signed 32-bit integers. goname := identifierTransform(name) Gen.Enums = append(Gen.Enums, Decl{goname, name, "int32"}) // Set the automatic value var to -1; it will be incremented before being // assigned to an enum value. CurrentEnumVal = -1 } // AddEnumVal will add a new enum value to the list. func AddEnumVal(name, val string) error { ev, err := parseNumber(val) if err != nil { return fmt.Errorf("invalid enum value %v = %v", name, val) } return addEnumVal(name, ev, nil) } // AddProcEnumVal adds a procedure enum to our list of remote procedures which // we will later generate code for. These declarations look like enums, but have // a (currently optional) comment block above them which we partially parse for // information about the procedure's in/output streams. Metadata is parsed from // annotations in libvirt RPC description file that are in block comment // preceding every function in enum, it looks like this: // // /** // * @generate: both // * @readstream: 1 // * @sparseflag: VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM // * @acl: storage_vol:data_read // */ // // See full description of possible annotations in libvirt's // src/remote/remote_protocol.x at the top of remote_procedure enum. We're // parsing only @readstream and @writestream annotations at the moment. func AddProcEnumVal(name, val string, meta string) error { ev, err := parseNumber(val) if err != nil { return fmt.Errorf("invalid enum value %v = %v", name, val) } metaObj, err := parseMeta(meta) if err != nil { return fmt.Errorf("invalid metadata for enum value %v: %v", name, err) } // Confusingly, the procedure name we use for generating code has "Proc" // stripped, but the name of the enum does not. program := procProgramName(name) procName := procNameTransform(name) enumName := constNameTransform(name) Gen.EnumVals = append(Gen.EnumVals, ConstItem{enumName, name, strconv.FormatInt(ev, 10)}) CurrentEnumVal = ev proc := &Proc{Program: program, Num: ev, Name: procName, LVName: name, ReadStreamIdx: -1, WriteStreamIdx: -1} if metaObj != nil { proc.ReadStreamIdx = metaObj.ReadStream proc.WriteStreamIdx = metaObj.WriteStream } Gen.Procs = append(Gen.Procs, *proc) return nil } // AddEnumAutoVal adds an enum to the list, using the automatically-incremented // value. This is called when the parser finds an enum definition without an // explicit value. func AddEnumAutoVal(name string) error { CurrentEnumVal++ return addEnumVal(name, CurrentEnumVal, nil) } func addEnumVal(name string, val int64, meta *ProcMeta) error { goname := constNameTransform(name) Gen.EnumVals = append(Gen.EnumVals, ConstItem{goname, name, fmt.Sprintf("%d", val)}) CurrentEnumVal = val return nil } // AddConst adds a new constant to the parser's list. func AddConst(name, val string) error { _, err := parseNumber(val) if err != nil { return fmt.Errorf("invalid const value %v = %v", name, val) } goname := constNameTransform(name) Gen.Consts = append(Gen.Consts, ConstItem{goname, name, val}) return nil } // parseNumber makes sure that a parsed numerical value can be parsed to a 64- // bit integer. func parseNumber(val string) (int64, error) { base := 10 if strings.HasPrefix(val, "0x") { base = 16 val = val[2:] } n, err := strconv.ParseInt(val, base, 64) return n, err } // parseMeta parses procedure metadata to simple string mapping func parseMeta(meta string) (*ProcMeta, error) { res := &ProcMeta{ ReadStream: -1, WriteStream: -1, } for _, line := range strings.Split(meta, "\n") { atInd := strings.Index(line, "@") if atInd == -1 { // Should be only first and last line of comment continue } spl := strings.SplitN(line[atInd+1:], ":", 2) if len(spl) != 2 { return nil, fmt.Errorf("invalid annotation: %s", meta) } spl[1] = strings.Trim(spl[1], " ") switch spl[0] { case "readstream": var err error res.ReadStream, err = strconv.Atoi(spl[1]) if err != nil { return nil, fmt.Errorf("invalid value for readstream: %s", spl[1]) } case "writestream": var err error res.WriteStream, err = strconv.Atoi(spl[1]) if err != nil { return nil, fmt.Errorf("invalid value for writestream: %s", spl[1]) } } } return res, nil } // StartStruct is called from the parser when a struct definition is found, but // before the member declarations are processed. func StartStruct(name string) { goname := identifierTransform(name) CurrentStruct.push(&Structure{Name: goname, LVName: name}) } // AddStruct is called when the parser has finished parsing a struct. It adds // the now-complete struct definition to the generator's list. func AddStruct() { st := *CurrentStruct.pop() Gen.StructMap[st.Name] = len(Gen.Structs) Gen.Structs = append(Gen.Structs, st) } // StartTypedef is called when the parser finds a typedef. func StartTypedef() { CurrentTypedef = &Typedef{} } // StartUnion is called by the parser when it finds a union declaraion. func StartUnion(name string) { name = identifierTransform(name) CurrentUnion = &Union{Name: name} } // AddUnion is called by the parser when it has finished processing a union // type. It adds the union to the generator's list and clears the CurrentUnion // pointer. We handle unions by declaring an interface for the union type, and // adding methods to each of the cases so that they satisfy the interface. func AddUnion() { Gen.UnionMap[CurrentUnion.Name] = len(Gen.Unions) Gen.Unions = append(Gen.Unions, *CurrentUnion) CurrentUnion = nil } // StartCase is called when the parser finds a case statement within a union. func StartCase(dvalue string) { // In libvirt, the discriminant values are all C pre- processor definitions. // Since we don't run the C pre-processor on the protocol file, they're // still just names when we get them - we don't actually have their integer // values. We'll use the strings to build the type names, although this is // brittle, because we're defining a type for each of the case values, and // that type needs a name. caseName := dvalue if ix := strings.LastIndexByte(caseName, '_'); ix != -1 { caseName = caseName[ix+1:] } caseName = fromSnakeToCamel(caseName) dv, ok := lvTypedParams[dvalue] if ok { dvalue = strconv.FormatUint(uint64(dv), 10) } CurrentCase = &Case{CaseName: caseName, DiscriminantVal: dvalue} } // AddCase is called when the parser finishes parsing a case. func AddCase() { CurrentUnion.Cases = append(CurrentUnion.Cases, *CurrentCase) CurrentCase = nil } // AddDeclaration is called by the parser when it find a declaration (int x). // The declaration will be added to any open container (such as a struct, if the // parser is working through a struct definition.) func AddDeclaration(identifier, itype string) { addDecl(NewDecl(identifier, itype)) } // addDecl adds a declaration to the current container. func addDecl(decl *Decl) { if !CurrentStruct.empty() { st := CurrentStruct.peek() st.Members = append(st.Members, *decl) } else if CurrentTypedef != nil { CurrentTypedef.Name = decl.Name CurrentTypedef.LVName = decl.LVName CurrentTypedef.Type = decl.Type if CurrentTypedef.Name != "string" { // Omit recursive typedefs. These happen because we're massaging // some of the type names. Gen.Typedefs = append(Gen.Typedefs, *CurrentTypedef) } CurrentTypedef = nil } else if CurrentCase != nil { CurrentCase.Name = decl.Name CurrentCase.Type = decl.Type } else if CurrentUnion != nil { CurrentUnion.DiscriminantType = decl.Type } } // AddFixedArray is called by the parser to add a fixed-length array to the // current container (struct, union, etc). Fixed-length arrays are not length- // prefixed. func AddFixedArray(identifier, itype, len string) { atype := fmt.Sprintf("[%v]%v", len, itype) addDecl(NewDecl(identifier, atype)) } // AddVariableArray is called by the parser to add a variable-length array. // Variable-length arrays are prefixed with a 32-bit unsigned length, and may // also have a maximum length specified. func AddVariableArray(identifier, itype, len string) { // This code ignores the length restriction (array), so as of now we // can't check to make sure that we're not exceeding that restriction when // we fill in message buffers. That may not matter, if libvirt's checking is // careful enough. atype := "[]" + itype // Handle strings specially. In the rpcgen definition a string is specified // as a variable-length array, either with or without a max length. We want // these to be go strings, so we'll just remove the array specifier. if itype == "string" { atype = itype } addDecl(NewDecl(identifier, atype)) } // AddOptValue is called by the parser to add an optional value. These are // declared in the protocol definition file using a syntax that looks like a // pointer declaration, but are actually represented by a variable-sized array // with a maximum size of 1. func AddOptValue(identifier, itype string) { atype := "[]" + itype decl := NewDecl(identifier, atype) newType := "Opt" + decl.Name goEquivTypes[decl.Name] = newType decl.Name = newType addDecl(decl) } // checkIdentifier determines whether an identifier is in our translation list. // If so it returns the translated name. This is used to massage the type names // we're emitting. func checkIdentifier(i string) string { nn, reserved := goEquivTypes[i] if reserved { return nn } return i } // GetUnion returns the type information for a union. If the provided type name // isn't a union, this will return a zero-value Union type. func (decl *Decl) GetUnion() Union { ix, ok := Gen.UnionMap[decl.Type] if ok { return Gen.Unions[ix] } return Union{} } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/lv-gen.go000066400000000000000000000023461463537555000301440ustar00rootroot00000000000000// Copyright 2017 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Package lvgen contains the instructions for regenerating the libvirt // bindings. We do this by parsing the remote_protocol.x file included in the // libvirt sources. Bindings will be generated if you run `go generate` in this // directory. package lvgen // Before running `go generate`: // 1) Make sure goyacc is installed from golang.org/x/tools (you can use this // command: `go get golang.org/x/tools/...`) // 2) Set the environment variable LIBVIRT_SOURCE to point to the top level // directory containing the version of libvirt for which you want to generate // bindings. //go:generate goyacc sunrpc.y //go:generate go run gen/main.go golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/lvlexer.go000066400000000000000000000214611463537555000304340ustar00rootroot00000000000000// Copyright 2017 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package lvgen import ( "fmt" "io" "io/ioutil" "strings" "unicode" "unicode/utf8" ) // eof is returned by the lexer when there's no more input. const eof = -1 // oneRuneTokens lists the runes the lexer will consider to be tokens when it // finds them. These are returned to the parser using the integer value of their // runes. var oneRuneTokens = `{}[]<>(),=;:*` var keywords = map[string]int{ "hyper": HYPER, "int": INT, "short": SHORT, "char": CHAR, "bool": BOOL, "case": CASE, "const": CONST, "default": DEFAULT, "double": DOUBLE, "enum": ENUM, "float": FLOAT, "opaque": OPAQUE, "string": STRING, "struct": STRUCT, "switch": SWITCH, "typedef": TYPEDEF, "union": UNION, "unsigned": UNSIGNED, "void": VOID, "program": PROGRAM, "version": VERSION, } // item is a lexeme, or what the lexer returns to the parser. type item struct { typ int val string line, column int } // String will display lexer items for humans to debug. There are some // calculations here due to the way goyacc arranges token values; see the // generated file y.go for an idea what's going on here, but the basic idea is // that the lower token type values are reserved for single-rune tokens, which // the lexer reports using the value of the rune itself. Everything else is // allocated a range of type value up above all the possible single-rune values. func (i item) String() string { tokType := i.typ if tokType >= yyPrivate { if tokType < yyPrivate+len(yyTok2) { tokType = int(yyTok2[tokType-yyPrivate]) } } rv := fmt.Sprintf("%s %q %d:%d", yyTokname(tokType), i.val, i.line, i.column) return rv } // Lexer stores the state of this lexer. type Lexer struct { input string // the string we're scanning. start int // start position of the item. pos int // current position in the input. line int // the current line (for error reporting). column int // current position within the current line. width int // width of the last rune scanned. items chan item // channel of scanned lexer items (lexemes). lastItem item // The last item the lexer handed the parser } // NewLexer will return a new lexer for the passed-in reader. func NewLexer(rdr io.Reader) (*Lexer, error) { l := &Lexer{} b, err := ioutil.ReadAll(rdr) if err != nil { return nil, err } l.input = string(b) l.items = make(chan item) return l, nil } // Run starts the lexer, and should be called in a goroutine. func (l *Lexer) Run() { for state := lexText; state != nil; { state = state(l) } close(l.items) } // emit returns a token to the parser. func (l *Lexer) emit(t int) { l.items <- item{t, l.input[l.start:l.pos], l.line, l.column} l.start = l.pos } // Lex gets the next token. func (l *Lexer) Lex(st *yySymType) int { s := <-l.items l.lastItem = s st.val = s.val return int(s.typ) } // Error is called by the parser when it finds a problem. func (l *Lexer) Error(s string) { fmt.Printf("parse error at %d:%d: %v\n", l.lastItem.line+1, l.lastItem.column+1, s) fmt.Printf("error at %q\n", l.lastItem.val) } // errorf is used by the lexer to report errors. It inserts an ERROR token into // the items channel, and sets the state to nil, which stops the lexer's state // machine. func (l *Lexer) errorf(format string, args ...interface{}) stateFn { l.items <- item{ERROR, fmt.Sprintf(format, args...), l.line, l.column} return nil } // next returns the rune at the current location, and advances to the next rune // in the input. func (l *Lexer) next() (r rune) { if l.pos >= len(l.input) { l.width = 0 return eof } r, l.width = utf8.DecodeRuneInString(l.input[l.pos:]) l.pos += l.width l.column++ if r == '\n' { l.line++ l.column = 0 } return r } // ignore discards the current text from start to pos. func (l *Lexer) ignore() { l.start = l.pos } // backup moves back one character, but can only be called once per next() call. func (l *Lexer) backup() { l.pos -= l.width if l.column > 0 { l.column-- } else { l.line-- } l.width = 0 } // peek looks ahead at the next rune in the stream without consuming it. func (l *Lexer) peek() rune { r := l.next() l.backup() return r } // accept will advance to the next rune if it's contained in the string of valid // runes passed in by the caller. func (l *Lexer) accept(valid string) bool { if strings.IndexRune(valid, l.next()) >= 0 { return true } l.backup() return false } // acceptRun advances over a number of valid runes, stopping as soon as it hits // one not on the list. func (l *Lexer) acceptRun(valid string) { for strings.IndexRune(valid, l.next()) >= 0 { } l.backup() } // procIdent checks whether an identifier matches the pattern for a procedure // enum. func procIdent(ident string) bool { // The pattern we're looking for is "_PROC_", like // "REMOTE_PROC_DOMAIN_OPEN_CONSOLE" if ix := strings.Index(ident, "_PROC_"); ix != -1 { if strings.Index(ident[:ix], "_") == -1 { return true } } return false } // keyword checks whether the current lexeme is a keyword or not. If so it // returns the keyword's token id, otherwise it returns IDENTIFIER. func (l *Lexer) keyword() int { ident := l.input[l.start:l.pos] tok, ok := keywords[ident] if ok == true { return int(tok) } if procIdent(ident) { return PROCIDENTIFIER } return IDENTIFIER } // oneRuneToken determines whether a rune is a token. If so it returns the token // id and true, otherwise it returns false. func (l *Lexer) oneRuneToken(r rune) (int, bool) { if strings.IndexRune(oneRuneTokens, r) >= 0 { return int(r), true } return 0, false } // State functions type stateFn func(*Lexer) stateFn // lexText is the master lex routine. The lexer is started in this state. func lexText(l *Lexer) stateFn { for { if strings.HasPrefix(l.input[l.pos:], "/*") { return lexBlockComment } r := l.next() if r == eof { break } if unicode.IsSpace(r) { l.ignore() return lexText } if l.column == 1 && r == '%' { l.backup() return lexDirective } if unicode.IsLetter(r) { l.backup() return lexIdent } if unicode.IsNumber(r) || r == '-' { l.backup() return lexNumber } if t, isToken := l.oneRuneToken(r); isToken == true { l.emit(t) } } return nil } // lexBlockComment is used when we find a comment marker '/*' in the input. func lexBlockComment(l *Lexer) stateFn { // Double star is used only at the start of metadata comments metadataComment := strings.HasPrefix(l.input[l.pos:], "/**") for { if strings.HasPrefix(l.input[l.pos:], "*/") { // Found the end. Advance past the '*/' and discard the comment body // unless it's a metadata comment l.next() l.next() if metadataComment { l.emit(METADATACOMMENT) } else { l.ignore() } return lexText } if l.next() == eof { return l.errorf("unterminated block comment") } } } // lexIdent handles identifiers. func lexIdent(l *Lexer) stateFn { for { r := l.next() if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' { continue } l.backup() break } // We may have a keyword, so check for that before emitting. l.emit(l.keyword()) return lexText } // lexNumber handles decimal and hexadecimal numbers. Decimal numbers may begin // with a '-'; hex numbers begin with '0x' and do not accept leading '-'. func lexNumber(l *Lexer) stateFn { // Leading '-' is ok digits := "0123456789" neg := l.accept("-") if !neg { // allow '0x' for hex numbers, as long as there's not a leading '-'. r := l.peek() if r == '0' { l.next() if l.accept("x") { digits = "0123456789ABCDEFabcdef" } } } // followed by any number of digits l.acceptRun(digits) r := l.peek() if unicode.IsLetter(r) { l.next() return l.errorf("invalid number: %q", l.input[l.start:l.pos]) } l.emit(CONSTANT) return lexText } // lexDirective handles lines beginning with '%'. These are used to emit C code // directly to the output file. For now we're ignoring them, but some of the // constants in the protocol file do depend on values from #included header // files, so that may need to change. func lexDirective(l *Lexer) stateFn { for { r := l.next() if r == '\n' { l.ignore() return lexText } if r == eof { return l.errorf("unterminated directive") } } } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/procedures.tmpl000066400000000000000000000060351463537555000314750ustar00rootroot00000000000000// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Code generated by internal/lvgen/generate.go. DO NOT EDIT. // // To regenerate, run 'go generate' in internal/lvgen. // package libvirt import ( "bytes" "io" "github.com/digitalocean/go-libvirt/internal/constants" "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" ) // References to prevent "imported and not used" errors. var ( _ = bytes.Buffer{} _ = io.Copy _ = constants.Program _ = xdr.Unmarshal ) // // Typedefs: // {{range .Typedefs}}// {{.Name}} is libvirt's {{.LVName}} type {{.Name}} {{.Type}} {{end}} // // Enums: // {{range .Enums}}// {{.Name}} is libvirt's {{.LVName}} type {{.Name}} {{.Type}} {{end}} // // Structs: // {{range .Structs}}// {{.Name}} is libvirt's {{.LVName}} type {{.Name}} struct { {{range .Members}} {{.Name}} {{.Type}} {{end -}} } {{end}} {{range .Unions}}// {{.Name}} is a discriminated union. type {{.Name}} struct { D uint32 I interface{} } {{end -}} {{range .Unions}}{{$uname := .Name}}{{range .Cases}}{{$casetype := printf "%v%v" $uname .CaseName}} // New{{$casetype}} creates a discriminated union value satisfying // the {{$uname}} interface. func New{{$casetype}}(v {{.Type}}) *{{$uname}} { return &{{$uname}}{D: {{.DiscriminantVal}}, I: v} } {{end}} {{- end}} {{range $proc := .Procs}} // {{.Name}} is the go wrapper for {{.LVName}}. func (l *Libvirt) {{.Name}}( {{- range $ix, $arg := .Args}} {{- if (eq $ix $proc.WriteStreamIdx)}}{{if $ix}}, {{end}}outStream io.Reader{{end}} {{- if (eq $ix $proc.ReadStreamIdx)}}{{if $ix}}, {{end}}inStream io.Writer{{end}} {{- if $ix}}, {{end}}{{.Name}} {{.Type}} {{- end -}} ) ({{range .Ret}}r{{.Name}} {{.Type}}, {{end}}err error) { var buf []byte {{if .ArgsStruct}} args := {{.ArgsStruct}} { {{range .Args}} {{.Name}}: {{.Name}}, {{end}} } buf, err = encode(&args) if err != nil { return } {{end}} {{if .RetStruct}} var r response{{end}} {{if .RetStruct}}r{{else}}_{{end}}, err = l.requestStream({{.Num}}, constants.{{.Program}}Program, buf, {{- if (ne .WriteStreamIdx -1)}} outStream,{{else}} nil,{{end}} {{- if (ne .ReadStreamIdx -1)}} inStream{{else}} nil{{end -}} ) if err != nil { return } {{if .RetStruct}} // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) {{range .Ret}} // {{.Name}}: {{.Type}} _, err = dec.Decode(&r{{.Name}}) if err != nil { return } {{end}}{{end}} return } {{end}} golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/sunrpc.y000066400000000000000000000144621463537555000301330ustar00rootroot00000000000000// Copyright 2017 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // The generated code notice below is output to the generated file. *This* file, // (sunrpc.y) is the yacc grammar for the sunrpc protocol language, and is *not* // generated. %{ // Copyright 2017 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Code generated by goyacc. DO NOT EDIT. // // To regenerate, run 'go generate' in internal/lvgen. // package lvgen import ( //"fmt" ) %} // SymType %union{ val string } // XDR tokens: %token BOOL CASE CONST DEFAULT DOUBLE ENUM FLOAT OPAQUE STRING STRUCT %token SWITCH TYPEDEF UNION UNSIGNED VOID HYPER INT SHORT CHAR %token IDENTIFIER CONSTANT ERROR // RPCL additional tokens: %token PROGRAM VERSION %token METADATACOMMENT %token PROCIDENTIFIER %% specification : definition_list ; value : IDENTIFIER | CONSTANT ; definition_list : definition ';' | definition ';' definition_list ; definition : enum_definition | const_definition | typedef_definition | struct_definition | union_definition | program_definition ; enum_definition : ENUM enum_ident '{' enum_value_list '}' { StartEnum($2.val) } ; enum_value_list : enum_value | enum_value ',' enum_value_list ; enum_value : enum_value_ident { err := AddEnumAutoVal($1.val) if err != nil { yylex.Error(err.Error()) return 1 } } | enum_value_ident '=' value { err := AddEnumVal($1.val, $3.val) if err != nil { yylex.Error(err.Error()) return 1 } } | enum_proc_ident '=' value { err := AddProcEnumVal($1.val, $3.val, "") if err != nil { yylex.Error(err.Error()) return 1 } } | METADATACOMMENT enum_proc_ident '=' value { err := AddProcEnumVal($2.val, $4.val, $1.val) if err != nil { yylex.Error(err.Error()) return 1 } } ; enum_proc_ident : PROCIDENTIFIER ; enum_ident : IDENTIFIER ; enum_value_ident : IDENTIFIER ; // Ignore consts that are set to IDENTIFIERs - this isn't allowed by the spec, // but occurs in the file because libvirt runs the pre-processor on the protocol // file, and it handles replacing the identifier with it's #defined value. const_definition : CONST const_ident '=' IDENTIFIER | CONST const_ident '=' CONSTANT { err := AddConst($2.val, $4.val) if err != nil { yylex.Error(err.Error()) return 1 } } ; const_ident : IDENTIFIER ; typedef_definition : TYPEDEF {StartTypedef()} declaration ; declaration : simple_declaration | fixed_array_declaration | variable_array_declaration | pointer_declaration ; simple_declaration : type_specifier variable_ident {AddDeclaration($2.val, $1.val)} ; type_specifier : int_spec | UNSIGNED int_spec {$$.val = "u"+$2.val} | FLOAT {$$.val = "float32"} | DOUBLE {$$.val = "float64"} | BOOL {$$.val = "bool"} | STRING {$$.val = "string"} | OPAQUE {$$.val = "byte"} | enum_definition | struct_definition | union_definition | IDENTIFIER ; int_spec : HYPER {$$.val = "int64"} | INT {$$.val = "int32"} | SHORT {$$.val = "int16"} | CHAR {$$.val = "int8"} ; variable_ident : IDENTIFIER ; fixed_array_declaration : type_specifier variable_ident '[' value ']' { AddFixedArray($2.val, $1.val, $4.val) } ; variable_array_declaration : type_specifier variable_ident '<' value '>' { AddVariableArray($2.val, $1.val, $4.val) } | type_specifier variable_ident '<' '>' { AddVariableArray($2.val, $1.val, "") } ; // while pointer_declarations may look like their familiar c-equivalents, in the // XDR language they actually declare "Optional-data". The simplest // representation to use for these is a variable-length array with a size of 1. // See the XDR spec for a more complete explanation of this. pointer_declaration : type_specifier '*' variable_ident { AddOptValue($3.val, $1.val) } ; struct_definition : STRUCT struct_ident '{' {StartStruct($2.val)} declaration_list '}' { AddStruct() } ; struct_ident : IDENTIFIER ; declaration_list : declaration ';' | declaration ';' declaration_list ; union_definition : UNION union_ident {StartUnion($2.val)} SWITCH '(' simple_declaration ')' '{' case_list '}' {AddUnion()} ; union_ident : IDENTIFIER ; case_list : case ';' | case ';' case_list ; case : CASE value {StartCase($2.val)} ':' declaration {AddCase()} | DEFAULT {StartCase("default")} ':' declaration {AddCase()} ; program_definition : PROGRAM program_ident '{' version_list '}' '=' value ; program_ident : IDENTIFIER ; version_list : version ';' | version ';' version_list ; version : VERSION version_ident '{' procedure_list '}' '=' value ';' ; version_ident : IDENTIFIER ; procedure_list : procedure ';' | procedure ';' procedure_list ; procedure : type_specifier procedure_ident '(' type_specifier ')' '=' value ';' ; procedure_ident : IDENTIFIER ; %% golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/y.go000066400000000000000000000404231463537555000272220ustar00rootroot00000000000000// Code generated by goyacc sunrpc.y. DO NOT EDIT. //line sunrpc.y:20 // Copyright 2017 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Code generated by goyacc. DO NOT EDIT. // // To regenerate, run 'go generate' in internal/lvgen. // package lvgen import __yyfmt__ "fmt" //line sunrpc.y:40 import ( //"fmt" ) //line sunrpc.y:49 type yySymType struct { yys int val string } const BOOL = 57346 const CASE = 57347 const CONST = 57348 const DEFAULT = 57349 const DOUBLE = 57350 const ENUM = 57351 const FLOAT = 57352 const OPAQUE = 57353 const STRING = 57354 const STRUCT = 57355 const SWITCH = 57356 const TYPEDEF = 57357 const UNION = 57358 const UNSIGNED = 57359 const VOID = 57360 const HYPER = 57361 const INT = 57362 const SHORT = 57363 const CHAR = 57364 const IDENTIFIER = 57365 const CONSTANT = 57366 const ERROR = 57367 const PROGRAM = 57368 const VERSION = 57369 const METADATACOMMENT = 57370 const PROCIDENTIFIER = 57371 var yyToknames = [...]string{ "$end", "error", "$unk", "BOOL", "CASE", "CONST", "DEFAULT", "DOUBLE", "ENUM", "FLOAT", "OPAQUE", "STRING", "STRUCT", "SWITCH", "TYPEDEF", "UNION", "UNSIGNED", "VOID", "HYPER", "INT", "SHORT", "CHAR", "IDENTIFIER", "CONSTANT", "ERROR", "PROGRAM", "VERSION", "METADATACOMMENT", "PROCIDENTIFIER", "';'", "'{'", "'}'", "','", "'='", "'['", "']'", "'<'", "'>'", "'*'", "'('", "')'", "':'", } var yyStatenames = [...]string{} const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 //line sunrpc.y:279 //line yacctab:1 var yyExca = [...]int8{ -1, 1, 1, -1, -2, 0, } const yyPrivate = 57344 const yyLast = 157 var yyAct = [...]uint8{ 89, 82, 36, 119, 111, 81, 64, 70, 32, 55, 58, 137, 134, 136, 108, 125, 90, 91, 83, 66, 37, 106, 78, 31, 79, 105, 139, 61, 123, 101, 74, 96, 41, 93, 76, 65, 40, 10, 39, 43, 42, 13, 75, 30, 14, 38, 126, 48, 49, 50, 51, 47, 115, 97, 84, 73, 114, 103, 60, 67, 54, 52, 29, 59, 61, 118, 142, 135, 127, 116, 77, 98, 80, 85, 16, 72, 66, 92, 11, 94, 95, 10, 90, 91, 88, 13, 100, 12, 14, 62, 63, 87, 99, 102, 104, 69, 27, 25, 15, 23, 20, 18, 110, 2, 107, 117, 113, 109, 48, 49, 50, 51, 46, 8, 112, 45, 7, 44, 4, 113, 28, 124, 128, 121, 130, 122, 86, 71, 131, 8, 26, 132, 7, 129, 4, 133, 138, 120, 53, 140, 141, 24, 68, 22, 35, 34, 33, 21, 19, 57, 56, 17, 9, 6, 5, 3, 1, } var yyPact = [...]int16{ 72, -1000, -1000, 44, -1000, -1000, -1000, -1000, -1000, -1000, 78, 77, -1000, 76, 74, 73, 72, 31, -1000, 9, -1000, 28, 30, -1000, -1000, -1000, 29, -1000, -1000, 35, 66, -1000, -1000, -1000, -1000, -1000, -4, -1000, 89, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, 81, 48, 23, -3, 8, 0, -2, -1000, -1000, -1000, -1000, -13, 53, -1000, -1000, 28, -22, 22, 43, 68, -1000, 35, 59, 59, -1, 59, -7, -1000, 21, 41, 28, -5, 48, 26, -1000, -1000, -1000, -1000, -1000, -1000, 59, -11, -17, -1000, -1000, 28, -27, 53, 59, -1000, 28, -1000, -1000, -1000, -1000, 25, -1000, -1000, 20, 39, 42, 118, -6, 28, -25, -1000, 14, 38, 59, -1000, 59, -1000, 28, -1000, 118, -1000, -30, 37, -28, -1000, -31, 28, -1000, -8, 28, -1000, 59, -1000, 36, -1000, } var yyPgo = [...]uint8{ 0, 156, 103, 0, 155, 117, 154, 153, 115, 112, 152, 151, 9, 150, 149, 10, 148, 147, 1, 8, 146, 145, 144, 2, 6, 20, 143, 142, 5, 141, 138, 3, 137, 135, 133, 130, 7, 127, 126, 4, 114, 105, } var yyR1 = [...]int8{ 0, 1, 3, 3, 2, 2, 4, 4, 4, 4, 4, 4, 5, 12, 12, 13, 13, 13, 13, 15, 11, 14, 6, 6, 16, 17, 7, 18, 18, 18, 18, 19, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 25, 25, 25, 25, 24, 20, 21, 21, 22, 27, 8, 26, 28, 28, 30, 9, 29, 31, 31, 33, 32, 34, 32, 10, 35, 36, 36, 37, 38, 39, 39, 40, 41, } var yyR2 = [...]int8{ 0, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 5, 1, 3, 1, 3, 3, 4, 1, 1, 1, 4, 4, 1, 0, 3, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 4, 3, 0, 6, 1, 2, 3, 0, 10, 1, 2, 3, 0, 5, 0, 4, 7, 1, 2, 3, 8, 1, 2, 3, 8, 1, } var yyChk = [...]int16{ -1000, -1, -2, -4, -5, -6, -7, -8, -9, -10, 9, 6, 15, 13, 16, 26, 30, -11, 23, -16, 23, -17, -26, 23, -29, 23, -35, 23, -2, 31, 34, -18, -19, -20, -21, -22, -23, -25, 17, 10, 8, 4, 12, 11, -5, -8, -9, 23, 19, 20, 21, 22, 31, -30, 31, -12, -13, -14, -15, 28, 23, 29, 23, 24, -24, 39, 23, -25, -27, 14, -36, -37, 27, 32, 33, 34, 34, -15, 35, 37, -24, -28, -18, 40, 32, 30, -38, 23, -12, -3, 23, 24, -3, 34, -3, -3, 38, 32, 30, -19, -23, 34, -36, 31, -3, 36, 38, -28, 41, -24, -3, -39, -40, -23, 31, 32, 30, -41, 23, -31, -32, 5, 7, 34, -39, 40, 32, 30, -3, -34, -3, -23, -31, -33, 42, 30, 41, 42, -18, 34, -18, -3, 30, } var yyDef = [...]int8{ 0, -2, 1, 0, 6, 7, 8, 9, 10, 11, 0, 0, 25, 0, 0, 0, 4, 0, 20, 0, 24, 0, 0, 54, 57, 59, 0, 67, 5, 0, 0, 26, 27, 28, 29, 30, 0, 32, 0, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 52, 0, 0, 0, 13, 15, 0, 0, 21, 19, 22, 23, 31, 0, 47, 33, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 68, 0, 71, 14, 16, 2, 3, 17, 0, 0, 0, 50, 53, 55, 0, 0, 0, 69, 0, 18, 48, 49, 56, 0, 31, 66, 0, 0, 0, 0, 0, 72, 0, 75, 0, 0, 0, 64, 0, 73, 0, 58, 60, 62, 0, 0, 0, 61, 0, 0, 70, 0, 0, 65, 0, 63, 0, 74, } var yyTok1 = [...]int8{ 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 40, 41, 39, 3, 33, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 42, 30, 37, 34, 38, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 35, 3, 36, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 31, 3, 32, } var yyTok2 = [...]int8{ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, } var yyTok3 = [...]int8{ 0, } var yyErrorMessages = [...]struct { state int token int msg string }{} //line yaccpar:1 /* parser for yacc output */ var ( yyDebug = 0 yyErrorVerbose = false ) type yyLexer interface { Lex(lval *yySymType) int Error(s string) } type yyParser interface { Parse(yyLexer) int Lookahead() int } type yyParserImpl struct { lval yySymType stack [yyInitialStackSize]yySymType char int } func (p *yyParserImpl) Lookahead() int { return p.char } func yyNewParser() yyParser { return &yyParserImpl{} } const yyFlag = -1000 func yyTokname(c int) string { if c >= 1 && c-1 < len(yyToknames) { if yyToknames[c-1] != "" { return yyToknames[c-1] } } return __yyfmt__.Sprintf("tok-%v", c) } func yyStatname(s int) string { if s >= 0 && s < len(yyStatenames) { if yyStatenames[s] != "" { return yyStatenames[s] } } return __yyfmt__.Sprintf("state-%v", s) } func yyErrorMessage(state, lookAhead int) string { const TOKSTART = 4 if !yyErrorVerbose { return "syntax error" } for _, e := range yyErrorMessages { if e.state == state && e.token == lookAhead { return "syntax error: " + e.msg } } res := "syntax error: unexpected " + yyTokname(lookAhead) // To match Bison, suggest at most four expected tokens. expected := make([]int, 0, 4) // Look for shiftable tokens. base := int(yyPact[state]) for tok := TOKSTART; tok-1 < len(yyToknames); tok++ { if n := base + tok; n >= 0 && n < yyLast && int(yyChk[int(yyAct[n])]) == tok { if len(expected) == cap(expected) { return res } expected = append(expected, tok) } } if yyDef[state] == -2 { i := 0 for yyExca[i] != -1 || int(yyExca[i+1]) != state { i += 2 } // Look for tokens that we accept or reduce. for i += 2; yyExca[i] >= 0; i += 2 { tok := int(yyExca[i]) if tok < TOKSTART || yyExca[i+1] == 0 { continue } if len(expected) == cap(expected) { return res } expected = append(expected, tok) } // If the default action is to accept or reduce, give up. if yyExca[i+1] != 0 { return res } } for i, tok := range expected { if i == 0 { res += ", expecting " } else { res += " or " } res += yyTokname(tok) } return res } func yylex1(lex yyLexer, lval *yySymType) (char, token int) { token = 0 char = lex.Lex(lval) if char <= 0 { token = int(yyTok1[0]) goto out } if char < len(yyTok1) { token = int(yyTok1[char]) goto out } if char >= yyPrivate { if char < yyPrivate+len(yyTok2) { token = int(yyTok2[char-yyPrivate]) goto out } } for i := 0; i < len(yyTok3); i += 2 { token = int(yyTok3[i+0]) if token == char { token = int(yyTok3[i+1]) goto out } } out: if token == 0 { token = int(yyTok2[1]) /* unknown char */ } if yyDebug >= 3 { __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char)) } return char, token } func yyParse(yylex yyLexer) int { return yyNewParser().Parse(yylex) } func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int { var yyn int var yyVAL yySymType var yyDollar []yySymType _ = yyDollar // silence set and not used yyS := yyrcvr.stack[:] Nerrs := 0 /* number of errors */ Errflag := 0 /* error recovery flag */ yystate := 0 yyrcvr.char = -1 yytoken := -1 // yyrcvr.char translated into internal numbering defer func() { // Make sure we report no lookahead when not parsing. yystate = -1 yyrcvr.char = -1 yytoken = -1 }() yyp := -1 goto yystack ret0: return 0 ret1: return 1 yystack: /* put a state and value onto the stack */ if yyDebug >= 4 { __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate)) } yyp++ if yyp >= len(yyS) { nyys := make([]yySymType, len(yyS)*2) copy(nyys, yyS) yyS = nyys } yyS[yyp] = yyVAL yyS[yyp].yys = yystate yynewstate: yyn = int(yyPact[yystate]) if yyn <= yyFlag { goto yydefault /* simple state */ } if yyrcvr.char < 0 { yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) } yyn += yytoken if yyn < 0 || yyn >= yyLast { goto yydefault } yyn = int(yyAct[yyn]) if int(yyChk[yyn]) == yytoken { /* valid shift */ yyrcvr.char = -1 yytoken = -1 yyVAL = yyrcvr.lval yystate = yyn if Errflag > 0 { Errflag-- } goto yystack } yydefault: /* default state action */ yyn = int(yyDef[yystate]) if yyn == -2 { if yyrcvr.char < 0 { yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval) } /* look through exception table */ xi := 0 for { if yyExca[xi+0] == -1 && int(yyExca[xi+1]) == yystate { break } xi += 2 } for xi += 2; ; xi += 2 { yyn = int(yyExca[xi+0]) if yyn < 0 || yyn == yytoken { break } } yyn = int(yyExca[xi+1]) if yyn < 0 { goto ret0 } } if yyn == 0 { /* error ... attempt to resume parsing */ switch Errflag { case 0: /* brand new error */ yylex.Error(yyErrorMessage(yystate, yytoken)) Nerrs++ if yyDebug >= 1 { __yyfmt__.Printf("%s", yyStatname(yystate)) __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken)) } fallthrough case 1, 2: /* incompletely recovered error ... try again */ Errflag = 3 /* find a state where "error" is a legal shift action */ for yyp >= 0 { yyn = int(yyPact[yyS[yyp].yys]) + yyErrCode if yyn >= 0 && yyn < yyLast { yystate = int(yyAct[yyn]) /* simulate a shift of "error" */ if int(yyChk[yystate]) == yyErrCode { goto yystack } } /* the current p has no shift on "error", pop stack */ if yyDebug >= 2 { __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys) } yyp-- } /* there is no state on the stack with an error shift ... abort */ goto ret1 case 3: /* no shift yet; clobber input char */ if yyDebug >= 2 { __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken)) } if yytoken == yyEofCode { goto ret1 } yyrcvr.char = -1 yytoken = -1 goto yynewstate /* try again in the same state */ } } /* reduction by production yyn */ if yyDebug >= 2 { __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate)) } yynt := yyn yypt := yyp _ = yypt // guard against "declared and not used" yyp -= int(yyR2[yyn]) // yyp is now the index of $0. Perform the default action. Iff the // reduced production is ε, $1 is possibly out of range. if yyp+1 >= len(yyS) { nyys := make([]yySymType, len(yyS)*2) copy(nyys, yyS) yyS = nyys } yyVAL = yyS[yyp+1] /* consult goto table to find next state */ yyn = int(yyR1[yyn]) yyg := int(yyPgo[yyn]) yyj := yyg + yyS[yyp].yys + 1 if yyj >= yyLast { yystate = int(yyAct[yyg]) } else { yystate = int(yyAct[yyj]) if int(yyChk[yystate]) != -yyn { yystate = int(yyAct[yyg]) } } // dummy call; replaced with literal code switch yynt { case 12: yyDollar = yyS[yypt-5 : yypt+1] //line sunrpc.y:88 { StartEnum(yyDollar[2].val) } case 15: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:97 { err := AddEnumAutoVal(yyDollar[1].val) if err != nil { yylex.Error(err.Error()) return 1 } } case 16: yyDollar = yyS[yypt-3 : yypt+1] //line sunrpc.y:104 { err := AddEnumVal(yyDollar[1].val, yyDollar[3].val) if err != nil { yylex.Error(err.Error()) return 1 } } case 17: yyDollar = yyS[yypt-3 : yypt+1] //line sunrpc.y:111 { err := AddProcEnumVal(yyDollar[1].val, yyDollar[3].val, "") if err != nil { yylex.Error(err.Error()) return 1 } } case 18: yyDollar = yyS[yypt-4 : yypt+1] //line sunrpc.y:118 { err := AddProcEnumVal(yyDollar[2].val, yyDollar[4].val, yyDollar[1].val) if err != nil { yylex.Error(err.Error()) return 1 } } case 23: yyDollar = yyS[yypt-4 : yypt+1] //line sunrpc.y:144 { err := AddConst(yyDollar[2].val, yyDollar[4].val) if err != nil { yylex.Error(err.Error()) return 1 } } case 25: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:158 { StartTypedef() } case 31: yyDollar = yyS[yypt-2 : yypt+1] //line sunrpc.y:169 { AddDeclaration(yyDollar[2].val, yyDollar[1].val) } case 33: yyDollar = yyS[yypt-2 : yypt+1] //line sunrpc.y:174 { yyVAL.val = "u" + yyDollar[2].val } case 34: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:175 { yyVAL.val = "float32" } case 35: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:176 { yyVAL.val = "float64" } case 36: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:177 { yyVAL.val = "bool" } case 37: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:178 { yyVAL.val = "string" } case 38: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:179 { yyVAL.val = "byte" } case 43: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:187 { yyVAL.val = "int64" } case 44: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:188 { yyVAL.val = "int32" } case 45: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:189 { yyVAL.val = "int16" } case 46: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:190 { yyVAL.val = "int8" } case 48: yyDollar = yyS[yypt-5 : yypt+1] //line sunrpc.y:198 { AddFixedArray(yyDollar[2].val, yyDollar[1].val, yyDollar[4].val) } case 49: yyDollar = yyS[yypt-5 : yypt+1] //line sunrpc.y:202 { AddVariableArray(yyDollar[2].val, yyDollar[1].val, yyDollar[4].val) } case 50: yyDollar = yyS[yypt-4 : yypt+1] //line sunrpc.y:203 { AddVariableArray(yyDollar[2].val, yyDollar[1].val, "") } case 51: yyDollar = yyS[yypt-3 : yypt+1] //line sunrpc.y:211 { AddOptValue(yyDollar[3].val, yyDollar[1].val) } case 52: yyDollar = yyS[yypt-3 : yypt+1] //line sunrpc.y:215 { StartStruct(yyDollar[2].val) } case 53: yyDollar = yyS[yypt-6 : yypt+1] //line sunrpc.y:215 { AddStruct() } case 57: yyDollar = yyS[yypt-2 : yypt+1] //line sunrpc.y:228 { StartUnion(yyDollar[2].val) } case 58: yyDollar = yyS[yypt-10 : yypt+1] //line sunrpc.y:228 { AddUnion() } case 62: yyDollar = yyS[yypt-2 : yypt+1] //line sunrpc.y:241 { StartCase(yyDollar[2].val) } case 63: yyDollar = yyS[yypt-5 : yypt+1] //line sunrpc.y:241 { AddCase() } case 64: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:242 { StartCase("default") } case 65: yyDollar = yyS[yypt-4 : yypt+1] //line sunrpc.y:242 { AddCase() } } goto yystack /* stack new state and value */ } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/internal/lvgen/y.output000066400000000000000000000522571463537555000301650ustar00rootroot00000000000000 state 0 $accept: .specification $end CONST shift 11 ENUM shift 10 STRUCT shift 13 TYPEDEF shift 12 UNION shift 14 PROGRAM shift 15 . error specification goto 1 definition_list goto 2 definition goto 3 enum_definition goto 4 const_definition goto 5 typedef_definition goto 6 struct_definition goto 7 union_definition goto 8 program_definition goto 9 state 1 $accept: specification.$end $end accept . error state 2 specification: definition_list. (1) . reduce 1 (src line 64) state 3 definition_list: definition.';' definition_list: definition.';' definition_list ';' shift 16 . error state 4 definition: enum_definition. (6) . reduce 6 (src line 78) state 5 definition: const_definition. (7) . reduce 7 (src line 80) state 6 definition: typedef_definition. (8) . reduce 8 (src line 81) state 7 definition: struct_definition. (9) . reduce 9 (src line 82) state 8 definition: union_definition. (10) . reduce 10 (src line 83) state 9 definition: program_definition. (11) . reduce 11 (src line 84) state 10 enum_definition: ENUM.enum_ident '{' enum_value_list '}' IDENTIFIER shift 18 . error enum_ident goto 17 state 11 const_definition: CONST.const_ident '=' IDENTIFIER const_definition: CONST.const_ident '=' CONSTANT IDENTIFIER shift 20 . error const_ident goto 19 state 12 typedef_definition: TYPEDEF.$$25 declaration $$25: . (25) . reduce 25 (src line 157) $$25 goto 21 state 13 struct_definition: STRUCT.struct_ident '{' $$52 declaration_list '}' IDENTIFIER shift 23 . error struct_ident goto 22 state 14 union_definition: UNION.union_ident $$57 SWITCH '(' simple_declaration ')' '{' case_list '}' IDENTIFIER shift 25 . error union_ident goto 24 state 15 program_definition: PROGRAM.program_ident '{' version_list '}' '=' value IDENTIFIER shift 27 . error program_ident goto 26 state 16 definition_list: definition ';'. (4) definition_list: definition ';'.definition_list CONST shift 11 ENUM shift 10 STRUCT shift 13 TYPEDEF shift 12 UNION shift 14 PROGRAM shift 15 . reduce 4 (src line 73) definition_list goto 28 definition goto 3 enum_definition goto 4 const_definition goto 5 typedef_definition goto 6 struct_definition goto 7 union_definition goto 8 program_definition goto 9 state 17 enum_definition: ENUM enum_ident.'{' enum_value_list '}' '{' shift 29 . error state 18 enum_ident: IDENTIFIER. (20) . reduce 20 (src line 131) state 19 const_definition: CONST const_ident.'=' IDENTIFIER const_definition: CONST const_ident.'=' CONSTANT '=' shift 30 . error state 20 const_ident: IDENTIFIER. (24) . reduce 24 (src line 153) state 21 typedef_definition: TYPEDEF $$25.declaration BOOL shift 41 DOUBLE shift 40 ENUM shift 10 FLOAT shift 39 OPAQUE shift 43 STRING shift 42 STRUCT shift 13 UNION shift 14 UNSIGNED shift 38 HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 . error enum_definition goto 44 struct_definition goto 45 union_definition goto 46 declaration goto 31 simple_declaration goto 32 fixed_array_declaration goto 33 variable_array_declaration goto 34 pointer_declaration goto 35 type_specifier goto 36 int_spec goto 37 state 22 struct_definition: STRUCT struct_ident.'{' $$52 declaration_list '}' '{' shift 52 . error state 23 struct_ident: IDENTIFIER. (54) . reduce 54 (src line 218) state 24 union_definition: UNION union_ident.$$57 SWITCH '(' simple_declaration ')' '{' case_list '}' $$57: . (57) . reduce 57 (src line 227) $$57 goto 53 state 25 union_ident: IDENTIFIER. (59) . reduce 59 (src line 231) state 26 program_definition: PROGRAM program_ident.'{' version_list '}' '=' value '{' shift 54 . error state 27 program_ident: IDENTIFIER. (67) . reduce 67 (src line 249) state 28 definition_list: definition ';' definition_list. (5) . reduce 5 (src line 75) state 29 enum_definition: ENUM enum_ident '{'.enum_value_list '}' IDENTIFIER shift 60 METADATACOMMENT shift 59 PROCIDENTIFIER shift 61 . error enum_value_list goto 55 enum_value goto 56 enum_value_ident goto 57 enum_proc_ident goto 58 state 30 const_definition: CONST const_ident '='.IDENTIFIER const_definition: CONST const_ident '='.CONSTANT IDENTIFIER shift 62 CONSTANT shift 63 . error state 31 typedef_definition: TYPEDEF $$25 declaration. (26) . reduce 26 (src line 158) state 32 declaration: simple_declaration. (27) . reduce 27 (src line 161) state 33 declaration: fixed_array_declaration. (28) . reduce 28 (src line 163) state 34 declaration: variable_array_declaration. (29) . reduce 29 (src line 164) state 35 declaration: pointer_declaration. (30) . reduce 30 (src line 165) state 36 simple_declaration: type_specifier.variable_ident fixed_array_declaration: type_specifier.variable_ident '[' value ']' variable_array_declaration: type_specifier.variable_ident '<' value '>' variable_array_declaration: type_specifier.variable_ident '<' '>' pointer_declaration: type_specifier.'*' variable_ident IDENTIFIER shift 66 '*' shift 65 . error variable_ident goto 64 state 37 type_specifier: int_spec. (32) . reduce 32 (src line 172) state 38 type_specifier: UNSIGNED.int_spec HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 . error int_spec goto 67 state 39 type_specifier: FLOAT. (34) . reduce 34 (src line 175) state 40 type_specifier: DOUBLE. (35) . reduce 35 (src line 176) state 41 type_specifier: BOOL. (36) . reduce 36 (src line 177) state 42 type_specifier: STRING. (37) . reduce 37 (src line 178) state 43 type_specifier: OPAQUE. (38) . reduce 38 (src line 179) state 44 type_specifier: enum_definition. (39) . reduce 39 (src line 180) state 45 type_specifier: struct_definition. (40) . reduce 40 (src line 181) state 46 type_specifier: union_definition. (41) . reduce 41 (src line 182) state 47 type_specifier: IDENTIFIER. (42) . reduce 42 (src line 183) state 48 int_spec: HYPER. (43) . reduce 43 (src line 186) state 49 int_spec: INT. (44) . reduce 44 (src line 188) state 50 int_spec: SHORT. (45) . reduce 45 (src line 189) state 51 int_spec: CHAR. (46) . reduce 46 (src line 190) state 52 struct_definition: STRUCT struct_ident '{'.$$52 declaration_list '}' $$52: . (52) . reduce 52 (src line 214) $$52 goto 68 state 53 union_definition: UNION union_ident $$57.SWITCH '(' simple_declaration ')' '{' case_list '}' SWITCH shift 69 . error state 54 program_definition: PROGRAM program_ident '{'.version_list '}' '=' value VERSION shift 72 . error version_list goto 70 version goto 71 state 55 enum_definition: ENUM enum_ident '{' enum_value_list.'}' '}' shift 73 . error state 56 enum_value_list: enum_value. (13) enum_value_list: enum_value.',' enum_value_list ',' shift 74 . reduce 13 (src line 91) state 57 enum_value: enum_value_ident. (15) enum_value: enum_value_ident.'=' value '=' shift 75 . reduce 15 (src line 96) state 58 enum_value: enum_proc_ident.'=' value '=' shift 76 . error state 59 enum_value: METADATACOMMENT.enum_proc_ident '=' value PROCIDENTIFIER shift 61 . error enum_proc_ident goto 77 state 60 enum_value_ident: IDENTIFIER. (21) . reduce 21 (src line 135) state 61 enum_proc_ident: PROCIDENTIFIER. (19) . reduce 19 (src line 127) state 62 const_definition: CONST const_ident '=' IDENTIFIER. (22) . reduce 22 (src line 142) state 63 const_definition: CONST const_ident '=' CONSTANT. (23) . reduce 23 (src line 144) state 64 simple_declaration: type_specifier variable_ident. (31) fixed_array_declaration: type_specifier variable_ident.'[' value ']' variable_array_declaration: type_specifier variable_ident.'<' value '>' variable_array_declaration: type_specifier variable_ident.'<' '>' '[' shift 78 '<' shift 79 . reduce 31 (src line 168) state 65 pointer_declaration: type_specifier '*'.variable_ident IDENTIFIER shift 66 . error variable_ident goto 80 state 66 variable_ident: IDENTIFIER. (47) . reduce 47 (src line 193) state 67 type_specifier: UNSIGNED int_spec. (33) . reduce 33 (src line 174) state 68 struct_definition: STRUCT struct_ident '{' $$52.declaration_list '}' BOOL shift 41 DOUBLE shift 40 ENUM shift 10 FLOAT shift 39 OPAQUE shift 43 STRING shift 42 STRUCT shift 13 UNION shift 14 UNSIGNED shift 38 HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 . error enum_definition goto 44 struct_definition goto 45 union_definition goto 46 declaration goto 82 simple_declaration goto 32 fixed_array_declaration goto 33 variable_array_declaration goto 34 pointer_declaration goto 35 type_specifier goto 36 int_spec goto 37 declaration_list goto 81 state 69 union_definition: UNION union_ident $$57 SWITCH.'(' simple_declaration ')' '{' case_list '}' '(' shift 83 . error state 70 program_definition: PROGRAM program_ident '{' version_list.'}' '=' value '}' shift 84 . error state 71 version_list: version.';' version_list: version.';' version_list ';' shift 85 . error state 72 version: VERSION.version_ident '{' procedure_list '}' '=' value ';' IDENTIFIER shift 87 . error version_ident goto 86 state 73 enum_definition: ENUM enum_ident '{' enum_value_list '}'. (12) . reduce 12 (src line 87) state 74 enum_value_list: enum_value ','.enum_value_list IDENTIFIER shift 60 METADATACOMMENT shift 59 PROCIDENTIFIER shift 61 . error enum_value_list goto 88 enum_value goto 56 enum_value_ident goto 57 enum_proc_ident goto 58 state 75 enum_value: enum_value_ident '='.value IDENTIFIER shift 90 CONSTANT shift 91 . error value goto 89 state 76 enum_value: enum_proc_ident '='.value IDENTIFIER shift 90 CONSTANT shift 91 . error value goto 92 state 77 enum_value: METADATACOMMENT enum_proc_ident.'=' value '=' shift 93 . error state 78 fixed_array_declaration: type_specifier variable_ident '['.value ']' IDENTIFIER shift 90 CONSTANT shift 91 . error value goto 94 state 79 variable_array_declaration: type_specifier variable_ident '<'.value '>' variable_array_declaration: type_specifier variable_ident '<'.'>' IDENTIFIER shift 90 CONSTANT shift 91 '>' shift 96 . error value goto 95 state 80 pointer_declaration: type_specifier '*' variable_ident. (51) . reduce 51 (src line 210) state 81 struct_definition: STRUCT struct_ident '{' $$52 declaration_list.'}' '}' shift 97 . error state 82 declaration_list: declaration.';' declaration_list: declaration.';' declaration_list ';' shift 98 . error state 83 union_definition: UNION union_ident $$57 SWITCH '('.simple_declaration ')' '{' case_list '}' BOOL shift 41 DOUBLE shift 40 ENUM shift 10 FLOAT shift 39 OPAQUE shift 43 STRING shift 42 STRUCT shift 13 UNION shift 14 UNSIGNED shift 38 HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 . error enum_definition goto 44 struct_definition goto 45 union_definition goto 46 simple_declaration goto 99 type_specifier goto 100 int_spec goto 37 state 84 program_definition: PROGRAM program_ident '{' version_list '}'.'=' value '=' shift 101 . error state 85 version_list: version ';'. (68) version_list: version ';'.version_list VERSION shift 72 . reduce 68 (src line 253) version_list goto 102 version goto 71 state 86 version: VERSION version_ident.'{' procedure_list '}' '=' value ';' '{' shift 103 . error state 87 version_ident: IDENTIFIER. (71) . reduce 71 (src line 262) state 88 enum_value_list: enum_value ',' enum_value_list. (14) . reduce 14 (src line 93) state 89 enum_value: enum_value_ident '=' value. (16) . reduce 16 (src line 104) state 90 value: IDENTIFIER. (2) . reduce 2 (src line 68) state 91 value: CONSTANT. (3) . reduce 3 (src line 70) state 92 enum_value: enum_proc_ident '=' value. (17) . reduce 17 (src line 111) state 93 enum_value: METADATACOMMENT enum_proc_ident '='.value IDENTIFIER shift 90 CONSTANT shift 91 . error value goto 104 state 94 fixed_array_declaration: type_specifier variable_ident '[' value.']' ']' shift 105 . error state 95 variable_array_declaration: type_specifier variable_ident '<' value.'>' '>' shift 106 . error state 96 variable_array_declaration: type_specifier variable_ident '<' '>'. (50) . reduce 50 (src line 203) state 97 struct_definition: STRUCT struct_ident '{' $$52 declaration_list '}'. (53) . reduce 53 (src line 215) state 98 declaration_list: declaration ';'. (55) declaration_list: declaration ';'.declaration_list BOOL shift 41 DOUBLE shift 40 ENUM shift 10 FLOAT shift 39 OPAQUE shift 43 STRING shift 42 STRUCT shift 13 UNION shift 14 UNSIGNED shift 38 HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 . reduce 55 (src line 222) enum_definition goto 44 struct_definition goto 45 union_definition goto 46 declaration goto 82 simple_declaration goto 32 fixed_array_declaration goto 33 variable_array_declaration goto 34 pointer_declaration goto 35 type_specifier goto 36 int_spec goto 37 declaration_list goto 107 state 99 union_definition: UNION union_ident $$57 SWITCH '(' simple_declaration.')' '{' case_list '}' ')' shift 108 . error state 100 simple_declaration: type_specifier.variable_ident IDENTIFIER shift 66 . error variable_ident goto 109 state 101 program_definition: PROGRAM program_ident '{' version_list '}' '='.value IDENTIFIER shift 90 CONSTANT shift 91 . error value goto 110 state 102 version_list: version ';' version_list. (69) . reduce 69 (src line 255) state 103 version: VERSION version_ident '{'.procedure_list '}' '=' value ';' BOOL shift 41 DOUBLE shift 40 ENUM shift 10 FLOAT shift 39 OPAQUE shift 43 STRING shift 42 STRUCT shift 13 UNION shift 14 UNSIGNED shift 38 HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 . error enum_definition goto 44 struct_definition goto 45 union_definition goto 46 type_specifier goto 113 int_spec goto 37 procedure_list goto 111 procedure goto 112 state 104 enum_value: METADATACOMMENT enum_proc_ident '=' value. (18) . reduce 18 (src line 118) state 105 fixed_array_declaration: type_specifier variable_ident '[' value ']'. (48) . reduce 48 (src line 197) state 106 variable_array_declaration: type_specifier variable_ident '<' value '>'. (49) . reduce 49 (src line 201) state 107 declaration_list: declaration ';' declaration_list. (56) . reduce 56 (src line 224) state 108 union_definition: UNION union_ident $$57 SWITCH '(' simple_declaration ')'.'{' case_list '}' '{' shift 114 . error state 109 simple_declaration: type_specifier variable_ident. (31) . reduce 31 (src line 168) state 110 program_definition: PROGRAM program_ident '{' version_list '}' '=' value. (66) . reduce 66 (src line 245) state 111 version: VERSION version_ident '{' procedure_list.'}' '=' value ';' '}' shift 115 . error state 112 procedure_list: procedure.';' procedure_list: procedure.';' procedure_list ';' shift 116 . error state 113 procedure: type_specifier.procedure_ident '(' type_specifier ')' '=' value ';' IDENTIFIER shift 118 . error procedure_ident goto 117 state 114 union_definition: UNION union_ident $$57 SWITCH '(' simple_declaration ')' '{'.case_list '}' CASE shift 121 DEFAULT shift 122 . error case_list goto 119 case goto 120 state 115 version: VERSION version_ident '{' procedure_list '}'.'=' value ';' '=' shift 123 . error state 116 procedure_list: procedure ';'. (72) procedure_list: procedure ';'.procedure_list BOOL shift 41 DOUBLE shift 40 ENUM shift 10 FLOAT shift 39 OPAQUE shift 43 STRING shift 42 STRUCT shift 13 UNION shift 14 UNSIGNED shift 38 HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 . reduce 72 (src line 266) enum_definition goto 44 struct_definition goto 45 union_definition goto 46 type_specifier goto 113 int_spec goto 37 procedure_list goto 124 procedure goto 112 state 117 procedure: type_specifier procedure_ident.'(' type_specifier ')' '=' value ';' '(' shift 125 . error state 118 procedure_ident: IDENTIFIER. (75) . reduce 75 (src line 275) state 119 union_definition: UNION union_ident $$57 SWITCH '(' simple_declaration ')' '{' case_list.'}' '}' shift 126 . error state 120 case_list: case.';' case_list: case.';' case_list ';' shift 127 . error state 121 case: CASE.value $$62 ':' declaration IDENTIFIER shift 90 CONSTANT shift 91 . error value goto 128 state 122 case: DEFAULT.$$64 ':' declaration $$64: . (64) . reduce 64 (src line 242) $$64 goto 129 state 123 version: VERSION version_ident '{' procedure_list '}' '='.value ';' IDENTIFIER shift 90 CONSTANT shift 91 . error value goto 130 state 124 procedure_list: procedure ';' procedure_list. (73) . reduce 73 (src line 268) state 125 procedure: type_specifier procedure_ident '('.type_specifier ')' '=' value ';' BOOL shift 41 DOUBLE shift 40 ENUM shift 10 FLOAT shift 39 OPAQUE shift 43 STRING shift 42 STRUCT shift 13 UNION shift 14 UNSIGNED shift 38 HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 . error enum_definition goto 44 struct_definition goto 45 union_definition goto 46 type_specifier goto 131 int_spec goto 37 state 126 union_definition: UNION union_ident $$57 SWITCH '(' simple_declaration ')' '{' case_list '}'. (58) . reduce 58 (src line 228) state 127 case_list: case ';'. (60) case_list: case ';'.case_list CASE shift 121 DEFAULT shift 122 . reduce 60 (src line 235) case_list goto 132 case goto 120 state 128 case: CASE value.$$62 ':' declaration $$62: . (62) . reduce 62 (src line 240) $$62 goto 133 state 129 case: DEFAULT $$64.':' declaration ':' shift 134 . error state 130 version: VERSION version_ident '{' procedure_list '}' '=' value.';' ';' shift 135 . error state 131 procedure: type_specifier procedure_ident '(' type_specifier.')' '=' value ';' ')' shift 136 . error state 132 case_list: case ';' case_list. (61) . reduce 61 (src line 237) state 133 case: CASE value $$62.':' declaration ':' shift 137 . error state 134 case: DEFAULT $$64 ':'.declaration BOOL shift 41 DOUBLE shift 40 ENUM shift 10 FLOAT shift 39 OPAQUE shift 43 STRING shift 42 STRUCT shift 13 UNION shift 14 UNSIGNED shift 38 HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 . error enum_definition goto 44 struct_definition goto 45 union_definition goto 46 declaration goto 138 simple_declaration goto 32 fixed_array_declaration goto 33 variable_array_declaration goto 34 pointer_declaration goto 35 type_specifier goto 36 int_spec goto 37 state 135 version: VERSION version_ident '{' procedure_list '}' '=' value ';'. (70) . reduce 70 (src line 258) state 136 procedure: type_specifier procedure_ident '(' type_specifier ')'.'=' value ';' '=' shift 139 . error state 137 case: CASE value $$62 ':'.declaration BOOL shift 41 DOUBLE shift 40 ENUM shift 10 FLOAT shift 39 OPAQUE shift 43 STRING shift 42 STRUCT shift 13 UNION shift 14 UNSIGNED shift 38 HYPER shift 48 INT shift 49 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 . error enum_definition goto 44 struct_definition goto 45 union_definition goto 46 declaration goto 140 simple_declaration goto 32 fixed_array_declaration goto 33 variable_array_declaration goto 34 pointer_declaration goto 35 type_specifier goto 36 int_spec goto 37 state 138 case: DEFAULT $$64 ':' declaration. (65) . reduce 65 (src line 242) state 139 procedure: type_specifier procedure_ident '(' type_specifier ')' '='.value ';' IDENTIFIER shift 90 CONSTANT shift 91 . error value goto 141 state 140 case: CASE value $$62 ':' declaration. (63) . reduce 63 (src line 241) state 141 procedure: type_specifier procedure_ident '(' type_specifier ')' '=' value.';' ';' shift 142 . error state 142 procedure: type_specifier procedure_ident '(' type_specifier ')' '=' value ';'. (74) . reduce 74 (src line 271) 42 terminals, 42 nonterminals 76 grammar rules, 143/16000 states 0 shift/reduce, 0 reduce/reduce conflicts reported 91 working sets used memory: parser 163/240000 40 extra closures 223 shift entries, 1 exceptions 73 goto entries 63 entries saved by goto default Optimizer space used: output 157/240000 157 table entries, 0 zero maximum spread: 42, maximum offset: 139 golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/libvirt.go000066400000000000000000000625151463537555000255040ustar00rootroot00000000000000// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package libvirt // We'll use c-for-go to extract the consts and typedefs from the libvirt // sources so we don't have to duplicate them here. //go:generate scripts/gen-consts.sh import ( "bytes" "context" "encoding/json" "errors" "fmt" "net" "sync" "syscall" "time" "github.com/digitalocean/go-libvirt/internal/constants" "github.com/digitalocean/go-libvirt/internal/event" xdr "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" "github.com/digitalocean/go-libvirt/socket" "github.com/digitalocean/go-libvirt/socket/dialers" ) // ErrEventsNotSupported is returned by Events() if event streams // are unsupported by either QEMU or libvirt. var ErrEventsNotSupported = errors.New("event monitor is not supported") // ConnectURI defines a type for driver URIs for libvirt // the defined constants are *not* exhaustive as there are also options // e.g. to connect remote via SSH type ConnectURI string const ( // QEMUSystem connects to a QEMU system mode daemon QEMUSystem ConnectURI = "qemu:///system" // QEMUSession connects to a QEMU session mode daemon (unprivileged) QEMUSession ConnectURI = "qemu:///session" // XenSystem connects to a Xen system mode daemon XenSystem ConnectURI = "xen:///system" //TestDefault connect to default mock driver TestDefault ConnectURI = "test:///default" // disconnectedTimeout is how long to wait for disconnect cleanup to // complete disconnectTimeout = 5 * time.Second ) // Libvirt implements libvirt's remote procedure call protocol. type Libvirt struct { // socket connection socket *socket.Socket // closed after cleanup complete following the underlying connection to // libvirt being disconnected. disconnected chan struct{} // method callbacks cmux sync.RWMutex callbacks map[int32]chan response // event listeners emux sync.RWMutex events map[int32]*event.Stream // next request serial number s int32 } // DomainEvent represents a libvirt domain event. type DomainEvent struct { CallbackID int32 Domain Domain Event string Seconds uint64 Microseconds uint32 Padding uint8 Details []byte } // GetCallbackID returns the callback ID of a QEMU domain event. func (de DomainEvent) GetCallbackID() int32 { return de.CallbackID } // GetCallbackID returns the callback ID of a libvirt lifecycle event. func (m DomainEventCallbackLifecycleMsg) GetCallbackID() int32 { return m.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackRebootMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackRtcChangeMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackWatchdogMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackIOErrorMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackIOErrorReasonMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackGraphicsMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackBlockJobMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackDiskChangeMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackTrayChangeMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackPmwakeupMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackPmsuspendMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackBalloonChangeMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackPmsuspendDiskMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackControlErrorMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackDeviceRemovedMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackTunableMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackDeviceAddedMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackAgentLifecycleMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackMigrationIterationMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackJobCompletedMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackDeviceRemovalFailedMsg) GetCallbackID() int32 { return e.CallbackID } // GetCallbackID returns the callback ID. func (e *DomainEventCallbackMetadataChangeMsg) GetCallbackID() int32 { return e.CallbackID } // qemuError represents a QEMU process error. type qemuError struct { Error struct { Class string `json:"class"` Description string `json:"desc"` } `json:"error"` } // Capabilities returns an XML document describing the host's capabilties. func (l *Libvirt) Capabilities() ([]byte, error) { caps, err := l.ConnectGetCapabilities() return []byte(caps), err } // called at connection time, authenticating with all supported auth types func (l *Libvirt) authenticate() error { // libvirt requires that we call auth-list prior to connecting, // even when no authentication is used. resp, err := l.AuthList() if err != nil { return err } for _, auth := range resp { switch auth { case constants.AuthNone: case constants.AuthPolkit: _, err := l.AuthPolkit() if err != nil { return err } default: continue } break } return nil } func (l *Libvirt) initLibvirtComms(uri ConnectURI) error { payload := struct { Padding [3]byte Name string Flags uint32 }{ Padding: [3]byte{0x1, 0x0, 0x0}, Name: string(uri), Flags: 0, } buf, err := encode(&payload) if err != nil { return err } err = l.authenticate() if err != nil { return err } _, err = l.request(constants.ProcConnectOpen, constants.Program, buf) if err != nil { return err } return nil } // ConnectToURI establishes communication with the specified libvirt driver // The underlying libvirt socket connection will be created via the dialer. // Since the connection can be lost, the Disconnected function can be used // to monitor for a lost connection. func (l *Libvirt) ConnectToURI(uri ConnectURI) error { err := l.socket.Connect() if err != nil { return err } // Start watching the underlying socket connection immediately. // If we don't, and Libvirt goes away partway through initLibvirtComms, // then the callbacks that initLibvirtComms has registered will never // be closed, and therefore it will be stuck waiting for data from a // channel that will never arrive. go l.waitAndDisconnect() err = l.initLibvirtComms(uri) if err != nil { l.socket.Disconnect() return err } l.disconnected = make(chan struct{}) return nil } // Connect establishes communication with the libvirt server. // The underlying libvirt socket connection will be created via the dialer. // Since the connection can be lost, the Disconnected function can be used // to monitor for a lost connection. func (l *Libvirt) Connect() error { return l.ConnectToURI(QEMUSystem) } // Disconnect shuts down communication with the libvirt server and closes the // underlying net.Conn. func (l *Libvirt) Disconnect() error { // Ordering is important here. We want to make sure the connection is closed // before unsubscribing and deregistering the events and requests, to // prevent new requests from racing. _, err := l.request(constants.ProcConnectClose, constants.Program, nil) // syscall.EINVAL is returned by the socket pkg when things have already // been disconnected. if err != nil && err != syscall.EINVAL { return err } err = l.socket.Disconnect() if err != nil { return err } // wait for the listen goroutine to detect the lost connection and clean up // to happen once it returns. Safeguard with a timeout. // Things not fully cleaned up is better than a deadlock. select { case <-l.disconnected: case <-time.After(disconnectTimeout): } return err } // Disconnected allows callers to detect if the underlying connection // to libvirt has been closed. If the returned channel is closed, then // the connection to libvirt has been lost (or disconnected intentionally). func (l *Libvirt) Disconnected() <-chan struct{} { return l.disconnected } // IsConnected indicates whether or not there is currently a connection to // libvirtd. func (l *Libvirt) IsConnected() bool { select { case <-l.Disconnected(): return false default: return true } } // Domains returns a list of all domains managed by libvirt. // // Deprecated: use ConnectListAllDomains instead. func (l *Libvirt) Domains() ([]Domain, error) { // these are the flags as passed by `virsh list --all` flags := ConnectListDomainsActive | ConnectListDomainsInactive domains, _, err := l.ConnectListAllDomains(1, flags) return domains, err } // DomainState returns state of the domain managed by libvirt. // // Deprecated: use DomainGetState instead. func (l *Libvirt) DomainState(dom string) (DomainState, error) { d, err := l.lookup(dom) if err != nil { return DomainNostate, err } state, _, err := l.DomainGetState(d, 0) return DomainState(state), err } // SubscribeQEMUEvents streams domain events until the provided context is // cancelled. If a problem is encountered setting up the event monitor // connection an error will be returned. Errors encountered during streaming // will cause the returned event channel to be closed. QEMU domain events. func (l *Libvirt) SubscribeQEMUEvents(ctx context.Context, dom string) (<-chan DomainEvent, error) { d, err := l.lookup(dom) if err != nil { return nil, err } callbackID, err := l.QEMUConnectDomainMonitorEventRegister([]Domain{d}, nil, 0) if err != nil { return nil, err } stream := event.NewStream(constants.QEMUProgram, callbackID) l.addStream(stream) ch := make(chan DomainEvent) go func() { ctx, cancel := context.WithCancel(ctx) defer cancel() defer l.unsubscribeQEMUEvents(stream) defer stream.Shutdown() defer close(ch) for { select { case ev, ok := <-stream.Recv(): if !ok { return } ch <- *ev.(*DomainEvent) case <-ctx.Done(): return } } }() return ch, nil } // unsubscribeQEMUEvents stops the flow of events from QEMU through libvirt. func (l *Libvirt) unsubscribeQEMUEvents(stream *event.Stream) error { err := l.QEMUConnectDomainMonitorEventDeregister(stream.CallbackID) l.removeStream(stream.CallbackID) return err } // SubscribeEvents allows the caller to subscribe to any of the event types // supported by libvirt. The events will continue to be streamed until the // caller cancels the provided context. After canceling the context, callers // should wait until the channel is closed to be sure they're collected all the // events. func (l *Libvirt) SubscribeEvents(ctx context.Context, eventID DomainEventID, dom OptDomain) (<-chan interface{}, error) { callbackID, err := l.ConnectDomainEventCallbackRegisterAny(int32(eventID), nil) if err != nil { return nil, err } stream := event.NewStream(constants.QEMUProgram, callbackID) l.addStream(stream) ch := make(chan interface{}) go func() { ctx, cancel := context.WithCancel(ctx) defer cancel() defer l.unsubscribeEvents(stream) defer stream.Shutdown() defer func() { close(ch) }() for { select { case ev, ok := <-stream.Recv(): if !ok { return } ch <- ev case <-ctx.Done(): return } } }() return ch, nil } // unsubscribeEvents stops the flow of the specified events from libvirt. There // are two steps to this process: a call to libvirt to deregister our callback, // and then removing the callback from the list used by the `Route` function. If // the deregister call fails, we'll return the error, but still remove the // callback from the list. That's ok; if any events arrive after this point, the // Route function will drop them when it finds no registered handler. func (l *Libvirt) unsubscribeEvents(stream *event.Stream) error { err := l.ConnectDomainEventCallbackDeregisterAny(stream.CallbackID) l.removeStream(stream.CallbackID) return err } // LifecycleEvents streams lifecycle events until the provided context is // cancelled. If a problem is encountered setting up the event monitor // connection, an error will be returned. Errors encountered during streaming // will cause the returned event channel to be closed. func (l *Libvirt) LifecycleEvents(ctx context.Context) (<-chan DomainEventLifecycleMsg, error) { callbackID, err := l.ConnectDomainEventCallbackRegisterAny(int32(DomainEventIDLifecycle), nil) if err != nil { return nil, err } stream := event.NewStream(constants.Program, callbackID) l.addStream(stream) ch := make(chan DomainEventLifecycleMsg) go func() { ctx, cancel := context.WithCancel(ctx) defer cancel() defer l.unsubscribeEvents(stream) defer stream.Shutdown() defer func() { close(ch) }() for { select { case ev, ok := <-stream.Recv(): if !ok { return } ch <- ev.(*DomainEventCallbackLifecycleMsg).Msg case <-ctx.Done(): return } } }() return ch, nil } // Run executes the given QAPI command against a domain's QEMU instance. // For a list of available QAPI commands, see: // http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD func (l *Libvirt) Run(dom string, cmd []byte) ([]byte, error) { d, err := l.lookup(dom) if err != nil { return nil, err } payload := struct { Domain Domain Command []byte Flags uint32 }{ Domain: d, Command: cmd, Flags: 0, } buf, err := encode(&payload) if err != nil { return nil, err } res, err := l.request(constants.QEMUProcDomainMonitorCommand, constants.QEMUProgram, buf) if err != nil { return nil, err } // check for QEMU process errors if err = getQEMUError(res); err != nil { return nil, err } r := bytes.NewReader(res.Payload) dec := xdr.NewDecoder(r) data, _, err := dec.DecodeFixedOpaque(int32(r.Len())) if err != nil { return nil, err } // drop QMP control characters from start of line, and drop // any trailing NULL characters from the end return bytes.TrimRight(data[4:], "\x00"), nil } // Secrets returns all secrets managed by the libvirt daemon. // // Deprecated: use ConnectListAllSecrets instead. func (l *Libvirt) Secrets() ([]Secret, error) { secrets, _, err := l.ConnectListAllSecrets(1, 0) return secrets, err } // StoragePool returns the storage pool associated with the provided name. // An error is returned if the requested storage pool is not found. // // Deprecated: use StoragePoolLookupByName instead. func (l *Libvirt) StoragePool(name string) (StoragePool, error) { return l.StoragePoolLookupByName(name) } // StoragePools returns a list of defined storage pools. Pools are filtered by // the provided flags. See StoragePools*. // // Deprecated: use ConnectListAllStoragePools instead. func (l *Libvirt) StoragePools(flags ConnectListAllStoragePoolsFlags) ([]StoragePool, error) { pools, _, err := l.ConnectListAllStoragePools(1, flags) return pools, err } // Undefine undefines the domain specified by dom, e.g., 'prod-lb-01'. // The flags argument allows additional options to be specified such as // cleaning up snapshot metadata. For more information on available // flags, see DomainUndefine*. // // Deprecated: use DomainUndefineFlags instead. func (l *Libvirt) Undefine(dom string, flags DomainUndefineFlagsValues) error { d, err := l.lookup(dom) if err != nil { return err } return l.DomainUndefineFlags(d, flags) } // Destroy destroys the domain specified by dom, e.g., 'prod-lb-01'. // The flags argument allows additional options to be specified such as // allowing a graceful shutdown with SIGTERM than SIGKILL. // For more information on available flags, see DomainDestroy*. // // Deprecated: use DomainDestroyFlags instead. func (l *Libvirt) Destroy(dom string, flags DomainDestroyFlagsValues) error { d, err := l.lookup(dom) if err != nil { return err } return l.DomainDestroyFlags(d, flags) } // XML returns a domain's raw XML definition, akin to `virsh dumpxml `. // See DomainXMLFlag* for optional flags. // // Deprecated: use DomainGetXMLDesc instead. func (l *Libvirt) XML(dom string, flags DomainXMLFlags) ([]byte, error) { d, err := l.lookup(dom) if err != nil { return nil, err } xml, err := l.DomainGetXMLDesc(d, flags) return []byte(xml), err } // DefineXML defines a domain, but does not start it. // // Deprecated: use DomainDefineXMLFlags instead. func (l *Libvirt) DefineXML(x []byte, flags DomainDefineFlags) error { _, err := l.DomainDefineXMLFlags(string(x), flags) return err } // Version returns the version of the libvirt daemon. // // Deprecated: use ConnectGetLibVersion instead. func (l *Libvirt) Version() (string, error) { ver, err := l.ConnectGetLibVersion() if err != nil { return "", err } // The version is provided as an int following this formula: // version * 1,000,000 + minor * 1000 + micro // See src/libvirt-host.c # virConnectGetLibVersion major := ver / 1000000 ver %= 1000000 minor := ver / 1000 ver %= 1000 micro := ver versionString := fmt.Sprintf("%d.%d.%d", major, minor, micro) return versionString, nil } // Shutdown shuts down a domain. Note that the guest OS may ignore the request. // If flags is set to 0 then the hypervisor will choose the method of shutdown it considers best. // // Deprecated: use DomainShutdownFlags instead. func (l *Libvirt) Shutdown(dom string, flags DomainShutdownFlagValues) error { d, err := l.lookup(dom) if err != nil { return err } return l.DomainShutdownFlags(d, flags) } // Reboot reboots the domain. Note that the guest OS may ignore the request. // If flags is set to zero, then the hypervisor will choose the method of shutdown it considers best. // // Deprecated: use DomainReboot instead. func (l *Libvirt) Reboot(dom string, flags DomainRebootFlagValues) error { d, err := l.lookup(dom) if err != nil { return err } return l.DomainReboot(d, flags) } // Reset resets domain immediately without any guest OS shutdown // // Deprecated: use DomainReset instead. func (l *Libvirt) Reset(dom string) error { d, err := l.lookup(dom) if err != nil { return err } return l.DomainReset(d, 0) } // BlockLimit contains a name and value pair for a Get/SetBlockIOTune limit. The // Name field is the name of the limit (to see a list of the limits that can be // applied, execute the 'blkdeviotune' command on a VM in virsh). Callers can // use the QEMUBlockIO... constants below for the Name value. The Value field is // the limit to apply. type BlockLimit struct { Name string Value uint64 } // SetBlockIOTune changes the per-device block I/O tunables within a guest. // Parameters are the name of the VM, the name of the disk device to which the // limits should be applied, and 1 or more BlockLimit structs containing the // actual limits. // // The limits which can be applied here are enumerated in the QEMUBlockIO... // constants above, and you can also see the full list by executing the // 'blkdeviotune' command on a VM in virsh. // // Example usage: // SetBlockIOTune("vm-name", "vda", BlockLimit{libvirt.QEMUBlockIOWriteBytesSec, 1000000}) // // Deprecated: use DomainSetBlockIOTune instead. func (l *Libvirt) SetBlockIOTune(dom string, disk string, limits ...BlockLimit) error { d, err := l.lookup(dom) if err != nil { return err } params := make([]TypedParam, len(limits)) for ix, limit := range limits { tpval := NewTypedParamValueUllong(limit.Value) params[ix] = TypedParam{Field: limit.Name, Value: *tpval} } return l.DomainSetBlockIOTune(d, disk, params, uint32(DomainAffectLive)) } // GetBlockIOTune returns a slice containing the current block I/O tunables for // a disk. // // Deprecated: use DomainGetBlockIOTune instead. func (l *Libvirt) GetBlockIOTune(dom string, disk string) ([]BlockLimit, error) { d, err := l.lookup(dom) if err != nil { return nil, err } lims, _, err := l.DomainGetBlockIOTune(d, []string{disk}, 32, uint32(TypedParamStringOkay)) if err != nil { return nil, err } var limits []BlockLimit // now decode each of the returned TypedParams. To do this we read the field // name and type, then use the type information to decode the value. for _, lim := range lims { var l BlockLimit name := lim.Field switch lim.Value.I.(type) { case uint64: l = BlockLimit{Name: name, Value: lim.Value.I.(uint64)} } limits = append(limits, l) } return limits, nil } // lookup returns a domain as seen by libvirt. func (l *Libvirt) lookup(name string) (Domain, error) { return l.DomainLookupByName(name) } // getQEMUError checks the provided response for QEMU process errors. // If an error is found, it is extracted an returned, otherwise nil. func getQEMUError(r response) error { pl := bytes.NewReader(r.Payload) dec := xdr.NewDecoder(pl) s, _, err := dec.DecodeString() if err != nil { return err } var e qemuError if err = json.Unmarshal([]byte(s), &e); err != nil { return err } if e.Error.Description != "" { return errors.New(e.Error.Description) } return nil } func (l *Libvirt) waitAndDisconnect() { // wait for the socket to indicate if/when it's been disconnected <-l.socket.Disconnected() // close event streams l.removeAllStreams() // Deregister all callbacks to prevent blocking on clients with // outstanding requests l.deregisterAll() select { case <-l.disconnected: // l.disconnected is already closed, i.e., Libvirt.ConnectToURI // was unable to complete all phases of its connection and // so this hadn't been assigned to an open channel yet (it // is set to a closed channel in Libvirt.New*) // // Just return to avoid closing an already-closed channel. return default: // if we make it here then reading from l.disconnected is blocking, // which suggests that it is open and must be closed. } close(l.disconnected) } // NewWithDialer configures a new Libvirt object that can be used to perform // RPCs via libvirt's socket. The actual connection will not be established // until Connect is called. The same Libvirt object may be used to re-connect // multiple times. func NewWithDialer(dialer socket.Dialer) *Libvirt { l := &Libvirt{ s: 0, disconnected: make(chan struct{}), callbacks: make(map[int32]chan response), events: make(map[int32]*event.Stream), } l.socket = socket.New(dialer, l) // we start with a closed channel since that indicates no connection close(l.disconnected) return l } // New configures a new Libvirt RPC connection. // This function only remains to retain backwards compatability. // When Libvirt's Connect function is called, the Dial will simply return the // connection passed in here and start a goroutine listening/reading from it. // If at any point the Disconnect function is called, any subsequent Connect // call will simply return an already closed connection. // // Deprecated: Please use NewWithDialer. func New(conn net.Conn) *Libvirt { return NewWithDialer(dialers.NewAlreadyConnected(conn)) } // NetworkUpdateCompat is a wrapper over NetworkUpdate which swaps `Command` and `Section` when needed. // This function must be used instead of NetworkUpdate to be sure that the // NetworkUpdate call works both with older and newer libvirtd connections. // // libvirt on-wire protocol had a bug for a long time where Command and Section // were reversed. It's been fixed in newer libvirt versions, and backported to // some older versions. This helper detects what argument order libvirtd expects // and makes the correct NetworkUpdate call. func (l *Libvirt) NetworkUpdateCompat(Net Network, Command NetworkUpdateCommand, Section NetworkUpdateSection, ParentIndex int32, XML string, Flags NetworkUpdateFlags) (err error) { // This is defined in libvirt/src/libvirt_internal.h and thus not available in go-libvirt autogenerated code const virDrvFeatureNetworkUpdateHasCorrectOrder = 16 hasCorrectOrder, err := l.ConnectSupportsFeature(virDrvFeatureNetworkUpdateHasCorrectOrder) if err != nil { return fmt.Errorf("failed to confirm argument order for NetworkUpdate: %w", err) } // https://gitlab.com/libvirt/libvirt/-/commit/b0f78d626a18bcecae3a4d165540ab88bfbfc9ee if hasCorrectOrder == 0 { return l.NetworkUpdate(Net, uint32(Section), uint32(Command), ParentIndex, XML, Flags) } return l.NetworkUpdate(Net, uint32(Command), uint32(Section), ParentIndex, XML, Flags) } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/libvirt.yml000066400000000000000000000063601463537555000256740ustar00rootroot00000000000000# Configuration file for c-for-go, which go-libvirt uses to translate the const # and type definitions from the C-language sources in the libvirt project into # Go. This file is used by the c-for-go binary (github.com/xlab/c-for-go), which # is called when 'go generate' is run. See libvirt.go for the command line used. --- GENERATOR: PackageName: libvirt PackageLicense: | Copyright 2018 The go-libvirt Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Includes: [] PARSER: # We can't use environment variables here, but we don't want to process the # libvirt version installed in the system folders (if any). Instead we'll # rely on our caller to link the libvirt source directory to lv_source/, and # run on that code. This isn't ideal, but changes to c-for-go are needed to # fix it. IncludePaths: [./lv_source/include, ./lv_source/build/include] SysIncludePaths: [./lv_source/include, ./lv_source/build/include] SourcesPaths: - libvirt/libvirt.h - libvirt/virterror.h TRANSLATOR: ConstRules: defines: eval TypeTips: enum: - { target: "ConnectGetAllDomainStatsFlags", tips: [ unsigned ] } - { target: "ConnectListAllNodeDeviceFlags", tips: [ unsigned ] } Rules: global: - {action: accept, from: "^vir"} post-global: - {action: replace, from: "^vir"} - {load: snakecase} # Follow golint's capitalization conventions. - {action: replace, from: "Api([A-Z]|$)", to: "API$1"} - {action: replace, from: "Cpu([A-Z]|$)", to: "CPU$1"} - {action: replace, from: "Dns([A-Z]|$)", to: "DNS$1"} - {action: replace, from: "Eof([A-Z]|$)", to: "EOF$1"} - {action: replace, from: "Id([A-Z]|$)", to: "ID$1"} - {action: replace, from: "Ip([A-Z]|$)", to: "IP$1"} - {action: replace, from: "Tls([A-Z]|$)", to: "TLS$1"} - {action: replace, from: "Uuid([A-Z]|$)", to: "UUID$1"} - {action: replace, from: "Uri([A-Z]|$)", to: "URI$1"} - {action: replace, from: "Vcpu([A-Z]|$)", to: "VCPU$1"} - {action: replace, from: "Xml([A-Z]|$)", to: "XML$1"} - {action: replace, from: "Rpc([A-Z]|$)", to: "RPC$1"} - {action: replace, from: "Ssh([A-Z]|$)", to: "SSH$1"} - {action: replace, from: "Http([A-Z]|$)", to: "HTTP$1"} - {transform: unexport, from: "^From"} const: - {action: accept, from: "^VIR_"} # Special case to prevent a collision with a type: - {action: replace, from: "^VIR_DOMAIN_JOB_OPERATION", to: "VIR_DOMAIN_JOB_OPERATION_STR"} - {transform: lower} golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/libvirt_integration_test.go000066400000000000000000000244071463537555000311440ustar00rootroot00000000000000// Copyright 2016 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // +build integration package libvirt import ( "bytes" "encoding/xml" "errors" "net" "sync" "testing" "time" "github.com/digitalocean/go-libvirt/socket" "github.com/digitalocean/go-libvirt/socket/dialers" ) // In order for this test to work, libvirtd must be running and listening for // tcp connections. Then the items (domain, secret, storage pool) in the top level testdata directory // need to have been previously defined. (See the "Setup test artifacts" steps // in .github/workflows/main.yml for how to use virsh for this.) // // TODO: The setup steps should be moved into a script that can be manually // called or used by ci. const ( testAddr = "127.0.0.1" testPort = "16509" testDomainName = "test" ) func TestDeprecatedConnectDisconnectIntegration(t *testing.T) { l := New(testConn(t)) if err := l.Connect(); err != nil { t.Fatal(err) } if err := l.Disconnect(); err != nil { t.Fatal(err) } } func TestConnectDisconnectIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } if err := l.Disconnect(); err != nil { t.Fatal(err) } } func TestConnectToURIIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.ConnectToURI(TestDefault); err != nil { t.Error(err) } defer l.Disconnect() } func checkCapabilities(t *testing.T, l *Libvirt) error { t.Helper() resp, err := l.Capabilities() if err != nil { return err } // verify UUID exists within returned XML var caps struct { Host struct { UUID string `xml:"uuid"` } `xml:"host"` } if err := xml.Unmarshal(resp, &caps); err != nil { return err } if caps.Host.UUID == "" { return errors.New("expected capabilities to contain a UUID") } return nil } func TestDeprecatedCapabilities(t *testing.T) { l := New(testConn(t)) if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() if err := checkCapabilities(t, l); err != nil { t.Errorf("check capabilities error: %v", err) } } func TestCapabilities(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() if err := checkCapabilities(t, l); err != nil { t.Errorf("check capabilities error: %v", err) } } func TestUsingNeverConnected(t *testing.T) { l := NewWithDialer(testDialer(t)) // should fail because Connect was never called _, err := l.DomainLookupByName(testDomainName) if err == nil { t.Fatal("using a never connected libvirt should fail") } } func TestUsingAfterDisconnect(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } if err := l.Disconnect(); err != nil { t.Fatal(err) } // should fail because Disconnect was already called _, err := l.DomainLookupByName(testDomainName) if err == nil { t.Fatal("using a disconnected libvirt should fail") } } func TestLostConnection(t *testing.T) { // In order to be able to close the connection external to libvirt, // we use an already established dialer. conn := testConn(t) l := NewWithDialer(dialers.NewAlreadyConnected(conn)) if err := l.Connect(); err != nil { t.Fatal(err) } // forcibly close the connection out from under the Libvirt object conn.Close() <-l.Disconnected() // this should return an error about the connection being lost _, err := l.DomainLookupByName(testDomainName) if err == nil { t.Error("using a libvirt with a lost connection should fail") } // Disconnect should still return success when the connection was already // lost. if err := l.Disconnect(); err != nil { t.Fatalf("disconnect should still succeed after connection is lost"+ ": %v", err) } } func TestMultipleConnections(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } if err := l.Disconnect(); err != nil { t.Fatal(err) } // Now connect again and make sure stuff still works if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() if err := checkCapabilities(t, l); err != nil { t.Errorf("failed to use reconnected libvirt: %v", err) } } func TestSecretsIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() secrets, err := l.Secrets() if err != nil { t.Fatal(err) } wantLen := 1 gotLen := len(secrets) if gotLen != wantLen { t.Fatalf("expected %d secrets, got %d", wantLen, gotLen) } s := secrets[0] wantType := SecretUsageTypeVolume if s.UsageType != int32(wantType) { t.Errorf("expected usage type: %d, got %d", wantType, s.UsageType) } wantID := "/tmp" if s.UsageID != wantID { t.Errorf("expected usage id: %q, got %q", wantID, s.UsageID) } // 19fdc2f2-fa64-46f3-bacf-42a8aafca6dd wantUUID := [UUIDBuflen]byte{ 0x19, 0xfd, 0xc2, 0xf2, 0xfa, 0x64, 0x46, 0xf3, 0xba, 0xcf, 0x42, 0xa8, 0xaa, 0xfc, 0xa6, 0xdd, } if s.UUID != wantUUID { t.Errorf("expected UUID %q, got %q", wantUUID, s.UUID) } } func TestStoragePoolIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() wantName := "test" pool, err := l.StoragePool(wantName) if err != nil { t.Fatal(err) } gotName := pool.Name if gotName != wantName { t.Errorf("expected name %q, got %q", wantName, gotName) } } func TestStoragePoolInvalidIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() _, err := l.StoragePool("test-does-not-exist") if err == nil { t.Errorf("expected non-existent storage pool return error") } } func TestStoragePoolsIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() pools, err := l.StoragePools(ConnectListStoragePoolsActive) if err != nil { t.Error(err) } wantLen := 1 gotLen := len(pools) if gotLen != wantLen { t.Fatalf("expected %d storage pool, got %d", wantLen, gotLen) } wantName := "test" gotName := pools[0].Name if gotName != wantName { t.Errorf("expected name %q, got %q", wantName, gotName) } } func TestStoragePoolsAutostartIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() pools, err := l.StoragePools(ConnectListStoragePoolsAutostart) if err != nil { t.Error(err) } wantLen := 0 gotLen := len(pools) if gotLen != wantLen { t.Errorf("expected %d storage pool, got %d", wantLen, gotLen) } } func TestStoragePoolRefreshIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() pool, err := l.StoragePool("test") if err != nil { t.Error(err) } err = l.StoragePoolRefresh(pool, 0) if err != nil { t.Error(err) } } func TestStoragePoolRefreshInvalidIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Fatal(err) } defer l.Disconnect() pool, err := l.StoragePool("test-does-not-exist") if err == nil { t.Error(err) } err = l.StoragePoolRefresh(pool, 0) if err == nil { t.Error("expected non-existent storage pool to fail refresh") } } func TestXMLIntegration(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Error(err) } defer l.Disconnect() var flags DomainXMLFlags data, err := l.XML("test", flags) if err != nil { t.Fatal(err) } var v interface{} if err := xml.Unmarshal(data, &v); err != nil { t.Error(err) } } func TestVolumeUploadDownloadIntegration(t *testing.T) { testdata := []byte("Hello, world!") l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Error(err) } defer l.Disconnect() pool, err := l.StoragePool("test") if err != nil { t.Fatal(err) } var volObj struct { XMLName xml.Name `xml:"volume"` Name string `xml:"name"` Capacity struct { Value uint64 `xml:",chardata"` } `xml:"capacity"` Target struct { Format struct { Type string `xml:"type,attr"` } `xml:"format"` } `xml:"target"` } volObj.Name = "testvol" volObj.Capacity.Value = uint64(len(testdata)) volObj.Target.Format.Type = "raw" xmlVol, err := xml.Marshal(volObj) if err != nil { t.Fatal(err) } vol, err := l.StorageVolCreateXML(pool, string(xmlVol), 0) if err != nil { t.Fatal(err) } defer l.StorageVolDelete(vol, 0) err = l.StorageVolUpload(vol, bytes.NewBuffer(testdata), 0, 0, 0) if err != nil { t.Fatal(err) } var buf bytes.Buffer err = l.StorageVolDownload(vol, &buf, 0, 0, 0) if err != nil { t.Fatal(err) } if bytes.Compare(testdata, buf.Bytes()) != 0 { t.Fatal("download not what we uploaded") } } // verify we're able to concurrently communicate with libvirtd. // see: https://github.com/digitalocean/go-libvirt/pull/52 func Test_concurrentWrite(t *testing.T) { l := NewWithDialer(testDialer(t)) if err := l.Connect(); err != nil { t.Error(err) } defer l.Disconnect() count := 10 wg := sync.WaitGroup{} wg.Add(count) start := make(chan struct{}) done := make(chan struct{}) go func() { wg.Wait() close(done) }() for i := 0; i < count; i++ { go func() { defer wg.Done() <-start _, err := l.Domains() if err != nil { t.Fatal(err) } }() } close(start) select { case <-done: case <-time.After(10 * time.Second): t.Fatal("timed out waiting for execution to complete") } } func testDialer(t *testing.T) socket.Dialer { t.Helper() return dialers.NewRemote( testAddr, dialers.UsePort(testPort), dialers.WithRemoteTimeout(time.Second*2), ) } func testConn(t *testing.T) net.Conn { t.Helper() dialer := testDialer(t) conn, err := dialer.Dial() if err != nil { t.Fatal(err) } return conn } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/libvirt_test.go000066400000000000000000000434111463537555000265350ustar00rootroot00000000000000// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package libvirt import ( "context" "encoding/json" "errors" "fmt" "testing" "time" "github.com/digitalocean/go-libvirt/libvirttest" ) func TestDeprecatedConnectAndDisconnect(t *testing.T) { dialer := libvirttest.New() conn, err := dialer.Dial() if err != nil { t.Fatalf("failed to establish test connection: %v", err) } l := New(conn) err = l.Connect() if err != nil { t.Fatal(err) } err = l.Disconnect() if err != nil { t.Error(err) } } func TestConnectAndDisconnect(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatal(err) } err = l.Disconnect() if err != nil { t.Error(err) } } func TestLibvirt_ConnectToURI(t *testing.T) { type args struct { uri ConnectURI } tests := []struct { name string args args wantErr bool }{ { name: "connect to test:///default socket", args: args{ uri: TestDefault, }, wantErr: false, }, { name: "connect to qemu:///session socket", args: args{ uri: QEMUSession, }, wantErr: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { dialer := libvirttest.New() libvirtConn := NewWithDialer(dialer) if err := libvirtConn.ConnectToURI(tt.args.uri); (err != nil) != tt.wantErr { t.Errorf("ConnectToURI() error = %v, wantErr %v", err, tt.wantErr) } libvirtConn.Disconnect() }) } } func TestDisconnectCleanup(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } // register a callback ch := make(chan response) l.register(1, ch) err = l.Disconnect() if err != nil { t.Errorf("disconnect failed: %v", err) } // now make sure that the Disconnect deregistered the callback // do it via a select just to avoid the 10 minute unit test timeout on // failure select { case <-ch: t.Log("callback channel appropriately closed") case <-time.After(10 * time.Second): t.Errorf("callback channel not closed") } } func TestLostConnectionCleanup(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } // register a callback ch := make(chan response) l.register(1, ch) // forcibly just close the fake libvirt tester side of the pipe to lose // the connection. // This should be detected and cleaned up without having to call Disconnect. dialer.Test.Close() // now make sure that deregistered the callback // do it via a select just to avoid the 10 minute unit test timeout on // failure select { case <-ch: t.Log("callback channel appropriately closed") case <-time.After(10 * time.Second): t.Fatalf("callback channel not closed") } } func TestMonitorDisconnect(t *testing.T) { dialer := libvirttest.New() lv := NewWithDialer(dialer) // Haven't connected yet. select { case <-lv.Disconnected(): default: t.Fatalf("chan is open but should be closed") } err := lv.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } select { case <-lv.Disconnected(): t.Fatalf("chan should be open but is closed") default: } err = lv.Disconnect() if err != nil { t.Fatalf("disconnect failed: %v", err) } select { case <-lv.Disconnected(): default: t.Fatalf("chan still open after Disconnect") } } func TestMigrate(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() flags := MigrateLive | MigratePeer2peer | MigratePersistDest | MigrateChangeProtection | MigrateAbortOnError | MigrateAutoConverge | MigrateNonSharedDisk dom, err := l.DomainLookupByName("test") if err != nil { t.Fatalf("failed to lookup domain: %v", err) } dconnuri := []string{"qemu+tcp://foo/system"} if _, err := l.DomainMigratePerform3Params(dom, dconnuri, []TypedParam{}, []byte{}, flags); err != nil { t.Fatalf("unexpected live migration error: %v", err) } } func TestMigrateSetMaxSpeed(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() dom, err := l.DomainLookupByName("test") if err != nil { t.Fatalf("failed to lookup domain: %v", err) } if err := l.DomainMigrateSetMaxSpeed(dom, 100, 0); err != nil { t.Fatalf("unexpected error setting max speed for migrate: %v", err) } } func TestDomainsWithDeprecatedNew(t *testing.T) { dialer := libvirttest.New() conn, err := dialer.Dial() if err != nil { t.Fatalf("failed to dial test connection: %v", err) } l := New(conn) err = l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() domains, err := l.Domains() if err != nil { t.Error(err) } wantLen := 2 gotLen := len(domains) if gotLen != wantLen { t.Errorf("expected %d domains to be returned, got %d", wantLen, gotLen) } for i, d := range domains { wantID := i + 1 if d.ID != int32(wantID) { t.Errorf("expected domain ID %q, got %q", wantID, d.ID) } wantName := fmt.Sprintf("aaaaaaa-%d", i+1) if d.Name != wantName { t.Errorf("expected domain name %q, got %q", wantName, d.Name) } } } func TestDomains(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() domains, err := l.Domains() if err != nil { t.Error(err) } wantLen := 2 gotLen := len(domains) if gotLen != wantLen { t.Errorf("expected %d domains to be returned, got %d", wantLen, gotLen) } for i, d := range domains { wantID := i + 1 if d.ID != int32(wantID) { t.Errorf("expected domain ID %q, got %q", wantID, d.ID) } wantName := fmt.Sprintf("aaaaaaa-%d", i+1) if d.Name != wantName { t.Errorf("expected domain name %q, got %q", wantName, d.Name) } } } func TestDomainState(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() wantState := DomainState(DomainRunning) gotState, err := l.DomainState("test") if err != nil { t.Error(err) } if gotState != wantState { t.Errorf("expected domain state %d, got %d", wantState, gotState) } } func TestDomainMemoryStats(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() wantDomainMemoryStats := []DomainMemoryStat{ { Tag: 6, Val: 1048576, }, { Tag: 7, Val: 91272, }, } d, err := l.lookup("test") if err != nil { t.Error(err) } gotDomainMemoryStats, err := l.DomainMemoryStats(d, 8, 0) if err != nil { t.Error(err) } if len(gotDomainMemoryStats) == 0 { t.Error("No memory stats returned!") } for i := range wantDomainMemoryStats { if wantDomainMemoryStats[i] != gotDomainMemoryStats[i] { t.Errorf("expected domain memory stat %v, got %v", wantDomainMemoryStats[i], gotDomainMemoryStats[i]) } } } func TestEvents(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() done := make(chan error) ctx, cancel := context.WithCancel(context.Background()) defer cancel() stream, err := l.SubscribeQEMUEvents(ctx, "test") if err != nil { t.Error(err) } go func() { var e DomainEvent select { case e = <-stream: case <-time.After(time.Second * 5): done <- errors.New("expected event, received timeout") } result := struct { Device string `json:"device"` Len int `json:"len"` Offset int `json:"offset"` Speed int `json:"speed"` Type string `json:"type"` }{} if err := json.Unmarshal(e.Details, &result); err != nil { t.Error(err) } expected := "drive-ide0-0-0" if result.Device != expected { t.Errorf("expected device %q, got %q", expected, result.Device) } done <- nil }() // send an event to the listener goroutine dialer.Test.Write(append(testEventHeader, testEvent...)) // wait for completion if err := <-done; err != nil { t.Fatal(err) } } func TestRun(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() res, err := l.Run("test", []byte(`{"query-version"}`)) if err != nil { t.Error(err) } type version struct { Return struct { Package string `json:"package"` QEMU struct { Major int `json:"major"` Micro int `json:"micro"` Minor int `json:"minor"` } `json:"qemu"` } `json:"return"` } var v version err = json.Unmarshal(res, &v) if err != nil { t.Error(err) } expected := 2 if v.Return.QEMU.Major != expected { t.Errorf("expected qemu major version %d, got %d", expected, v.Return.QEMU.Major) } } func TestRunFail(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) dialer.Fail = true err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() _, err = l.Run("test", []byte(`{"drive-foo"}`)) if err == nil { t.Error("expected qemu error") } } func TestSecrets(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() secrets, err := l.Secrets() if err != nil { t.Fatal(err) } wantLen := 1 gotLen := len(secrets) if gotLen != wantLen { t.Fatalf("expected %d secrets, got %d", wantLen, gotLen) } s := secrets[0] wantType := int32(SecretUsageTypeVolume) if s.UsageType != wantType { t.Errorf("expected usage type %d, got %d", wantType, s.UsageType) } wantID := "/tmp" if s.UsageID != wantID { t.Errorf("expected usage id %q, got %q", wantID, s.UsageID) } // 19fdc2f2-fa64-46f3-bacf-42a8aafca6dd wantUUID := [UUIDBuflen]byte{ 0x19, 0xfd, 0xc2, 0xf2, 0xfa, 0x64, 0x46, 0xf3, 0xba, 0xcf, 0x42, 0xa8, 0xaa, 0xfc, 0xa6, 0xdd, } if s.UUID != wantUUID { t.Errorf("expected UUID %q, got %q", wantUUID, s.UUID) } } func TestStoragePool(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() wantName := "default" pool, err := l.StoragePool(wantName) if err != nil { t.Error(err) } gotName := pool.Name if gotName != wantName { t.Errorf("expected name %q, got %q", wantName, gotName) } // bb30a11c-0846-4827-8bba-3e6b5cf1b65f wantUUID := [UUIDBuflen]byte{ 0xbb, 0x30, 0xa1, 0x1c, 0x08, 0x46, 0x48, 0x27, 0x8b, 0xba, 0x3e, 0x6b, 0x5c, 0xf1, 0xb6, 0x5f, } gotUUID := pool.UUID if gotUUID != wantUUID { t.Errorf("expected UUID %q, got %q", wantUUID, gotUUID) } } func TestStoragePools(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() pools, err := l.StoragePools(ConnectListStoragePoolsTransient) if err != nil { t.Error(err) } wantLen := 1 gotLen := len(pools) if gotLen != wantLen { t.Errorf("expected %d storage pool, got %d", wantLen, gotLen) } wantName := "default" gotName := pools[0].Name if gotName != wantName { t.Errorf("expected name %q, got %q", wantName, gotName) } // bb30a11c-0846-4827-8bba-3e6b5cf1b65f wantUUID := [UUIDBuflen]byte{ 0xbb, 0x30, 0xa1, 0x1c, 0x08, 0x46, 0x48, 0x27, 0x8b, 0xba, 0x3e, 0x6b, 0x5c, 0xf1, 0xb6, 0x5f, } gotUUID := pools[0].UUID if gotUUID != wantUUID { t.Errorf("expected UUID %q, got %q", wantUUID, gotUUID) } } func TestStoragePoolRefresh(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() pool, err := l.StoragePool("default") if err != nil { t.Error(err) } err = l.StoragePoolRefresh(pool, 0) if err != nil { t.Error(err) } } func TestUndefine(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() var flags DomainUndefineFlagsValues if err := l.Undefine("test", flags); err != nil { t.Fatalf("unexpected undefine error: %v", err) } } func TestDestroy(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() var flags DomainDestroyFlagsValues if err := l.Destroy("test", flags); err != nil { t.Fatalf("unexpected destroy error: %v", err) } } func TestVersion(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() version, err := l.Version() if err != nil { t.Error(err) } expected := "1.3.4" if version != expected { t.Errorf("expected version %q, got %q", expected, version) } } func TestDefineXML(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() var flags DomainDefineFlags var buf []byte if err := l.DefineXML(buf, flags); err != nil { t.Fatalf("unexpected define error: %v", err) } } func TestDomainCreateWithFlags(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() d, err := l.lookup("test") if err != nil { t.Fatalf("failed to lookup domain: %v", err) } var flags uint32 if _, err := l.DomainCreateWithFlags(d, flags); err != nil { t.Fatalf("unexpected create error: %v", err) } } func TestShutdown(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() var flags DomainShutdownFlagValues if err := l.Shutdown("test", flags); err != nil { t.Fatalf("unexpected shutdown error: %v", err) } } func TestReboot(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() var flags DomainRebootFlagValues if err := l.Reboot("test", flags); err != nil { t.Fatalf("unexpected reboot error: %v", err) } } func TestReset(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() if err := l.Reset("test"); err != nil { t.Fatalf("unexpected reset error: %v", err) } } func TestSetBlockIOTune(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() if err := l.SetBlockIOTune("test", "vda", BlockLimit{"write_bytes_sec", 5000000}); err != nil { t.Fatalf("unexpected SetBlockIOTune error: %v", err) } } func TestGetBlockIOTune(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() limits, err := l.GetBlockIOTune("do-test", "vda") if err != nil { t.Fatalf("unexpected GetBlockIOTune error: %v", err) } lim := BlockLimit{"write_bytes_sec", 500000} if limits[2] != lim { t.Fatalf("unexpected result in limits list: %v", limits[2]) } } // ConnectGetAllDomainStats is a good test, since its return values include an // array of TypedParams embedded in a struct. func TestConnectGetAllDomainStats(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() doms, _, err := l.ConnectListAllDomains(1, 0) if err != nil { t.Fatalf("unexpected error listing all domains") } stats, err := l.ConnectGetAllDomainStats(doms, uint32(DomainStatsState), 0) if err != nil { t.Fatalf("unexpected error getting domain stats") } // Verify that the stats records we got back look like this: // [{state.state {1 1}} {state.reason {1 2}}] // [{state.state {1 1}} {state.reason {1 1}}] if len(stats) != 2 { t.Fatalf("expected 2 domain stats records, got %d", len(stats)) } tp1 := NewTypedParamValueInt(1) if stats[1].Params[0].Field != "state.state" { t.Fatalf("unexpected domain statistic %v", stats[1].Params[0].Field) } if stats[1].Params[1].Field != "state.reason" { t.Fatalf("unexpected domain statistic %v", stats[1].Params[1].Field) } if stats[1].Params[0].Value != *tp1 { t.Fatalf("unexpected typed param value %v", stats[1].Params[0].Value) } if stats[1].Params[1].Value != *tp1 { t.Fatalf("unexpected typed param value %v", stats[1].Params[1].Value) } } func TestIsConnected(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) if l.IsConnected() { t.Error("expected IsConnected == false, got true") } err := l.Connect() if err != nil { t.Error(err) } if !l.IsConnected() { t.Error("expected IsConnected == true, got false") } err = l.Disconnect() if err != nil { t.Error(err) } if l.IsConnected() { t.Error("expected IsConnected == false, got true") } } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/libvirttest/000077500000000000000000000000001463537555000260445ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/libvirttest/libvirt.go000066400000000000000000000620471463537555000300570ustar00rootroot00000000000000// Copyright 2022 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // Package libvirttest provides a mock libvirt server for RPC testing. package libvirttest import ( "bytes" "encoding/binary" "errors" "fmt" "io" "net" "os" "sync/atomic" "github.com/digitalocean/go-libvirt/internal/constants" ) var testDomainResponse = []byte{ 0x00, 0x00, 0x00, 0x38, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x17, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status // domain name ("test") 0x00, 0x00, 0x00, 0x04, 0x74, 0x65, 0x73, 0x74, // uuid (dc229f87d4de47198cfd2e21c6105b01) 0xdc, 0x22, 0x9f, 0x87, 0xd4, 0xde, 0x47, 0x19, 0x8c, 0xfd, 0x2e, 0x21, 0xc6, 0x10, 0x5b, 0x01, // domain id (14) 0x00, 0x00, 0x00, 0x0e, } var testRegisterEvent = []byte{ 0x00, 0x00, 0x00, 0x20, // length 0x20, 0x00, 0x80, 0x87, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x04, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status 0x00, 0x00, 0x00, 0x01, // callback id } var testDeregisterEvent = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x87, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x05, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } var testAuthReply = []byte{ 0x00, 0x00, 0x00, 0x24, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x42, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status 0x00, 0x00, 0x00, 0x01, // list length 0x00, 0x00, 0x00, 0x00, // first entry (== no auth) } var testConnectReply = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x01, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } var testDisconnectReply = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x02, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } var testMigrateReply = []byte{ 0x00, 0x00, 0x00, 0x20, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x01, 0x31, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status // cookie out: 0 0x00, 0x00, 0x00, 0x00, } var testRunReply = []byte{ 0x00, 0x00, 0x00, 0x78, // length 0x20, 0x00, 0x80, 0x87, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x01, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status // {"return":{"qemu":{"micro":1,"minor":5,"major":2},"package":""},"id":"libvirt-53"} 0x00, 0x00, 0x00, 0x52, 0x7b, 0x22, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x22, 0x3a, 0x7b, 0x22, 0x71, 0x65, 0x6d, 0x75, 0x22, 0x3a, 0x7b, 0x22, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x22, 0x3a, 0x31, 0x2c, 0x22, 0x6d, 0x69, 0x6e, 0x6f, 0x72, 0x22, 0x3a, 0x35, 0x2c, 0x22, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x22, 0x3a, 0x32, 0x7d, 0x2c, 0x22, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x22, 0x3a, 0x22, 0x22, 0x7d, 0x2c, 0x22, 0x69, 0x64, 0x22, 0x3a, 0x22, 0x6c, 0x69, 0x62, 0x76, 0x69, 0x72, 0x74, 0x2d, 0x35, 0x33, 0x22, 0x7d, // All trailing NULL characters should be removed 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, } var testRunReplyFail = []byte{ 0x00, 0x00, 0x00, 0x8c, // length 0x20, 0x00, 0x80, 0x87, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x01, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x0a, // serial 0x00, 0x00, 0x00, 0x00, // status // {"id":"libvirt-68","error":{"class":"CommandNotFound","desc":"The command drive-foo has not been found"}}` 0x00, 0x00, 0x00, 0x69, 0x7b, 0x22, 0x69, 0x64, 0x22, 0x3a, 0x22, 0x6c, 0x69, 0x62, 0x76, 0x69, 0x72, 0x74, 0x2d, 0x36, 0x38, 0x22, 0x2c, 0x22, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0x3a, 0x7b, 0x22, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x22, 0x3a, 0x22, 0x43, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x2c, 0x22, 0x64, 0x65, 0x73, 0x63, 0x22, 0x3a, 0x22, 0x54, 0x68, 0x65, 0x20, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x20, 0x64, 0x72, 0x69, 0x76, 0x65, 0x2d, 0x66, 0x6f, 0x6f, 0x20, 0x68, 0x61, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x65, 0x6e, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x22, 0x7d, 0x7d, 0x00, 0x00, 0x00, } var testSetSpeedReply = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0xcf, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } var testDomainsReply = []byte{ 0x00, 0x00, 0x00, 0x6c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x01, 0x11, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status // struct of domains 0x00, 0x00, 0x00, 0x02, // first domain // name - aaaaaaa-1 0x00, 0x00, 0x00, 0x09, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x2d, 0x31, 0x00, 0x00, 0x00, // uuid - dc:32:9f:87:d4:de:47:19:8c:fd:2e:21:c6:10:5b:01 0xdc, 0x32, 0x9f, 0x87, 0xd4, 0xde, 0x47, 0x19, 0x8c, 0xfd, 0x2e, 0x21, 0xc6, 0x10, 0x5b, 0x01, // id 0x00, 0x00, 0x00, 0x01, // second domain // name - aaaaaaa-2 0x00, 0x00, 0x00, 0x09, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x2d, 0x32, 0x00, 0x00, 0x00, // uuid - dc:22:9f:87:d4:de:47:19:8c:fd:2e:21:c6:10:5b:01 0xdc, 0x22, 0x9f, 0x87, 0xd4, 0xde, 0x47, 0x19, 0x8c, 0xfd, 0x2e, 0x21, 0xc6, 0x10, 0x5b, 0x01, 0x00, 0x00, // id 0x00, 0x02, 0x00, // count of domains returned 0x00, 0x00, 0x02, } var testDomainMemoryStatsReply = []byte{ 0x00, 0x00, 0x00, 0x38, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x9f, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status // tag 6 val 1048576 // tag 7 val 91272 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x64, 0x88, } var testDomainStateReply = []byte{ 0x00, 0x00, 0x00, 0x24, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0xd4, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status 0x00, 0x00, 0x00, 0x01, // state 0x00, 0x00, 0x00, 0x01, // reason } var testSecretsReply = []byte{ 0x00, 0x00, 0x00, 0x40, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x01, 0x1f, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status // list of secrets 0x00, 0x00, 0x00, 0x01, // first secret // UUID: 19fdc2f2fa64-46f3bacf42a8aafca6dd 0x19, 0xfd, 0xc2, 0xf2, 0xfa, 0x64, 0x46, 0xf3, 0xba, 0xcf, 0x42, 0xa8, 0xaa, 0xfc, 0xa6, 0xdd, // usage type: (1, volume) 0x00, 0x00, 0x00, 0x01, // usage id: "/tmp" 0x00, 0x00, 0x00, 0x04, 0x2f, 0x74, 0x6d, 0x70, // end of secrets 0x00, 0x00, 0x00, 0x01, } var testStoragePoolLookup = []byte{ 0x00, 0x00, 0x00, 0x38, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x54, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status // pool: name = default 0x00, 0x00, 0x00, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x00, // uuid = bb30a11c084648278bba3e6b5cf1b65f 0xbb, 0x30, 0xa1, 0x1c, 0x08, 0x46, 0x48, 0x27, 0x8b, 0xba, 0x3e, 0x6b, 0x5c, 0xf1, 0xb6, 0x5f, } var testStoragePoolRefresh = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x53, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } var testListPoolsReply = []byte{ 0x00, 0x00, 0x00, 0x40, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x01, 0x19, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status 0x00, 0x00, 0x00, 0x01, // pools // first pool, name: "default" 0x00, 0x00, 0x00, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x00, // uuid: bb30a11c084648278bba3e6b5cf1b65f 0xbb, 0x30, 0xa1, 0x1c, 0x08, 0x46, 0x48, 0x27, 0x8b, 0xba, 0x3e, 0x6b, 0x5c, 0xf1, 0xb6, 0x5f, 0x00, 0x00, 0x00, 0x01, // count } var testUndefineReply = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0xe7, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } var testDestroyReply = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0xea, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } var testVersionReply = []byte{ 0x00, 0x00, 0x00, 0x24, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x9d, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x4d, 0xfc, // version (1003004) } var testDefineXML = []byte{ 0x00, 0x00, 0x00, 0x38, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x01, 0x5e, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status 0x00, 0x00, 0x00, 0x04, // dom 0x74, 0x65, 0x73, 0x74, // name // uuid 0xaf, 0xc2, 0xef, 0x71, 0x66, 0xe0, 0x45, 0xa7, 0xa5, 0xec, 0xd8, 0xba, 0x1e, 0xa8, 0x17, 0x7d, 0xff, 0xff, 0xff, 0xff, // id } var testCreateWithFlags = []byte{ 0x00, 0x00, 0x00, 0x38, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x01, 0x5e, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status 0x00, 0x00, 0x00, 0x04, // dom 0x74, 0x65, 0x73, 0x74, // name // uuid 0xaf, 0xc2, 0xef, 0x71, 0x66, 0xe0, 0x45, 0xa7, 0xa5, 0xec, 0xd8, 0xba, 0x1e, 0xa8, 0x17, 0x7d, 0xff, 0xff, 0xff, 0xff, // id } var testShutdownReply = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0xea, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } var testRebootReply = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0xea, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } var testSetBlockIoTuneReply = []byte{ 0x00, 0x00, 0x00, 0x1c, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0xfc, // procedure 0x00, 0x00, 0x00, 0x00, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } // This result block was obtained by calling `fmt.Printf("%#v", r.Payload)` on // the result returned by an actual call to GetBlockIoTune, and then adding the // standard header to the beginning. The length parameter has to be correct! var testGetBlockIoTuneReply = []byte{ 0x00, 0x00, 0x03, 0x00, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0xfd, // procedure 0x00, 0x00, 0x00, 0x00, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status 0x0, 0x0, 0x0, 0x14, // 14 TypedParams follow 0x0, 0x0, 0x0, 0xf, // field name is 15 bytes, padded to a multiple of 4 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x0, 0x0, 0x0, 0x0, 0x4, // type 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, // value 0x0, 0x0, 0x0, 0xe, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xa1, 0x20, 0x0, 0x0, 0x0, 0xe, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xe, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x13, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc3, 0x50, 0x0, 0x0, 0x0, 0x12, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x11, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x12, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd, 0x73, 0x69, 0x7a, 0x65, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1a, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x19, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x19, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x69, 0x6f, 0x70, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xa, // This is field "group_name", a string (type 7), whose value is "somename" 0x67, 0x72, 0x6F, 0x75, 0x70, 0x5F, 0x6E, 0x61, 0x6D, 0x65, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x8, 0x73, 0x6F, 0x6D, 0x65, 0x6E, 0x61, 0x6D, 0x65, 0x0, 0x0, 0x0, 0x0, // End of TypedParams } var testGetAllDomainStatsReply = []byte{ 0x00, 0x00, 0x00, 0xd8, // length 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x01, 0x58, // procedure 0x00, 0x00, 0x00, 0x00, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status 0x0, 0x0, 0x0, 0x2, // 2 domain stats records follow // Domain 0: "Droplet-844329" 0x0, 0x0, 0x0, 0xe, // Domain name is 14 bytes, padded to 4-byte boundary 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x2d, 0x38, 0x34, 0x34, 0x33, 0x32, 0x39, 0x0, 0x0, 0x51, 0x53, 0x24, 0x2e, 0xc6, 0xbd, 0x44, 0x59, 0xa9, 0xff, 0x20, 0xca, 0x79, 0x8f, 0x31, 0x71, // 16-byte UUID 0xff, 0xff, 0xff, 0xff, // ID 0x0, 0x0, 0x0, 0x2, // Array of 2 TypedParams. 0x0, 0x0, 0x0, 0xb, // Field name contains 11 bytes, padded to 4-byte boundary ("state.state") 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x0, 0x0, 0x0, 0x0, 0x1, // Type 0x0, 0x0, 0x0, 0x1, // Value 0x0, 0x0, 0x0, 0xc, // Field name contains 12 bytes ("state.reason") 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x0, 0x0, 0x0, 0x1, // Type 0x0, 0x0, 0x0, 0x2, // Value // Domain 1: "Droplet-33436" 0x0, 0x0, 0x0, 0xd, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x2d, 0x33, 0x33, 0x34, 0x33, 0x36, 0x0, 0x0, 0x0, 0x24, 0xd, 0x94, 0xc5, 0xf0, 0x47, 0x45, 0x8b, 0x89, 0xf1, 0xcd, 0x3a, 0xe6, 0xd6, 0x2b, 0x5d, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xb, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, // 0x0, 0x0, 0x0, 0xe, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x2d, 0x38, 0x34, 0x34, 0x33, 0x33, 0x30, 0x0, 0x0, 0xfb, 0x21, 0xa7, 0xe7, 0x69, 0x89, 0x4c, 0x56, 0xaa, 0xcb, 0x3, 0xde, 0xfc, 0x41, 0xbe, 0xb4, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xb, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xe, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x2d, 0x36, 0x36, 0x32, 0x36, 0x32, 0x35, 0x0, 0x0, 0x37, 0x1b, 0xf, 0xd7, 0xb4, 0xeb, 0x4a, 0xca, 0xae, 0xfd, 0x10, 0xf9, 0x9f, 0x42, 0xf4, 0x23, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xb, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xe, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x2d, 0x36, 0x33, 0x39, 0x38, 0x35, 0x35, 0x0, 0x0, 0xed, 0x77, 0x55, 0x81, 0xa, 0xe6, 0x4d, 0x99, 0xac, 0xbd, 0x7f, 0xd0, 0x3e, 0x81, 0xb6, 0x1c, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xb, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xe, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x2d, 0x36, 0x36, 0x39, 0x31, 0x31, 0x34, 0x0, 0x0, 0x9e, 0x15, 0x30, 0x92, 0x14, 0x49, 0x40, 0xb1, 0xa8, 0x84, 0xd, 0x40, 0x16, 0x37, 0x9c, 0xf3, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xb, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xe, 0x44, 0x72, 0x6f, 0x70, 0x6c, 0x65, 0x74, 0x2d, 0x38, 0x39, 0x39, 0x38, 0x36, 0x37, 0x0, 0x0, 0x23, 0x81, 0x16, 0xe6, 0x7f, 0x3a, 0x4a, 0x80, 0xac, 0x1, 0xe4, 0x77, 0x6, 0xa5, 0x8b, 0x82, 0xff, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x0, 0xb, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x74, 0x61, 0x74, 0x65, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0xc, 0x73, 0x74, 0x61, 0x74, 0x65, 0x2e, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, // 0x0, 0x0, 0x0, 0x1, // 0x0, 0x0, 0x0, 0x2 } // MockLibvirt provides a mock libvirt server for testing. type MockLibvirt struct { client net.Conn Test net.Conn Fail bool serial uint32 disconnected chan struct{} } // New creates a new mock Libvirt server. func New() *MockLibvirt { m := &MockLibvirt{ disconnected: make(chan struct{}), } close(m.disconnected) return m } // Dial creates a pipe to use for the server and client func (m *MockLibvirt) Dial() (net.Conn, error) { serv, conn := net.Pipe() m.client = conn m.Test = serv m.disconnected = make(chan struct{}) go func() { m.handle(serv) fmt.Println("libvirttest pipe closed") close(m.disconnected) }() return m.client, nil } func (m *MockLibvirt) handle(conn net.Conn) { for { // packetLengthSize + headerSize buf := make([]byte, 28) _, err := conn.Read(buf) if errors.Is(err, io.EOF) { return } // extract program prog := binary.BigEndian.Uint32(buf[4:8]) // extract procedure proc := binary.BigEndian.Uint32(buf[12:16]) switch prog { case constants.Program: m.handleRemote(proc, conn) case constants.QEMUProgram: m.handleQEMU(proc, conn) } } } func (m *MockLibvirt) handleRemote(procedure uint32, conn net.Conn) { switch procedure { case constants.ProcAuthList: conn.Write(m.reply(testAuthReply)) case constants.ProcStoragePoolRefresh: conn.Write(m.reply(testStoragePoolRefresh)) case constants.ProcStoragePoolLookupByName: conn.Write(m.reply(testStoragePoolLookup)) case constants.ProcConnectOpen: conn.Write(m.reply(testConnectReply)) case constants.ProcConnectClose: conn.Write(m.reply(testDisconnectReply)) case constants.ProcConnectGetLibVersion: conn.Write(m.reply(testVersionReply)) case constants.ProcDomainLookupByName: conn.Write(m.reply(testDomainResponse)) case constants.ProcConnectListAllDomains: conn.Write(m.reply(testDomainsReply)) case constants.ProcConnectListAllStoragePools: conn.Write(m.reply(testListPoolsReply)) case constants.ProcConnectListAllSecrets: conn.Write(m.reply(testSecretsReply)) case constants.ProcDomainGetState: conn.Write(m.reply(testDomainStateReply)) case constants.ProcDomainMemoryStats: conn.Write(m.reply(testDomainMemoryStatsReply)) case constants.ProcDomainMigrateSetMaxSpeed: conn.Write(m.reply(testSetSpeedReply)) case constants.ProcDomainMigratePerform3Params: conn.Write(m.reply(testMigrateReply)) case constants.ProcDomainUndefineFlags: conn.Write(m.reply(testUndefineReply)) case constants.ProcDomainDestroyFlags: conn.Write(m.reply(testDestroyReply)) case constants.ProcDomainDefineXMLFlags: conn.Write(m.reply(testDefineXML)) case constants.ProcDomainReboot: conn.Write(m.reply(testRebootReply)) case constants.ProcDomainReset: conn.Write(m.reply(testRebootReply)) case constants.ProcDomainCreateWithFlags: conn.Write(m.reply(testCreateWithFlags)) case constants.ProcDomainShutdownFlags: conn.Write(m.reply(testShutdownReply)) case constants.ProcDomainSetBlockIOTune: conn.Write(m.reply(testSetBlockIoTuneReply)) case constants.ProcDomainGetBlockIOTune: conn.Write(m.reply(testGetBlockIoTuneReply)) case constants.ProcConnectGetAllDomainStats: conn.Write(m.reply(testGetAllDomainStatsReply)) default: fmt.Fprintln(os.Stderr, "unknown procedure", procedure) } } func (m *MockLibvirt) handleQEMU(procedure uint32, conn net.Conn) { switch procedure { case constants.QEMUProcConnectDomainMonitorEventRegister: conn.Write(m.reply(testRegisterEvent)) case constants.QEMUProcConnectDomainMonitorEventDeregister: conn.Write(m.reply(testDeregisterEvent)) case constants.QEMUProcDomainMonitorCommand: if m.Fail { conn.Write(m.reply(testRunReplyFail)) } else { conn.Write(m.reply(testRunReply)) } } } // reply automatically injects the correct serial // number into the provided response buffer. func (m *MockLibvirt) reply(buf []byte) []byte { var rspbuf bytes.Buffer io.Copy(&rspbuf, bytes.NewReader(buf)) rsp := rspbuf.Bytes() serial := atomic.AddUint32(&m.serial, 1) binary.BigEndian.PutUint32(rsp[20:24], serial) return rsp } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/qemu_protocol.gen.go000066400000000000000000000147121463537555000274650ustar00rootroot00000000000000// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Code generated by internal/lvgen/generate.go. DO NOT EDIT. // // To regenerate, run 'go generate' in internal/lvgen. // package libvirt import ( "bytes" "io" "github.com/digitalocean/go-libvirt/internal/constants" "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" ) // References to prevent "imported and not used" errors. var ( _ = bytes.Buffer{} _ = io.Copy _ = constants.Program _ = xdr.Unmarshal ) // // Typedefs: // // // Enums: // // QEMUProcedure is libvirt's qemu_procedure type QEMUProcedure int32 // // Structs: // // QEMUDomainMonitorCommandArgs is libvirt's qemu_domain_monitor_command_args type QEMUDomainMonitorCommandArgs struct { Dom Domain Cmd string Flags uint32 } // QEMUDomainMonitorCommandRet is libvirt's qemu_domain_monitor_command_ret type QEMUDomainMonitorCommandRet struct { Result string } // QEMUDomainAttachArgs is libvirt's qemu_domain_attach_args type QEMUDomainAttachArgs struct { PidValue uint32 Flags uint32 } // QEMUDomainAttachRet is libvirt's qemu_domain_attach_ret type QEMUDomainAttachRet struct { Dom Domain } // QEMUDomainAgentCommandArgs is libvirt's qemu_domain_agent_command_args type QEMUDomainAgentCommandArgs struct { Dom Domain Cmd string Timeout int32 Flags uint32 } // QEMUDomainAgentCommandRet is libvirt's qemu_domain_agent_command_ret type QEMUDomainAgentCommandRet struct { Result OptString } // QEMUConnectDomainMonitorEventRegisterArgs is libvirt's qemu_connect_domain_monitor_event_register_args type QEMUConnectDomainMonitorEventRegisterArgs struct { Dom OptDomain Event OptString Flags uint32 } // QEMUConnectDomainMonitorEventRegisterRet is libvirt's qemu_connect_domain_monitor_event_register_ret type QEMUConnectDomainMonitorEventRegisterRet struct { CallbackID int32 } // QEMUConnectDomainMonitorEventDeregisterArgs is libvirt's qemu_connect_domain_monitor_event_deregister_args type QEMUConnectDomainMonitorEventDeregisterArgs struct { CallbackID int32 } // QEMUDomainMonitorEventMsg is libvirt's qemu_domain_monitor_event_msg type QEMUDomainMonitorEventMsg struct { CallbackID int32 Dom Domain Event string Seconds int64 Micros uint32 Details OptString } // QEMUDomainMonitorCommand is the go wrapper for QEMU_PROC_DOMAIN_MONITOR_COMMAND. func (l *Libvirt) QEMUDomainMonitorCommand(Dom Domain, Cmd string, Flags uint32) (rResult string, err error) { var buf []byte args := QEMUDomainMonitorCommandArgs { Dom: Dom, Cmd: Cmd, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(1, constants.QEMUProgram, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Result: string _, err = dec.Decode(&rResult) if err != nil { return } return } // QEMUDomainAttach is the go wrapper for QEMU_PROC_DOMAIN_ATTACH. func (l *Libvirt) QEMUDomainAttach(PidValue uint32, Flags uint32) (rDom Domain, err error) { var buf []byte args := QEMUDomainAttachArgs { PidValue: PidValue, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(2, constants.QEMUProgram, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // QEMUDomainAgentCommand is the go wrapper for QEMU_PROC_DOMAIN_AGENT_COMMAND. func (l *Libvirt) QEMUDomainAgentCommand(Dom Domain, Cmd string, Timeout int32, Flags uint32) (rResult OptString, err error) { var buf []byte args := QEMUDomainAgentCommandArgs { Dom: Dom, Cmd: Cmd, Timeout: Timeout, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(3, constants.QEMUProgram, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Result: OptString _, err = dec.Decode(&rResult) if err != nil { return } return } // QEMUConnectDomainMonitorEventRegister is the go wrapper for QEMU_PROC_CONNECT_DOMAIN_MONITOR_EVENT_REGISTER. func (l *Libvirt) QEMUConnectDomainMonitorEventRegister(Dom OptDomain, Event OptString, Flags uint32) (rCallbackID int32, err error) { var buf []byte args := QEMUConnectDomainMonitorEventRegisterArgs { Dom: Dom, Event: Event, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(4, constants.QEMUProgram, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CallbackID: int32 _, err = dec.Decode(&rCallbackID) if err != nil { return } return } // QEMUConnectDomainMonitorEventDeregister is the go wrapper for QEMU_PROC_CONNECT_DOMAIN_MONITOR_EVENT_DEREGISTER. func (l *Libvirt) QEMUConnectDomainMonitorEventDeregister(CallbackID int32) (err error) { var buf []byte args := QEMUConnectDomainMonitorEventDeregisterArgs { CallbackID: CallbackID, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(5, constants.QEMUProgram, buf, nil, nil) if err != nil { return } return } // QEMUDomainMonitorEvent is the go wrapper for QEMU_PROC_DOMAIN_MONITOR_EVENT. func (l *Libvirt) QEMUDomainMonitorEvent() (err error) { var buf []byte _, err = l.requestStream(6, constants.QEMUProgram, buf, nil, nil) if err != nil { return } return } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/remote_protocol.gen.go000066400000000000000000013336461463537555000300240ustar00rootroot00000000000000// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Code generated by internal/lvgen/generate.go. DO NOT EDIT. // // To regenerate, run 'go generate' in internal/lvgen. // package libvirt import ( "bytes" "io" "github.com/digitalocean/go-libvirt/internal/constants" "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" ) // References to prevent "imported and not used" errors. var ( _ = bytes.Buffer{} _ = io.Copy _ = constants.Program _ = xdr.Unmarshal ) // // Typedefs: // // OptString is libvirt's remote_string type OptString []string // UUID is libvirt's remote_uuid type UUID [UUIDBuflen]byte // OptDomain is libvirt's remote_domain type OptDomain []Domain // OptNetwork is libvirt's remote_network type OptNetwork []Network // OptNetworkPort is libvirt's remote_network_port type OptNetworkPort []NetworkPort // OptNwfilter is libvirt's remote_nwfilter type OptNwfilter []Nwfilter // OptNwfilterBinding is libvirt's remote_nwfilter_binding type OptNwfilterBinding []NwfilterBinding // OptStoragePool is libvirt's remote_storage_pool type OptStoragePool []StoragePool // OptStorageVol is libvirt's remote_storage_vol type OptStorageVol []StorageVol // OptNodeDevice is libvirt's remote_node_device type OptNodeDevice []NodeDevice // OptSecret is libvirt's remote_secret type OptSecret []Secret // // Enums: // // AuthType is libvirt's remote_auth_type type AuthType int32 // Procedure is libvirt's remote_procedure type Procedure int32 // // Structs: // // Domain is libvirt's remote_nonnull_domain type Domain struct { Name string UUID UUID ID int32 } // Network is libvirt's remote_nonnull_network type Network struct { Name string UUID UUID } // NetworkPort is libvirt's remote_nonnull_network_port type NetworkPort struct { Net Network UUID UUID } // Nwfilter is libvirt's remote_nonnull_nwfilter type Nwfilter struct { Name string UUID UUID } // NwfilterBinding is libvirt's remote_nonnull_nwfilter_binding type NwfilterBinding struct { Portdev string Filtername string } // Interface is libvirt's remote_nonnull_interface type Interface struct { Name string Mac string } // StoragePool is libvirt's remote_nonnull_storage_pool type StoragePool struct { Name string UUID UUID } // StorageVol is libvirt's remote_nonnull_storage_vol type StorageVol struct { Pool string Name string Key string } // NodeDevice is libvirt's remote_nonnull_node_device type NodeDevice struct { Name string } // Secret is libvirt's remote_nonnull_secret type Secret struct { UUID UUID UsageType int32 UsageID string } // DomainCheckpoint is libvirt's remote_nonnull_domain_checkpoint type DomainCheckpoint struct { Name string Dom Domain } // DomainSnapshot is libvirt's remote_nonnull_domain_snapshot type DomainSnapshot struct { Name string Dom Domain } // remote_error is libvirt's remote_error type remote_error struct { Code int32 OptDomain int32 Message OptString Level int32 Dom OptDomain Str1 OptString Str2 OptString Str3 OptString Int1 int32 Int2 int32 Net OptNetwork } // VcpuInfo is libvirt's remote_vcpu_info type VcpuInfo struct { Number uint32 State int32 CPUTime uint64 CPU int32 } // TypedParam is libvirt's remote_typed_param type TypedParam struct { Field string Value TypedParamValue } // NodeGetCPUStats is libvirt's remote_node_get_cpu_stats type NodeGetCPUStats struct { Field string Value uint64 } // NodeGetMemoryStats is libvirt's remote_node_get_memory_stats type NodeGetMemoryStats struct { Field string Value uint64 } // DomainDiskError is libvirt's remote_domain_disk_error type DomainDiskError struct { Disk string remote_error int32 } // ConnectOpenArgs is libvirt's remote_connect_open_args type ConnectOpenArgs struct { Name OptString Flags ConnectFlags } // ConnectSupportsFeatureArgs is libvirt's remote_connect_supports_feature_args type ConnectSupportsFeatureArgs struct { Feature int32 } // ConnectSupportsFeatureRet is libvirt's remote_connect_supports_feature_ret type ConnectSupportsFeatureRet struct { Supported int32 } // ConnectGetTypeRet is libvirt's remote_connect_get_type_ret type ConnectGetTypeRet struct { Type string } // ConnectGetVersionRet is libvirt's remote_connect_get_version_ret type ConnectGetVersionRet struct { HvVer uint64 } // ConnectGetLibVersionRet is libvirt's remote_connect_get_lib_version_ret type ConnectGetLibVersionRet struct { LibVer uint64 } // ConnectGetHostnameRet is libvirt's remote_connect_get_hostname_ret type ConnectGetHostnameRet struct { Hostname string } // ConnectGetSysinfoArgs is libvirt's remote_connect_get_sysinfo_args type ConnectGetSysinfoArgs struct { Flags uint32 } // ConnectGetSysinfoRet is libvirt's remote_connect_get_sysinfo_ret type ConnectGetSysinfoRet struct { Sysinfo string } // ConnectGetUriRet is libvirt's remote_connect_get_uri_ret type ConnectGetUriRet struct { Uri string } // ConnectGetMaxVcpusArgs is libvirt's remote_connect_get_max_vcpus_args type ConnectGetMaxVcpusArgs struct { Type OptString } // ConnectGetMaxVcpusRet is libvirt's remote_connect_get_max_vcpus_ret type ConnectGetMaxVcpusRet struct { MaxVcpus int32 } // NodeGetInfoRet is libvirt's remote_node_get_info_ret type NodeGetInfoRet struct { Model [32]int8 Memory uint64 Cpus int32 Mhz int32 Nodes int32 Sockets int32 Cores int32 Threads int32 } // ConnectGetCapabilitiesRet is libvirt's remote_connect_get_capabilities_ret type ConnectGetCapabilitiesRet struct { Capabilities string } // ConnectGetDomainCapabilitiesArgs is libvirt's remote_connect_get_domain_capabilities_args type ConnectGetDomainCapabilitiesArgs struct { Emulatorbin OptString Arch OptString Machine OptString Virttype OptString Flags uint32 } // ConnectGetDomainCapabilitiesRet is libvirt's remote_connect_get_domain_capabilities_ret type ConnectGetDomainCapabilitiesRet struct { Capabilities string } // NodeGetCPUStatsArgs is libvirt's remote_node_get_cpu_stats_args type NodeGetCPUStatsArgs struct { CPUNum int32 Nparams int32 Flags uint32 } // NodeGetCPUStatsRet is libvirt's remote_node_get_cpu_stats_ret type NodeGetCPUStatsRet struct { Params []NodeGetCPUStats Nparams int32 } // NodeGetMemoryStatsArgs is libvirt's remote_node_get_memory_stats_args type NodeGetMemoryStatsArgs struct { Nparams int32 CellNum int32 Flags uint32 } // NodeGetMemoryStatsRet is libvirt's remote_node_get_memory_stats_ret type NodeGetMemoryStatsRet struct { Params []NodeGetMemoryStats Nparams int32 } // NodeGetCellsFreeMemoryArgs is libvirt's remote_node_get_cells_free_memory_args type NodeGetCellsFreeMemoryArgs struct { StartCell int32 Maxcells int32 } // NodeGetCellsFreeMemoryRet is libvirt's remote_node_get_cells_free_memory_ret type NodeGetCellsFreeMemoryRet struct { Cells []uint64 } // NodeGetFreeMemoryRet is libvirt's remote_node_get_free_memory_ret type NodeGetFreeMemoryRet struct { FreeMem uint64 } // DomainGetSchedulerTypeArgs is libvirt's remote_domain_get_scheduler_type_args type DomainGetSchedulerTypeArgs struct { Dom Domain } // DomainGetSchedulerTypeRet is libvirt's remote_domain_get_scheduler_type_ret type DomainGetSchedulerTypeRet struct { Type string Nparams int32 } // DomainGetSchedulerParametersArgs is libvirt's remote_domain_get_scheduler_parameters_args type DomainGetSchedulerParametersArgs struct { Dom Domain Nparams int32 } // DomainGetSchedulerParametersRet is libvirt's remote_domain_get_scheduler_parameters_ret type DomainGetSchedulerParametersRet struct { Params []TypedParam } // DomainGetSchedulerParametersFlagsArgs is libvirt's remote_domain_get_scheduler_parameters_flags_args type DomainGetSchedulerParametersFlagsArgs struct { Dom Domain Nparams int32 Flags uint32 } // DomainGetSchedulerParametersFlagsRet is libvirt's remote_domain_get_scheduler_parameters_flags_ret type DomainGetSchedulerParametersFlagsRet struct { Params []TypedParam } // DomainSetSchedulerParametersArgs is libvirt's remote_domain_set_scheduler_parameters_args type DomainSetSchedulerParametersArgs struct { Dom Domain Params []TypedParam } // DomainSetSchedulerParametersFlagsArgs is libvirt's remote_domain_set_scheduler_parameters_flags_args type DomainSetSchedulerParametersFlagsArgs struct { Dom Domain Params []TypedParam Flags uint32 } // DomainSetBlkioParametersArgs is libvirt's remote_domain_set_blkio_parameters_args type DomainSetBlkioParametersArgs struct { Dom Domain Params []TypedParam Flags uint32 } // DomainGetBlkioParametersArgs is libvirt's remote_domain_get_blkio_parameters_args type DomainGetBlkioParametersArgs struct { Dom Domain Nparams int32 Flags uint32 } // DomainGetBlkioParametersRet is libvirt's remote_domain_get_blkio_parameters_ret type DomainGetBlkioParametersRet struct { Params []TypedParam Nparams int32 } // DomainSetMemoryParametersArgs is libvirt's remote_domain_set_memory_parameters_args type DomainSetMemoryParametersArgs struct { Dom Domain Params []TypedParam Flags uint32 } // DomainGetMemoryParametersArgs is libvirt's remote_domain_get_memory_parameters_args type DomainGetMemoryParametersArgs struct { Dom Domain Nparams int32 Flags uint32 } // DomainGetMemoryParametersRet is libvirt's remote_domain_get_memory_parameters_ret type DomainGetMemoryParametersRet struct { Params []TypedParam Nparams int32 } // DomainBlockResizeArgs is libvirt's remote_domain_block_resize_args type DomainBlockResizeArgs struct { Dom Domain Disk string Size uint64 Flags DomainBlockResizeFlags } // DomainSetNumaParametersArgs is libvirt's remote_domain_set_numa_parameters_args type DomainSetNumaParametersArgs struct { Dom Domain Params []TypedParam Flags uint32 } // DomainGetNumaParametersArgs is libvirt's remote_domain_get_numa_parameters_args type DomainGetNumaParametersArgs struct { Dom Domain Nparams int32 Flags uint32 } // DomainGetNumaParametersRet is libvirt's remote_domain_get_numa_parameters_ret type DomainGetNumaParametersRet struct { Params []TypedParam Nparams int32 } // DomainSetPerfEventsArgs is libvirt's remote_domain_set_perf_events_args type DomainSetPerfEventsArgs struct { Dom Domain Params []TypedParam Flags DomainModificationImpact } // DomainGetPerfEventsArgs is libvirt's remote_domain_get_perf_events_args type DomainGetPerfEventsArgs struct { Dom Domain Flags DomainModificationImpact } // DomainGetPerfEventsRet is libvirt's remote_domain_get_perf_events_ret type DomainGetPerfEventsRet struct { Params []TypedParam } // DomainBlockStatsArgs is libvirt's remote_domain_block_stats_args type DomainBlockStatsArgs struct { Dom Domain Path string } // DomainBlockStatsRet is libvirt's remote_domain_block_stats_ret type DomainBlockStatsRet struct { RdReq int64 RdBytes int64 WrReq int64 WrBytes int64 Errs int64 } // DomainBlockStatsFlagsArgs is libvirt's remote_domain_block_stats_flags_args type DomainBlockStatsFlagsArgs struct { Dom Domain Path string Nparams int32 Flags uint32 } // DomainBlockStatsFlagsRet is libvirt's remote_domain_block_stats_flags_ret type DomainBlockStatsFlagsRet struct { Params []TypedParam Nparams int32 } // DomainInterfaceStatsArgs is libvirt's remote_domain_interface_stats_args type DomainInterfaceStatsArgs struct { Dom Domain Device string } // DomainInterfaceStatsRet is libvirt's remote_domain_interface_stats_ret type DomainInterfaceStatsRet struct { RxBytes int64 RxPackets int64 RxErrs int64 RxDrop int64 TxBytes int64 TxPackets int64 TxErrs int64 TxDrop int64 } // DomainSetInterfaceParametersArgs is libvirt's remote_domain_set_interface_parameters_args type DomainSetInterfaceParametersArgs struct { Dom Domain Device string Params []TypedParam Flags uint32 } // DomainGetInterfaceParametersArgs is libvirt's remote_domain_get_interface_parameters_args type DomainGetInterfaceParametersArgs struct { Dom Domain Device string Nparams int32 Flags DomainModificationImpact } // DomainGetInterfaceParametersRet is libvirt's remote_domain_get_interface_parameters_ret type DomainGetInterfaceParametersRet struct { Params []TypedParam Nparams int32 } // DomainMemoryStatsArgs is libvirt's remote_domain_memory_stats_args type DomainMemoryStatsArgs struct { Dom Domain MaxStats uint32 Flags uint32 } // DomainMemoryStat is libvirt's remote_domain_memory_stat type DomainMemoryStat struct { Tag int32 Val uint64 } // DomainMemoryStatsRet is libvirt's remote_domain_memory_stats_ret type DomainMemoryStatsRet struct { Stats []DomainMemoryStat } // DomainBlockPeekArgs is libvirt's remote_domain_block_peek_args type DomainBlockPeekArgs struct { Dom Domain Path string Offset uint64 Size uint32 Flags uint32 } // DomainBlockPeekRet is libvirt's remote_domain_block_peek_ret type DomainBlockPeekRet struct { Buffer []byte } // DomainMemoryPeekArgs is libvirt's remote_domain_memory_peek_args type DomainMemoryPeekArgs struct { Dom Domain Offset uint64 Size uint32 Flags DomainMemoryFlags } // DomainMemoryPeekRet is libvirt's remote_domain_memory_peek_ret type DomainMemoryPeekRet struct { Buffer []byte } // DomainGetBlockInfoArgs is libvirt's remote_domain_get_block_info_args type DomainGetBlockInfoArgs struct { Dom Domain Path string Flags uint32 } // DomainGetBlockInfoRet is libvirt's remote_domain_get_block_info_ret type DomainGetBlockInfoRet struct { Allocation uint64 Capacity uint64 Physical uint64 } // ConnectListDomainsArgs is libvirt's remote_connect_list_domains_args type ConnectListDomainsArgs struct { Maxids int32 } // ConnectListDomainsRet is libvirt's remote_connect_list_domains_ret type ConnectListDomainsRet struct { Ids []int32 } // ConnectNumOfDomainsRet is libvirt's remote_connect_num_of_domains_ret type ConnectNumOfDomainsRet struct { Num int32 } // DomainCreateXMLArgs is libvirt's remote_domain_create_xml_args type DomainCreateXMLArgs struct { XMLDesc string Flags DomainCreateFlags } // DomainCreateXMLRet is libvirt's remote_domain_create_xml_ret type DomainCreateXMLRet struct { Dom Domain } // DomainCreateXMLWithFilesArgs is libvirt's remote_domain_create_xml_with_files_args type DomainCreateXMLWithFilesArgs struct { XMLDesc string Flags DomainCreateFlags } // DomainCreateXMLWithFilesRet is libvirt's remote_domain_create_xml_with_files_ret type DomainCreateXMLWithFilesRet struct { Dom Domain } // DomainLookupByIDArgs is libvirt's remote_domain_lookup_by_id_args type DomainLookupByIDArgs struct { ID int32 } // DomainLookupByIDRet is libvirt's remote_domain_lookup_by_id_ret type DomainLookupByIDRet struct { Dom Domain } // DomainLookupByUUIDArgs is libvirt's remote_domain_lookup_by_uuid_args type DomainLookupByUUIDArgs struct { UUID UUID } // DomainLookupByUUIDRet is libvirt's remote_domain_lookup_by_uuid_ret type DomainLookupByUUIDRet struct { Dom Domain } // DomainLookupByNameArgs is libvirt's remote_domain_lookup_by_name_args type DomainLookupByNameArgs struct { Name string } // DomainLookupByNameRet is libvirt's remote_domain_lookup_by_name_ret type DomainLookupByNameRet struct { Dom Domain } // DomainSuspendArgs is libvirt's remote_domain_suspend_args type DomainSuspendArgs struct { Dom Domain } // DomainResumeArgs is libvirt's remote_domain_resume_args type DomainResumeArgs struct { Dom Domain } // DomainPmSuspendForDurationArgs is libvirt's remote_domain_pm_suspend_for_duration_args type DomainPmSuspendForDurationArgs struct { Dom Domain Target uint32 Duration uint64 Flags uint32 } // DomainPmWakeupArgs is libvirt's remote_domain_pm_wakeup_args type DomainPmWakeupArgs struct { Dom Domain Flags uint32 } // DomainShutdownArgs is libvirt's remote_domain_shutdown_args type DomainShutdownArgs struct { Dom Domain } // DomainRebootArgs is libvirt's remote_domain_reboot_args type DomainRebootArgs struct { Dom Domain Flags DomainRebootFlagValues } // DomainResetArgs is libvirt's remote_domain_reset_args type DomainResetArgs struct { Dom Domain Flags uint32 } // DomainDestroyArgs is libvirt's remote_domain_destroy_args type DomainDestroyArgs struct { Dom Domain } // DomainDestroyFlagsArgs is libvirt's remote_domain_destroy_flags_args type DomainDestroyFlagsArgs struct { Dom Domain Flags DomainDestroyFlagsValues } // DomainGetOsTypeArgs is libvirt's remote_domain_get_os_type_args type DomainGetOsTypeArgs struct { Dom Domain } // DomainGetOsTypeRet is libvirt's remote_domain_get_os_type_ret type DomainGetOsTypeRet struct { Type string } // DomainGetMaxMemoryArgs is libvirt's remote_domain_get_max_memory_args type DomainGetMaxMemoryArgs struct { Dom Domain } // DomainGetMaxMemoryRet is libvirt's remote_domain_get_max_memory_ret type DomainGetMaxMemoryRet struct { Memory uint64 } // DomainSetMaxMemoryArgs is libvirt's remote_domain_set_max_memory_args type DomainSetMaxMemoryArgs struct { Dom Domain Memory uint64 } // DomainSetMemoryArgs is libvirt's remote_domain_set_memory_args type DomainSetMemoryArgs struct { Dom Domain Memory uint64 } // DomainSetMemoryFlagsArgs is libvirt's remote_domain_set_memory_flags_args type DomainSetMemoryFlagsArgs struct { Dom Domain Memory uint64 Flags uint32 } // DomainSetMemoryStatsPeriodArgs is libvirt's remote_domain_set_memory_stats_period_args type DomainSetMemoryStatsPeriodArgs struct { Dom Domain Period int32 Flags DomainMemoryModFlags } // DomainGetInfoArgs is libvirt's remote_domain_get_info_args type DomainGetInfoArgs struct { Dom Domain } // DomainGetInfoRet is libvirt's remote_domain_get_info_ret type DomainGetInfoRet struct { State uint8 MaxMem uint64 Memory uint64 NrVirtCPU uint16 CPUTime uint64 } // DomainSaveArgs is libvirt's remote_domain_save_args type DomainSaveArgs struct { Dom Domain To string } // DomainSaveFlagsArgs is libvirt's remote_domain_save_flags_args type DomainSaveFlagsArgs struct { Dom Domain To string Dxml OptString Flags uint32 } // DomainRestoreArgs is libvirt's remote_domain_restore_args type DomainRestoreArgs struct { From string } // DomainRestoreFlagsArgs is libvirt's remote_domain_restore_flags_args type DomainRestoreFlagsArgs struct { From string Dxml OptString Flags uint32 } // DomainSaveImageGetXMLDescArgs is libvirt's remote_domain_save_image_get_xml_desc_args type DomainSaveImageGetXMLDescArgs struct { File string Flags uint32 } // DomainSaveImageGetXMLDescRet is libvirt's remote_domain_save_image_get_xml_desc_ret type DomainSaveImageGetXMLDescRet struct { XML string } // DomainSaveImageDefineXMLArgs is libvirt's remote_domain_save_image_define_xml_args type DomainSaveImageDefineXMLArgs struct { File string Dxml string Flags uint32 } // DomainCoreDumpArgs is libvirt's remote_domain_core_dump_args type DomainCoreDumpArgs struct { Dom Domain To string Flags DomainCoreDumpFlags } // DomainCoreDumpWithFormatArgs is libvirt's remote_domain_core_dump_with_format_args type DomainCoreDumpWithFormatArgs struct { Dom Domain To string Dumpformat uint32 Flags DomainCoreDumpFlags } // DomainScreenshotArgs is libvirt's remote_domain_screenshot_args type DomainScreenshotArgs struct { Dom Domain Screen uint32 Flags uint32 } // DomainScreenshotRet is libvirt's remote_domain_screenshot_ret type DomainScreenshotRet struct { Mime OptString } // DomainGetXMLDescArgs is libvirt's remote_domain_get_xml_desc_args type DomainGetXMLDescArgs struct { Dom Domain Flags DomainXMLFlags } // DomainGetXMLDescRet is libvirt's remote_domain_get_xml_desc_ret type DomainGetXMLDescRet struct { XML string } // DomainMigratePrepareArgs is libvirt's remote_domain_migrate_prepare_args type DomainMigratePrepareArgs struct { UriIn OptString Flags uint64 Dname OptString Resource uint64 } // DomainMigratePrepareRet is libvirt's remote_domain_migrate_prepare_ret type DomainMigratePrepareRet struct { Cookie []byte UriOut OptString } // DomainMigratePerformArgs is libvirt's remote_domain_migrate_perform_args type DomainMigratePerformArgs struct { Dom Domain Cookie []byte Uri string Flags uint64 Dname OptString Resource uint64 } // DomainMigrateFinishArgs is libvirt's remote_domain_migrate_finish_args type DomainMigrateFinishArgs struct { Dname string Cookie []byte Uri string Flags uint64 } // DomainMigrateFinishRet is libvirt's remote_domain_migrate_finish_ret type DomainMigrateFinishRet struct { Ddom Domain } // DomainMigratePrepare2Args is libvirt's remote_domain_migrate_prepare2_args type DomainMigratePrepare2Args struct { UriIn OptString Flags uint64 Dname OptString Resource uint64 DomXML string } // DomainMigratePrepare2Ret is libvirt's remote_domain_migrate_prepare2_ret type DomainMigratePrepare2Ret struct { Cookie []byte UriOut OptString } // DomainMigrateFinish2Args is libvirt's remote_domain_migrate_finish2_args type DomainMigrateFinish2Args struct { Dname string Cookie []byte Uri string Flags uint64 Retcode int32 } // DomainMigrateFinish2Ret is libvirt's remote_domain_migrate_finish2_ret type DomainMigrateFinish2Ret struct { Ddom Domain } // ConnectListDefinedDomainsArgs is libvirt's remote_connect_list_defined_domains_args type ConnectListDefinedDomainsArgs struct { Maxnames int32 } // ConnectListDefinedDomainsRet is libvirt's remote_connect_list_defined_domains_ret type ConnectListDefinedDomainsRet struct { Names []string } // ConnectNumOfDefinedDomainsRet is libvirt's remote_connect_num_of_defined_domains_ret type ConnectNumOfDefinedDomainsRet struct { Num int32 } // DomainCreateArgs is libvirt's remote_domain_create_args type DomainCreateArgs struct { Dom Domain } // DomainCreateWithFlagsArgs is libvirt's remote_domain_create_with_flags_args type DomainCreateWithFlagsArgs struct { Dom Domain Flags uint32 } // DomainCreateWithFlagsRet is libvirt's remote_domain_create_with_flags_ret type DomainCreateWithFlagsRet struct { Dom Domain } // DomainCreateWithFilesArgs is libvirt's remote_domain_create_with_files_args type DomainCreateWithFilesArgs struct { Dom Domain Flags DomainCreateFlags } // DomainCreateWithFilesRet is libvirt's remote_domain_create_with_files_ret type DomainCreateWithFilesRet struct { Dom Domain } // DomainDefineXMLArgs is libvirt's remote_domain_define_xml_args type DomainDefineXMLArgs struct { XML string } // DomainDefineXMLRet is libvirt's remote_domain_define_xml_ret type DomainDefineXMLRet struct { Dom Domain } // DomainDefineXMLFlagsArgs is libvirt's remote_domain_define_xml_flags_args type DomainDefineXMLFlagsArgs struct { XML string Flags DomainDefineFlags } // DomainDefineXMLFlagsRet is libvirt's remote_domain_define_xml_flags_ret type DomainDefineXMLFlagsRet struct { Dom Domain } // DomainUndefineArgs is libvirt's remote_domain_undefine_args type DomainUndefineArgs struct { Dom Domain } // DomainUndefineFlagsArgs is libvirt's remote_domain_undefine_flags_args type DomainUndefineFlagsArgs struct { Dom Domain Flags DomainUndefineFlagsValues } // DomainInjectNmiArgs is libvirt's remote_domain_inject_nmi_args type DomainInjectNmiArgs struct { Dom Domain Flags uint32 } // DomainSendKeyArgs is libvirt's remote_domain_send_key_args type DomainSendKeyArgs struct { Dom Domain Codeset uint32 Holdtime uint32 Keycodes []uint32 Flags uint32 } // DomainSendProcessSignalArgs is libvirt's remote_domain_send_process_signal_args type DomainSendProcessSignalArgs struct { Dom Domain PidValue int64 Signum uint32 Flags uint32 } // DomainSetVcpusArgs is libvirt's remote_domain_set_vcpus_args type DomainSetVcpusArgs struct { Dom Domain Nvcpus uint32 } // DomainSetVcpusFlagsArgs is libvirt's remote_domain_set_vcpus_flags_args type DomainSetVcpusFlagsArgs struct { Dom Domain Nvcpus uint32 Flags uint32 } // DomainGetVcpusFlagsArgs is libvirt's remote_domain_get_vcpus_flags_args type DomainGetVcpusFlagsArgs struct { Dom Domain Flags uint32 } // DomainGetVcpusFlagsRet is libvirt's remote_domain_get_vcpus_flags_ret type DomainGetVcpusFlagsRet struct { Num int32 } // DomainPinVcpuArgs is libvirt's remote_domain_pin_vcpu_args type DomainPinVcpuArgs struct { Dom Domain Vcpu uint32 Cpumap []byte } // DomainPinVcpuFlagsArgs is libvirt's remote_domain_pin_vcpu_flags_args type DomainPinVcpuFlagsArgs struct { Dom Domain Vcpu uint32 Cpumap []byte Flags uint32 } // DomainGetVcpuPinInfoArgs is libvirt's remote_domain_get_vcpu_pin_info_args type DomainGetVcpuPinInfoArgs struct { Dom Domain Ncpumaps int32 Maplen int32 Flags uint32 } // DomainGetVcpuPinInfoRet is libvirt's remote_domain_get_vcpu_pin_info_ret type DomainGetVcpuPinInfoRet struct { Cpumaps []byte Num int32 } // DomainPinEmulatorArgs is libvirt's remote_domain_pin_emulator_args type DomainPinEmulatorArgs struct { Dom Domain Cpumap []byte Flags DomainModificationImpact } // DomainGetEmulatorPinInfoArgs is libvirt's remote_domain_get_emulator_pin_info_args type DomainGetEmulatorPinInfoArgs struct { Dom Domain Maplen int32 Flags DomainModificationImpact } // DomainGetEmulatorPinInfoRet is libvirt's remote_domain_get_emulator_pin_info_ret type DomainGetEmulatorPinInfoRet struct { Cpumaps []byte Ret int32 } // DomainGetVcpusArgs is libvirt's remote_domain_get_vcpus_args type DomainGetVcpusArgs struct { Dom Domain Maxinfo int32 Maplen int32 } // DomainGetVcpusRet is libvirt's remote_domain_get_vcpus_ret type DomainGetVcpusRet struct { Info []VcpuInfo Cpumaps []byte } // DomainGetMaxVcpusArgs is libvirt's remote_domain_get_max_vcpus_args type DomainGetMaxVcpusArgs struct { Dom Domain } // DomainGetMaxVcpusRet is libvirt's remote_domain_get_max_vcpus_ret type DomainGetMaxVcpusRet struct { Num int32 } // DomainIothreadInfo is libvirt's remote_domain_iothread_info type DomainIothreadInfo struct { IothreadID uint32 Cpumap []byte } // DomainGetIothreadInfoArgs is libvirt's remote_domain_get_iothread_info_args type DomainGetIothreadInfoArgs struct { Dom Domain Flags DomainModificationImpact } // DomainGetIothreadInfoRet is libvirt's remote_domain_get_iothread_info_ret type DomainGetIothreadInfoRet struct { Info []DomainIothreadInfo Ret uint32 } // DomainPinIothreadArgs is libvirt's remote_domain_pin_iothread_args type DomainPinIothreadArgs struct { Dom Domain IothreadsID uint32 Cpumap []byte Flags DomainModificationImpact } // DomainAddIothreadArgs is libvirt's remote_domain_add_iothread_args type DomainAddIothreadArgs struct { Dom Domain IothreadID uint32 Flags DomainModificationImpact } // DomainDelIothreadArgs is libvirt's remote_domain_del_iothread_args type DomainDelIothreadArgs struct { Dom Domain IothreadID uint32 Flags DomainModificationImpact } // DomainSetIothreadParamsArgs is libvirt's remote_domain_set_iothread_params_args type DomainSetIothreadParamsArgs struct { Dom Domain IothreadID uint32 Params []TypedParam Flags uint32 } // DomainGetSecurityLabelArgs is libvirt's remote_domain_get_security_label_args type DomainGetSecurityLabelArgs struct { Dom Domain } // DomainGetSecurityLabelRet is libvirt's remote_domain_get_security_label_ret type DomainGetSecurityLabelRet struct { Label []int8 Enforcing int32 } // DomainGetSecurityLabelListArgs is libvirt's remote_domain_get_security_label_list_args type DomainGetSecurityLabelListArgs struct { Dom Domain } // DomainGetSecurityLabelListRet is libvirt's remote_domain_get_security_label_list_ret type DomainGetSecurityLabelListRet struct { Labels []DomainGetSecurityLabelRet Ret int32 } // NodeGetSecurityModelRet is libvirt's remote_node_get_security_model_ret type NodeGetSecurityModelRet struct { Model []int8 Doi []int8 } // DomainAttachDeviceArgs is libvirt's remote_domain_attach_device_args type DomainAttachDeviceArgs struct { Dom Domain XML string } // DomainAttachDeviceFlagsArgs is libvirt's remote_domain_attach_device_flags_args type DomainAttachDeviceFlagsArgs struct { Dom Domain XML string Flags uint32 } // DomainDetachDeviceArgs is libvirt's remote_domain_detach_device_args type DomainDetachDeviceArgs struct { Dom Domain XML string } // DomainDetachDeviceFlagsArgs is libvirt's remote_domain_detach_device_flags_args type DomainDetachDeviceFlagsArgs struct { Dom Domain XML string Flags uint32 } // DomainUpdateDeviceFlagsArgs is libvirt's remote_domain_update_device_flags_args type DomainUpdateDeviceFlagsArgs struct { Dom Domain XML string Flags DomainDeviceModifyFlags } // DomainDetachDeviceAliasArgs is libvirt's remote_domain_detach_device_alias_args type DomainDetachDeviceAliasArgs struct { Dom Domain Alias string Flags uint32 } // DomainGetAutostartArgs is libvirt's remote_domain_get_autostart_args type DomainGetAutostartArgs struct { Dom Domain } // DomainGetAutostartRet is libvirt's remote_domain_get_autostart_ret type DomainGetAutostartRet struct { Autostart int32 } // DomainSetAutostartArgs is libvirt's remote_domain_set_autostart_args type DomainSetAutostartArgs struct { Dom Domain Autostart int32 } // DomainSetMetadataArgs is libvirt's remote_domain_set_metadata_args type DomainSetMetadataArgs struct { Dom Domain Type int32 Metadata OptString Key OptString Uri OptString Flags DomainModificationImpact } // DomainGetMetadataArgs is libvirt's remote_domain_get_metadata_args type DomainGetMetadataArgs struct { Dom Domain Type int32 Uri OptString Flags DomainModificationImpact } // DomainGetMetadataRet is libvirt's remote_domain_get_metadata_ret type DomainGetMetadataRet struct { Metadata string } // DomainBlockJobAbortArgs is libvirt's remote_domain_block_job_abort_args type DomainBlockJobAbortArgs struct { Dom Domain Path string Flags DomainBlockJobAbortFlags } // DomainGetBlockJobInfoArgs is libvirt's remote_domain_get_block_job_info_args type DomainGetBlockJobInfoArgs struct { Dom Domain Path string Flags uint32 } // DomainGetBlockJobInfoRet is libvirt's remote_domain_get_block_job_info_ret type DomainGetBlockJobInfoRet struct { Found int32 Type int32 Bandwidth uint64 Cur uint64 End uint64 } // DomainBlockJobSetSpeedArgs is libvirt's remote_domain_block_job_set_speed_args type DomainBlockJobSetSpeedArgs struct { Dom Domain Path string Bandwidth uint64 Flags DomainBlockJobSetSpeedFlags } // DomainBlockPullArgs is libvirt's remote_domain_block_pull_args type DomainBlockPullArgs struct { Dom Domain Path string Bandwidth uint64 Flags DomainBlockPullFlags } // DomainBlockRebaseArgs is libvirt's remote_domain_block_rebase_args type DomainBlockRebaseArgs struct { Dom Domain Path string Base OptString Bandwidth uint64 Flags DomainBlockRebaseFlags } // DomainBlockCopyArgs is libvirt's remote_domain_block_copy_args type DomainBlockCopyArgs struct { Dom Domain Path string Destxml string Params []TypedParam Flags DomainBlockCopyFlags } // DomainBlockCommitArgs is libvirt's remote_domain_block_commit_args type DomainBlockCommitArgs struct { Dom Domain Disk string Base OptString Top OptString Bandwidth uint64 Flags DomainBlockCommitFlags } // DomainSetBlockIOTuneArgs is libvirt's remote_domain_set_block_io_tune_args type DomainSetBlockIOTuneArgs struct { Dom Domain Disk string Params []TypedParam Flags uint32 } // DomainGetBlockIOTuneArgs is libvirt's remote_domain_get_block_io_tune_args type DomainGetBlockIOTuneArgs struct { Dom Domain Disk OptString Nparams int32 Flags uint32 } // DomainGetBlockIOTuneRet is libvirt's remote_domain_get_block_io_tune_ret type DomainGetBlockIOTuneRet struct { Params []TypedParam Nparams int32 } // DomainGetCPUStatsArgs is libvirt's remote_domain_get_cpu_stats_args type DomainGetCPUStatsArgs struct { Dom Domain Nparams uint32 StartCPU int32 Ncpus uint32 Flags TypedParameterFlags } // DomainGetCPUStatsRet is libvirt's remote_domain_get_cpu_stats_ret type DomainGetCPUStatsRet struct { Params []TypedParam Nparams int32 } // DomainGetHostnameArgs is libvirt's remote_domain_get_hostname_args type DomainGetHostnameArgs struct { Dom Domain Flags DomainGetHostnameFlags } // DomainGetHostnameRet is libvirt's remote_domain_get_hostname_ret type DomainGetHostnameRet struct { Hostname string } // ConnectNumOfNetworksRet is libvirt's remote_connect_num_of_networks_ret type ConnectNumOfNetworksRet struct { Num int32 } // ConnectListNetworksArgs is libvirt's remote_connect_list_networks_args type ConnectListNetworksArgs struct { Maxnames int32 } // ConnectListNetworksRet is libvirt's remote_connect_list_networks_ret type ConnectListNetworksRet struct { Names []string } // ConnectNumOfDefinedNetworksRet is libvirt's remote_connect_num_of_defined_networks_ret type ConnectNumOfDefinedNetworksRet struct { Num int32 } // ConnectListDefinedNetworksArgs is libvirt's remote_connect_list_defined_networks_args type ConnectListDefinedNetworksArgs struct { Maxnames int32 } // ConnectListDefinedNetworksRet is libvirt's remote_connect_list_defined_networks_ret type ConnectListDefinedNetworksRet struct { Names []string } // NetworkLookupByUUIDArgs is libvirt's remote_network_lookup_by_uuid_args type NetworkLookupByUUIDArgs struct { UUID UUID } // NetworkLookupByUUIDRet is libvirt's remote_network_lookup_by_uuid_ret type NetworkLookupByUUIDRet struct { Net Network } // NetworkLookupByNameArgs is libvirt's remote_network_lookup_by_name_args type NetworkLookupByNameArgs struct { Name string } // NetworkLookupByNameRet is libvirt's remote_network_lookup_by_name_ret type NetworkLookupByNameRet struct { Net Network } // NetworkCreateXMLArgs is libvirt's remote_network_create_xml_args type NetworkCreateXMLArgs struct { XML string } // NetworkCreateXMLRet is libvirt's remote_network_create_xml_ret type NetworkCreateXMLRet struct { Net Network } // NetworkCreateXMLFlagsArgs is libvirt's remote_network_create_xml_flags_args type NetworkCreateXMLFlagsArgs struct { XML string Flags uint32 } // NetworkCreateXMLFlagsRet is libvirt's remote_network_create_xml_flags_ret type NetworkCreateXMLFlagsRet struct { Net Network } // NetworkDefineXMLArgs is libvirt's remote_network_define_xml_args type NetworkDefineXMLArgs struct { XML string } // NetworkDefineXMLRet is libvirt's remote_network_define_xml_ret type NetworkDefineXMLRet struct { Net Network } // NetworkDefineXMLFlagsArgs is libvirt's remote_network_define_xml_flags_args type NetworkDefineXMLFlagsArgs struct { XML string Flags uint32 } // NetworkDefineXMLFlagsRet is libvirt's remote_network_define_xml_flags_ret type NetworkDefineXMLFlagsRet struct { Net Network } // NetworkUndefineArgs is libvirt's remote_network_undefine_args type NetworkUndefineArgs struct { Net Network } // NetworkUpdateArgs is libvirt's remote_network_update_args type NetworkUpdateArgs struct { Net Network Command uint32 Section uint32 ParentIndex int32 XML string Flags NetworkUpdateFlags } // NetworkCreateArgs is libvirt's remote_network_create_args type NetworkCreateArgs struct { Net Network } // NetworkDestroyArgs is libvirt's remote_network_destroy_args type NetworkDestroyArgs struct { Net Network } // NetworkGetXMLDescArgs is libvirt's remote_network_get_xml_desc_args type NetworkGetXMLDescArgs struct { Net Network Flags uint32 } // NetworkGetXMLDescRet is libvirt's remote_network_get_xml_desc_ret type NetworkGetXMLDescRet struct { XML string } // NetworkGetBridgeNameArgs is libvirt's remote_network_get_bridge_name_args type NetworkGetBridgeNameArgs struct { Net Network } // NetworkGetBridgeNameRet is libvirt's remote_network_get_bridge_name_ret type NetworkGetBridgeNameRet struct { Name string } // NetworkGetAutostartArgs is libvirt's remote_network_get_autostart_args type NetworkGetAutostartArgs struct { Net Network } // NetworkGetAutostartRet is libvirt's remote_network_get_autostart_ret type NetworkGetAutostartRet struct { Autostart int32 } // NetworkSetAutostartArgs is libvirt's remote_network_set_autostart_args type NetworkSetAutostartArgs struct { Net Network Autostart int32 } // ConnectNumOfNwfiltersRet is libvirt's remote_connect_num_of_nwfilters_ret type ConnectNumOfNwfiltersRet struct { Num int32 } // ConnectListNwfiltersArgs is libvirt's remote_connect_list_nwfilters_args type ConnectListNwfiltersArgs struct { Maxnames int32 } // ConnectListNwfiltersRet is libvirt's remote_connect_list_nwfilters_ret type ConnectListNwfiltersRet struct { Names []string } // NwfilterLookupByUUIDArgs is libvirt's remote_nwfilter_lookup_by_uuid_args type NwfilterLookupByUUIDArgs struct { UUID UUID } // NwfilterLookupByUUIDRet is libvirt's remote_nwfilter_lookup_by_uuid_ret type NwfilterLookupByUUIDRet struct { OptNwfilter Nwfilter } // NwfilterLookupByNameArgs is libvirt's remote_nwfilter_lookup_by_name_args type NwfilterLookupByNameArgs struct { Name string } // NwfilterLookupByNameRet is libvirt's remote_nwfilter_lookup_by_name_ret type NwfilterLookupByNameRet struct { OptNwfilter Nwfilter } // NwfilterDefineXMLArgs is libvirt's remote_nwfilter_define_xml_args type NwfilterDefineXMLArgs struct { XML string } // NwfilterDefineXMLRet is libvirt's remote_nwfilter_define_xml_ret type NwfilterDefineXMLRet struct { OptNwfilter Nwfilter } // NwfilterDefineXMLFlagsArgs is libvirt's remote_nwfilter_define_xml_flags_args type NwfilterDefineXMLFlagsArgs struct { XML string Flags uint32 } // NwfilterDefineXMLFlagsRet is libvirt's remote_nwfilter_define_xml_flags_ret type NwfilterDefineXMLFlagsRet struct { OptNwfilter Nwfilter } // NwfilterUndefineArgs is libvirt's remote_nwfilter_undefine_args type NwfilterUndefineArgs struct { OptNwfilter Nwfilter } // NwfilterGetXMLDescArgs is libvirt's remote_nwfilter_get_xml_desc_args type NwfilterGetXMLDescArgs struct { OptNwfilter Nwfilter Flags uint32 } // NwfilterGetXMLDescRet is libvirt's remote_nwfilter_get_xml_desc_ret type NwfilterGetXMLDescRet struct { XML string } // ConnectNumOfInterfacesRet is libvirt's remote_connect_num_of_interfaces_ret type ConnectNumOfInterfacesRet struct { Num int32 } // ConnectListInterfacesArgs is libvirt's remote_connect_list_interfaces_args type ConnectListInterfacesArgs struct { Maxnames int32 } // ConnectListInterfacesRet is libvirt's remote_connect_list_interfaces_ret type ConnectListInterfacesRet struct { Names []string } // ConnectNumOfDefinedInterfacesRet is libvirt's remote_connect_num_of_defined_interfaces_ret type ConnectNumOfDefinedInterfacesRet struct { Num int32 } // ConnectListDefinedInterfacesArgs is libvirt's remote_connect_list_defined_interfaces_args type ConnectListDefinedInterfacesArgs struct { Maxnames int32 } // ConnectListDefinedInterfacesRet is libvirt's remote_connect_list_defined_interfaces_ret type ConnectListDefinedInterfacesRet struct { Names []string } // InterfaceLookupByNameArgs is libvirt's remote_interface_lookup_by_name_args type InterfaceLookupByNameArgs struct { Name string } // InterfaceLookupByNameRet is libvirt's remote_interface_lookup_by_name_ret type InterfaceLookupByNameRet struct { Iface Interface } // InterfaceLookupByMacStringArgs is libvirt's remote_interface_lookup_by_mac_string_args type InterfaceLookupByMacStringArgs struct { Mac string } // InterfaceLookupByMacStringRet is libvirt's remote_interface_lookup_by_mac_string_ret type InterfaceLookupByMacStringRet struct { Iface Interface } // InterfaceGetXMLDescArgs is libvirt's remote_interface_get_xml_desc_args type InterfaceGetXMLDescArgs struct { Iface Interface Flags uint32 } // InterfaceGetXMLDescRet is libvirt's remote_interface_get_xml_desc_ret type InterfaceGetXMLDescRet struct { XML string } // InterfaceDefineXMLArgs is libvirt's remote_interface_define_xml_args type InterfaceDefineXMLArgs struct { XML string Flags uint32 } // InterfaceDefineXMLRet is libvirt's remote_interface_define_xml_ret type InterfaceDefineXMLRet struct { Iface Interface } // InterfaceUndefineArgs is libvirt's remote_interface_undefine_args type InterfaceUndefineArgs struct { Iface Interface } // InterfaceCreateArgs is libvirt's remote_interface_create_args type InterfaceCreateArgs struct { Iface Interface Flags uint32 } // InterfaceDestroyArgs is libvirt's remote_interface_destroy_args type InterfaceDestroyArgs struct { Iface Interface Flags uint32 } // InterfaceChangeBeginArgs is libvirt's remote_interface_change_begin_args type InterfaceChangeBeginArgs struct { Flags uint32 } // InterfaceChangeCommitArgs is libvirt's remote_interface_change_commit_args type InterfaceChangeCommitArgs struct { Flags uint32 } // InterfaceChangeRollbackArgs is libvirt's remote_interface_change_rollback_args type InterfaceChangeRollbackArgs struct { Flags uint32 } // AuthListRet is libvirt's remote_auth_list_ret type AuthListRet struct { Types []AuthType } // AuthSaslInitRet is libvirt's remote_auth_sasl_init_ret type AuthSaslInitRet struct { Mechlist string } // AuthSaslStartArgs is libvirt's remote_auth_sasl_start_args type AuthSaslStartArgs struct { Mech string Nil int32 Data []int8 } // AuthSaslStartRet is libvirt's remote_auth_sasl_start_ret type AuthSaslStartRet struct { Complete int32 Nil int32 Data []int8 } // AuthSaslStepArgs is libvirt's remote_auth_sasl_step_args type AuthSaslStepArgs struct { Nil int32 Data []int8 } // AuthSaslStepRet is libvirt's remote_auth_sasl_step_ret type AuthSaslStepRet struct { Complete int32 Nil int32 Data []int8 } // AuthPolkitRet is libvirt's remote_auth_polkit_ret type AuthPolkitRet struct { Complete int32 } // ConnectNumOfStoragePoolsRet is libvirt's remote_connect_num_of_storage_pools_ret type ConnectNumOfStoragePoolsRet struct { Num int32 } // ConnectListStoragePoolsArgs is libvirt's remote_connect_list_storage_pools_args type ConnectListStoragePoolsArgs struct { Maxnames int32 } // ConnectListStoragePoolsRet is libvirt's remote_connect_list_storage_pools_ret type ConnectListStoragePoolsRet struct { Names []string } // ConnectNumOfDefinedStoragePoolsRet is libvirt's remote_connect_num_of_defined_storage_pools_ret type ConnectNumOfDefinedStoragePoolsRet struct { Num int32 } // ConnectListDefinedStoragePoolsArgs is libvirt's remote_connect_list_defined_storage_pools_args type ConnectListDefinedStoragePoolsArgs struct { Maxnames int32 } // ConnectListDefinedStoragePoolsRet is libvirt's remote_connect_list_defined_storage_pools_ret type ConnectListDefinedStoragePoolsRet struct { Names []string } // ConnectFindStoragePoolSourcesArgs is libvirt's remote_connect_find_storage_pool_sources_args type ConnectFindStoragePoolSourcesArgs struct { Type string SrcSpec OptString Flags uint32 } // ConnectFindStoragePoolSourcesRet is libvirt's remote_connect_find_storage_pool_sources_ret type ConnectFindStoragePoolSourcesRet struct { XML string } // StoragePoolLookupByUUIDArgs is libvirt's remote_storage_pool_lookup_by_uuid_args type StoragePoolLookupByUUIDArgs struct { UUID UUID } // StoragePoolLookupByUUIDRet is libvirt's remote_storage_pool_lookup_by_uuid_ret type StoragePoolLookupByUUIDRet struct { Pool StoragePool } // StoragePoolLookupByNameArgs is libvirt's remote_storage_pool_lookup_by_name_args type StoragePoolLookupByNameArgs struct { Name string } // StoragePoolLookupByNameRet is libvirt's remote_storage_pool_lookup_by_name_ret type StoragePoolLookupByNameRet struct { Pool StoragePool } // StoragePoolLookupByVolumeArgs is libvirt's remote_storage_pool_lookup_by_volume_args type StoragePoolLookupByVolumeArgs struct { Vol StorageVol } // StoragePoolLookupByVolumeRet is libvirt's remote_storage_pool_lookup_by_volume_ret type StoragePoolLookupByVolumeRet struct { Pool StoragePool } // StoragePoolLookupByTargetPathArgs is libvirt's remote_storage_pool_lookup_by_target_path_args type StoragePoolLookupByTargetPathArgs struct { Path string } // StoragePoolLookupByTargetPathRet is libvirt's remote_storage_pool_lookup_by_target_path_ret type StoragePoolLookupByTargetPathRet struct { Pool StoragePool } // StoragePoolCreateXMLArgs is libvirt's remote_storage_pool_create_xml_args type StoragePoolCreateXMLArgs struct { XML string Flags StoragePoolCreateFlags } // StoragePoolCreateXMLRet is libvirt's remote_storage_pool_create_xml_ret type StoragePoolCreateXMLRet struct { Pool StoragePool } // StoragePoolDefineXMLArgs is libvirt's remote_storage_pool_define_xml_args type StoragePoolDefineXMLArgs struct { XML string Flags uint32 } // StoragePoolDefineXMLRet is libvirt's remote_storage_pool_define_xml_ret type StoragePoolDefineXMLRet struct { Pool StoragePool } // StoragePoolBuildArgs is libvirt's remote_storage_pool_build_args type StoragePoolBuildArgs struct { Pool StoragePool Flags StoragePoolBuildFlags } // StoragePoolUndefineArgs is libvirt's remote_storage_pool_undefine_args type StoragePoolUndefineArgs struct { Pool StoragePool } // StoragePoolCreateArgs is libvirt's remote_storage_pool_create_args type StoragePoolCreateArgs struct { Pool StoragePool Flags StoragePoolCreateFlags } // StoragePoolDestroyArgs is libvirt's remote_storage_pool_destroy_args type StoragePoolDestroyArgs struct { Pool StoragePool } // StoragePoolDeleteArgs is libvirt's remote_storage_pool_delete_args type StoragePoolDeleteArgs struct { Pool StoragePool Flags StoragePoolDeleteFlags } // StoragePoolRefreshArgs is libvirt's remote_storage_pool_refresh_args type StoragePoolRefreshArgs struct { Pool StoragePool Flags uint32 } // StoragePoolGetXMLDescArgs is libvirt's remote_storage_pool_get_xml_desc_args type StoragePoolGetXMLDescArgs struct { Pool StoragePool Flags StorageXMLFlags } // StoragePoolGetXMLDescRet is libvirt's remote_storage_pool_get_xml_desc_ret type StoragePoolGetXMLDescRet struct { XML string } // StoragePoolGetInfoArgs is libvirt's remote_storage_pool_get_info_args type StoragePoolGetInfoArgs struct { Pool StoragePool } // StoragePoolGetInfoRet is libvirt's remote_storage_pool_get_info_ret type StoragePoolGetInfoRet struct { State uint8 Capacity uint64 Allocation uint64 Available uint64 } // StoragePoolGetAutostartArgs is libvirt's remote_storage_pool_get_autostart_args type StoragePoolGetAutostartArgs struct { Pool StoragePool } // StoragePoolGetAutostartRet is libvirt's remote_storage_pool_get_autostart_ret type StoragePoolGetAutostartRet struct { Autostart int32 } // StoragePoolSetAutostartArgs is libvirt's remote_storage_pool_set_autostart_args type StoragePoolSetAutostartArgs struct { Pool StoragePool Autostart int32 } // StoragePoolNumOfVolumesArgs is libvirt's remote_storage_pool_num_of_volumes_args type StoragePoolNumOfVolumesArgs struct { Pool StoragePool } // StoragePoolNumOfVolumesRet is libvirt's remote_storage_pool_num_of_volumes_ret type StoragePoolNumOfVolumesRet struct { Num int32 } // StoragePoolListVolumesArgs is libvirt's remote_storage_pool_list_volumes_args type StoragePoolListVolumesArgs struct { Pool StoragePool Maxnames int32 } // StoragePoolListVolumesRet is libvirt's remote_storage_pool_list_volumes_ret type StoragePoolListVolumesRet struct { Names []string } // StorageVolLookupByNameArgs is libvirt's remote_storage_vol_lookup_by_name_args type StorageVolLookupByNameArgs struct { Pool StoragePool Name string } // StorageVolLookupByNameRet is libvirt's remote_storage_vol_lookup_by_name_ret type StorageVolLookupByNameRet struct { Vol StorageVol } // StorageVolLookupByKeyArgs is libvirt's remote_storage_vol_lookup_by_key_args type StorageVolLookupByKeyArgs struct { Key string } // StorageVolLookupByKeyRet is libvirt's remote_storage_vol_lookup_by_key_ret type StorageVolLookupByKeyRet struct { Vol StorageVol } // StorageVolLookupByPathArgs is libvirt's remote_storage_vol_lookup_by_path_args type StorageVolLookupByPathArgs struct { Path string } // StorageVolLookupByPathRet is libvirt's remote_storage_vol_lookup_by_path_ret type StorageVolLookupByPathRet struct { Vol StorageVol } // StorageVolCreateXMLArgs is libvirt's remote_storage_vol_create_xml_args type StorageVolCreateXMLArgs struct { Pool StoragePool XML string Flags StorageVolCreateFlags } // StorageVolCreateXMLRet is libvirt's remote_storage_vol_create_xml_ret type StorageVolCreateXMLRet struct { Vol StorageVol } // StorageVolCreateXMLFromArgs is libvirt's remote_storage_vol_create_xml_from_args type StorageVolCreateXMLFromArgs struct { Pool StoragePool XML string Clonevol StorageVol Flags StorageVolCreateFlags } // StorageVolCreateXMLFromRet is libvirt's remote_storage_vol_create_xml_from_ret type StorageVolCreateXMLFromRet struct { Vol StorageVol } // StorageVolDeleteArgs is libvirt's remote_storage_vol_delete_args type StorageVolDeleteArgs struct { Vol StorageVol Flags StorageVolDeleteFlags } // StorageVolWipeArgs is libvirt's remote_storage_vol_wipe_args type StorageVolWipeArgs struct { Vol StorageVol Flags uint32 } // StorageVolWipePatternArgs is libvirt's remote_storage_vol_wipe_pattern_args type StorageVolWipePatternArgs struct { Vol StorageVol Algorithm uint32 Flags uint32 } // StorageVolGetXMLDescArgs is libvirt's remote_storage_vol_get_xml_desc_args type StorageVolGetXMLDescArgs struct { Vol StorageVol Flags uint32 } // StorageVolGetXMLDescRet is libvirt's remote_storage_vol_get_xml_desc_ret type StorageVolGetXMLDescRet struct { XML string } // StorageVolGetInfoArgs is libvirt's remote_storage_vol_get_info_args type StorageVolGetInfoArgs struct { Vol StorageVol } // StorageVolGetInfoRet is libvirt's remote_storage_vol_get_info_ret type StorageVolGetInfoRet struct { Type int8 Capacity uint64 Allocation uint64 } // StorageVolGetInfoFlagsArgs is libvirt's remote_storage_vol_get_info_flags_args type StorageVolGetInfoFlagsArgs struct { Vol StorageVol Flags uint32 } // StorageVolGetInfoFlagsRet is libvirt's remote_storage_vol_get_info_flags_ret type StorageVolGetInfoFlagsRet struct { Type int8 Capacity uint64 Allocation uint64 } // StorageVolGetPathArgs is libvirt's remote_storage_vol_get_path_args type StorageVolGetPathArgs struct { Vol StorageVol } // StorageVolGetPathRet is libvirt's remote_storage_vol_get_path_ret type StorageVolGetPathRet struct { Name string } // StorageVolResizeArgs is libvirt's remote_storage_vol_resize_args type StorageVolResizeArgs struct { Vol StorageVol Capacity uint64 Flags StorageVolResizeFlags } // NodeNumOfDevicesArgs is libvirt's remote_node_num_of_devices_args type NodeNumOfDevicesArgs struct { Cap OptString Flags uint32 } // NodeNumOfDevicesRet is libvirt's remote_node_num_of_devices_ret type NodeNumOfDevicesRet struct { Num int32 } // NodeListDevicesArgs is libvirt's remote_node_list_devices_args type NodeListDevicesArgs struct { Cap OptString Maxnames int32 Flags uint32 } // NodeListDevicesRet is libvirt's remote_node_list_devices_ret type NodeListDevicesRet struct { Names []string } // NodeDeviceLookupByNameArgs is libvirt's remote_node_device_lookup_by_name_args type NodeDeviceLookupByNameArgs struct { Name string } // NodeDeviceLookupByNameRet is libvirt's remote_node_device_lookup_by_name_ret type NodeDeviceLookupByNameRet struct { Dev NodeDevice } // NodeDeviceLookupScsiHostByWwnArgs is libvirt's remote_node_device_lookup_scsi_host_by_wwn_args type NodeDeviceLookupScsiHostByWwnArgs struct { Wwnn string Wwpn string Flags uint32 } // NodeDeviceLookupScsiHostByWwnRet is libvirt's remote_node_device_lookup_scsi_host_by_wwn_ret type NodeDeviceLookupScsiHostByWwnRet struct { Dev NodeDevice } // NodeDeviceGetXMLDescArgs is libvirt's remote_node_device_get_xml_desc_args type NodeDeviceGetXMLDescArgs struct { Name string Flags uint32 } // NodeDeviceGetXMLDescRet is libvirt's remote_node_device_get_xml_desc_ret type NodeDeviceGetXMLDescRet struct { XML string } // NodeDeviceGetParentArgs is libvirt's remote_node_device_get_parent_args type NodeDeviceGetParentArgs struct { Name string } // NodeDeviceGetParentRet is libvirt's remote_node_device_get_parent_ret type NodeDeviceGetParentRet struct { ParentName OptString } // NodeDeviceNumOfCapsArgs is libvirt's remote_node_device_num_of_caps_args type NodeDeviceNumOfCapsArgs struct { Name string } // NodeDeviceNumOfCapsRet is libvirt's remote_node_device_num_of_caps_ret type NodeDeviceNumOfCapsRet struct { Num int32 } // NodeDeviceListCapsArgs is libvirt's remote_node_device_list_caps_args type NodeDeviceListCapsArgs struct { Name string Maxnames int32 } // NodeDeviceListCapsRet is libvirt's remote_node_device_list_caps_ret type NodeDeviceListCapsRet struct { Names []string } // NodeDeviceDettachArgs is libvirt's remote_node_device_dettach_args type NodeDeviceDettachArgs struct { Name string } // NodeDeviceDetachFlagsArgs is libvirt's remote_node_device_detach_flags_args type NodeDeviceDetachFlagsArgs struct { Name string DriverName OptString Flags uint32 } // NodeDeviceReAttachArgs is libvirt's remote_node_device_re_attach_args type NodeDeviceReAttachArgs struct { Name string } // NodeDeviceResetArgs is libvirt's remote_node_device_reset_args type NodeDeviceResetArgs struct { Name string } // NodeDeviceCreateXMLArgs is libvirt's remote_node_device_create_xml_args type NodeDeviceCreateXMLArgs struct { XMLDesc string Flags uint32 } // NodeDeviceCreateXMLRet is libvirt's remote_node_device_create_xml_ret type NodeDeviceCreateXMLRet struct { Dev NodeDevice } // NodeDeviceDestroyArgs is libvirt's remote_node_device_destroy_args type NodeDeviceDestroyArgs struct { Name string } // NodeDeviceDefineXMLArgs is libvirt's remote_node_device_define_xml_args type NodeDeviceDefineXMLArgs struct { XMLDesc string Flags uint32 } // NodeDeviceDefineXMLRet is libvirt's remote_node_device_define_xml_ret type NodeDeviceDefineXMLRet struct { Dev NodeDevice } // NodeDeviceUndefineArgs is libvirt's remote_node_device_undefine_args type NodeDeviceUndefineArgs struct { Name string Flags uint32 } // NodeDeviceCreateArgs is libvirt's remote_node_device_create_args type NodeDeviceCreateArgs struct { Name string Flags uint32 } // NodeDeviceGetAutostartArgs is libvirt's remote_node_device_get_autostart_args type NodeDeviceGetAutostartArgs struct { Name string } // NodeDeviceGetAutostartRet is libvirt's remote_node_device_get_autostart_ret type NodeDeviceGetAutostartRet struct { Autostart int32 } // NodeDeviceSetAutostartArgs is libvirt's remote_node_device_set_autostart_args type NodeDeviceSetAutostartArgs struct { Name string Autostart int32 } // NodeDeviceIsPersistentArgs is libvirt's remote_node_device_is_persistent_args type NodeDeviceIsPersistentArgs struct { Name string } // NodeDeviceIsPersistentRet is libvirt's remote_node_device_is_persistent_ret type NodeDeviceIsPersistentRet struct { Persistent int32 } // NodeDeviceIsActiveArgs is libvirt's remote_node_device_is_active_args type NodeDeviceIsActiveArgs struct { Name string } // NodeDeviceIsActiveRet is libvirt's remote_node_device_is_active_ret type NodeDeviceIsActiveRet struct { Active int32 } // ConnectDomainEventRegisterRet is libvirt's remote_connect_domain_event_register_ret type ConnectDomainEventRegisterRet struct { CbRegistered int32 } // ConnectDomainEventDeregisterRet is libvirt's remote_connect_domain_event_deregister_ret type ConnectDomainEventDeregisterRet struct { CbRegistered int32 } // DomainEventLifecycleMsg is libvirt's remote_domain_event_lifecycle_msg type DomainEventLifecycleMsg struct { Dom Domain Event int32 Detail int32 } // DomainEventCallbackLifecycleMsg is libvirt's remote_domain_event_callback_lifecycle_msg type DomainEventCallbackLifecycleMsg struct { CallbackID int32 Msg DomainEventLifecycleMsg } // ConnectDomainXMLFromNativeArgs is libvirt's remote_connect_domain_xml_from_native_args type ConnectDomainXMLFromNativeArgs struct { NativeFormat string NativeConfig string Flags uint32 } // ConnectDomainXMLFromNativeRet is libvirt's remote_connect_domain_xml_from_native_ret type ConnectDomainXMLFromNativeRet struct { DomainXML string } // ConnectDomainXMLToNativeArgs is libvirt's remote_connect_domain_xml_to_native_args type ConnectDomainXMLToNativeArgs struct { NativeFormat string DomainXML string Flags uint32 } // ConnectDomainXMLToNativeRet is libvirt's remote_connect_domain_xml_to_native_ret type ConnectDomainXMLToNativeRet struct { NativeConfig string } // ConnectNumOfSecretsRet is libvirt's remote_connect_num_of_secrets_ret type ConnectNumOfSecretsRet struct { Num int32 } // ConnectListSecretsArgs is libvirt's remote_connect_list_secrets_args type ConnectListSecretsArgs struct { Maxuuids int32 } // ConnectListSecretsRet is libvirt's remote_connect_list_secrets_ret type ConnectListSecretsRet struct { Uuids []string } // SecretLookupByUUIDArgs is libvirt's remote_secret_lookup_by_uuid_args type SecretLookupByUUIDArgs struct { UUID UUID } // SecretLookupByUUIDRet is libvirt's remote_secret_lookup_by_uuid_ret type SecretLookupByUUIDRet struct { OptSecret Secret } // SecretDefineXMLArgs is libvirt's remote_secret_define_xml_args type SecretDefineXMLArgs struct { XML string Flags uint32 } // SecretDefineXMLRet is libvirt's remote_secret_define_xml_ret type SecretDefineXMLRet struct { OptSecret Secret } // SecretGetXMLDescArgs is libvirt's remote_secret_get_xml_desc_args type SecretGetXMLDescArgs struct { OptSecret Secret Flags uint32 } // SecretGetXMLDescRet is libvirt's remote_secret_get_xml_desc_ret type SecretGetXMLDescRet struct { XML string } // SecretSetValueArgs is libvirt's remote_secret_set_value_args type SecretSetValueArgs struct { OptSecret Secret Value []byte Flags uint32 } // SecretGetValueArgs is libvirt's remote_secret_get_value_args type SecretGetValueArgs struct { OptSecret Secret Flags uint32 } // SecretGetValueRet is libvirt's remote_secret_get_value_ret type SecretGetValueRet struct { Value []byte } // SecretUndefineArgs is libvirt's remote_secret_undefine_args type SecretUndefineArgs struct { OptSecret Secret } // SecretLookupByUsageArgs is libvirt's remote_secret_lookup_by_usage_args type SecretLookupByUsageArgs struct { UsageType int32 UsageID string } // SecretLookupByUsageRet is libvirt's remote_secret_lookup_by_usage_ret type SecretLookupByUsageRet struct { OptSecret Secret } // DomainMigratePrepareTunnelArgs is libvirt's remote_domain_migrate_prepare_tunnel_args type DomainMigratePrepareTunnelArgs struct { Flags uint64 Dname OptString Resource uint64 DomXML string } // ConnectIsSecureRet is libvirt's remote_connect_is_secure_ret type ConnectIsSecureRet struct { Secure int32 } // DomainIsActiveArgs is libvirt's remote_domain_is_active_args type DomainIsActiveArgs struct { Dom Domain } // DomainIsActiveRet is libvirt's remote_domain_is_active_ret type DomainIsActiveRet struct { Active int32 } // DomainIsPersistentArgs is libvirt's remote_domain_is_persistent_args type DomainIsPersistentArgs struct { Dom Domain } // DomainIsPersistentRet is libvirt's remote_domain_is_persistent_ret type DomainIsPersistentRet struct { Persistent int32 } // DomainIsUpdatedArgs is libvirt's remote_domain_is_updated_args type DomainIsUpdatedArgs struct { Dom Domain } // DomainIsUpdatedRet is libvirt's remote_domain_is_updated_ret type DomainIsUpdatedRet struct { Updated int32 } // NetworkIsActiveArgs is libvirt's remote_network_is_active_args type NetworkIsActiveArgs struct { Net Network } // NetworkIsActiveRet is libvirt's remote_network_is_active_ret type NetworkIsActiveRet struct { Active int32 } // NetworkIsPersistentArgs is libvirt's remote_network_is_persistent_args type NetworkIsPersistentArgs struct { Net Network } // NetworkIsPersistentRet is libvirt's remote_network_is_persistent_ret type NetworkIsPersistentRet struct { Persistent int32 } // StoragePoolIsActiveArgs is libvirt's remote_storage_pool_is_active_args type StoragePoolIsActiveArgs struct { Pool StoragePool } // StoragePoolIsActiveRet is libvirt's remote_storage_pool_is_active_ret type StoragePoolIsActiveRet struct { Active int32 } // StoragePoolIsPersistentArgs is libvirt's remote_storage_pool_is_persistent_args type StoragePoolIsPersistentArgs struct { Pool StoragePool } // StoragePoolIsPersistentRet is libvirt's remote_storage_pool_is_persistent_ret type StoragePoolIsPersistentRet struct { Persistent int32 } // InterfaceIsActiveArgs is libvirt's remote_interface_is_active_args type InterfaceIsActiveArgs struct { Iface Interface } // InterfaceIsActiveRet is libvirt's remote_interface_is_active_ret type InterfaceIsActiveRet struct { Active int32 } // ConnectCompareCPUArgs is libvirt's remote_connect_compare_cpu_args type ConnectCompareCPUArgs struct { XML string Flags ConnectCompareCPUFlags } // ConnectCompareCPURet is libvirt's remote_connect_compare_cpu_ret type ConnectCompareCPURet struct { Result int32 } // ConnectBaselineCPUArgs is libvirt's remote_connect_baseline_cpu_args type ConnectBaselineCPUArgs struct { XMLCPUs []string Flags ConnectBaselineCPUFlags } // ConnectBaselineCPURet is libvirt's remote_connect_baseline_cpu_ret type ConnectBaselineCPURet struct { CPU string } // DomainGetJobInfoArgs is libvirt's remote_domain_get_job_info_args type DomainGetJobInfoArgs struct { Dom Domain } // DomainGetJobInfoRet is libvirt's remote_domain_get_job_info_ret type DomainGetJobInfoRet struct { Type int32 TimeElapsed uint64 TimeRemaining uint64 DataTotal uint64 DataProcessed uint64 DataRemaining uint64 MemTotal uint64 MemProcessed uint64 MemRemaining uint64 FileTotal uint64 FileProcessed uint64 FileRemaining uint64 } // DomainGetJobStatsArgs is libvirt's remote_domain_get_job_stats_args type DomainGetJobStatsArgs struct { Dom Domain Flags DomainGetJobStatsFlags } // DomainGetJobStatsRet is libvirt's remote_domain_get_job_stats_ret type DomainGetJobStatsRet struct { Type int32 Params []TypedParam } // DomainAbortJobArgs is libvirt's remote_domain_abort_job_args type DomainAbortJobArgs struct { Dom Domain } // DomainMigrateGetMaxDowntimeArgs is libvirt's remote_domain_migrate_get_max_downtime_args type DomainMigrateGetMaxDowntimeArgs struct { Dom Domain Flags uint32 } // DomainMigrateGetMaxDowntimeRet is libvirt's remote_domain_migrate_get_max_downtime_ret type DomainMigrateGetMaxDowntimeRet struct { Downtime uint64 } // DomainMigrateSetMaxDowntimeArgs is libvirt's remote_domain_migrate_set_max_downtime_args type DomainMigrateSetMaxDowntimeArgs struct { Dom Domain Downtime uint64 Flags uint32 } // DomainMigrateGetCompressionCacheArgs is libvirt's remote_domain_migrate_get_compression_cache_args type DomainMigrateGetCompressionCacheArgs struct { Dom Domain Flags uint32 } // DomainMigrateGetCompressionCacheRet is libvirt's remote_domain_migrate_get_compression_cache_ret type DomainMigrateGetCompressionCacheRet struct { CacheSize uint64 } // DomainMigrateSetCompressionCacheArgs is libvirt's remote_domain_migrate_set_compression_cache_args type DomainMigrateSetCompressionCacheArgs struct { Dom Domain CacheSize uint64 Flags uint32 } // DomainMigrateSetMaxSpeedArgs is libvirt's remote_domain_migrate_set_max_speed_args type DomainMigrateSetMaxSpeedArgs struct { Dom Domain Bandwidth uint64 Flags uint32 } // DomainMigrateGetMaxSpeedArgs is libvirt's remote_domain_migrate_get_max_speed_args type DomainMigrateGetMaxSpeedArgs struct { Dom Domain Flags uint32 } // DomainMigrateGetMaxSpeedRet is libvirt's remote_domain_migrate_get_max_speed_ret type DomainMigrateGetMaxSpeedRet struct { Bandwidth uint64 } // ConnectDomainEventRegisterAnyArgs is libvirt's remote_connect_domain_event_register_any_args type ConnectDomainEventRegisterAnyArgs struct { EventID int32 } // ConnectDomainEventDeregisterAnyArgs is libvirt's remote_connect_domain_event_deregister_any_args type ConnectDomainEventDeregisterAnyArgs struct { EventID int32 } // ConnectDomainEventCallbackRegisterAnyArgs is libvirt's remote_connect_domain_event_callback_register_any_args type ConnectDomainEventCallbackRegisterAnyArgs struct { EventID int32 Dom OptDomain } // ConnectDomainEventCallbackRegisterAnyRet is libvirt's remote_connect_domain_event_callback_register_any_ret type ConnectDomainEventCallbackRegisterAnyRet struct { CallbackID int32 } // ConnectDomainEventCallbackDeregisterAnyArgs is libvirt's remote_connect_domain_event_callback_deregister_any_args type ConnectDomainEventCallbackDeregisterAnyArgs struct { CallbackID int32 } // DomainEventRebootMsg is libvirt's remote_domain_event_reboot_msg type DomainEventRebootMsg struct { Dom Domain } // DomainEventCallbackRebootMsg is libvirt's remote_domain_event_callback_reboot_msg type DomainEventCallbackRebootMsg struct { CallbackID int32 Msg DomainEventRebootMsg } // DomainEventRtcChangeMsg is libvirt's remote_domain_event_rtc_change_msg type DomainEventRtcChangeMsg struct { Dom Domain Offset int64 } // DomainEventCallbackRtcChangeMsg is libvirt's remote_domain_event_callback_rtc_change_msg type DomainEventCallbackRtcChangeMsg struct { CallbackID int32 Msg DomainEventRtcChangeMsg } // DomainEventWatchdogMsg is libvirt's remote_domain_event_watchdog_msg type DomainEventWatchdogMsg struct { Dom Domain Action int32 } // DomainEventCallbackWatchdogMsg is libvirt's remote_domain_event_callback_watchdog_msg type DomainEventCallbackWatchdogMsg struct { CallbackID int32 Msg DomainEventWatchdogMsg } // DomainEventIOErrorMsg is libvirt's remote_domain_event_io_error_msg type DomainEventIOErrorMsg struct { Dom Domain SrcPath string DevAlias string Action int32 } // DomainEventCallbackIOErrorMsg is libvirt's remote_domain_event_callback_io_error_msg type DomainEventCallbackIOErrorMsg struct { CallbackID int32 Msg DomainEventIOErrorMsg } // DomainEventIOErrorReasonMsg is libvirt's remote_domain_event_io_error_reason_msg type DomainEventIOErrorReasonMsg struct { Dom Domain SrcPath string DevAlias string Action int32 Reason string } // DomainEventCallbackIOErrorReasonMsg is libvirt's remote_domain_event_callback_io_error_reason_msg type DomainEventCallbackIOErrorReasonMsg struct { CallbackID int32 Msg DomainEventIOErrorReasonMsg } // DomainEventGraphicsAddress is libvirt's remote_domain_event_graphics_address type DomainEventGraphicsAddress struct { Family int32 Node string Service string } // DomainEventGraphicsIdentity is libvirt's remote_domain_event_graphics_identity type DomainEventGraphicsIdentity struct { Type string Name string } // DomainEventGraphicsMsg is libvirt's remote_domain_event_graphics_msg type DomainEventGraphicsMsg struct { Dom Domain Phase int32 Local DomainEventGraphicsAddress Remote DomainEventGraphicsAddress AuthScheme string Subject []DomainEventGraphicsIdentity } // DomainEventCallbackGraphicsMsg is libvirt's remote_domain_event_callback_graphics_msg type DomainEventCallbackGraphicsMsg struct { CallbackID int32 Msg DomainEventGraphicsMsg } // DomainEventBlockJobMsg is libvirt's remote_domain_event_block_job_msg type DomainEventBlockJobMsg struct { Dom Domain Path string Type int32 Status int32 } // DomainEventCallbackBlockJobMsg is libvirt's remote_domain_event_callback_block_job_msg type DomainEventCallbackBlockJobMsg struct { CallbackID int32 Msg DomainEventBlockJobMsg } // DomainEventDiskChangeMsg is libvirt's remote_domain_event_disk_change_msg type DomainEventDiskChangeMsg struct { Dom Domain OldSrcPath OptString NewSrcPath OptString DevAlias string Reason int32 } // DomainEventCallbackDiskChangeMsg is libvirt's remote_domain_event_callback_disk_change_msg type DomainEventCallbackDiskChangeMsg struct { CallbackID int32 Msg DomainEventDiskChangeMsg } // DomainEventTrayChangeMsg is libvirt's remote_domain_event_tray_change_msg type DomainEventTrayChangeMsg struct { Dom Domain DevAlias string Reason int32 } // DomainEventCallbackTrayChangeMsg is libvirt's remote_domain_event_callback_tray_change_msg type DomainEventCallbackTrayChangeMsg struct { CallbackID int32 Msg DomainEventTrayChangeMsg } // DomainEventPmwakeupMsg is libvirt's remote_domain_event_pmwakeup_msg type DomainEventPmwakeupMsg struct { Dom Domain } // DomainEventCallbackPmwakeupMsg is libvirt's remote_domain_event_callback_pmwakeup_msg type DomainEventCallbackPmwakeupMsg struct { CallbackID int32 Reason int32 Msg DomainEventPmwakeupMsg } // DomainEventPmsuspendMsg is libvirt's remote_domain_event_pmsuspend_msg type DomainEventPmsuspendMsg struct { Dom Domain } // DomainEventCallbackPmsuspendMsg is libvirt's remote_domain_event_callback_pmsuspend_msg type DomainEventCallbackPmsuspendMsg struct { CallbackID int32 Reason int32 Msg DomainEventPmsuspendMsg } // DomainEventBalloonChangeMsg is libvirt's remote_domain_event_balloon_change_msg type DomainEventBalloonChangeMsg struct { Dom Domain Actual uint64 } // DomainEventCallbackBalloonChangeMsg is libvirt's remote_domain_event_callback_balloon_change_msg type DomainEventCallbackBalloonChangeMsg struct { CallbackID int32 Msg DomainEventBalloonChangeMsg } // DomainEventPmsuspendDiskMsg is libvirt's remote_domain_event_pmsuspend_disk_msg type DomainEventPmsuspendDiskMsg struct { Dom Domain } // DomainEventCallbackPmsuspendDiskMsg is libvirt's remote_domain_event_callback_pmsuspend_disk_msg type DomainEventCallbackPmsuspendDiskMsg struct { CallbackID int32 Reason int32 Msg DomainEventPmsuspendDiskMsg } // DomainManagedSaveArgs is libvirt's remote_domain_managed_save_args type DomainManagedSaveArgs struct { Dom Domain Flags uint32 } // DomainHasManagedSaveImageArgs is libvirt's remote_domain_has_managed_save_image_args type DomainHasManagedSaveImageArgs struct { Dom Domain Flags uint32 } // DomainHasManagedSaveImageRet is libvirt's remote_domain_has_managed_save_image_ret type DomainHasManagedSaveImageRet struct { Result int32 } // DomainManagedSaveRemoveArgs is libvirt's remote_domain_managed_save_remove_args type DomainManagedSaveRemoveArgs struct { Dom Domain Flags uint32 } // DomainManagedSaveGetXMLDescArgs is libvirt's remote_domain_managed_save_get_xml_desc_args type DomainManagedSaveGetXMLDescArgs struct { Dom Domain Flags DomainXMLFlags } // DomainManagedSaveGetXMLDescRet is libvirt's remote_domain_managed_save_get_xml_desc_ret type DomainManagedSaveGetXMLDescRet struct { XML string } // DomainManagedSaveDefineXMLArgs is libvirt's remote_domain_managed_save_define_xml_args type DomainManagedSaveDefineXMLArgs struct { Dom Domain Dxml OptString Flags DomainSaveRestoreFlags } // DomainSnapshotCreateXMLArgs is libvirt's remote_domain_snapshot_create_xml_args type DomainSnapshotCreateXMLArgs struct { Dom Domain XMLDesc string Flags uint32 } // DomainSnapshotCreateXMLRet is libvirt's remote_domain_snapshot_create_xml_ret type DomainSnapshotCreateXMLRet struct { Snap DomainSnapshot } // DomainSnapshotGetXMLDescArgs is libvirt's remote_domain_snapshot_get_xml_desc_args type DomainSnapshotGetXMLDescArgs struct { Snap DomainSnapshot Flags uint32 } // DomainSnapshotGetXMLDescRet is libvirt's remote_domain_snapshot_get_xml_desc_ret type DomainSnapshotGetXMLDescRet struct { XML string } // DomainSnapshotNumArgs is libvirt's remote_domain_snapshot_num_args type DomainSnapshotNumArgs struct { Dom Domain Flags uint32 } // DomainSnapshotNumRet is libvirt's remote_domain_snapshot_num_ret type DomainSnapshotNumRet struct { Num int32 } // DomainSnapshotListNamesArgs is libvirt's remote_domain_snapshot_list_names_args type DomainSnapshotListNamesArgs struct { Dom Domain Maxnames int32 Flags uint32 } // DomainSnapshotListNamesRet is libvirt's remote_domain_snapshot_list_names_ret type DomainSnapshotListNamesRet struct { Names []string } // DomainListAllSnapshotsArgs is libvirt's remote_domain_list_all_snapshots_args type DomainListAllSnapshotsArgs struct { Dom Domain NeedResults int32 Flags uint32 } // DomainListAllSnapshotsRet is libvirt's remote_domain_list_all_snapshots_ret type DomainListAllSnapshotsRet struct { Snapshots []DomainSnapshot Ret int32 } // DomainSnapshotNumChildrenArgs is libvirt's remote_domain_snapshot_num_children_args type DomainSnapshotNumChildrenArgs struct { Snap DomainSnapshot Flags uint32 } // DomainSnapshotNumChildrenRet is libvirt's remote_domain_snapshot_num_children_ret type DomainSnapshotNumChildrenRet struct { Num int32 } // DomainSnapshotListChildrenNamesArgs is libvirt's remote_domain_snapshot_list_children_names_args type DomainSnapshotListChildrenNamesArgs struct { Snap DomainSnapshot Maxnames int32 Flags uint32 } // DomainSnapshotListChildrenNamesRet is libvirt's remote_domain_snapshot_list_children_names_ret type DomainSnapshotListChildrenNamesRet struct { Names []string } // DomainSnapshotListAllChildrenArgs is libvirt's remote_domain_snapshot_list_all_children_args type DomainSnapshotListAllChildrenArgs struct { Snapshot DomainSnapshot NeedResults int32 Flags uint32 } // DomainSnapshotListAllChildrenRet is libvirt's remote_domain_snapshot_list_all_children_ret type DomainSnapshotListAllChildrenRet struct { Snapshots []DomainSnapshot Ret int32 } // DomainSnapshotLookupByNameArgs is libvirt's remote_domain_snapshot_lookup_by_name_args type DomainSnapshotLookupByNameArgs struct { Dom Domain Name string Flags uint32 } // DomainSnapshotLookupByNameRet is libvirt's remote_domain_snapshot_lookup_by_name_ret type DomainSnapshotLookupByNameRet struct { Snap DomainSnapshot } // DomainHasCurrentSnapshotArgs is libvirt's remote_domain_has_current_snapshot_args type DomainHasCurrentSnapshotArgs struct { Dom Domain Flags uint32 } // DomainHasCurrentSnapshotRet is libvirt's remote_domain_has_current_snapshot_ret type DomainHasCurrentSnapshotRet struct { Result int32 } // DomainSnapshotGetParentArgs is libvirt's remote_domain_snapshot_get_parent_args type DomainSnapshotGetParentArgs struct { Snap DomainSnapshot Flags uint32 } // DomainSnapshotGetParentRet is libvirt's remote_domain_snapshot_get_parent_ret type DomainSnapshotGetParentRet struct { Snap DomainSnapshot } // DomainSnapshotCurrentArgs is libvirt's remote_domain_snapshot_current_args type DomainSnapshotCurrentArgs struct { Dom Domain Flags uint32 } // DomainSnapshotCurrentRet is libvirt's remote_domain_snapshot_current_ret type DomainSnapshotCurrentRet struct { Snap DomainSnapshot } // DomainSnapshotIsCurrentArgs is libvirt's remote_domain_snapshot_is_current_args type DomainSnapshotIsCurrentArgs struct { Snap DomainSnapshot Flags uint32 } // DomainSnapshotIsCurrentRet is libvirt's remote_domain_snapshot_is_current_ret type DomainSnapshotIsCurrentRet struct { Current int32 } // DomainSnapshotHasMetadataArgs is libvirt's remote_domain_snapshot_has_metadata_args type DomainSnapshotHasMetadataArgs struct { Snap DomainSnapshot Flags uint32 } // DomainSnapshotHasMetadataRet is libvirt's remote_domain_snapshot_has_metadata_ret type DomainSnapshotHasMetadataRet struct { Metadata int32 } // DomainRevertToSnapshotArgs is libvirt's remote_domain_revert_to_snapshot_args type DomainRevertToSnapshotArgs struct { Snap DomainSnapshot Flags uint32 } // DomainSnapshotDeleteArgs is libvirt's remote_domain_snapshot_delete_args type DomainSnapshotDeleteArgs struct { Snap DomainSnapshot Flags DomainSnapshotDeleteFlags } // DomainOpenConsoleArgs is libvirt's remote_domain_open_console_args type DomainOpenConsoleArgs struct { Dom Domain DevName OptString Flags uint32 } // DomainOpenChannelArgs is libvirt's remote_domain_open_channel_args type DomainOpenChannelArgs struct { Dom Domain Name OptString Flags DomainChannelFlags } // StorageVolUploadArgs is libvirt's remote_storage_vol_upload_args type StorageVolUploadArgs struct { Vol StorageVol Offset uint64 Length uint64 Flags StorageVolUploadFlags } // StorageVolDownloadArgs is libvirt's remote_storage_vol_download_args type StorageVolDownloadArgs struct { Vol StorageVol Offset uint64 Length uint64 Flags StorageVolDownloadFlags } // DomainGetStateArgs is libvirt's remote_domain_get_state_args type DomainGetStateArgs struct { Dom Domain Flags uint32 } // DomainGetStateRet is libvirt's remote_domain_get_state_ret type DomainGetStateRet struct { State int32 Reason int32 } // DomainMigrateBegin3Args is libvirt's remote_domain_migrate_begin3_args type DomainMigrateBegin3Args struct { Dom Domain Xmlin OptString Flags uint64 Dname OptString Resource uint64 } // DomainMigrateBegin3Ret is libvirt's remote_domain_migrate_begin3_ret type DomainMigrateBegin3Ret struct { CookieOut []byte XML string } // DomainMigratePrepare3Args is libvirt's remote_domain_migrate_prepare3_args type DomainMigratePrepare3Args struct { CookieIn []byte UriIn OptString Flags uint64 Dname OptString Resource uint64 DomXML string } // DomainMigratePrepare3Ret is libvirt's remote_domain_migrate_prepare3_ret type DomainMigratePrepare3Ret struct { CookieOut []byte UriOut OptString } // DomainMigratePrepareTunnel3Args is libvirt's remote_domain_migrate_prepare_tunnel3_args type DomainMigratePrepareTunnel3Args struct { CookieIn []byte Flags uint64 Dname OptString Resource uint64 DomXML string } // DomainMigratePrepareTunnel3Ret is libvirt's remote_domain_migrate_prepare_tunnel3_ret type DomainMigratePrepareTunnel3Ret struct { CookieOut []byte } // DomainMigratePerform3Args is libvirt's remote_domain_migrate_perform3_args type DomainMigratePerform3Args struct { Dom Domain Xmlin OptString CookieIn []byte Dconnuri OptString Uri OptString Flags uint64 Dname OptString Resource uint64 } // DomainMigratePerform3Ret is libvirt's remote_domain_migrate_perform3_ret type DomainMigratePerform3Ret struct { CookieOut []byte } // DomainMigrateFinish3Args is libvirt's remote_domain_migrate_finish3_args type DomainMigrateFinish3Args struct { Dname string CookieIn []byte Dconnuri OptString Uri OptString Flags uint64 Cancelled int32 } // DomainMigrateFinish3Ret is libvirt's remote_domain_migrate_finish3_ret type DomainMigrateFinish3Ret struct { Dom Domain CookieOut []byte } // DomainMigrateConfirm3Args is libvirt's remote_domain_migrate_confirm3_args type DomainMigrateConfirm3Args struct { Dom Domain CookieIn []byte Flags uint64 Cancelled int32 } // DomainEventControlErrorMsg is libvirt's remote_domain_event_control_error_msg type DomainEventControlErrorMsg struct { Dom Domain } // DomainEventCallbackControlErrorMsg is libvirt's remote_domain_event_callback_control_error_msg type DomainEventCallbackControlErrorMsg struct { CallbackID int32 Msg DomainEventControlErrorMsg } // DomainGetControlInfoArgs is libvirt's remote_domain_get_control_info_args type DomainGetControlInfoArgs struct { Dom Domain Flags uint32 } // DomainGetControlInfoRet is libvirt's remote_domain_get_control_info_ret type DomainGetControlInfoRet struct { State uint32 Details uint32 StateTime uint64 } // DomainOpenGraphicsArgs is libvirt's remote_domain_open_graphics_args type DomainOpenGraphicsArgs struct { Dom Domain Idx uint32 Flags DomainOpenGraphicsFlags } // DomainOpenGraphicsFdArgs is libvirt's remote_domain_open_graphics_fd_args type DomainOpenGraphicsFdArgs struct { Dom Domain Idx uint32 Flags DomainOpenGraphicsFlags } // NodeSuspendForDurationArgs is libvirt's remote_node_suspend_for_duration_args type NodeSuspendForDurationArgs struct { Target uint32 Duration uint64 Flags uint32 } // DomainShutdownFlagsArgs is libvirt's remote_domain_shutdown_flags_args type DomainShutdownFlagsArgs struct { Dom Domain Flags DomainShutdownFlagValues } // DomainGetDiskErrorsArgs is libvirt's remote_domain_get_disk_errors_args type DomainGetDiskErrorsArgs struct { Dom Domain Maxerrors uint32 Flags uint32 } // DomainGetDiskErrorsRet is libvirt's remote_domain_get_disk_errors_ret type DomainGetDiskErrorsRet struct { Errors []DomainDiskError Nerrors int32 } // ConnectListAllDomainsArgs is libvirt's remote_connect_list_all_domains_args type ConnectListAllDomainsArgs struct { NeedResults int32 Flags ConnectListAllDomainsFlags } // ConnectListAllDomainsRet is libvirt's remote_connect_list_all_domains_ret type ConnectListAllDomainsRet struct { Domains []Domain Ret uint32 } // ConnectListAllStoragePoolsArgs is libvirt's remote_connect_list_all_storage_pools_args type ConnectListAllStoragePoolsArgs struct { NeedResults int32 Flags ConnectListAllStoragePoolsFlags } // ConnectListAllStoragePoolsRet is libvirt's remote_connect_list_all_storage_pools_ret type ConnectListAllStoragePoolsRet struct { Pools []StoragePool Ret uint32 } // StoragePoolListAllVolumesArgs is libvirt's remote_storage_pool_list_all_volumes_args type StoragePoolListAllVolumesArgs struct { Pool StoragePool NeedResults int32 Flags uint32 } // StoragePoolListAllVolumesRet is libvirt's remote_storage_pool_list_all_volumes_ret type StoragePoolListAllVolumesRet struct { Vols []StorageVol Ret uint32 } // ConnectListAllNetworksArgs is libvirt's remote_connect_list_all_networks_args type ConnectListAllNetworksArgs struct { NeedResults int32 Flags ConnectListAllNetworksFlags } // ConnectListAllNetworksRet is libvirt's remote_connect_list_all_networks_ret type ConnectListAllNetworksRet struct { Nets []Network Ret uint32 } // ConnectListAllInterfacesArgs is libvirt's remote_connect_list_all_interfaces_args type ConnectListAllInterfacesArgs struct { NeedResults int32 Flags ConnectListAllInterfacesFlags } // ConnectListAllInterfacesRet is libvirt's remote_connect_list_all_interfaces_ret type ConnectListAllInterfacesRet struct { Ifaces []Interface Ret uint32 } // ConnectListAllNodeDevicesArgs is libvirt's remote_connect_list_all_node_devices_args type ConnectListAllNodeDevicesArgs struct { NeedResults int32 Flags uint32 } // ConnectListAllNodeDevicesRet is libvirt's remote_connect_list_all_node_devices_ret type ConnectListAllNodeDevicesRet struct { Devices []NodeDevice Ret uint32 } // ConnectListAllNwfiltersArgs is libvirt's remote_connect_list_all_nwfilters_args type ConnectListAllNwfiltersArgs struct { NeedResults int32 Flags uint32 } // ConnectListAllNwfiltersRet is libvirt's remote_connect_list_all_nwfilters_ret type ConnectListAllNwfiltersRet struct { Filters []Nwfilter Ret uint32 } // ConnectListAllSecretsArgs is libvirt's remote_connect_list_all_secrets_args type ConnectListAllSecretsArgs struct { NeedResults int32 Flags ConnectListAllSecretsFlags } // ConnectListAllSecretsRet is libvirt's remote_connect_list_all_secrets_ret type ConnectListAllSecretsRet struct { Secrets []Secret Ret uint32 } // NodeSetMemoryParametersArgs is libvirt's remote_node_set_memory_parameters_args type NodeSetMemoryParametersArgs struct { Params []TypedParam Flags uint32 } // NodeGetMemoryParametersArgs is libvirt's remote_node_get_memory_parameters_args type NodeGetMemoryParametersArgs struct { Nparams int32 Flags uint32 } // NodeGetMemoryParametersRet is libvirt's remote_node_get_memory_parameters_ret type NodeGetMemoryParametersRet struct { Params []TypedParam Nparams int32 } // NodeGetCPUMapArgs is libvirt's remote_node_get_cpu_map_args type NodeGetCPUMapArgs struct { NeedMap int32 NeedOnline int32 Flags uint32 } // NodeGetCPUMapRet is libvirt's remote_node_get_cpu_map_ret type NodeGetCPUMapRet struct { Cpumap []byte Online uint32 Ret int32 } // DomainFstrimArgs is libvirt's remote_domain_fstrim_args type DomainFstrimArgs struct { Dom Domain MountPoint OptString Minimum uint64 Flags uint32 } // DomainGetTimeArgs is libvirt's remote_domain_get_time_args type DomainGetTimeArgs struct { Dom Domain Flags uint32 } // DomainGetTimeRet is libvirt's remote_domain_get_time_ret type DomainGetTimeRet struct { Seconds int64 Nseconds uint32 } // DomainSetTimeArgs is libvirt's remote_domain_set_time_args type DomainSetTimeArgs struct { Dom Domain Seconds int64 Nseconds uint32 Flags DomainSetTimeFlags } // DomainMigrateBegin3ParamsArgs is libvirt's remote_domain_migrate_begin3_params_args type DomainMigrateBegin3ParamsArgs struct { Dom Domain Params []TypedParam Flags uint32 } // DomainMigrateBegin3ParamsRet is libvirt's remote_domain_migrate_begin3_params_ret type DomainMigrateBegin3ParamsRet struct { CookieOut []byte XML string } // DomainMigratePrepare3ParamsArgs is libvirt's remote_domain_migrate_prepare3_params_args type DomainMigratePrepare3ParamsArgs struct { Params []TypedParam CookieIn []byte Flags uint32 } // DomainMigratePrepare3ParamsRet is libvirt's remote_domain_migrate_prepare3_params_ret type DomainMigratePrepare3ParamsRet struct { CookieOut []byte UriOut OptString } // DomainMigratePrepareTunnel3ParamsArgs is libvirt's remote_domain_migrate_prepare_tunnel3_params_args type DomainMigratePrepareTunnel3ParamsArgs struct { Params []TypedParam CookieIn []byte Flags uint32 } // DomainMigratePrepareTunnel3ParamsRet is libvirt's remote_domain_migrate_prepare_tunnel3_params_ret type DomainMigratePrepareTunnel3ParamsRet struct { CookieOut []byte } // DomainMigratePerform3ParamsArgs is libvirt's remote_domain_migrate_perform3_params_args type DomainMigratePerform3ParamsArgs struct { Dom Domain Dconnuri OptString Params []TypedParam CookieIn []byte Flags DomainMigrateFlags } // DomainMigratePerform3ParamsRet is libvirt's remote_domain_migrate_perform3_params_ret type DomainMigratePerform3ParamsRet struct { CookieOut []byte } // DomainMigrateFinish3ParamsArgs is libvirt's remote_domain_migrate_finish3_params_args type DomainMigrateFinish3ParamsArgs struct { Params []TypedParam CookieIn []byte Flags uint32 Cancelled int32 } // DomainMigrateFinish3ParamsRet is libvirt's remote_domain_migrate_finish3_params_ret type DomainMigrateFinish3ParamsRet struct { Dom Domain CookieOut []byte } // DomainMigrateConfirm3ParamsArgs is libvirt's remote_domain_migrate_confirm3_params_args type DomainMigrateConfirm3ParamsArgs struct { Dom Domain Params []TypedParam CookieIn []byte Flags uint32 Cancelled int32 } // DomainEventDeviceRemovedMsg is libvirt's remote_domain_event_device_removed_msg type DomainEventDeviceRemovedMsg struct { Dom Domain DevAlias string } // DomainEventCallbackDeviceRemovedMsg is libvirt's remote_domain_event_callback_device_removed_msg type DomainEventCallbackDeviceRemovedMsg struct { CallbackID int32 Msg DomainEventDeviceRemovedMsg } // DomainEventBlockJob2Msg is libvirt's remote_domain_event_block_job_2_msg type DomainEventBlockJob2Msg struct { CallbackID int32 Dom Domain Dst string Type int32 Status int32 } // DomainEventBlockThresholdMsg is libvirt's remote_domain_event_block_threshold_msg type DomainEventBlockThresholdMsg struct { CallbackID int32 Dom Domain Dev string Path OptString Threshold uint64 Excess uint64 } // DomainEventCallbackTunableMsg is libvirt's remote_domain_event_callback_tunable_msg type DomainEventCallbackTunableMsg struct { CallbackID int32 Dom Domain Params []TypedParam } // DomainEventCallbackDeviceAddedMsg is libvirt's remote_domain_event_callback_device_added_msg type DomainEventCallbackDeviceAddedMsg struct { CallbackID int32 Dom Domain DevAlias string } // ConnectEventConnectionClosedMsg is libvirt's remote_connect_event_connection_closed_msg type ConnectEventConnectionClosedMsg struct { Reason int32 } // ConnectGetCPUModelNamesArgs is libvirt's remote_connect_get_cpu_model_names_args type ConnectGetCPUModelNamesArgs struct { Arch string NeedResults int32 Flags uint32 } // ConnectGetCPUModelNamesRet is libvirt's remote_connect_get_cpu_model_names_ret type ConnectGetCPUModelNamesRet struct { Models []string Ret int32 } // ConnectNetworkEventRegisterAnyArgs is libvirt's remote_connect_network_event_register_any_args type ConnectNetworkEventRegisterAnyArgs struct { EventID int32 Net OptNetwork } // ConnectNetworkEventRegisterAnyRet is libvirt's remote_connect_network_event_register_any_ret type ConnectNetworkEventRegisterAnyRet struct { CallbackID int32 } // ConnectNetworkEventDeregisterAnyArgs is libvirt's remote_connect_network_event_deregister_any_args type ConnectNetworkEventDeregisterAnyArgs struct { CallbackID int32 } // NetworkEventLifecycleMsg is libvirt's remote_network_event_lifecycle_msg type NetworkEventLifecycleMsg struct { CallbackID int32 Net Network Event int32 Detail int32 } // ConnectStoragePoolEventRegisterAnyArgs is libvirt's remote_connect_storage_pool_event_register_any_args type ConnectStoragePoolEventRegisterAnyArgs struct { EventID int32 Pool OptStoragePool } // ConnectStoragePoolEventRegisterAnyRet is libvirt's remote_connect_storage_pool_event_register_any_ret type ConnectStoragePoolEventRegisterAnyRet struct { CallbackID int32 } // ConnectStoragePoolEventDeregisterAnyArgs is libvirt's remote_connect_storage_pool_event_deregister_any_args type ConnectStoragePoolEventDeregisterAnyArgs struct { CallbackID int32 } // StoragePoolEventLifecycleMsg is libvirt's remote_storage_pool_event_lifecycle_msg type StoragePoolEventLifecycleMsg struct { CallbackID int32 Pool StoragePool Event int32 Detail int32 } // StoragePoolEventRefreshMsg is libvirt's remote_storage_pool_event_refresh_msg type StoragePoolEventRefreshMsg struct { CallbackID int32 Pool StoragePool } // ConnectNodeDeviceEventRegisterAnyArgs is libvirt's remote_connect_node_device_event_register_any_args type ConnectNodeDeviceEventRegisterAnyArgs struct { EventID int32 Dev OptNodeDevice } // ConnectNodeDeviceEventRegisterAnyRet is libvirt's remote_connect_node_device_event_register_any_ret type ConnectNodeDeviceEventRegisterAnyRet struct { CallbackID int32 } // ConnectNodeDeviceEventDeregisterAnyArgs is libvirt's remote_connect_node_device_event_deregister_any_args type ConnectNodeDeviceEventDeregisterAnyArgs struct { CallbackID int32 } // NodeDeviceEventLifecycleMsg is libvirt's remote_node_device_event_lifecycle_msg type NodeDeviceEventLifecycleMsg struct { CallbackID int32 Dev NodeDevice Event int32 Detail int32 } // NodeDeviceEventUpdateMsg is libvirt's remote_node_device_event_update_msg type NodeDeviceEventUpdateMsg struct { CallbackID int32 Dev NodeDevice } // DomainFsfreezeArgs is libvirt's remote_domain_fsfreeze_args type DomainFsfreezeArgs struct { Dom Domain Mountpoints []string Flags uint32 } // DomainFsfreezeRet is libvirt's remote_domain_fsfreeze_ret type DomainFsfreezeRet struct { Filesystems int32 } // DomainFsthawArgs is libvirt's remote_domain_fsthaw_args type DomainFsthawArgs struct { Dom Domain Mountpoints []string Flags uint32 } // DomainFsthawRet is libvirt's remote_domain_fsthaw_ret type DomainFsthawRet struct { Filesystems int32 } // NodeGetFreePagesArgs is libvirt's remote_node_get_free_pages_args type NodeGetFreePagesArgs struct { Pages []uint32 StartCell int32 CellCount uint32 Flags uint32 } // NodeGetFreePagesRet is libvirt's remote_node_get_free_pages_ret type NodeGetFreePagesRet struct { Counts []uint64 } // NodeAllocPagesArgs is libvirt's remote_node_alloc_pages_args type NodeAllocPagesArgs struct { PageSizes []uint32 PageCounts []uint64 StartCell int32 CellCount uint32 Flags NodeAllocPagesFlags } // NodeAllocPagesRet is libvirt's remote_node_alloc_pages_ret type NodeAllocPagesRet struct { Ret int32 } // NetworkDhcpLease is libvirt's remote_network_dhcp_lease type NetworkDhcpLease struct { Iface string Expirytime int64 Type int32 Mac OptString Iaid OptString Ipaddr string Prefix uint32 Hostname OptString Clientid OptString } // NetworkGetDhcpLeasesArgs is libvirt's remote_network_get_dhcp_leases_args type NetworkGetDhcpLeasesArgs struct { Net Network Mac OptString NeedResults int32 Flags uint32 } // NetworkGetDhcpLeasesRet is libvirt's remote_network_get_dhcp_leases_ret type NetworkGetDhcpLeasesRet struct { Leases []NetworkDhcpLease Ret uint32 } // DomainStatsRecord is libvirt's remote_domain_stats_record type DomainStatsRecord struct { Dom Domain Params []TypedParam } // ConnectGetAllDomainStatsArgs is libvirt's remote_connect_get_all_domain_stats_args type ConnectGetAllDomainStatsArgs struct { Doms []Domain Stats uint32 Flags uint32 } // DomainEventCallbackAgentLifecycleMsg is libvirt's remote_domain_event_callback_agent_lifecycle_msg type DomainEventCallbackAgentLifecycleMsg struct { CallbackID int32 Dom Domain State int32 Reason int32 } // ConnectGetAllDomainStatsRet is libvirt's remote_connect_get_all_domain_stats_ret type ConnectGetAllDomainStatsRet struct { RetStats []DomainStatsRecord } // DomainFsinfo is libvirt's remote_domain_fsinfo type DomainFsinfo struct { Mountpoint string Name string Fstype string DevAliases []string } // DomainGetFsinfoArgs is libvirt's remote_domain_get_fsinfo_args type DomainGetFsinfoArgs struct { Dom Domain Flags uint32 } // DomainGetFsinfoRet is libvirt's remote_domain_get_fsinfo_ret type DomainGetFsinfoRet struct { Info []DomainFsinfo Ret uint32 } // DomainIPAddr is libvirt's remote_domain_ip_addr type DomainIPAddr struct { Type int32 Addr string Prefix uint32 } // DomainInterface is libvirt's remote_domain_interface type DomainInterface struct { Name string Hwaddr OptString Addrs []DomainIPAddr } // DomainInterfaceAddressesArgs is libvirt's remote_domain_interface_addresses_args type DomainInterfaceAddressesArgs struct { Dom Domain Source uint32 Flags uint32 } // DomainInterfaceAddressesRet is libvirt's remote_domain_interface_addresses_ret type DomainInterfaceAddressesRet struct { Ifaces []DomainInterface } // DomainSetUserPasswordArgs is libvirt's remote_domain_set_user_password_args type DomainSetUserPasswordArgs struct { Dom Domain User OptString Password OptString Flags DomainSetUserPasswordFlags } // DomainRenameArgs is libvirt's remote_domain_rename_args type DomainRenameArgs struct { Dom Domain NewName OptString Flags uint32 } // DomainRenameRet is libvirt's remote_domain_rename_ret type DomainRenameRet struct { Retcode int32 } // DomainEventCallbackMigrationIterationMsg is libvirt's remote_domain_event_callback_migration_iteration_msg type DomainEventCallbackMigrationIterationMsg struct { CallbackID int32 Dom Domain Iteration int32 } // DomainEventCallbackJobCompletedMsg is libvirt's remote_domain_event_callback_job_completed_msg type DomainEventCallbackJobCompletedMsg struct { CallbackID int32 Dom Domain Params []TypedParam } // DomainMigrateStartPostCopyArgs is libvirt's remote_domain_migrate_start_post_copy_args type DomainMigrateStartPostCopyArgs struct { Dom Domain Flags uint32 } // DomainEventCallbackDeviceRemovalFailedMsg is libvirt's remote_domain_event_callback_device_removal_failed_msg type DomainEventCallbackDeviceRemovalFailedMsg struct { CallbackID int32 Dom Domain DevAlias string } // DomainGetGuestVcpusArgs is libvirt's remote_domain_get_guest_vcpus_args type DomainGetGuestVcpusArgs struct { Dom Domain Flags uint32 } // DomainGetGuestVcpusRet is libvirt's remote_domain_get_guest_vcpus_ret type DomainGetGuestVcpusRet struct { Params []TypedParam } // DomainSetGuestVcpusArgs is libvirt's remote_domain_set_guest_vcpus_args type DomainSetGuestVcpusArgs struct { Dom Domain Cpumap string State int32 Flags uint32 } // DomainSetVcpuArgs is libvirt's remote_domain_set_vcpu_args type DomainSetVcpuArgs struct { Dom Domain Cpumap string State int32 Flags DomainModificationImpact } // DomainEventCallbackMetadataChangeMsg is libvirt's remote_domain_event_callback_metadata_change_msg type DomainEventCallbackMetadataChangeMsg struct { CallbackID int32 Dom Domain Type int32 Nsuri OptString } // DomainEventMemoryFailureMsg is libvirt's remote_domain_event_memory_failure_msg type DomainEventMemoryFailureMsg struct { CallbackID int32 Dom Domain Recipient int32 Action int32 Flags uint32 } // ConnectSecretEventRegisterAnyArgs is libvirt's remote_connect_secret_event_register_any_args type ConnectSecretEventRegisterAnyArgs struct { EventID int32 OptSecret OptSecret } // ConnectSecretEventRegisterAnyRet is libvirt's remote_connect_secret_event_register_any_ret type ConnectSecretEventRegisterAnyRet struct { CallbackID int32 } // ConnectSecretEventDeregisterAnyArgs is libvirt's remote_connect_secret_event_deregister_any_args type ConnectSecretEventDeregisterAnyArgs struct { CallbackID int32 } // SecretEventLifecycleMsg is libvirt's remote_secret_event_lifecycle_msg type SecretEventLifecycleMsg struct { CallbackID int32 OptSecret Secret Event int32 Detail int32 } // SecretEventValueChangedMsg is libvirt's remote_secret_event_value_changed_msg type SecretEventValueChangedMsg struct { CallbackID int32 OptSecret Secret } // DomainSetBlockThresholdArgs is libvirt's remote_domain_set_block_threshold_args type DomainSetBlockThresholdArgs struct { Dom Domain Dev string Threshold uint64 Flags uint32 } // DomainSetLifecycleActionArgs is libvirt's remote_domain_set_lifecycle_action_args type DomainSetLifecycleActionArgs struct { Dom Domain Type uint32 Action uint32 Flags DomainModificationImpact } // ConnectCompareHypervisorCPUArgs is libvirt's remote_connect_compare_hypervisor_cpu_args type ConnectCompareHypervisorCPUArgs struct { Emulator OptString Arch OptString Machine OptString Virttype OptString XMLCPU string Flags uint32 } // ConnectCompareHypervisorCPURet is libvirt's remote_connect_compare_hypervisor_cpu_ret type ConnectCompareHypervisorCPURet struct { Result int32 } // ConnectBaselineHypervisorCPUArgs is libvirt's remote_connect_baseline_hypervisor_cpu_args type ConnectBaselineHypervisorCPUArgs struct { Emulator OptString Arch OptString Machine OptString Virttype OptString XMLCPUs []string Flags uint32 } // ConnectBaselineHypervisorCPURet is libvirt's remote_connect_baseline_hypervisor_cpu_ret type ConnectBaselineHypervisorCPURet struct { CPU string } // NodeGetSevInfoArgs is libvirt's remote_node_get_sev_info_args type NodeGetSevInfoArgs struct { Nparams int32 Flags uint32 } // NodeGetSevInfoRet is libvirt's remote_node_get_sev_info_ret type NodeGetSevInfoRet struct { Params []TypedParam Nparams int32 } // DomainGetLaunchSecurityInfoArgs is libvirt's remote_domain_get_launch_security_info_args type DomainGetLaunchSecurityInfoArgs struct { Dom Domain Flags uint32 } // DomainGetLaunchSecurityInfoRet is libvirt's remote_domain_get_launch_security_info_ret type DomainGetLaunchSecurityInfoRet struct { Params []TypedParam } // DomainSetLaunchSecurityStateArgs is libvirt's remote_domain_set_launch_security_state_args type DomainSetLaunchSecurityStateArgs struct { Dom Domain Params []TypedParam Flags uint32 } // NwfilterBindingLookupByPortDevArgs is libvirt's remote_nwfilter_binding_lookup_by_port_dev_args type NwfilterBindingLookupByPortDevArgs struct { Name string } // NwfilterBindingLookupByPortDevRet is libvirt's remote_nwfilter_binding_lookup_by_port_dev_ret type NwfilterBindingLookupByPortDevRet struct { OptNwfilter NwfilterBinding } // NwfilterBindingCreateXMLArgs is libvirt's remote_nwfilter_binding_create_xml_args type NwfilterBindingCreateXMLArgs struct { XML string Flags uint32 } // NwfilterBindingCreateXMLRet is libvirt's remote_nwfilter_binding_create_xml_ret type NwfilterBindingCreateXMLRet struct { OptNwfilter NwfilterBinding } // NwfilterBindingDeleteArgs is libvirt's remote_nwfilter_binding_delete_args type NwfilterBindingDeleteArgs struct { OptNwfilter NwfilterBinding } // NwfilterBindingGetXMLDescArgs is libvirt's remote_nwfilter_binding_get_xml_desc_args type NwfilterBindingGetXMLDescArgs struct { OptNwfilter NwfilterBinding Flags uint32 } // NwfilterBindingGetXMLDescRet is libvirt's remote_nwfilter_binding_get_xml_desc_ret type NwfilterBindingGetXMLDescRet struct { XML string } // ConnectListAllNwfilterBindingsArgs is libvirt's remote_connect_list_all_nwfilter_bindings_args type ConnectListAllNwfilterBindingsArgs struct { NeedResults int32 Flags uint32 } // ConnectListAllNwfilterBindingsRet is libvirt's remote_connect_list_all_nwfilter_bindings_ret type ConnectListAllNwfilterBindingsRet struct { Bindings []NwfilterBinding Ret uint32 } // ConnectGetStoragePoolCapabilitiesArgs is libvirt's remote_connect_get_storage_pool_capabilities_args type ConnectGetStoragePoolCapabilitiesArgs struct { Flags uint32 } // ConnectGetStoragePoolCapabilitiesRet is libvirt's remote_connect_get_storage_pool_capabilities_ret type ConnectGetStoragePoolCapabilitiesRet struct { Capabilities string } // NetworkListAllPortsArgs is libvirt's remote_network_list_all_ports_args type NetworkListAllPortsArgs struct { OptNetwork Network NeedResults int32 Flags uint32 } // NetworkListAllPortsRet is libvirt's remote_network_list_all_ports_ret type NetworkListAllPortsRet struct { Ports []NetworkPort Ret uint32 } // NetworkPortLookupByUUIDArgs is libvirt's remote_network_port_lookup_by_uuid_args type NetworkPortLookupByUUIDArgs struct { OptNetwork Network UUID UUID } // NetworkPortLookupByUUIDRet is libvirt's remote_network_port_lookup_by_uuid_ret type NetworkPortLookupByUUIDRet struct { Port NetworkPort } // NetworkPortCreateXMLArgs is libvirt's remote_network_port_create_xml_args type NetworkPortCreateXMLArgs struct { OptNetwork Network XML string Flags uint32 } // NetworkPortCreateXMLRet is libvirt's remote_network_port_create_xml_ret type NetworkPortCreateXMLRet struct { Port NetworkPort } // NetworkPortSetParametersArgs is libvirt's remote_network_port_set_parameters_args type NetworkPortSetParametersArgs struct { Port NetworkPort Params []TypedParam Flags uint32 } // NetworkPortGetParametersArgs is libvirt's remote_network_port_get_parameters_args type NetworkPortGetParametersArgs struct { Port NetworkPort Nparams int32 Flags uint32 } // NetworkPortGetParametersRet is libvirt's remote_network_port_get_parameters_ret type NetworkPortGetParametersRet struct { Params []TypedParam Nparams int32 } // NetworkPortGetXMLDescArgs is libvirt's remote_network_port_get_xml_desc_args type NetworkPortGetXMLDescArgs struct { Port NetworkPort Flags uint32 } // NetworkPortGetXMLDescRet is libvirt's remote_network_port_get_xml_desc_ret type NetworkPortGetXMLDescRet struct { XML string } // NetworkPortDeleteArgs is libvirt's remote_network_port_delete_args type NetworkPortDeleteArgs struct { Port NetworkPort Flags uint32 } // DomainCheckpointCreateXMLArgs is libvirt's remote_domain_checkpoint_create_xml_args type DomainCheckpointCreateXMLArgs struct { Dom Domain XMLDesc string Flags uint32 } // DomainCheckpointCreateXMLRet is libvirt's remote_domain_checkpoint_create_xml_ret type DomainCheckpointCreateXMLRet struct { Checkpoint DomainCheckpoint } // DomainCheckpointGetXMLDescArgs is libvirt's remote_domain_checkpoint_get_xml_desc_args type DomainCheckpointGetXMLDescArgs struct { Checkpoint DomainCheckpoint Flags uint32 } // DomainCheckpointGetXMLDescRet is libvirt's remote_domain_checkpoint_get_xml_desc_ret type DomainCheckpointGetXMLDescRet struct { XML string } // DomainListAllCheckpointsArgs is libvirt's remote_domain_list_all_checkpoints_args type DomainListAllCheckpointsArgs struct { Dom Domain NeedResults int32 Flags uint32 } // DomainListAllCheckpointsRet is libvirt's remote_domain_list_all_checkpoints_ret type DomainListAllCheckpointsRet struct { Checkpoints []DomainCheckpoint Ret int32 } // DomainCheckpointListAllChildrenArgs is libvirt's remote_domain_checkpoint_list_all_children_args type DomainCheckpointListAllChildrenArgs struct { Checkpoint DomainCheckpoint NeedResults int32 Flags uint32 } // DomainCheckpointListAllChildrenRet is libvirt's remote_domain_checkpoint_list_all_children_ret type DomainCheckpointListAllChildrenRet struct { Checkpoints []DomainCheckpoint Ret int32 } // DomainCheckpointLookupByNameArgs is libvirt's remote_domain_checkpoint_lookup_by_name_args type DomainCheckpointLookupByNameArgs struct { Dom Domain Name string Flags uint32 } // DomainCheckpointLookupByNameRet is libvirt's remote_domain_checkpoint_lookup_by_name_ret type DomainCheckpointLookupByNameRet struct { Checkpoint DomainCheckpoint } // DomainCheckpointGetParentArgs is libvirt's remote_domain_checkpoint_get_parent_args type DomainCheckpointGetParentArgs struct { Checkpoint DomainCheckpoint Flags uint32 } // DomainCheckpointGetParentRet is libvirt's remote_domain_checkpoint_get_parent_ret type DomainCheckpointGetParentRet struct { Parent DomainCheckpoint } // DomainCheckpointDeleteArgs is libvirt's remote_domain_checkpoint_delete_args type DomainCheckpointDeleteArgs struct { Checkpoint DomainCheckpoint Flags DomainCheckpointDeleteFlags } // DomainGetGuestInfoArgs is libvirt's remote_domain_get_guest_info_args type DomainGetGuestInfoArgs struct { Dom Domain Types uint32 Flags uint32 } // DomainGetGuestInfoRet is libvirt's remote_domain_get_guest_info_ret type DomainGetGuestInfoRet struct { Params []TypedParam } // ConnectSetIdentityArgs is libvirt's remote_connect_set_identity_args type ConnectSetIdentityArgs struct { Params []TypedParam Flags uint32 } // DomainAgentSetResponseTimeoutArgs is libvirt's remote_domain_agent_set_response_timeout_args type DomainAgentSetResponseTimeoutArgs struct { Dom Domain Timeout int32 Flags uint32 } // DomainAgentSetResponseTimeoutRet is libvirt's remote_domain_agent_set_response_timeout_ret type DomainAgentSetResponseTimeoutRet struct { Result int32 } // DomainBackupBeginArgs is libvirt's remote_domain_backup_begin_args type DomainBackupBeginArgs struct { Dom Domain BackupXML string CheckpointXML OptString Flags DomainBackupBeginFlags } // DomainBackupGetXMLDescArgs is libvirt's remote_domain_backup_get_xml_desc_args type DomainBackupGetXMLDescArgs struct { Dom Domain Flags uint32 } // DomainBackupGetXMLDescRet is libvirt's remote_domain_backup_get_xml_desc_ret type DomainBackupGetXMLDescRet struct { XML string } // DomainAuthorizedSshKeysGetArgs is libvirt's remote_domain_authorized_ssh_keys_get_args type DomainAuthorizedSshKeysGetArgs struct { Dom Domain User string Flags uint32 } // DomainAuthorizedSshKeysGetRet is libvirt's remote_domain_authorized_ssh_keys_get_ret type DomainAuthorizedSshKeysGetRet struct { Keys []string } // DomainAuthorizedSshKeysSetArgs is libvirt's remote_domain_authorized_ssh_keys_set_args type DomainAuthorizedSshKeysSetArgs struct { Dom Domain User string Keys []string Flags uint32 } // DomainGetMessagesArgs is libvirt's remote_domain_get_messages_args type DomainGetMessagesArgs struct { Dom Domain Flags uint32 } // DomainGetMessagesRet is libvirt's remote_domain_get_messages_ret type DomainGetMessagesRet struct { Msgs []string } // DomainStartDirtyRateCalcArgs is libvirt's remote_domain_start_dirty_rate_calc_args type DomainStartDirtyRateCalcArgs struct { Dom Domain Seconds int32 Flags uint32 } // DomainEventMemoryDeviceSizeChangeMsg is libvirt's remote_domain_event_memory_device_size_change_msg type DomainEventMemoryDeviceSizeChangeMsg struct { CallbackID int32 Dom Domain Alias string Size uint64 } // TypedParamValue is a discriminated union. type TypedParamValue struct { D uint32 I interface{} } // NewTypedParamValueInt creates a discriminated union value satisfying // the TypedParamValue interface. func NewTypedParamValueInt(v int32) *TypedParamValue { return &TypedParamValue{D: 1, I: v} } // NewTypedParamValueUint creates a discriminated union value satisfying // the TypedParamValue interface. func NewTypedParamValueUint(v uint32) *TypedParamValue { return &TypedParamValue{D: 2, I: v} } // NewTypedParamValueLlong creates a discriminated union value satisfying // the TypedParamValue interface. func NewTypedParamValueLlong(v int64) *TypedParamValue { return &TypedParamValue{D: 3, I: v} } // NewTypedParamValueUllong creates a discriminated union value satisfying // the TypedParamValue interface. func NewTypedParamValueUllong(v uint64) *TypedParamValue { return &TypedParamValue{D: 4, I: v} } // NewTypedParamValueDouble creates a discriminated union value satisfying // the TypedParamValue interface. func NewTypedParamValueDouble(v float64) *TypedParamValue { return &TypedParamValue{D: 5, I: v} } // NewTypedParamValueBoolean creates a discriminated union value satisfying // the TypedParamValue interface. func NewTypedParamValueBoolean(v int32) *TypedParamValue { return &TypedParamValue{D: 6, I: v} } // NewTypedParamValueString creates a discriminated union value satisfying // the TypedParamValue interface. func NewTypedParamValueString(v string) *TypedParamValue { return &TypedParamValue{D: 7, I: v} } // ConnectOpen is the go wrapper for REMOTE_PROC_CONNECT_OPEN. func (l *Libvirt) ConnectOpen(Name OptString, Flags ConnectFlags) (err error) { var buf []byte args := ConnectOpenArgs { Name: Name, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(1, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectClose is the go wrapper for REMOTE_PROC_CONNECT_CLOSE. func (l *Libvirt) ConnectClose() (err error) { var buf []byte _, err = l.requestStream(2, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectGetType is the go wrapper for REMOTE_PROC_CONNECT_GET_TYPE. func (l *Libvirt) ConnectGetType() (rType string, err error) { var buf []byte var r response r, err = l.requestStream(3, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Type: string _, err = dec.Decode(&rType) if err != nil { return } return } // ConnectGetVersion is the go wrapper for REMOTE_PROC_CONNECT_GET_VERSION. func (l *Libvirt) ConnectGetVersion() (rHvVer uint64, err error) { var buf []byte var r response r, err = l.requestStream(4, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // HvVer: uint64 _, err = dec.Decode(&rHvVer) if err != nil { return } return } // ConnectGetMaxVcpus is the go wrapper for REMOTE_PROC_CONNECT_GET_MAX_VCPUS. func (l *Libvirt) ConnectGetMaxVcpus(Type OptString) (rMaxVcpus int32, err error) { var buf []byte args := ConnectGetMaxVcpusArgs { Type: Type, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(5, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // MaxVcpus: int32 _, err = dec.Decode(&rMaxVcpus) if err != nil { return } return } // NodeGetInfo is the go wrapper for REMOTE_PROC_NODE_GET_INFO. func (l *Libvirt) NodeGetInfo() (rModel [32]int8, rMemory uint64, rCpus int32, rMhz int32, rNodes int32, rSockets int32, rCores int32, rThreads int32, err error) { var buf []byte var r response r, err = l.requestStream(6, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Model: [32]int8 _, err = dec.Decode(&rModel) if err != nil { return } // Memory: uint64 _, err = dec.Decode(&rMemory) if err != nil { return } // Cpus: int32 _, err = dec.Decode(&rCpus) if err != nil { return } // Mhz: int32 _, err = dec.Decode(&rMhz) if err != nil { return } // Nodes: int32 _, err = dec.Decode(&rNodes) if err != nil { return } // Sockets: int32 _, err = dec.Decode(&rSockets) if err != nil { return } // Cores: int32 _, err = dec.Decode(&rCores) if err != nil { return } // Threads: int32 _, err = dec.Decode(&rThreads) if err != nil { return } return } // ConnectGetCapabilities is the go wrapper for REMOTE_PROC_CONNECT_GET_CAPABILITIES. func (l *Libvirt) ConnectGetCapabilities() (rCapabilities string, err error) { var buf []byte var r response r, err = l.requestStream(7, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Capabilities: string _, err = dec.Decode(&rCapabilities) if err != nil { return } return } // DomainAttachDevice is the go wrapper for REMOTE_PROC_DOMAIN_ATTACH_DEVICE. func (l *Libvirt) DomainAttachDevice(Dom Domain, XML string) (err error) { var buf []byte args := DomainAttachDeviceArgs { Dom: Dom, XML: XML, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(8, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainCreate is the go wrapper for REMOTE_PROC_DOMAIN_CREATE. func (l *Libvirt) DomainCreate(Dom Domain) (err error) { var buf []byte args := DomainCreateArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(9, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainCreateXML is the go wrapper for REMOTE_PROC_DOMAIN_CREATE_XML. func (l *Libvirt) DomainCreateXML(XMLDesc string, Flags DomainCreateFlags) (rDom Domain, err error) { var buf []byte args := DomainCreateXMLArgs { XMLDesc: XMLDesc, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(10, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // DomainDefineXML is the go wrapper for REMOTE_PROC_DOMAIN_DEFINE_XML. func (l *Libvirt) DomainDefineXML(XML string) (rDom Domain, err error) { var buf []byte args := DomainDefineXMLArgs { XML: XML, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(11, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // DomainDestroy is the go wrapper for REMOTE_PROC_DOMAIN_DESTROY. func (l *Libvirt) DomainDestroy(Dom Domain) (err error) { var buf []byte args := DomainDestroyArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(12, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainDetachDevice is the go wrapper for REMOTE_PROC_DOMAIN_DETACH_DEVICE. func (l *Libvirt) DomainDetachDevice(Dom Domain, XML string) (err error) { var buf []byte args := DomainDetachDeviceArgs { Dom: Dom, XML: XML, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(13, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_GET_XML_DESC. func (l *Libvirt) DomainGetXMLDesc(Dom Domain, Flags DomainXMLFlags) (rXML string, err error) { var buf []byte args := DomainGetXMLDescArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(14, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // DomainGetAutostart is the go wrapper for REMOTE_PROC_DOMAIN_GET_AUTOSTART. func (l *Libvirt) DomainGetAutostart(Dom Domain) (rAutostart int32, err error) { var buf []byte args := DomainGetAutostartArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(15, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Autostart: int32 _, err = dec.Decode(&rAutostart) if err != nil { return } return } // DomainGetInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_INFO. func (l *Libvirt) DomainGetInfo(Dom Domain) (rState uint8, rMaxMem uint64, rMemory uint64, rNrVirtCPU uint16, rCPUTime uint64, err error) { var buf []byte args := DomainGetInfoArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(16, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // State: uint8 _, err = dec.Decode(&rState) if err != nil { return } // MaxMem: uint64 _, err = dec.Decode(&rMaxMem) if err != nil { return } // Memory: uint64 _, err = dec.Decode(&rMemory) if err != nil { return } // NrVirtCPU: uint16 _, err = dec.Decode(&rNrVirtCPU) if err != nil { return } // CPUTime: uint64 _, err = dec.Decode(&rCPUTime) if err != nil { return } return } // DomainGetMaxMemory is the go wrapper for REMOTE_PROC_DOMAIN_GET_MAX_MEMORY. func (l *Libvirt) DomainGetMaxMemory(Dom Domain) (rMemory uint64, err error) { var buf []byte args := DomainGetMaxMemoryArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(17, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Memory: uint64 _, err = dec.Decode(&rMemory) if err != nil { return } return } // DomainGetMaxVcpus is the go wrapper for REMOTE_PROC_DOMAIN_GET_MAX_VCPUS. func (l *Libvirt) DomainGetMaxVcpus(Dom Domain) (rNum int32, err error) { var buf []byte args := DomainGetMaxVcpusArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(18, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // DomainGetOsType is the go wrapper for REMOTE_PROC_DOMAIN_GET_OS_TYPE. func (l *Libvirt) DomainGetOsType(Dom Domain) (rType string, err error) { var buf []byte args := DomainGetOsTypeArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(19, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Type: string _, err = dec.Decode(&rType) if err != nil { return } return } // DomainGetVcpus is the go wrapper for REMOTE_PROC_DOMAIN_GET_VCPUS. func (l *Libvirt) DomainGetVcpus(Dom Domain, Maxinfo int32, Maplen int32) (rInfo []VcpuInfo, rCpumaps []byte, err error) { var buf []byte args := DomainGetVcpusArgs { Dom: Dom, Maxinfo: Maxinfo, Maplen: Maplen, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(20, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Info: []VcpuInfo _, err = dec.Decode(&rInfo) if err != nil { return } // Cpumaps: []byte _, err = dec.Decode(&rCpumaps) if err != nil { return } return } // ConnectListDefinedDomains is the go wrapper for REMOTE_PROC_CONNECT_LIST_DEFINED_DOMAINS. func (l *Libvirt) ConnectListDefinedDomains(Maxnames int32) (rNames []string, err error) { var buf []byte args := ConnectListDefinedDomainsArgs { Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(21, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // DomainLookupByID is the go wrapper for REMOTE_PROC_DOMAIN_LOOKUP_BY_ID. func (l *Libvirt) DomainLookupByID(ID int32) (rDom Domain, err error) { var buf []byte args := DomainLookupByIDArgs { ID: ID, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(22, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // DomainLookupByName is the go wrapper for REMOTE_PROC_DOMAIN_LOOKUP_BY_NAME. func (l *Libvirt) DomainLookupByName(Name string) (rDom Domain, err error) { var buf []byte args := DomainLookupByNameArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(23, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // DomainLookupByUUID is the go wrapper for REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID. func (l *Libvirt) DomainLookupByUUID(UUID UUID) (rDom Domain, err error) { var buf []byte args := DomainLookupByUUIDArgs { UUID: UUID, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(24, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // ConnectNumOfDefinedDomains is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DEFINED_DOMAINS. func (l *Libvirt) ConnectNumOfDefinedDomains() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(25, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // DomainPinVcpu is the go wrapper for REMOTE_PROC_DOMAIN_PIN_VCPU. func (l *Libvirt) DomainPinVcpu(Dom Domain, Vcpu uint32, Cpumap []byte) (err error) { var buf []byte args := DomainPinVcpuArgs { Dom: Dom, Vcpu: Vcpu, Cpumap: Cpumap, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(26, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainReboot is the go wrapper for REMOTE_PROC_DOMAIN_REBOOT. func (l *Libvirt) DomainReboot(Dom Domain, Flags DomainRebootFlagValues) (err error) { var buf []byte args := DomainRebootArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(27, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainResume is the go wrapper for REMOTE_PROC_DOMAIN_RESUME. func (l *Libvirt) DomainResume(Dom Domain) (err error) { var buf []byte args := DomainResumeArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(28, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetAutostart is the go wrapper for REMOTE_PROC_DOMAIN_SET_AUTOSTART. func (l *Libvirt) DomainSetAutostart(Dom Domain, Autostart int32) (err error) { var buf []byte args := DomainSetAutostartArgs { Dom: Dom, Autostart: Autostart, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(29, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetMaxMemory is the go wrapper for REMOTE_PROC_DOMAIN_SET_MAX_MEMORY. func (l *Libvirt) DomainSetMaxMemory(Dom Domain, Memory uint64) (err error) { var buf []byte args := DomainSetMaxMemoryArgs { Dom: Dom, Memory: Memory, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(30, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetMemory is the go wrapper for REMOTE_PROC_DOMAIN_SET_MEMORY. func (l *Libvirt) DomainSetMemory(Dom Domain, Memory uint64) (err error) { var buf []byte args := DomainSetMemoryArgs { Dom: Dom, Memory: Memory, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(31, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetVcpus is the go wrapper for REMOTE_PROC_DOMAIN_SET_VCPUS. func (l *Libvirt) DomainSetVcpus(Dom Domain, Nvcpus uint32) (err error) { var buf []byte args := DomainSetVcpusArgs { Dom: Dom, Nvcpus: Nvcpus, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(32, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainShutdown is the go wrapper for REMOTE_PROC_DOMAIN_SHUTDOWN. func (l *Libvirt) DomainShutdown(Dom Domain) (err error) { var buf []byte args := DomainShutdownArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(33, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSuspend is the go wrapper for REMOTE_PROC_DOMAIN_SUSPEND. func (l *Libvirt) DomainSuspend(Dom Domain) (err error) { var buf []byte args := DomainSuspendArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(34, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainUndefine is the go wrapper for REMOTE_PROC_DOMAIN_UNDEFINE. func (l *Libvirt) DomainUndefine(Dom Domain) (err error) { var buf []byte args := DomainUndefineArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(35, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectListDefinedNetworks is the go wrapper for REMOTE_PROC_CONNECT_LIST_DEFINED_NETWORKS. func (l *Libvirt) ConnectListDefinedNetworks(Maxnames int32) (rNames []string, err error) { var buf []byte args := ConnectListDefinedNetworksArgs { Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(36, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // ConnectListDomains is the go wrapper for REMOTE_PROC_CONNECT_LIST_DOMAINS. func (l *Libvirt) ConnectListDomains(Maxids int32) (rIds []int32, err error) { var buf []byte args := ConnectListDomainsArgs { Maxids: Maxids, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(37, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Ids: []int32 _, err = dec.Decode(&rIds) if err != nil { return } return } // ConnectListNetworks is the go wrapper for REMOTE_PROC_CONNECT_LIST_NETWORKS. func (l *Libvirt) ConnectListNetworks(Maxnames int32) (rNames []string, err error) { var buf []byte args := ConnectListNetworksArgs { Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(38, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // NetworkCreate is the go wrapper for REMOTE_PROC_NETWORK_CREATE. func (l *Libvirt) NetworkCreate(Net Network) (err error) { var buf []byte args := NetworkCreateArgs { Net: Net, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(39, constants.Program, buf, nil, nil) if err != nil { return } return } // NetworkCreateXML is the go wrapper for REMOTE_PROC_NETWORK_CREATE_XML. func (l *Libvirt) NetworkCreateXML(XML string) (rNet Network, err error) { var buf []byte args := NetworkCreateXMLArgs { XML: XML, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(40, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Net: Network _, err = dec.Decode(&rNet) if err != nil { return } return } // NetworkDefineXML is the go wrapper for REMOTE_PROC_NETWORK_DEFINE_XML. func (l *Libvirt) NetworkDefineXML(XML string) (rNet Network, err error) { var buf []byte args := NetworkDefineXMLArgs { XML: XML, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(41, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Net: Network _, err = dec.Decode(&rNet) if err != nil { return } return } // NetworkDestroy is the go wrapper for REMOTE_PROC_NETWORK_DESTROY. func (l *Libvirt) NetworkDestroy(Net Network) (err error) { var buf []byte args := NetworkDestroyArgs { Net: Net, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(42, constants.Program, buf, nil, nil) if err != nil { return } return } // NetworkGetXMLDesc is the go wrapper for REMOTE_PROC_NETWORK_GET_XML_DESC. func (l *Libvirt) NetworkGetXMLDesc(Net Network, Flags uint32) (rXML string, err error) { var buf []byte args := NetworkGetXMLDescArgs { Net: Net, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(43, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // NetworkGetAutostart is the go wrapper for REMOTE_PROC_NETWORK_GET_AUTOSTART. func (l *Libvirt) NetworkGetAutostart(Net Network) (rAutostart int32, err error) { var buf []byte args := NetworkGetAutostartArgs { Net: Net, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(44, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Autostart: int32 _, err = dec.Decode(&rAutostart) if err != nil { return } return } // NetworkGetBridgeName is the go wrapper for REMOTE_PROC_NETWORK_GET_BRIDGE_NAME. func (l *Libvirt) NetworkGetBridgeName(Net Network) (rName string, err error) { var buf []byte args := NetworkGetBridgeNameArgs { Net: Net, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(45, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Name: string _, err = dec.Decode(&rName) if err != nil { return } return } // NetworkLookupByName is the go wrapper for REMOTE_PROC_NETWORK_LOOKUP_BY_NAME. func (l *Libvirt) NetworkLookupByName(Name string) (rNet Network, err error) { var buf []byte args := NetworkLookupByNameArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(46, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Net: Network _, err = dec.Decode(&rNet) if err != nil { return } return } // NetworkLookupByUUID is the go wrapper for REMOTE_PROC_NETWORK_LOOKUP_BY_UUID. func (l *Libvirt) NetworkLookupByUUID(UUID UUID) (rNet Network, err error) { var buf []byte args := NetworkLookupByUUIDArgs { UUID: UUID, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(47, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Net: Network _, err = dec.Decode(&rNet) if err != nil { return } return } // NetworkSetAutostart is the go wrapper for REMOTE_PROC_NETWORK_SET_AUTOSTART. func (l *Libvirt) NetworkSetAutostart(Net Network, Autostart int32) (err error) { var buf []byte args := NetworkSetAutostartArgs { Net: Net, Autostart: Autostart, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(48, constants.Program, buf, nil, nil) if err != nil { return } return } // NetworkUndefine is the go wrapper for REMOTE_PROC_NETWORK_UNDEFINE. func (l *Libvirt) NetworkUndefine(Net Network) (err error) { var buf []byte args := NetworkUndefineArgs { Net: Net, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(49, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectNumOfDefinedNetworks is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DEFINED_NETWORKS. func (l *Libvirt) ConnectNumOfDefinedNetworks() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(50, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // ConnectNumOfDomains is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DOMAINS. func (l *Libvirt) ConnectNumOfDomains() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(51, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // ConnectNumOfNetworks is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_NETWORKS. func (l *Libvirt) ConnectNumOfNetworks() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(52, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // DomainCoreDump is the go wrapper for REMOTE_PROC_DOMAIN_CORE_DUMP. func (l *Libvirt) DomainCoreDump(Dom Domain, To string, Flags DomainCoreDumpFlags) (err error) { var buf []byte args := DomainCoreDumpArgs { Dom: Dom, To: To, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(53, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainRestore is the go wrapper for REMOTE_PROC_DOMAIN_RESTORE. func (l *Libvirt) DomainRestore(From string) (err error) { var buf []byte args := DomainRestoreArgs { From: From, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(54, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSave is the go wrapper for REMOTE_PROC_DOMAIN_SAVE. func (l *Libvirt) DomainSave(Dom Domain, To string) (err error) { var buf []byte args := DomainSaveArgs { Dom: Dom, To: To, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(55, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetSchedulerType is the go wrapper for REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE. func (l *Libvirt) DomainGetSchedulerType(Dom Domain) (rType string, rNparams int32, err error) { var buf []byte args := DomainGetSchedulerTypeArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(56, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Type: string _, err = dec.Decode(&rType) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainGetSchedulerParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS. func (l *Libvirt) DomainGetSchedulerParameters(Dom Domain, Nparams int32) (rParams []TypedParam, err error) { var buf []byte args := DomainGetSchedulerParametersArgs { Dom: Dom, Nparams: Nparams, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(57, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } return } // DomainSetSchedulerParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS. func (l *Libvirt) DomainSetSchedulerParameters(Dom Domain, Params []TypedParam) (err error) { var buf []byte args := DomainSetSchedulerParametersArgs { Dom: Dom, Params: Params, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(58, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectGetHostname is the go wrapper for REMOTE_PROC_CONNECT_GET_HOSTNAME. func (l *Libvirt) ConnectGetHostname() (rHostname string, err error) { var buf []byte var r response r, err = l.requestStream(59, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Hostname: string _, err = dec.Decode(&rHostname) if err != nil { return } return } // ConnectSupportsFeature is the go wrapper for REMOTE_PROC_CONNECT_SUPPORTS_FEATURE. func (l *Libvirt) ConnectSupportsFeature(Feature int32) (rSupported int32, err error) { var buf []byte args := ConnectSupportsFeatureArgs { Feature: Feature, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(60, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Supported: int32 _, err = dec.Decode(&rSupported) if err != nil { return } return } // DomainMigratePrepare is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE. func (l *Libvirt) DomainMigratePrepare(UriIn OptString, Flags uint64, Dname OptString, Resource uint64) (rCookie []byte, rUriOut OptString, err error) { var buf []byte args := DomainMigratePrepareArgs { UriIn: UriIn, Flags: Flags, Dname: Dname, Resource: Resource, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(61, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Cookie: []byte _, err = dec.Decode(&rCookie) if err != nil { return } // UriOut: OptString _, err = dec.Decode(&rUriOut) if err != nil { return } return } // DomainMigratePerform is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PERFORM. func (l *Libvirt) DomainMigratePerform(Dom Domain, Cookie []byte, Uri string, Flags uint64, Dname OptString, Resource uint64) (err error) { var buf []byte args := DomainMigratePerformArgs { Dom: Dom, Cookie: Cookie, Uri: Uri, Flags: Flags, Dname: Dname, Resource: Resource, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(62, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainMigrateFinish is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_FINISH. func (l *Libvirt) DomainMigrateFinish(Dname string, Cookie []byte, Uri string, Flags uint64) (rDdom Domain, err error) { var buf []byte args := DomainMigrateFinishArgs { Dname: Dname, Cookie: Cookie, Uri: Uri, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(63, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Ddom: Domain _, err = dec.Decode(&rDdom) if err != nil { return } return } // DomainBlockStats is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_STATS. func (l *Libvirt) DomainBlockStats(Dom Domain, Path string) (rRdReq int64, rRdBytes int64, rWrReq int64, rWrBytes int64, rErrs int64, err error) { var buf []byte args := DomainBlockStatsArgs { Dom: Dom, Path: Path, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(64, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // RdReq: int64 _, err = dec.Decode(&rRdReq) if err != nil { return } // RdBytes: int64 _, err = dec.Decode(&rRdBytes) if err != nil { return } // WrReq: int64 _, err = dec.Decode(&rWrReq) if err != nil { return } // WrBytes: int64 _, err = dec.Decode(&rWrBytes) if err != nil { return } // Errs: int64 _, err = dec.Decode(&rErrs) if err != nil { return } return } // DomainInterfaceStats is the go wrapper for REMOTE_PROC_DOMAIN_INTERFACE_STATS. func (l *Libvirt) DomainInterfaceStats(Dom Domain, Device string) (rRxBytes int64, rRxPackets int64, rRxErrs int64, rRxDrop int64, rTxBytes int64, rTxPackets int64, rTxErrs int64, rTxDrop int64, err error) { var buf []byte args := DomainInterfaceStatsArgs { Dom: Dom, Device: Device, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(65, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // RxBytes: int64 _, err = dec.Decode(&rRxBytes) if err != nil { return } // RxPackets: int64 _, err = dec.Decode(&rRxPackets) if err != nil { return } // RxErrs: int64 _, err = dec.Decode(&rRxErrs) if err != nil { return } // RxDrop: int64 _, err = dec.Decode(&rRxDrop) if err != nil { return } // TxBytes: int64 _, err = dec.Decode(&rTxBytes) if err != nil { return } // TxPackets: int64 _, err = dec.Decode(&rTxPackets) if err != nil { return } // TxErrs: int64 _, err = dec.Decode(&rTxErrs) if err != nil { return } // TxDrop: int64 _, err = dec.Decode(&rTxDrop) if err != nil { return } return } // AuthList is the go wrapper for REMOTE_PROC_AUTH_LIST. func (l *Libvirt) AuthList() (rTypes []AuthType, err error) { var buf []byte var r response r, err = l.requestStream(66, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Types: []AuthType _, err = dec.Decode(&rTypes) if err != nil { return } return } // AuthSaslInit is the go wrapper for REMOTE_PROC_AUTH_SASL_INIT. func (l *Libvirt) AuthSaslInit() (rMechlist string, err error) { var buf []byte var r response r, err = l.requestStream(67, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Mechlist: string _, err = dec.Decode(&rMechlist) if err != nil { return } return } // AuthSaslStart is the go wrapper for REMOTE_PROC_AUTH_SASL_START. func (l *Libvirt) AuthSaslStart(Mech string, Nil int32, Data []int8) (rComplete int32, rNil int32, rData []int8, err error) { var buf []byte args := AuthSaslStartArgs { Mech: Mech, Nil: Nil, Data: Data, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(68, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Complete: int32 _, err = dec.Decode(&rComplete) if err != nil { return } // Nil: int32 _, err = dec.Decode(&rNil) if err != nil { return } // Data: []int8 _, err = dec.Decode(&rData) if err != nil { return } return } // AuthSaslStep is the go wrapper for REMOTE_PROC_AUTH_SASL_STEP. func (l *Libvirt) AuthSaslStep(Nil int32, Data []int8) (rComplete int32, rNil int32, rData []int8, err error) { var buf []byte args := AuthSaslStepArgs { Nil: Nil, Data: Data, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(69, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Complete: int32 _, err = dec.Decode(&rComplete) if err != nil { return } // Nil: int32 _, err = dec.Decode(&rNil) if err != nil { return } // Data: []int8 _, err = dec.Decode(&rData) if err != nil { return } return } // AuthPolkit is the go wrapper for REMOTE_PROC_AUTH_POLKIT. func (l *Libvirt) AuthPolkit() (rComplete int32, err error) { var buf []byte var r response r, err = l.requestStream(70, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Complete: int32 _, err = dec.Decode(&rComplete) if err != nil { return } return } // ConnectNumOfStoragePools is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_STORAGE_POOLS. func (l *Libvirt) ConnectNumOfStoragePools() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(71, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // ConnectListStoragePools is the go wrapper for REMOTE_PROC_CONNECT_LIST_STORAGE_POOLS. func (l *Libvirt) ConnectListStoragePools(Maxnames int32) (rNames []string, err error) { var buf []byte args := ConnectListStoragePoolsArgs { Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(72, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // ConnectNumOfDefinedStoragePools is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DEFINED_STORAGE_POOLS. func (l *Libvirt) ConnectNumOfDefinedStoragePools() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(73, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // ConnectListDefinedStoragePools is the go wrapper for REMOTE_PROC_CONNECT_LIST_DEFINED_STORAGE_POOLS. func (l *Libvirt) ConnectListDefinedStoragePools(Maxnames int32) (rNames []string, err error) { var buf []byte args := ConnectListDefinedStoragePoolsArgs { Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(74, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // ConnectFindStoragePoolSources is the go wrapper for REMOTE_PROC_CONNECT_FIND_STORAGE_POOL_SOURCES. func (l *Libvirt) ConnectFindStoragePoolSources(Type string, SrcSpec OptString, Flags uint32) (rXML string, err error) { var buf []byte args := ConnectFindStoragePoolSourcesArgs { Type: Type, SrcSpec: SrcSpec, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(75, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // StoragePoolCreateXML is the go wrapper for REMOTE_PROC_STORAGE_POOL_CREATE_XML. func (l *Libvirt) StoragePoolCreateXML(XML string, Flags StoragePoolCreateFlags) (rPool StoragePool, err error) { var buf []byte args := StoragePoolCreateXMLArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(76, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Pool: StoragePool _, err = dec.Decode(&rPool) if err != nil { return } return } // StoragePoolDefineXML is the go wrapper for REMOTE_PROC_STORAGE_POOL_DEFINE_XML. func (l *Libvirt) StoragePoolDefineXML(XML string, Flags uint32) (rPool StoragePool, err error) { var buf []byte args := StoragePoolDefineXMLArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(77, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Pool: StoragePool _, err = dec.Decode(&rPool) if err != nil { return } return } // StoragePoolCreate is the go wrapper for REMOTE_PROC_STORAGE_POOL_CREATE. func (l *Libvirt) StoragePoolCreate(Pool StoragePool, Flags StoragePoolCreateFlags) (err error) { var buf []byte args := StoragePoolCreateArgs { Pool: Pool, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(78, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolBuild is the go wrapper for REMOTE_PROC_STORAGE_POOL_BUILD. func (l *Libvirt) StoragePoolBuild(Pool StoragePool, Flags StoragePoolBuildFlags) (err error) { var buf []byte args := StoragePoolBuildArgs { Pool: Pool, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(79, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolDestroy is the go wrapper for REMOTE_PROC_STORAGE_POOL_DESTROY. func (l *Libvirt) StoragePoolDestroy(Pool StoragePool) (err error) { var buf []byte args := StoragePoolDestroyArgs { Pool: Pool, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(80, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolDelete is the go wrapper for REMOTE_PROC_STORAGE_POOL_DELETE. func (l *Libvirt) StoragePoolDelete(Pool StoragePool, Flags StoragePoolDeleteFlags) (err error) { var buf []byte args := StoragePoolDeleteArgs { Pool: Pool, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(81, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolUndefine is the go wrapper for REMOTE_PROC_STORAGE_POOL_UNDEFINE. func (l *Libvirt) StoragePoolUndefine(Pool StoragePool) (err error) { var buf []byte args := StoragePoolUndefineArgs { Pool: Pool, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(82, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolRefresh is the go wrapper for REMOTE_PROC_STORAGE_POOL_REFRESH. func (l *Libvirt) StoragePoolRefresh(Pool StoragePool, Flags uint32) (err error) { var buf []byte args := StoragePoolRefreshArgs { Pool: Pool, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(83, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolLookupByName is the go wrapper for REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_NAME. func (l *Libvirt) StoragePoolLookupByName(Name string) (rPool StoragePool, err error) { var buf []byte args := StoragePoolLookupByNameArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(84, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Pool: StoragePool _, err = dec.Decode(&rPool) if err != nil { return } return } // StoragePoolLookupByUUID is the go wrapper for REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_UUID. func (l *Libvirt) StoragePoolLookupByUUID(UUID UUID) (rPool StoragePool, err error) { var buf []byte args := StoragePoolLookupByUUIDArgs { UUID: UUID, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(85, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Pool: StoragePool _, err = dec.Decode(&rPool) if err != nil { return } return } // StoragePoolLookupByVolume is the go wrapper for REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_VOLUME. func (l *Libvirt) StoragePoolLookupByVolume(Vol StorageVol) (rPool StoragePool, err error) { var buf []byte args := StoragePoolLookupByVolumeArgs { Vol: Vol, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(86, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Pool: StoragePool _, err = dec.Decode(&rPool) if err != nil { return } return } // StoragePoolGetInfo is the go wrapper for REMOTE_PROC_STORAGE_POOL_GET_INFO. func (l *Libvirt) StoragePoolGetInfo(Pool StoragePool) (rState uint8, rCapacity uint64, rAllocation uint64, rAvailable uint64, err error) { var buf []byte args := StoragePoolGetInfoArgs { Pool: Pool, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(87, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // State: uint8 _, err = dec.Decode(&rState) if err != nil { return } // Capacity: uint64 _, err = dec.Decode(&rCapacity) if err != nil { return } // Allocation: uint64 _, err = dec.Decode(&rAllocation) if err != nil { return } // Available: uint64 _, err = dec.Decode(&rAvailable) if err != nil { return } return } // StoragePoolGetXMLDesc is the go wrapper for REMOTE_PROC_STORAGE_POOL_GET_XML_DESC. func (l *Libvirt) StoragePoolGetXMLDesc(Pool StoragePool, Flags StorageXMLFlags) (rXML string, err error) { var buf []byte args := StoragePoolGetXMLDescArgs { Pool: Pool, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(88, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // StoragePoolGetAutostart is the go wrapper for REMOTE_PROC_STORAGE_POOL_GET_AUTOSTART. func (l *Libvirt) StoragePoolGetAutostart(Pool StoragePool) (rAutostart int32, err error) { var buf []byte args := StoragePoolGetAutostartArgs { Pool: Pool, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(89, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Autostart: int32 _, err = dec.Decode(&rAutostart) if err != nil { return } return } // StoragePoolSetAutostart is the go wrapper for REMOTE_PROC_STORAGE_POOL_SET_AUTOSTART. func (l *Libvirt) StoragePoolSetAutostart(Pool StoragePool, Autostart int32) (err error) { var buf []byte args := StoragePoolSetAutostartArgs { Pool: Pool, Autostart: Autostart, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(90, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolNumOfVolumes is the go wrapper for REMOTE_PROC_STORAGE_POOL_NUM_OF_VOLUMES. func (l *Libvirt) StoragePoolNumOfVolumes(Pool StoragePool) (rNum int32, err error) { var buf []byte args := StoragePoolNumOfVolumesArgs { Pool: Pool, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(91, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // StoragePoolListVolumes is the go wrapper for REMOTE_PROC_STORAGE_POOL_LIST_VOLUMES. func (l *Libvirt) StoragePoolListVolumes(Pool StoragePool, Maxnames int32) (rNames []string, err error) { var buf []byte args := StoragePoolListVolumesArgs { Pool: Pool, Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(92, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // StorageVolCreateXML is the go wrapper for REMOTE_PROC_STORAGE_VOL_CREATE_XML. func (l *Libvirt) StorageVolCreateXML(Pool StoragePool, XML string, Flags StorageVolCreateFlags) (rVol StorageVol, err error) { var buf []byte args := StorageVolCreateXMLArgs { Pool: Pool, XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(93, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Vol: StorageVol _, err = dec.Decode(&rVol) if err != nil { return } return } // StorageVolDelete is the go wrapper for REMOTE_PROC_STORAGE_VOL_DELETE. func (l *Libvirt) StorageVolDelete(Vol StorageVol, Flags StorageVolDeleteFlags) (err error) { var buf []byte args := StorageVolDeleteArgs { Vol: Vol, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(94, constants.Program, buf, nil, nil) if err != nil { return } return } // StorageVolLookupByName is the go wrapper for REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_NAME. func (l *Libvirt) StorageVolLookupByName(Pool StoragePool, Name string) (rVol StorageVol, err error) { var buf []byte args := StorageVolLookupByNameArgs { Pool: Pool, Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(95, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Vol: StorageVol _, err = dec.Decode(&rVol) if err != nil { return } return } // StorageVolLookupByKey is the go wrapper for REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_KEY. func (l *Libvirt) StorageVolLookupByKey(Key string) (rVol StorageVol, err error) { var buf []byte args := StorageVolLookupByKeyArgs { Key: Key, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(96, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Vol: StorageVol _, err = dec.Decode(&rVol) if err != nil { return } return } // StorageVolLookupByPath is the go wrapper for REMOTE_PROC_STORAGE_VOL_LOOKUP_BY_PATH. func (l *Libvirt) StorageVolLookupByPath(Path string) (rVol StorageVol, err error) { var buf []byte args := StorageVolLookupByPathArgs { Path: Path, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(97, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Vol: StorageVol _, err = dec.Decode(&rVol) if err != nil { return } return } // StorageVolGetInfo is the go wrapper for REMOTE_PROC_STORAGE_VOL_GET_INFO. func (l *Libvirt) StorageVolGetInfo(Vol StorageVol) (rType int8, rCapacity uint64, rAllocation uint64, err error) { var buf []byte args := StorageVolGetInfoArgs { Vol: Vol, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(98, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Type: int8 _, err = dec.Decode(&rType) if err != nil { return } // Capacity: uint64 _, err = dec.Decode(&rCapacity) if err != nil { return } // Allocation: uint64 _, err = dec.Decode(&rAllocation) if err != nil { return } return } // StorageVolGetXMLDesc is the go wrapper for REMOTE_PROC_STORAGE_VOL_GET_XML_DESC. func (l *Libvirt) StorageVolGetXMLDesc(Vol StorageVol, Flags uint32) (rXML string, err error) { var buf []byte args := StorageVolGetXMLDescArgs { Vol: Vol, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(99, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // StorageVolGetPath is the go wrapper for REMOTE_PROC_STORAGE_VOL_GET_PATH. func (l *Libvirt) StorageVolGetPath(Vol StorageVol) (rName string, err error) { var buf []byte args := StorageVolGetPathArgs { Vol: Vol, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(100, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Name: string _, err = dec.Decode(&rName) if err != nil { return } return } // NodeGetCellsFreeMemory is the go wrapper for REMOTE_PROC_NODE_GET_CELLS_FREE_MEMORY. func (l *Libvirt) NodeGetCellsFreeMemory(StartCell int32, Maxcells int32) (rCells []uint64, err error) { var buf []byte args := NodeGetCellsFreeMemoryArgs { StartCell: StartCell, Maxcells: Maxcells, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(101, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Cells: []uint64 _, err = dec.Decode(&rCells) if err != nil { return } return } // NodeGetFreeMemory is the go wrapper for REMOTE_PROC_NODE_GET_FREE_MEMORY. func (l *Libvirt) NodeGetFreeMemory() (rFreeMem uint64, err error) { var buf []byte var r response r, err = l.requestStream(102, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // FreeMem: uint64 _, err = dec.Decode(&rFreeMem) if err != nil { return } return } // DomainBlockPeek is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_PEEK. func (l *Libvirt) DomainBlockPeek(Dom Domain, Path string, Offset uint64, Size uint32, Flags uint32) (rBuffer []byte, err error) { var buf []byte args := DomainBlockPeekArgs { Dom: Dom, Path: Path, Offset: Offset, Size: Size, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(103, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Buffer: []byte _, err = dec.Decode(&rBuffer) if err != nil { return } return } // DomainMemoryPeek is the go wrapper for REMOTE_PROC_DOMAIN_MEMORY_PEEK. func (l *Libvirt) DomainMemoryPeek(Dom Domain, Offset uint64, Size uint32, Flags DomainMemoryFlags) (rBuffer []byte, err error) { var buf []byte args := DomainMemoryPeekArgs { Dom: Dom, Offset: Offset, Size: Size, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(104, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Buffer: []byte _, err = dec.Decode(&rBuffer) if err != nil { return } return } // ConnectDomainEventRegister is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER. func (l *Libvirt) ConnectDomainEventRegister() (rCbRegistered int32, err error) { var buf []byte var r response r, err = l.requestStream(105, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CbRegistered: int32 _, err = dec.Decode(&rCbRegistered) if err != nil { return } return } // ConnectDomainEventDeregister is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER. func (l *Libvirt) ConnectDomainEventDeregister() (rCbRegistered int32, err error) { var buf []byte var r response r, err = l.requestStream(106, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CbRegistered: int32 _, err = dec.Decode(&rCbRegistered) if err != nil { return } return } // DomainEventLifecycle is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE. func (l *Libvirt) DomainEventLifecycle() (err error) { var buf []byte _, err = l.requestStream(107, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainMigratePrepare2 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2. func (l *Libvirt) DomainMigratePrepare2(UriIn OptString, Flags uint64, Dname OptString, Resource uint64, DomXML string) (rCookie []byte, rUriOut OptString, err error) { var buf []byte args := DomainMigratePrepare2Args { UriIn: UriIn, Flags: Flags, Dname: Dname, Resource: Resource, DomXML: DomXML, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(108, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Cookie: []byte _, err = dec.Decode(&rCookie) if err != nil { return } // UriOut: OptString _, err = dec.Decode(&rUriOut) if err != nil { return } return } // DomainMigrateFinish2 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_FINISH2. func (l *Libvirt) DomainMigrateFinish2(Dname string, Cookie []byte, Uri string, Flags uint64, Retcode int32) (rDdom Domain, err error) { var buf []byte args := DomainMigrateFinish2Args { Dname: Dname, Cookie: Cookie, Uri: Uri, Flags: Flags, Retcode: Retcode, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(109, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Ddom: Domain _, err = dec.Decode(&rDdom) if err != nil { return } return } // ConnectGetUri is the go wrapper for REMOTE_PROC_CONNECT_GET_URI. func (l *Libvirt) ConnectGetUri() (rUri string, err error) { var buf []byte var r response r, err = l.requestStream(110, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Uri: string _, err = dec.Decode(&rUri) if err != nil { return } return } // NodeNumOfDevices is the go wrapper for REMOTE_PROC_NODE_NUM_OF_DEVICES. func (l *Libvirt) NodeNumOfDevices(Cap OptString, Flags uint32) (rNum int32, err error) { var buf []byte args := NodeNumOfDevicesArgs { Cap: Cap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(111, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // NodeListDevices is the go wrapper for REMOTE_PROC_NODE_LIST_DEVICES. func (l *Libvirt) NodeListDevices(Cap OptString, Maxnames int32, Flags uint32) (rNames []string, err error) { var buf []byte args := NodeListDevicesArgs { Cap: Cap, Maxnames: Maxnames, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(112, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // NodeDeviceLookupByName is the go wrapper for REMOTE_PROC_NODE_DEVICE_LOOKUP_BY_NAME. func (l *Libvirt) NodeDeviceLookupByName(Name string) (rDev NodeDevice, err error) { var buf []byte args := NodeDeviceLookupByNameArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(113, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dev: NodeDevice _, err = dec.Decode(&rDev) if err != nil { return } return } // NodeDeviceGetXMLDesc is the go wrapper for REMOTE_PROC_NODE_DEVICE_GET_XML_DESC. func (l *Libvirt) NodeDeviceGetXMLDesc(Name string, Flags uint32) (rXML string, err error) { var buf []byte args := NodeDeviceGetXMLDescArgs { Name: Name, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(114, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // NodeDeviceGetParent is the go wrapper for REMOTE_PROC_NODE_DEVICE_GET_PARENT. func (l *Libvirt) NodeDeviceGetParent(Name string) (rParentName OptString, err error) { var buf []byte args := NodeDeviceGetParentArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(115, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // ParentName: OptString _, err = dec.Decode(&rParentName) if err != nil { return } return } // NodeDeviceNumOfCaps is the go wrapper for REMOTE_PROC_NODE_DEVICE_NUM_OF_CAPS. func (l *Libvirt) NodeDeviceNumOfCaps(Name string) (rNum int32, err error) { var buf []byte args := NodeDeviceNumOfCapsArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(116, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // NodeDeviceListCaps is the go wrapper for REMOTE_PROC_NODE_DEVICE_LIST_CAPS. func (l *Libvirt) NodeDeviceListCaps(Name string, Maxnames int32) (rNames []string, err error) { var buf []byte args := NodeDeviceListCapsArgs { Name: Name, Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(117, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // NodeDeviceDettach is the go wrapper for REMOTE_PROC_NODE_DEVICE_DETTACH. func (l *Libvirt) NodeDeviceDettach(Name string) (err error) { var buf []byte args := NodeDeviceDettachArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(118, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeDeviceReAttach is the go wrapper for REMOTE_PROC_NODE_DEVICE_RE_ATTACH. func (l *Libvirt) NodeDeviceReAttach(Name string) (err error) { var buf []byte args := NodeDeviceReAttachArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(119, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeDeviceReset is the go wrapper for REMOTE_PROC_NODE_DEVICE_RESET. func (l *Libvirt) NodeDeviceReset(Name string) (err error) { var buf []byte args := NodeDeviceResetArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(120, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetSecurityLabel is the go wrapper for REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL. func (l *Libvirt) DomainGetSecurityLabel(Dom Domain) (rLabel []int8, rEnforcing int32, err error) { var buf []byte args := DomainGetSecurityLabelArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(121, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Label: []int8 _, err = dec.Decode(&rLabel) if err != nil { return } // Enforcing: int32 _, err = dec.Decode(&rEnforcing) if err != nil { return } return } // NodeGetSecurityModel is the go wrapper for REMOTE_PROC_NODE_GET_SECURITY_MODEL. func (l *Libvirt) NodeGetSecurityModel() (rModel []int8, rDoi []int8, err error) { var buf []byte var r response r, err = l.requestStream(122, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Model: []int8 _, err = dec.Decode(&rModel) if err != nil { return } // Doi: []int8 _, err = dec.Decode(&rDoi) if err != nil { return } return } // NodeDeviceCreateXML is the go wrapper for REMOTE_PROC_NODE_DEVICE_CREATE_XML. func (l *Libvirt) NodeDeviceCreateXML(XMLDesc string, Flags uint32) (rDev NodeDevice, err error) { var buf []byte args := NodeDeviceCreateXMLArgs { XMLDesc: XMLDesc, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(123, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dev: NodeDevice _, err = dec.Decode(&rDev) if err != nil { return } return } // NodeDeviceDestroy is the go wrapper for REMOTE_PROC_NODE_DEVICE_DESTROY. func (l *Libvirt) NodeDeviceDestroy(Name string) (err error) { var buf []byte args := NodeDeviceDestroyArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(124, constants.Program, buf, nil, nil) if err != nil { return } return } // StorageVolCreateXMLFrom is the go wrapper for REMOTE_PROC_STORAGE_VOL_CREATE_XML_FROM. func (l *Libvirt) StorageVolCreateXMLFrom(Pool StoragePool, XML string, Clonevol StorageVol, Flags StorageVolCreateFlags) (rVol StorageVol, err error) { var buf []byte args := StorageVolCreateXMLFromArgs { Pool: Pool, XML: XML, Clonevol: Clonevol, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(125, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Vol: StorageVol _, err = dec.Decode(&rVol) if err != nil { return } return } // ConnectNumOfInterfaces is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_INTERFACES. func (l *Libvirt) ConnectNumOfInterfaces() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(126, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // ConnectListInterfaces is the go wrapper for REMOTE_PROC_CONNECT_LIST_INTERFACES. func (l *Libvirt) ConnectListInterfaces(Maxnames int32) (rNames []string, err error) { var buf []byte args := ConnectListInterfacesArgs { Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(127, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // InterfaceLookupByName is the go wrapper for REMOTE_PROC_INTERFACE_LOOKUP_BY_NAME. func (l *Libvirt) InterfaceLookupByName(Name string) (rIface Interface, err error) { var buf []byte args := InterfaceLookupByNameArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(128, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Iface: Interface _, err = dec.Decode(&rIface) if err != nil { return } return } // InterfaceLookupByMacString is the go wrapper for REMOTE_PROC_INTERFACE_LOOKUP_BY_MAC_STRING. func (l *Libvirt) InterfaceLookupByMacString(Mac string) (rIface Interface, err error) { var buf []byte args := InterfaceLookupByMacStringArgs { Mac: Mac, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(129, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Iface: Interface _, err = dec.Decode(&rIface) if err != nil { return } return } // InterfaceGetXMLDesc is the go wrapper for REMOTE_PROC_INTERFACE_GET_XML_DESC. func (l *Libvirt) InterfaceGetXMLDesc(Iface Interface, Flags uint32) (rXML string, err error) { var buf []byte args := InterfaceGetXMLDescArgs { Iface: Iface, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(130, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // InterfaceDefineXML is the go wrapper for REMOTE_PROC_INTERFACE_DEFINE_XML. func (l *Libvirt) InterfaceDefineXML(XML string, Flags uint32) (rIface Interface, err error) { var buf []byte args := InterfaceDefineXMLArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(131, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Iface: Interface _, err = dec.Decode(&rIface) if err != nil { return } return } // InterfaceUndefine is the go wrapper for REMOTE_PROC_INTERFACE_UNDEFINE. func (l *Libvirt) InterfaceUndefine(Iface Interface) (err error) { var buf []byte args := InterfaceUndefineArgs { Iface: Iface, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(132, constants.Program, buf, nil, nil) if err != nil { return } return } // InterfaceCreate is the go wrapper for REMOTE_PROC_INTERFACE_CREATE. func (l *Libvirt) InterfaceCreate(Iface Interface, Flags uint32) (err error) { var buf []byte args := InterfaceCreateArgs { Iface: Iface, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(133, constants.Program, buf, nil, nil) if err != nil { return } return } // InterfaceDestroy is the go wrapper for REMOTE_PROC_INTERFACE_DESTROY. func (l *Libvirt) InterfaceDestroy(Iface Interface, Flags uint32) (err error) { var buf []byte args := InterfaceDestroyArgs { Iface: Iface, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(134, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectDomainXMLFromNative is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_XML_FROM_NATIVE. func (l *Libvirt) ConnectDomainXMLFromNative(NativeFormat string, NativeConfig string, Flags uint32) (rDomainXML string, err error) { var buf []byte args := ConnectDomainXMLFromNativeArgs { NativeFormat: NativeFormat, NativeConfig: NativeConfig, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(135, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // DomainXML: string _, err = dec.Decode(&rDomainXML) if err != nil { return } return } // ConnectDomainXMLToNative is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_XML_TO_NATIVE. func (l *Libvirt) ConnectDomainXMLToNative(NativeFormat string, DomainXML string, Flags uint32) (rNativeConfig string, err error) { var buf []byte args := ConnectDomainXMLToNativeArgs { NativeFormat: NativeFormat, DomainXML: DomainXML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(136, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // NativeConfig: string _, err = dec.Decode(&rNativeConfig) if err != nil { return } return } // ConnectNumOfDefinedInterfaces is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_DEFINED_INTERFACES. func (l *Libvirt) ConnectNumOfDefinedInterfaces() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(137, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // ConnectListDefinedInterfaces is the go wrapper for REMOTE_PROC_CONNECT_LIST_DEFINED_INTERFACES. func (l *Libvirt) ConnectListDefinedInterfaces(Maxnames int32) (rNames []string, err error) { var buf []byte args := ConnectListDefinedInterfacesArgs { Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(138, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // ConnectNumOfSecrets is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_SECRETS. func (l *Libvirt) ConnectNumOfSecrets() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(139, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // ConnectListSecrets is the go wrapper for REMOTE_PROC_CONNECT_LIST_SECRETS. func (l *Libvirt) ConnectListSecrets(Maxuuids int32) (rUuids []string, err error) { var buf []byte args := ConnectListSecretsArgs { Maxuuids: Maxuuids, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(140, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Uuids: []string _, err = dec.Decode(&rUuids) if err != nil { return } return } // SecretLookupByUUID is the go wrapper for REMOTE_PROC_SECRET_LOOKUP_BY_UUID. func (l *Libvirt) SecretLookupByUUID(UUID UUID) (rOptSecret Secret, err error) { var buf []byte args := SecretLookupByUUIDArgs { UUID: UUID, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(141, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // OptSecret: Secret _, err = dec.Decode(&rOptSecret) if err != nil { return } return } // SecretDefineXML is the go wrapper for REMOTE_PROC_SECRET_DEFINE_XML. func (l *Libvirt) SecretDefineXML(XML string, Flags uint32) (rOptSecret Secret, err error) { var buf []byte args := SecretDefineXMLArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(142, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // OptSecret: Secret _, err = dec.Decode(&rOptSecret) if err != nil { return } return } // SecretGetXMLDesc is the go wrapper for REMOTE_PROC_SECRET_GET_XML_DESC. func (l *Libvirt) SecretGetXMLDesc(OptSecret Secret, Flags uint32) (rXML string, err error) { var buf []byte args := SecretGetXMLDescArgs { OptSecret: OptSecret, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(143, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // SecretSetValue is the go wrapper for REMOTE_PROC_SECRET_SET_VALUE. func (l *Libvirt) SecretSetValue(OptSecret Secret, Value []byte, Flags uint32) (err error) { var buf []byte args := SecretSetValueArgs { OptSecret: OptSecret, Value: Value, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(144, constants.Program, buf, nil, nil) if err != nil { return } return } // SecretGetValue is the go wrapper for REMOTE_PROC_SECRET_GET_VALUE. func (l *Libvirt) SecretGetValue(OptSecret Secret, Flags uint32) (rValue []byte, err error) { var buf []byte args := SecretGetValueArgs { OptSecret: OptSecret, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(145, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Value: []byte _, err = dec.Decode(&rValue) if err != nil { return } return } // SecretUndefine is the go wrapper for REMOTE_PROC_SECRET_UNDEFINE. func (l *Libvirt) SecretUndefine(OptSecret Secret) (err error) { var buf []byte args := SecretUndefineArgs { OptSecret: OptSecret, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(146, constants.Program, buf, nil, nil) if err != nil { return } return } // SecretLookupByUsage is the go wrapper for REMOTE_PROC_SECRET_LOOKUP_BY_USAGE. func (l *Libvirt) SecretLookupByUsage(UsageType int32, UsageID string) (rOptSecret Secret, err error) { var buf []byte args := SecretLookupByUsageArgs { UsageType: UsageType, UsageID: UsageID, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(147, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // OptSecret: Secret _, err = dec.Decode(&rOptSecret) if err != nil { return } return } // DomainMigratePrepareTunnel is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL. func (l *Libvirt) DomainMigratePrepareTunnel(Flags uint64, outStream io.Reader, Dname OptString, Resource uint64, DomXML string) (err error) { var buf []byte args := DomainMigratePrepareTunnelArgs { Flags: Flags, Dname: Dname, Resource: Resource, DomXML: DomXML, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(148, constants.Program, buf, outStream, nil) if err != nil { return } return } // ConnectIsSecure is the go wrapper for REMOTE_PROC_CONNECT_IS_SECURE. func (l *Libvirt) ConnectIsSecure() (rSecure int32, err error) { var buf []byte var r response r, err = l.requestStream(149, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Secure: int32 _, err = dec.Decode(&rSecure) if err != nil { return } return } // DomainIsActive is the go wrapper for REMOTE_PROC_DOMAIN_IS_ACTIVE. func (l *Libvirt) DomainIsActive(Dom Domain) (rActive int32, err error) { var buf []byte args := DomainIsActiveArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(150, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Active: int32 _, err = dec.Decode(&rActive) if err != nil { return } return } // DomainIsPersistent is the go wrapper for REMOTE_PROC_DOMAIN_IS_PERSISTENT. func (l *Libvirt) DomainIsPersistent(Dom Domain) (rPersistent int32, err error) { var buf []byte args := DomainIsPersistentArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(151, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Persistent: int32 _, err = dec.Decode(&rPersistent) if err != nil { return } return } // NetworkIsActive is the go wrapper for REMOTE_PROC_NETWORK_IS_ACTIVE. func (l *Libvirt) NetworkIsActive(Net Network) (rActive int32, err error) { var buf []byte args := NetworkIsActiveArgs { Net: Net, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(152, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Active: int32 _, err = dec.Decode(&rActive) if err != nil { return } return } // NetworkIsPersistent is the go wrapper for REMOTE_PROC_NETWORK_IS_PERSISTENT. func (l *Libvirt) NetworkIsPersistent(Net Network) (rPersistent int32, err error) { var buf []byte args := NetworkIsPersistentArgs { Net: Net, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(153, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Persistent: int32 _, err = dec.Decode(&rPersistent) if err != nil { return } return } // StoragePoolIsActive is the go wrapper for REMOTE_PROC_STORAGE_POOL_IS_ACTIVE. func (l *Libvirt) StoragePoolIsActive(Pool StoragePool) (rActive int32, err error) { var buf []byte args := StoragePoolIsActiveArgs { Pool: Pool, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(154, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Active: int32 _, err = dec.Decode(&rActive) if err != nil { return } return } // StoragePoolIsPersistent is the go wrapper for REMOTE_PROC_STORAGE_POOL_IS_PERSISTENT. func (l *Libvirt) StoragePoolIsPersistent(Pool StoragePool) (rPersistent int32, err error) { var buf []byte args := StoragePoolIsPersistentArgs { Pool: Pool, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(155, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Persistent: int32 _, err = dec.Decode(&rPersistent) if err != nil { return } return } // InterfaceIsActive is the go wrapper for REMOTE_PROC_INTERFACE_IS_ACTIVE. func (l *Libvirt) InterfaceIsActive(Iface Interface) (rActive int32, err error) { var buf []byte args := InterfaceIsActiveArgs { Iface: Iface, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(156, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Active: int32 _, err = dec.Decode(&rActive) if err != nil { return } return } // ConnectGetLibVersion is the go wrapper for REMOTE_PROC_CONNECT_GET_LIB_VERSION. func (l *Libvirt) ConnectGetLibVersion() (rLibVer uint64, err error) { var buf []byte var r response r, err = l.requestStream(157, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // LibVer: uint64 _, err = dec.Decode(&rLibVer) if err != nil { return } return } // ConnectCompareCPU is the go wrapper for REMOTE_PROC_CONNECT_COMPARE_CPU. func (l *Libvirt) ConnectCompareCPU(XML string, Flags ConnectCompareCPUFlags) (rResult int32, err error) { var buf []byte args := ConnectCompareCPUArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(158, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Result: int32 _, err = dec.Decode(&rResult) if err != nil { return } return } // DomainMemoryStats is the go wrapper for REMOTE_PROC_DOMAIN_MEMORY_STATS. func (l *Libvirt) DomainMemoryStats(Dom Domain, MaxStats uint32, Flags uint32) (rStats []DomainMemoryStat, err error) { var buf []byte args := DomainMemoryStatsArgs { Dom: Dom, MaxStats: MaxStats, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(159, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Stats: []DomainMemoryStat _, err = dec.Decode(&rStats) if err != nil { return } return } // DomainAttachDeviceFlags is the go wrapper for REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS. func (l *Libvirt) DomainAttachDeviceFlags(Dom Domain, XML string, Flags uint32) (err error) { var buf []byte args := DomainAttachDeviceFlagsArgs { Dom: Dom, XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(160, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainDetachDeviceFlags is the go wrapper for REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS. func (l *Libvirt) DomainDetachDeviceFlags(Dom Domain, XML string, Flags uint32) (err error) { var buf []byte args := DomainDetachDeviceFlagsArgs { Dom: Dom, XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(161, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectBaselineCPU is the go wrapper for REMOTE_PROC_CONNECT_BASELINE_CPU. func (l *Libvirt) ConnectBaselineCPU(XMLCPUs []string, Flags ConnectBaselineCPUFlags) (rCPU string, err error) { var buf []byte args := ConnectBaselineCPUArgs { XMLCPUs: XMLCPUs, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(162, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CPU: string _, err = dec.Decode(&rCPU) if err != nil { return } return } // DomainGetJobInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_JOB_INFO. func (l *Libvirt) DomainGetJobInfo(Dom Domain) (rType int32, rTimeElapsed uint64, rTimeRemaining uint64, rDataTotal uint64, rDataProcessed uint64, rDataRemaining uint64, rMemTotal uint64, rMemProcessed uint64, rMemRemaining uint64, rFileTotal uint64, rFileProcessed uint64, rFileRemaining uint64, err error) { var buf []byte args := DomainGetJobInfoArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(163, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Type: int32 _, err = dec.Decode(&rType) if err != nil { return } // TimeElapsed: uint64 _, err = dec.Decode(&rTimeElapsed) if err != nil { return } // TimeRemaining: uint64 _, err = dec.Decode(&rTimeRemaining) if err != nil { return } // DataTotal: uint64 _, err = dec.Decode(&rDataTotal) if err != nil { return } // DataProcessed: uint64 _, err = dec.Decode(&rDataProcessed) if err != nil { return } // DataRemaining: uint64 _, err = dec.Decode(&rDataRemaining) if err != nil { return } // MemTotal: uint64 _, err = dec.Decode(&rMemTotal) if err != nil { return } // MemProcessed: uint64 _, err = dec.Decode(&rMemProcessed) if err != nil { return } // MemRemaining: uint64 _, err = dec.Decode(&rMemRemaining) if err != nil { return } // FileTotal: uint64 _, err = dec.Decode(&rFileTotal) if err != nil { return } // FileProcessed: uint64 _, err = dec.Decode(&rFileProcessed) if err != nil { return } // FileRemaining: uint64 _, err = dec.Decode(&rFileRemaining) if err != nil { return } return } // DomainAbortJob is the go wrapper for REMOTE_PROC_DOMAIN_ABORT_JOB. func (l *Libvirt) DomainAbortJob(Dom Domain) (err error) { var buf []byte args := DomainAbortJobArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(164, constants.Program, buf, nil, nil) if err != nil { return } return } // StorageVolWipe is the go wrapper for REMOTE_PROC_STORAGE_VOL_WIPE. func (l *Libvirt) StorageVolWipe(Vol StorageVol, Flags uint32) (err error) { var buf []byte args := StorageVolWipeArgs { Vol: Vol, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(165, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainMigrateSetMaxDowntime is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_DOWNTIME. func (l *Libvirt) DomainMigrateSetMaxDowntime(Dom Domain, Downtime uint64, Flags uint32) (err error) { var buf []byte args := DomainMigrateSetMaxDowntimeArgs { Dom: Dom, Downtime: Downtime, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(166, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectDomainEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY. func (l *Libvirt) ConnectDomainEventRegisterAny(EventID int32) (err error) { var buf []byte args := ConnectDomainEventRegisterAnyArgs { EventID: EventID, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(167, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectDomainEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_DEREGISTER_ANY. func (l *Libvirt) ConnectDomainEventDeregisterAny(EventID int32) (err error) { var buf []byte args := ConnectDomainEventDeregisterAnyArgs { EventID: EventID, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(168, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventReboot is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_REBOOT. func (l *Libvirt) DomainEventReboot() (err error) { var buf []byte _, err = l.requestStream(169, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventRtcChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE. func (l *Libvirt) DomainEventRtcChange() (err error) { var buf []byte _, err = l.requestStream(170, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventWatchdog is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_WATCHDOG. func (l *Libvirt) DomainEventWatchdog() (err error) { var buf []byte _, err = l.requestStream(171, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventIOError is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_IO_ERROR. func (l *Libvirt) DomainEventIOError() (err error) { var buf []byte _, err = l.requestStream(172, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventGraphics is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_GRAPHICS. func (l *Libvirt) DomainEventGraphics() (err error) { var buf []byte _, err = l.requestStream(173, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainUpdateDeviceFlags is the go wrapper for REMOTE_PROC_DOMAIN_UPDATE_DEVICE_FLAGS. func (l *Libvirt) DomainUpdateDeviceFlags(Dom Domain, XML string, Flags DomainDeviceModifyFlags) (err error) { var buf []byte args := DomainUpdateDeviceFlagsArgs { Dom: Dom, XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(174, constants.Program, buf, nil, nil) if err != nil { return } return } // NwfilterLookupByName is the go wrapper for REMOTE_PROC_NWFILTER_LOOKUP_BY_NAME. func (l *Libvirt) NwfilterLookupByName(Name string) (rOptNwfilter Nwfilter, err error) { var buf []byte args := NwfilterLookupByNameArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(175, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // OptNwfilter: Nwfilter _, err = dec.Decode(&rOptNwfilter) if err != nil { return } return } // NwfilterLookupByUUID is the go wrapper for REMOTE_PROC_NWFILTER_LOOKUP_BY_UUID. func (l *Libvirt) NwfilterLookupByUUID(UUID UUID) (rOptNwfilter Nwfilter, err error) { var buf []byte args := NwfilterLookupByUUIDArgs { UUID: UUID, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(176, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // OptNwfilter: Nwfilter _, err = dec.Decode(&rOptNwfilter) if err != nil { return } return } // NwfilterGetXMLDesc is the go wrapper for REMOTE_PROC_NWFILTER_GET_XML_DESC. func (l *Libvirt) NwfilterGetXMLDesc(OptNwfilter Nwfilter, Flags uint32) (rXML string, err error) { var buf []byte args := NwfilterGetXMLDescArgs { OptNwfilter: OptNwfilter, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(177, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // ConnectNumOfNwfilters is the go wrapper for REMOTE_PROC_CONNECT_NUM_OF_NWFILTERS. func (l *Libvirt) ConnectNumOfNwfilters() (rNum int32, err error) { var buf []byte var r response r, err = l.requestStream(178, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // ConnectListNwfilters is the go wrapper for REMOTE_PROC_CONNECT_LIST_NWFILTERS. func (l *Libvirt) ConnectListNwfilters(Maxnames int32) (rNames []string, err error) { var buf []byte args := ConnectListNwfiltersArgs { Maxnames: Maxnames, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(179, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // NwfilterDefineXML is the go wrapper for REMOTE_PROC_NWFILTER_DEFINE_XML. func (l *Libvirt) NwfilterDefineXML(XML string) (rOptNwfilter Nwfilter, err error) { var buf []byte args := NwfilterDefineXMLArgs { XML: XML, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(180, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // OptNwfilter: Nwfilter _, err = dec.Decode(&rOptNwfilter) if err != nil { return } return } // NwfilterUndefine is the go wrapper for REMOTE_PROC_NWFILTER_UNDEFINE. func (l *Libvirt) NwfilterUndefine(OptNwfilter Nwfilter) (err error) { var buf []byte args := NwfilterUndefineArgs { OptNwfilter: OptNwfilter, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(181, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainManagedSave is the go wrapper for REMOTE_PROC_DOMAIN_MANAGED_SAVE. func (l *Libvirt) DomainManagedSave(Dom Domain, Flags uint32) (err error) { var buf []byte args := DomainManagedSaveArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(182, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainHasManagedSaveImage is the go wrapper for REMOTE_PROC_DOMAIN_HAS_MANAGED_SAVE_IMAGE. func (l *Libvirt) DomainHasManagedSaveImage(Dom Domain, Flags uint32) (rResult int32, err error) { var buf []byte args := DomainHasManagedSaveImageArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(183, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Result: int32 _, err = dec.Decode(&rResult) if err != nil { return } return } // DomainManagedSaveRemove is the go wrapper for REMOTE_PROC_DOMAIN_MANAGED_SAVE_REMOVE. func (l *Libvirt) DomainManagedSaveRemove(Dom Domain, Flags uint32) (err error) { var buf []byte args := DomainManagedSaveRemoveArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(184, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSnapshotCreateXML is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_CREATE_XML. func (l *Libvirt) DomainSnapshotCreateXML(Dom Domain, XMLDesc string, Flags uint32) (rSnap DomainSnapshot, err error) { var buf []byte args := DomainSnapshotCreateXMLArgs { Dom: Dom, XMLDesc: XMLDesc, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(185, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Snap: DomainSnapshot _, err = dec.Decode(&rSnap) if err != nil { return } return } // DomainSnapshotGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_GET_XML_DESC. func (l *Libvirt) DomainSnapshotGetXMLDesc(Snap DomainSnapshot, Flags uint32) (rXML string, err error) { var buf []byte args := DomainSnapshotGetXMLDescArgs { Snap: Snap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(186, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // DomainSnapshotNum is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_NUM. func (l *Libvirt) DomainSnapshotNum(Dom Domain, Flags uint32) (rNum int32, err error) { var buf []byte args := DomainSnapshotNumArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(187, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // DomainSnapshotListNames is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_NAMES. func (l *Libvirt) DomainSnapshotListNames(Dom Domain, Maxnames int32, Flags uint32) (rNames []string, err error) { var buf []byte args := DomainSnapshotListNamesArgs { Dom: Dom, Maxnames: Maxnames, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(188, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // DomainSnapshotLookupByName is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_LOOKUP_BY_NAME. func (l *Libvirt) DomainSnapshotLookupByName(Dom Domain, Name string, Flags uint32) (rSnap DomainSnapshot, err error) { var buf []byte args := DomainSnapshotLookupByNameArgs { Dom: Dom, Name: Name, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(189, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Snap: DomainSnapshot _, err = dec.Decode(&rSnap) if err != nil { return } return } // DomainHasCurrentSnapshot is the go wrapper for REMOTE_PROC_DOMAIN_HAS_CURRENT_SNAPSHOT. func (l *Libvirt) DomainHasCurrentSnapshot(Dom Domain, Flags uint32) (rResult int32, err error) { var buf []byte args := DomainHasCurrentSnapshotArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(190, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Result: int32 _, err = dec.Decode(&rResult) if err != nil { return } return } // DomainSnapshotCurrent is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_CURRENT. func (l *Libvirt) DomainSnapshotCurrent(Dom Domain, Flags uint32) (rSnap DomainSnapshot, err error) { var buf []byte args := DomainSnapshotCurrentArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(191, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Snap: DomainSnapshot _, err = dec.Decode(&rSnap) if err != nil { return } return } // DomainRevertToSnapshot is the go wrapper for REMOTE_PROC_DOMAIN_REVERT_TO_SNAPSHOT. func (l *Libvirt) DomainRevertToSnapshot(Snap DomainSnapshot, Flags uint32) (err error) { var buf []byte args := DomainRevertToSnapshotArgs { Snap: Snap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(192, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSnapshotDelete is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_DELETE. func (l *Libvirt) DomainSnapshotDelete(Snap DomainSnapshot, Flags DomainSnapshotDeleteFlags) (err error) { var buf []byte args := DomainSnapshotDeleteArgs { Snap: Snap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(193, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetBlockInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_BLOCK_INFO. func (l *Libvirt) DomainGetBlockInfo(Dom Domain, Path string, Flags uint32) (rAllocation uint64, rCapacity uint64, rPhysical uint64, err error) { var buf []byte args := DomainGetBlockInfoArgs { Dom: Dom, Path: Path, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(194, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Allocation: uint64 _, err = dec.Decode(&rAllocation) if err != nil { return } // Capacity: uint64 _, err = dec.Decode(&rCapacity) if err != nil { return } // Physical: uint64 _, err = dec.Decode(&rPhysical) if err != nil { return } return } // DomainEventIOErrorReason is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_REASON. func (l *Libvirt) DomainEventIOErrorReason() (err error) { var buf []byte _, err = l.requestStream(195, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainCreateWithFlags is the go wrapper for REMOTE_PROC_DOMAIN_CREATE_WITH_FLAGS. func (l *Libvirt) DomainCreateWithFlags(Dom Domain, Flags uint32) (rDom Domain, err error) { var buf []byte args := DomainCreateWithFlagsArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(196, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // DomainSetMemoryParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_MEMORY_PARAMETERS. func (l *Libvirt) DomainSetMemoryParameters(Dom Domain, Params []TypedParam, Flags uint32) (err error) { var buf []byte args := DomainSetMemoryParametersArgs { Dom: Dom, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(197, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetMemoryParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS. func (l *Libvirt) DomainGetMemoryParameters(Dom Domain, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := DomainGetMemoryParametersArgs { Dom: Dom, Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(198, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainSetVcpusFlags is the go wrapper for REMOTE_PROC_DOMAIN_SET_VCPUS_FLAGS. func (l *Libvirt) DomainSetVcpusFlags(Dom Domain, Nvcpus uint32, Flags uint32) (err error) { var buf []byte args := DomainSetVcpusFlagsArgs { Dom: Dom, Nvcpus: Nvcpus, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(199, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetVcpusFlags is the go wrapper for REMOTE_PROC_DOMAIN_GET_VCPUS_FLAGS. func (l *Libvirt) DomainGetVcpusFlags(Dom Domain, Flags uint32) (rNum int32, err error) { var buf []byte args := DomainGetVcpusFlagsArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(200, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // DomainOpenConsole is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_CONSOLE. func (l *Libvirt) DomainOpenConsole(Dom Domain, DevName OptString, inStream io.Writer, Flags uint32) (err error) { var buf []byte args := DomainOpenConsoleArgs { Dom: Dom, DevName: DevName, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(201, constants.Program, buf, nil, inStream) if err != nil { return } return } // DomainIsUpdated is the go wrapper for REMOTE_PROC_DOMAIN_IS_UPDATED. func (l *Libvirt) DomainIsUpdated(Dom Domain) (rUpdated int32, err error) { var buf []byte args := DomainIsUpdatedArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(202, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Updated: int32 _, err = dec.Decode(&rUpdated) if err != nil { return } return } // ConnectGetSysinfo is the go wrapper for REMOTE_PROC_CONNECT_GET_SYSINFO. func (l *Libvirt) ConnectGetSysinfo(Flags uint32) (rSysinfo string, err error) { var buf []byte args := ConnectGetSysinfoArgs { Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(203, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Sysinfo: string _, err = dec.Decode(&rSysinfo) if err != nil { return } return } // DomainSetMemoryFlags is the go wrapper for REMOTE_PROC_DOMAIN_SET_MEMORY_FLAGS. func (l *Libvirt) DomainSetMemoryFlags(Dom Domain, Memory uint64, Flags uint32) (err error) { var buf []byte args := DomainSetMemoryFlagsArgs { Dom: Dom, Memory: Memory, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(204, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetBlkioParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_BLKIO_PARAMETERS. func (l *Libvirt) DomainSetBlkioParameters(Dom Domain, Params []TypedParam, Flags uint32) (err error) { var buf []byte args := DomainSetBlkioParametersArgs { Dom: Dom, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(205, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetBlkioParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS. func (l *Libvirt) DomainGetBlkioParameters(Dom Domain, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := DomainGetBlkioParametersArgs { Dom: Dom, Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(206, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainMigrateSetMaxSpeed is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_SET_MAX_SPEED. func (l *Libvirt) DomainMigrateSetMaxSpeed(Dom Domain, Bandwidth uint64, Flags uint32) (err error) { var buf []byte args := DomainMigrateSetMaxSpeedArgs { Dom: Dom, Bandwidth: Bandwidth, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(207, constants.Program, buf, nil, nil) if err != nil { return } return } // StorageVolUpload is the go wrapper for REMOTE_PROC_STORAGE_VOL_UPLOAD. func (l *Libvirt) StorageVolUpload(Vol StorageVol, outStream io.Reader, Offset uint64, Length uint64, Flags StorageVolUploadFlags) (err error) { var buf []byte args := StorageVolUploadArgs { Vol: Vol, Offset: Offset, Length: Length, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(208, constants.Program, buf, outStream, nil) if err != nil { return } return } // StorageVolDownload is the go wrapper for REMOTE_PROC_STORAGE_VOL_DOWNLOAD. func (l *Libvirt) StorageVolDownload(Vol StorageVol, inStream io.Writer, Offset uint64, Length uint64, Flags StorageVolDownloadFlags) (err error) { var buf []byte args := StorageVolDownloadArgs { Vol: Vol, Offset: Offset, Length: Length, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(209, constants.Program, buf, nil, inStream) if err != nil { return } return } // DomainInjectNmi is the go wrapper for REMOTE_PROC_DOMAIN_INJECT_NMI. func (l *Libvirt) DomainInjectNmi(Dom Domain, Flags uint32) (err error) { var buf []byte args := DomainInjectNmiArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(210, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainScreenshot is the go wrapper for REMOTE_PROC_DOMAIN_SCREENSHOT. func (l *Libvirt) DomainScreenshot(Dom Domain, inStream io.Writer, Screen uint32, Flags uint32) (rMime OptString, err error) { var buf []byte args := DomainScreenshotArgs { Dom: Dom, Screen: Screen, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(211, constants.Program, buf, nil, inStream) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Mime: OptString _, err = dec.Decode(&rMime) if err != nil { return } return } // DomainGetState is the go wrapper for REMOTE_PROC_DOMAIN_GET_STATE. func (l *Libvirt) DomainGetState(Dom Domain, Flags uint32) (rState int32, rReason int32, err error) { var buf []byte args := DomainGetStateArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(212, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // State: int32 _, err = dec.Decode(&rState) if err != nil { return } // Reason: int32 _, err = dec.Decode(&rReason) if err != nil { return } return } // DomainMigrateBegin3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3. func (l *Libvirt) DomainMigrateBegin3(Dom Domain, Xmlin OptString, Flags uint64, Dname OptString, Resource uint64) (rCookieOut []byte, rXML string, err error) { var buf []byte args := DomainMigrateBegin3Args { Dom: Dom, Xmlin: Xmlin, Flags: Flags, Dname: Dname, Resource: Resource, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(213, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // DomainMigratePrepare3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3. func (l *Libvirt) DomainMigratePrepare3(CookieIn []byte, UriIn OptString, Flags uint64, Dname OptString, Resource uint64, DomXML string) (rCookieOut []byte, rUriOut OptString, err error) { var buf []byte args := DomainMigratePrepare3Args { CookieIn: CookieIn, UriIn: UriIn, Flags: Flags, Dname: Dname, Resource: Resource, DomXML: DomXML, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(214, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } // UriOut: OptString _, err = dec.Decode(&rUriOut) if err != nil { return } return } // DomainMigratePrepareTunnel3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3. func (l *Libvirt) DomainMigratePrepareTunnel3(CookieIn []byte, outStream io.Reader, Flags uint64, Dname OptString, Resource uint64, DomXML string) (rCookieOut []byte, err error) { var buf []byte args := DomainMigratePrepareTunnel3Args { CookieIn: CookieIn, Flags: Flags, Dname: Dname, Resource: Resource, DomXML: DomXML, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(215, constants.Program, buf, outStream, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } return } // DomainMigratePerform3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3. func (l *Libvirt) DomainMigratePerform3(Dom Domain, Xmlin OptString, CookieIn []byte, Dconnuri OptString, Uri OptString, Flags uint64, Dname OptString, Resource uint64) (rCookieOut []byte, err error) { var buf []byte args := DomainMigratePerform3Args { Dom: Dom, Xmlin: Xmlin, CookieIn: CookieIn, Dconnuri: Dconnuri, Uri: Uri, Flags: Flags, Dname: Dname, Resource: Resource, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(216, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } return } // DomainMigrateFinish3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_FINISH3. func (l *Libvirt) DomainMigrateFinish3(Dname string, CookieIn []byte, Dconnuri OptString, Uri OptString, Flags uint64, Cancelled int32) (rDom Domain, rCookieOut []byte, err error) { var buf []byte args := DomainMigrateFinish3Args { Dname: Dname, CookieIn: CookieIn, Dconnuri: Dconnuri, Uri: Uri, Flags: Flags, Cancelled: Cancelled, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(217, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } return } // DomainMigrateConfirm3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3. func (l *Libvirt) DomainMigrateConfirm3(Dom Domain, CookieIn []byte, Flags uint64, Cancelled int32) (err error) { var buf []byte args := DomainMigrateConfirm3Args { Dom: Dom, CookieIn: CookieIn, Flags: Flags, Cancelled: Cancelled, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(218, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetSchedulerParametersFlags is the go wrapper for REMOTE_PROC_DOMAIN_SET_SCHEDULER_PARAMETERS_FLAGS. func (l *Libvirt) DomainSetSchedulerParametersFlags(Dom Domain, Params []TypedParam, Flags uint32) (err error) { var buf []byte args := DomainSetSchedulerParametersFlagsArgs { Dom: Dom, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(219, constants.Program, buf, nil, nil) if err != nil { return } return } // InterfaceChangeBegin is the go wrapper for REMOTE_PROC_INTERFACE_CHANGE_BEGIN. func (l *Libvirt) InterfaceChangeBegin(Flags uint32) (err error) { var buf []byte args := InterfaceChangeBeginArgs { Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(220, constants.Program, buf, nil, nil) if err != nil { return } return } // InterfaceChangeCommit is the go wrapper for REMOTE_PROC_INTERFACE_CHANGE_COMMIT. func (l *Libvirt) InterfaceChangeCommit(Flags uint32) (err error) { var buf []byte args := InterfaceChangeCommitArgs { Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(221, constants.Program, buf, nil, nil) if err != nil { return } return } // InterfaceChangeRollback is the go wrapper for REMOTE_PROC_INTERFACE_CHANGE_ROLLBACK. func (l *Libvirt) InterfaceChangeRollback(Flags uint32) (err error) { var buf []byte args := InterfaceChangeRollbackArgs { Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(222, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetSchedulerParametersFlags is the go wrapper for REMOTE_PROC_DOMAIN_GET_SCHEDULER_PARAMETERS_FLAGS. func (l *Libvirt) DomainGetSchedulerParametersFlags(Dom Domain, Nparams int32, Flags uint32) (rParams []TypedParam, err error) { var buf []byte args := DomainGetSchedulerParametersFlagsArgs { Dom: Dom, Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(223, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } return } // DomainEventControlError is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERROR. func (l *Libvirt) DomainEventControlError() (err error) { var buf []byte _, err = l.requestStream(224, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainPinVcpuFlags is the go wrapper for REMOTE_PROC_DOMAIN_PIN_VCPU_FLAGS. func (l *Libvirt) DomainPinVcpuFlags(Dom Domain, Vcpu uint32, Cpumap []byte, Flags uint32) (err error) { var buf []byte args := DomainPinVcpuFlagsArgs { Dom: Dom, Vcpu: Vcpu, Cpumap: Cpumap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(225, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSendKey is the go wrapper for REMOTE_PROC_DOMAIN_SEND_KEY. func (l *Libvirt) DomainSendKey(Dom Domain, Codeset uint32, Holdtime uint32, Keycodes []uint32, Flags uint32) (err error) { var buf []byte args := DomainSendKeyArgs { Dom: Dom, Codeset: Codeset, Holdtime: Holdtime, Keycodes: Keycodes, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(226, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeGetCPUStats is the go wrapper for REMOTE_PROC_NODE_GET_CPU_STATS. func (l *Libvirt) NodeGetCPUStats(CPUNum int32, Nparams int32, Flags uint32) (rParams []NodeGetCPUStats, rNparams int32, err error) { var buf []byte args := NodeGetCPUStatsArgs { CPUNum: CPUNum, Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(227, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []NodeGetCPUStats _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // NodeGetMemoryStats is the go wrapper for REMOTE_PROC_NODE_GET_MEMORY_STATS. func (l *Libvirt) NodeGetMemoryStats(Nparams int32, CellNum int32, Flags uint32) (rParams []NodeGetMemoryStats, rNparams int32, err error) { var buf []byte args := NodeGetMemoryStatsArgs { Nparams: Nparams, CellNum: CellNum, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(228, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []NodeGetMemoryStats _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainGetControlInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_CONTROL_INFO. func (l *Libvirt) DomainGetControlInfo(Dom Domain, Flags uint32) (rState uint32, rDetails uint32, rStateTime uint64, err error) { var buf []byte args := DomainGetControlInfoArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(229, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // State: uint32 _, err = dec.Decode(&rState) if err != nil { return } // Details: uint32 _, err = dec.Decode(&rDetails) if err != nil { return } // StateTime: uint64 _, err = dec.Decode(&rStateTime) if err != nil { return } return } // DomainGetVcpuPinInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO. func (l *Libvirt) DomainGetVcpuPinInfo(Dom Domain, Ncpumaps int32, Maplen int32, Flags uint32) (rCpumaps []byte, rNum int32, err error) { var buf []byte args := DomainGetVcpuPinInfoArgs { Dom: Dom, Ncpumaps: Ncpumaps, Maplen: Maplen, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(230, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Cpumaps: []byte _, err = dec.Decode(&rCpumaps) if err != nil { return } // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // DomainUndefineFlags is the go wrapper for REMOTE_PROC_DOMAIN_UNDEFINE_FLAGS. func (l *Libvirt) DomainUndefineFlags(Dom Domain, Flags DomainUndefineFlagsValues) (err error) { var buf []byte args := DomainUndefineFlagsArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(231, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSaveFlags is the go wrapper for REMOTE_PROC_DOMAIN_SAVE_FLAGS. func (l *Libvirt) DomainSaveFlags(Dom Domain, To string, Dxml OptString, Flags uint32) (err error) { var buf []byte args := DomainSaveFlagsArgs { Dom: Dom, To: To, Dxml: Dxml, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(232, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainRestoreFlags is the go wrapper for REMOTE_PROC_DOMAIN_RESTORE_FLAGS. func (l *Libvirt) DomainRestoreFlags(From string, Dxml OptString, Flags uint32) (err error) { var buf []byte args := DomainRestoreFlagsArgs { From: From, Dxml: Dxml, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(233, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainDestroyFlags is the go wrapper for REMOTE_PROC_DOMAIN_DESTROY_FLAGS. func (l *Libvirt) DomainDestroyFlags(Dom Domain, Flags DomainDestroyFlagsValues) (err error) { var buf []byte args := DomainDestroyFlagsArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(234, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSaveImageGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_SAVE_IMAGE_GET_XML_DESC. func (l *Libvirt) DomainSaveImageGetXMLDesc(File string, Flags uint32) (rXML string, err error) { var buf []byte args := DomainSaveImageGetXMLDescArgs { File: File, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(235, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // DomainSaveImageDefineXML is the go wrapper for REMOTE_PROC_DOMAIN_SAVE_IMAGE_DEFINE_XML. func (l *Libvirt) DomainSaveImageDefineXML(File string, Dxml string, Flags uint32) (err error) { var buf []byte args := DomainSaveImageDefineXMLArgs { File: File, Dxml: Dxml, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(236, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainBlockJobAbort is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_JOB_ABORT. func (l *Libvirt) DomainBlockJobAbort(Dom Domain, Path string, Flags DomainBlockJobAbortFlags) (err error) { var buf []byte args := DomainBlockJobAbortArgs { Dom: Dom, Path: Path, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(237, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetBlockJobInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_BLOCK_JOB_INFO. func (l *Libvirt) DomainGetBlockJobInfo(Dom Domain, Path string, Flags uint32) (rFound int32, rType int32, rBandwidth uint64, rCur uint64, rEnd uint64, err error) { var buf []byte args := DomainGetBlockJobInfoArgs { Dom: Dom, Path: Path, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(238, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Found: int32 _, err = dec.Decode(&rFound) if err != nil { return } // Type: int32 _, err = dec.Decode(&rType) if err != nil { return } // Bandwidth: uint64 _, err = dec.Decode(&rBandwidth) if err != nil { return } // Cur: uint64 _, err = dec.Decode(&rCur) if err != nil { return } // End: uint64 _, err = dec.Decode(&rEnd) if err != nil { return } return } // DomainBlockJobSetSpeed is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_JOB_SET_SPEED. func (l *Libvirt) DomainBlockJobSetSpeed(Dom Domain, Path string, Bandwidth uint64, Flags DomainBlockJobSetSpeedFlags) (err error) { var buf []byte args := DomainBlockJobSetSpeedArgs { Dom: Dom, Path: Path, Bandwidth: Bandwidth, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(239, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainBlockPull is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_PULL. func (l *Libvirt) DomainBlockPull(Dom Domain, Path string, Bandwidth uint64, Flags DomainBlockPullFlags) (err error) { var buf []byte args := DomainBlockPullArgs { Dom: Dom, Path: Path, Bandwidth: Bandwidth, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(240, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventBlockJob is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB. func (l *Libvirt) DomainEventBlockJob() (err error) { var buf []byte _, err = l.requestStream(241, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainMigrateGetMaxSpeed is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_SPEED. func (l *Libvirt) DomainMigrateGetMaxSpeed(Dom Domain, Flags uint32) (rBandwidth uint64, err error) { var buf []byte args := DomainMigrateGetMaxSpeedArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(242, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Bandwidth: uint64 _, err = dec.Decode(&rBandwidth) if err != nil { return } return } // DomainBlockStatsFlags is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS. func (l *Libvirt) DomainBlockStatsFlags(Dom Domain, Path string, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := DomainBlockStatsFlagsArgs { Dom: Dom, Path: Path, Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(243, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainSnapshotGetParent is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_GET_PARENT. func (l *Libvirt) DomainSnapshotGetParent(Snap DomainSnapshot, Flags uint32) (rSnap DomainSnapshot, err error) { var buf []byte args := DomainSnapshotGetParentArgs { Snap: Snap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(244, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Snap: DomainSnapshot _, err = dec.Decode(&rSnap) if err != nil { return } return } // DomainReset is the go wrapper for REMOTE_PROC_DOMAIN_RESET. func (l *Libvirt) DomainReset(Dom Domain, Flags uint32) (err error) { var buf []byte args := DomainResetArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(245, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSnapshotNumChildren is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_NUM_CHILDREN. func (l *Libvirt) DomainSnapshotNumChildren(Snap DomainSnapshot, Flags uint32) (rNum int32, err error) { var buf []byte args := DomainSnapshotNumChildrenArgs { Snap: Snap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(246, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Num: int32 _, err = dec.Decode(&rNum) if err != nil { return } return } // DomainSnapshotListChildrenNames is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_CHILDREN_NAMES. func (l *Libvirt) DomainSnapshotListChildrenNames(Snap DomainSnapshot, Maxnames int32, Flags uint32) (rNames []string, err error) { var buf []byte args := DomainSnapshotListChildrenNamesArgs { Snap: Snap, Maxnames: Maxnames, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(247, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Names: []string _, err = dec.Decode(&rNames) if err != nil { return } return } // DomainEventDiskChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE. func (l *Libvirt) DomainEventDiskChange() (err error) { var buf []byte _, err = l.requestStream(248, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainOpenGraphics is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_GRAPHICS. func (l *Libvirt) DomainOpenGraphics(Dom Domain, Idx uint32, Flags DomainOpenGraphicsFlags) (err error) { var buf []byte args := DomainOpenGraphicsArgs { Dom: Dom, Idx: Idx, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(249, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeSuspendForDuration is the go wrapper for REMOTE_PROC_NODE_SUSPEND_FOR_DURATION. func (l *Libvirt) NodeSuspendForDuration(Target uint32, Duration uint64, Flags uint32) (err error) { var buf []byte args := NodeSuspendForDurationArgs { Target: Target, Duration: Duration, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(250, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainBlockResize is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_RESIZE. func (l *Libvirt) DomainBlockResize(Dom Domain, Disk string, Size uint64, Flags DomainBlockResizeFlags) (err error) { var buf []byte args := DomainBlockResizeArgs { Dom: Dom, Disk: Disk, Size: Size, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(251, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetBlockIOTune is the go wrapper for REMOTE_PROC_DOMAIN_SET_BLOCK_IO_TUNE. func (l *Libvirt) DomainSetBlockIOTune(Dom Domain, Disk string, Params []TypedParam, Flags uint32) (err error) { var buf []byte args := DomainSetBlockIOTuneArgs { Dom: Dom, Disk: Disk, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(252, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetBlockIOTune is the go wrapper for REMOTE_PROC_DOMAIN_GET_BLOCK_IO_TUNE. func (l *Libvirt) DomainGetBlockIOTune(Dom Domain, Disk OptString, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := DomainGetBlockIOTuneArgs { Dom: Dom, Disk: Disk, Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(253, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainSetNumaParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_NUMA_PARAMETERS. func (l *Libvirt) DomainSetNumaParameters(Dom Domain, Params []TypedParam, Flags uint32) (err error) { var buf []byte args := DomainSetNumaParametersArgs { Dom: Dom, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(254, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetNumaParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS. func (l *Libvirt) DomainGetNumaParameters(Dom Domain, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := DomainGetNumaParametersArgs { Dom: Dom, Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(255, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainSetInterfaceParameters is the go wrapper for REMOTE_PROC_DOMAIN_SET_INTERFACE_PARAMETERS. func (l *Libvirt) DomainSetInterfaceParameters(Dom Domain, Device string, Params []TypedParam, Flags uint32) (err error) { var buf []byte args := DomainSetInterfaceParametersArgs { Dom: Dom, Device: Device, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(256, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetInterfaceParameters is the go wrapper for REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS. func (l *Libvirt) DomainGetInterfaceParameters(Dom Domain, Device string, Nparams int32, Flags DomainModificationImpact) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := DomainGetInterfaceParametersArgs { Dom: Dom, Device: Device, Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(257, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainShutdownFlags is the go wrapper for REMOTE_PROC_DOMAIN_SHUTDOWN_FLAGS. func (l *Libvirt) DomainShutdownFlags(Dom Domain, Flags DomainShutdownFlagValues) (err error) { var buf []byte args := DomainShutdownFlagsArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(258, constants.Program, buf, nil, nil) if err != nil { return } return } // StorageVolWipePattern is the go wrapper for REMOTE_PROC_STORAGE_VOL_WIPE_PATTERN. func (l *Libvirt) StorageVolWipePattern(Vol StorageVol, Algorithm uint32, Flags uint32) (err error) { var buf []byte args := StorageVolWipePatternArgs { Vol: Vol, Algorithm: Algorithm, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(259, constants.Program, buf, nil, nil) if err != nil { return } return } // StorageVolResize is the go wrapper for REMOTE_PROC_STORAGE_VOL_RESIZE. func (l *Libvirt) StorageVolResize(Vol StorageVol, Capacity uint64, Flags StorageVolResizeFlags) (err error) { var buf []byte args := StorageVolResizeArgs { Vol: Vol, Capacity: Capacity, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(260, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainPmSuspendForDuration is the go wrapper for REMOTE_PROC_DOMAIN_PM_SUSPEND_FOR_DURATION. func (l *Libvirt) DomainPmSuspendForDuration(Dom Domain, Target uint32, Duration uint64, Flags uint32) (err error) { var buf []byte args := DomainPmSuspendForDurationArgs { Dom: Dom, Target: Target, Duration: Duration, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(261, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetCPUStats is the go wrapper for REMOTE_PROC_DOMAIN_GET_CPU_STATS. func (l *Libvirt) DomainGetCPUStats(Dom Domain, Nparams uint32, StartCPU int32, Ncpus uint32, Flags TypedParameterFlags) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := DomainGetCPUStatsArgs { Dom: Dom, Nparams: Nparams, StartCPU: StartCPU, Ncpus: Ncpus, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(262, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainGetDiskErrors is the go wrapper for REMOTE_PROC_DOMAIN_GET_DISK_ERRORS. func (l *Libvirt) DomainGetDiskErrors(Dom Domain, Maxerrors uint32, Flags uint32) (rErrors []DomainDiskError, rNerrors int32, err error) { var buf []byte args := DomainGetDiskErrorsArgs { Dom: Dom, Maxerrors: Maxerrors, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(263, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Errors: []DomainDiskError _, err = dec.Decode(&rErrors) if err != nil { return } // Nerrors: int32 _, err = dec.Decode(&rNerrors) if err != nil { return } return } // DomainSetMetadata is the go wrapper for REMOTE_PROC_DOMAIN_SET_METADATA. func (l *Libvirt) DomainSetMetadata(Dom Domain, Type int32, Metadata OptString, Key OptString, Uri OptString, Flags DomainModificationImpact) (err error) { var buf []byte args := DomainSetMetadataArgs { Dom: Dom, Type: Type, Metadata: Metadata, Key: Key, Uri: Uri, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(264, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetMetadata is the go wrapper for REMOTE_PROC_DOMAIN_GET_METADATA. func (l *Libvirt) DomainGetMetadata(Dom Domain, Type int32, Uri OptString, Flags DomainModificationImpact) (rMetadata string, err error) { var buf []byte args := DomainGetMetadataArgs { Dom: Dom, Type: Type, Uri: Uri, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(265, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Metadata: string _, err = dec.Decode(&rMetadata) if err != nil { return } return } // DomainBlockRebase is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_REBASE. func (l *Libvirt) DomainBlockRebase(Dom Domain, Path string, Base OptString, Bandwidth uint64, Flags DomainBlockRebaseFlags) (err error) { var buf []byte args := DomainBlockRebaseArgs { Dom: Dom, Path: Path, Base: Base, Bandwidth: Bandwidth, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(266, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainPmWakeup is the go wrapper for REMOTE_PROC_DOMAIN_PM_WAKEUP. func (l *Libvirt) DomainPmWakeup(Dom Domain, Flags uint32) (err error) { var buf []byte args := DomainPmWakeupArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(267, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventTrayChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE. func (l *Libvirt) DomainEventTrayChange() (err error) { var buf []byte _, err = l.requestStream(268, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventPmwakeup is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP. func (l *Libvirt) DomainEventPmwakeup() (err error) { var buf []byte _, err = l.requestStream(269, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventPmsuspend is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND. func (l *Libvirt) DomainEventPmsuspend() (err error) { var buf []byte _, err = l.requestStream(270, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSnapshotIsCurrent is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_IS_CURRENT. func (l *Libvirt) DomainSnapshotIsCurrent(Snap DomainSnapshot, Flags uint32) (rCurrent int32, err error) { var buf []byte args := DomainSnapshotIsCurrentArgs { Snap: Snap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(271, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Current: int32 _, err = dec.Decode(&rCurrent) if err != nil { return } return } // DomainSnapshotHasMetadata is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA. func (l *Libvirt) DomainSnapshotHasMetadata(Snap DomainSnapshot, Flags uint32) (rMetadata int32, err error) { var buf []byte args := DomainSnapshotHasMetadataArgs { Snap: Snap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(272, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Metadata: int32 _, err = dec.Decode(&rMetadata) if err != nil { return } return } // ConnectListAllDomains is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS. func (l *Libvirt) ConnectListAllDomains(NeedResults int32, Flags ConnectListAllDomainsFlags) (rDomains []Domain, rRet uint32, err error) { var buf []byte args := ConnectListAllDomainsArgs { NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(273, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Domains: []Domain _, err = dec.Decode(&rDomains) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainListAllSnapshots is the go wrapper for REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS. func (l *Libvirt) DomainListAllSnapshots(Dom Domain, NeedResults int32, Flags uint32) (rSnapshots []DomainSnapshot, rRet int32, err error) { var buf []byte args := DomainListAllSnapshotsArgs { Dom: Dom, NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(274, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Snapshots: []DomainSnapshot _, err = dec.Decode(&rSnapshots) if err != nil { return } // Ret: int32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainSnapshotListAllChildren is the go wrapper for REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN. func (l *Libvirt) DomainSnapshotListAllChildren(Snapshot DomainSnapshot, NeedResults int32, Flags uint32) (rSnapshots []DomainSnapshot, rRet int32, err error) { var buf []byte args := DomainSnapshotListAllChildrenArgs { Snapshot: Snapshot, NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(275, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Snapshots: []DomainSnapshot _, err = dec.Decode(&rSnapshots) if err != nil { return } // Ret: int32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainEventBalloonChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHANGE. func (l *Libvirt) DomainEventBalloonChange() (err error) { var buf []byte _, err = l.requestStream(276, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetHostname is the go wrapper for REMOTE_PROC_DOMAIN_GET_HOSTNAME. func (l *Libvirt) DomainGetHostname(Dom Domain, Flags DomainGetHostnameFlags) (rHostname string, err error) { var buf []byte args := DomainGetHostnameArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(277, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Hostname: string _, err = dec.Decode(&rHostname) if err != nil { return } return } // DomainGetSecurityLabelList is the go wrapper for REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST. func (l *Libvirt) DomainGetSecurityLabelList(Dom Domain) (rLabels []DomainGetSecurityLabelRet, rRet int32, err error) { var buf []byte args := DomainGetSecurityLabelListArgs { Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(278, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Labels: []DomainGetSecurityLabelRet _, err = dec.Decode(&rLabels) if err != nil { return } // Ret: int32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainPinEmulator is the go wrapper for REMOTE_PROC_DOMAIN_PIN_EMULATOR. func (l *Libvirt) DomainPinEmulator(Dom Domain, Cpumap []byte, Flags DomainModificationImpact) (err error) { var buf []byte args := DomainPinEmulatorArgs { Dom: Dom, Cpumap: Cpumap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(279, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetEmulatorPinInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO. func (l *Libvirt) DomainGetEmulatorPinInfo(Dom Domain, Maplen int32, Flags DomainModificationImpact) (rCpumaps []byte, rRet int32, err error) { var buf []byte args := DomainGetEmulatorPinInfoArgs { Dom: Dom, Maplen: Maplen, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(280, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Cpumaps: []byte _, err = dec.Decode(&rCpumaps) if err != nil { return } // Ret: int32 _, err = dec.Decode(&rRet) if err != nil { return } return } // ConnectListAllStoragePools is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_STORAGE_POOLS. func (l *Libvirt) ConnectListAllStoragePools(NeedResults int32, Flags ConnectListAllStoragePoolsFlags) (rPools []StoragePool, rRet uint32, err error) { var buf []byte args := ConnectListAllStoragePoolsArgs { NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(281, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Pools: []StoragePool _, err = dec.Decode(&rPools) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // StoragePoolListAllVolumes is the go wrapper for REMOTE_PROC_STORAGE_POOL_LIST_ALL_VOLUMES. func (l *Libvirt) StoragePoolListAllVolumes(Pool StoragePool, NeedResults int32, Flags uint32) (rVols []StorageVol, rRet uint32, err error) { var buf []byte args := StoragePoolListAllVolumesArgs { Pool: Pool, NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(282, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Vols: []StorageVol _, err = dec.Decode(&rVols) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // ConnectListAllNetworks is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_NETWORKS. func (l *Libvirt) ConnectListAllNetworks(NeedResults int32, Flags ConnectListAllNetworksFlags) (rNets []Network, rRet uint32, err error) { var buf []byte args := ConnectListAllNetworksArgs { NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(283, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Nets: []Network _, err = dec.Decode(&rNets) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // ConnectListAllInterfaces is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_INTERFACES. func (l *Libvirt) ConnectListAllInterfaces(NeedResults int32, Flags ConnectListAllInterfacesFlags) (rIfaces []Interface, rRet uint32, err error) { var buf []byte args := ConnectListAllInterfacesArgs { NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(284, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Ifaces: []Interface _, err = dec.Decode(&rIfaces) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // ConnectListAllNodeDevices is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_NODE_DEVICES. func (l *Libvirt) ConnectListAllNodeDevices(NeedResults int32, Flags uint32) (rDevices []NodeDevice, rRet uint32, err error) { var buf []byte args := ConnectListAllNodeDevicesArgs { NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(285, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Devices: []NodeDevice _, err = dec.Decode(&rDevices) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // ConnectListAllNwfilters is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_NWFILTERS. func (l *Libvirt) ConnectListAllNwfilters(NeedResults int32, Flags uint32) (rFilters []Nwfilter, rRet uint32, err error) { var buf []byte args := ConnectListAllNwfiltersArgs { NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(286, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Filters: []Nwfilter _, err = dec.Decode(&rFilters) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // ConnectListAllSecrets is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_SECRETS. func (l *Libvirt) ConnectListAllSecrets(NeedResults int32, Flags ConnectListAllSecretsFlags) (rSecrets []Secret, rRet uint32, err error) { var buf []byte args := ConnectListAllSecretsArgs { NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(287, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Secrets: []Secret _, err = dec.Decode(&rSecrets) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // NodeSetMemoryParameters is the go wrapper for REMOTE_PROC_NODE_SET_MEMORY_PARAMETERS. func (l *Libvirt) NodeSetMemoryParameters(Params []TypedParam, Flags uint32) (err error) { var buf []byte args := NodeSetMemoryParametersArgs { Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(288, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeGetMemoryParameters is the go wrapper for REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS. func (l *Libvirt) NodeGetMemoryParameters(Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := NodeGetMemoryParametersArgs { Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(289, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainBlockCommit is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_COMMIT. func (l *Libvirt) DomainBlockCommit(Dom Domain, Disk string, Base OptString, Top OptString, Bandwidth uint64, Flags DomainBlockCommitFlags) (err error) { var buf []byte args := DomainBlockCommitArgs { Dom: Dom, Disk: Disk, Base: Base, Top: Top, Bandwidth: Bandwidth, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(290, constants.Program, buf, nil, nil) if err != nil { return } return } // NetworkUpdate is the go wrapper for REMOTE_PROC_NETWORK_UPDATE. func (l *Libvirt) NetworkUpdate(Net Network, Command uint32, Section uint32, ParentIndex int32, XML string, Flags NetworkUpdateFlags) (err error) { var buf []byte args := NetworkUpdateArgs { Net: Net, Command: Command, Section: Section, ParentIndex: ParentIndex, XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(291, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventPmsuspendDisk is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_DISK. func (l *Libvirt) DomainEventPmsuspendDisk() (err error) { var buf []byte _, err = l.requestStream(292, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeGetCPUMap is the go wrapper for REMOTE_PROC_NODE_GET_CPU_MAP. func (l *Libvirt) NodeGetCPUMap(NeedMap int32, NeedOnline int32, Flags uint32) (rCpumap []byte, rOnline uint32, rRet int32, err error) { var buf []byte args := NodeGetCPUMapArgs { NeedMap: NeedMap, NeedOnline: NeedOnline, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(293, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Cpumap: []byte _, err = dec.Decode(&rCpumap) if err != nil { return } // Online: uint32 _, err = dec.Decode(&rOnline) if err != nil { return } // Ret: int32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainFstrim is the go wrapper for REMOTE_PROC_DOMAIN_FSTRIM. func (l *Libvirt) DomainFstrim(Dom Domain, MountPoint OptString, Minimum uint64, Flags uint32) (err error) { var buf []byte args := DomainFstrimArgs { Dom: Dom, MountPoint: MountPoint, Minimum: Minimum, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(294, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSendProcessSignal is the go wrapper for REMOTE_PROC_DOMAIN_SEND_PROCESS_SIGNAL. func (l *Libvirt) DomainSendProcessSignal(Dom Domain, PidValue int64, Signum uint32, Flags uint32) (err error) { var buf []byte args := DomainSendProcessSignalArgs { Dom: Dom, PidValue: PidValue, Signum: Signum, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(295, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainOpenChannel is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_CHANNEL. func (l *Libvirt) DomainOpenChannel(Dom Domain, Name OptString, inStream io.Writer, Flags DomainChannelFlags) (err error) { var buf []byte args := DomainOpenChannelArgs { Dom: Dom, Name: Name, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(296, constants.Program, buf, nil, inStream) if err != nil { return } return } // NodeDeviceLookupScsiHostByWwn is the go wrapper for REMOTE_PROC_NODE_DEVICE_LOOKUP_SCSI_HOST_BY_WWN. func (l *Libvirt) NodeDeviceLookupScsiHostByWwn(Wwnn string, Wwpn string, Flags uint32) (rDev NodeDevice, err error) { var buf []byte args := NodeDeviceLookupScsiHostByWwnArgs { Wwnn: Wwnn, Wwpn: Wwpn, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(297, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dev: NodeDevice _, err = dec.Decode(&rDev) if err != nil { return } return } // DomainGetJobStats is the go wrapper for REMOTE_PROC_DOMAIN_GET_JOB_STATS. func (l *Libvirt) DomainGetJobStats(Dom Domain, Flags DomainGetJobStatsFlags) (rType int32, rParams []TypedParam, err error) { var buf []byte args := DomainGetJobStatsArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(298, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Type: int32 _, err = dec.Decode(&rType) if err != nil { return } // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } return } // DomainMigrateGetCompressionCache is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_GET_COMPRESSION_CACHE. func (l *Libvirt) DomainMigrateGetCompressionCache(Dom Domain, Flags uint32) (rCacheSize uint64, err error) { var buf []byte args := DomainMigrateGetCompressionCacheArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(299, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CacheSize: uint64 _, err = dec.Decode(&rCacheSize) if err != nil { return } return } // DomainMigrateSetCompressionCache is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_SET_COMPRESSION_CACHE. func (l *Libvirt) DomainMigrateSetCompressionCache(Dom Domain, CacheSize uint64, Flags uint32) (err error) { var buf []byte args := DomainMigrateSetCompressionCacheArgs { Dom: Dom, CacheSize: CacheSize, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(300, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeDeviceDetachFlags is the go wrapper for REMOTE_PROC_NODE_DEVICE_DETACH_FLAGS. func (l *Libvirt) NodeDeviceDetachFlags(Name string, DriverName OptString, Flags uint32) (err error) { var buf []byte args := NodeDeviceDetachFlagsArgs { Name: Name, DriverName: DriverName, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(301, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainMigrateBegin3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3_PARAMS. func (l *Libvirt) DomainMigrateBegin3Params(Dom Domain, Params []TypedParam, Flags uint32) (rCookieOut []byte, rXML string, err error) { var buf []byte args := DomainMigrateBegin3ParamsArgs { Dom: Dom, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(302, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // DomainMigratePrepare3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3_PARAMS. func (l *Libvirt) DomainMigratePrepare3Params(Params []TypedParam, CookieIn []byte, Flags uint32) (rCookieOut []byte, rUriOut OptString, err error) { var buf []byte args := DomainMigratePrepare3ParamsArgs { Params: Params, CookieIn: CookieIn, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(303, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } // UriOut: OptString _, err = dec.Decode(&rUriOut) if err != nil { return } return } // DomainMigratePrepareTunnel3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS. func (l *Libvirt) DomainMigratePrepareTunnel3Params(Params []TypedParam, CookieIn []byte, Flags uint32) (rCookieOut []byte, err error) { var buf []byte args := DomainMigratePrepareTunnel3ParamsArgs { Params: Params, CookieIn: CookieIn, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(304, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } return } // DomainMigratePerform3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3_PARAMS. func (l *Libvirt) DomainMigratePerform3Params(Dom Domain, Dconnuri OptString, Params []TypedParam, CookieIn []byte, Flags DomainMigrateFlags) (rCookieOut []byte, err error) { var buf []byte args := DomainMigratePerform3ParamsArgs { Dom: Dom, Dconnuri: Dconnuri, Params: Params, CookieIn: CookieIn, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(305, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } return } // DomainMigrateFinish3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_FINISH3_PARAMS. func (l *Libvirt) DomainMigrateFinish3Params(Params []TypedParam, CookieIn []byte, Flags uint32, Cancelled int32) (rDom Domain, rCookieOut []byte, err error) { var buf []byte args := DomainMigrateFinish3ParamsArgs { Params: Params, CookieIn: CookieIn, Flags: Flags, Cancelled: Cancelled, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(306, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } // CookieOut: []byte _, err = dec.Decode(&rCookieOut) if err != nil { return } return } // DomainMigrateConfirm3Params is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3_PARAMS. func (l *Libvirt) DomainMigrateConfirm3Params(Dom Domain, Params []TypedParam, CookieIn []byte, Flags uint32, Cancelled int32) (err error) { var buf []byte args := DomainMigrateConfirm3ParamsArgs { Dom: Dom, Params: Params, CookieIn: CookieIn, Flags: Flags, Cancelled: Cancelled, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(307, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetMemoryStatsPeriod is the go wrapper for REMOTE_PROC_DOMAIN_SET_MEMORY_STATS_PERIOD. func (l *Libvirt) DomainSetMemoryStatsPeriod(Dom Domain, Period int32, Flags DomainMemoryModFlags) (err error) { var buf []byte args := DomainSetMemoryStatsPeriodArgs { Dom: Dom, Period: Period, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(308, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainCreateXMLWithFiles is the go wrapper for REMOTE_PROC_DOMAIN_CREATE_XML_WITH_FILES. func (l *Libvirt) DomainCreateXMLWithFiles(XMLDesc string, Flags DomainCreateFlags) (rDom Domain, err error) { var buf []byte args := DomainCreateXMLWithFilesArgs { XMLDesc: XMLDesc, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(309, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // DomainCreateWithFiles is the go wrapper for REMOTE_PROC_DOMAIN_CREATE_WITH_FILES. func (l *Libvirt) DomainCreateWithFiles(Dom Domain, Flags DomainCreateFlags) (rDom Domain, err error) { var buf []byte args := DomainCreateWithFilesArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(310, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // DomainEventDeviceRemoved is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMOVED. func (l *Libvirt) DomainEventDeviceRemoved() (err error) { var buf []byte _, err = l.requestStream(311, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectGetCPUModelNames is the go wrapper for REMOTE_PROC_CONNECT_GET_CPU_MODEL_NAMES. func (l *Libvirt) ConnectGetCPUModelNames(Arch string, NeedResults int32, Flags uint32) (rModels []string, rRet int32, err error) { var buf []byte args := ConnectGetCPUModelNamesArgs { Arch: Arch, NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(312, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Models: []string _, err = dec.Decode(&rModels) if err != nil { return } // Ret: int32 _, err = dec.Decode(&rRet) if err != nil { return } return } // ConnectNetworkEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_NETWORK_EVENT_REGISTER_ANY. func (l *Libvirt) ConnectNetworkEventRegisterAny(EventID int32, Net OptNetwork) (rCallbackID int32, err error) { var buf []byte args := ConnectNetworkEventRegisterAnyArgs { EventID: EventID, Net: Net, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(313, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CallbackID: int32 _, err = dec.Decode(&rCallbackID) if err != nil { return } return } // ConnectNetworkEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_NETWORK_EVENT_DEREGISTER_ANY. func (l *Libvirt) ConnectNetworkEventDeregisterAny(CallbackID int32) (err error) { var buf []byte args := ConnectNetworkEventDeregisterAnyArgs { CallbackID: CallbackID, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(314, constants.Program, buf, nil, nil) if err != nil { return } return } // NetworkEventLifecycle is the go wrapper for REMOTE_PROC_NETWORK_EVENT_LIFECYCLE. func (l *Libvirt) NetworkEventLifecycle() (err error) { var buf []byte _, err = l.requestStream(315, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectDomainEventCallbackRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_REGISTER_ANY. func (l *Libvirt) ConnectDomainEventCallbackRegisterAny(EventID int32, Dom OptDomain) (rCallbackID int32, err error) { var buf []byte args := ConnectDomainEventCallbackRegisterAnyArgs { EventID: EventID, Dom: Dom, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(316, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CallbackID: int32 _, err = dec.Decode(&rCallbackID) if err != nil { return } return } // ConnectDomainEventCallbackDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_DOMAIN_EVENT_CALLBACK_DEREGISTER_ANY. func (l *Libvirt) ConnectDomainEventCallbackDeregisterAny(CallbackID int32) (err error) { var buf []byte args := ConnectDomainEventCallbackDeregisterAnyArgs { CallbackID: CallbackID, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(317, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackLifecycle is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LIFECYCLE. func (l *Libvirt) DomainEventCallbackLifecycle() (err error) { var buf []byte _, err = l.requestStream(318, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackReboot is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_REBOOT. func (l *Libvirt) DomainEventCallbackReboot() (err error) { var buf []byte _, err = l.requestStream(319, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackRtcChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RTC_CHANGE. func (l *Libvirt) DomainEventCallbackRtcChange() (err error) { var buf []byte _, err = l.requestStream(320, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackWatchdog is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WATCHDOG. func (l *Libvirt) DomainEventCallbackWatchdog() (err error) { var buf []byte _, err = l.requestStream(321, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackIOError is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR. func (l *Libvirt) DomainEventCallbackIOError() (err error) { var buf []byte _, err = l.requestStream(322, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackGraphics is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GRAPHICS. func (l *Libvirt) DomainEventCallbackGraphics() (err error) { var buf []byte _, err = l.requestStream(323, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackIOErrorReason is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO_ERROR_REASON. func (l *Libvirt) DomainEventCallbackIOErrorReason() (err error) { var buf []byte _, err = l.requestStream(324, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackControlError is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CONTROL_ERROR. func (l *Libvirt) DomainEventCallbackControlError() (err error) { var buf []byte _, err = l.requestStream(325, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackBlockJob is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BLOCK_JOB. func (l *Libvirt) DomainEventCallbackBlockJob() (err error) { var buf []byte _, err = l.requestStream(326, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackDiskChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DISK_CHANGE. func (l *Libvirt) DomainEventCallbackDiskChange() (err error) { var buf []byte _, err = l.requestStream(327, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackTrayChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TRAY_CHANGE. func (l *Libvirt) DomainEventCallbackTrayChange() (err error) { var buf []byte _, err = l.requestStream(328, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackPmwakeup is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMWAKEUP. func (l *Libvirt) DomainEventCallbackPmwakeup() (err error) { var buf []byte _, err = l.requestStream(329, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackPmsuspend is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND. func (l *Libvirt) DomainEventCallbackPmsuspend() (err error) { var buf []byte _, err = l.requestStream(330, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackBalloonChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE. func (l *Libvirt) DomainEventCallbackBalloonChange() (err error) { var buf []byte _, err = l.requestStream(331, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackPmsuspendDisk is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK. func (l *Libvirt) DomainEventCallbackPmsuspendDisk() (err error) { var buf []byte _, err = l.requestStream(332, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackDeviceRemoved is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED. func (l *Libvirt) DomainEventCallbackDeviceRemoved() (err error) { var buf []byte _, err = l.requestStream(333, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainCoreDumpWithFormat is the go wrapper for REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT. func (l *Libvirt) DomainCoreDumpWithFormat(Dom Domain, To string, Dumpformat uint32, Flags DomainCoreDumpFlags) (err error) { var buf []byte args := DomainCoreDumpWithFormatArgs { Dom: Dom, To: To, Dumpformat: Dumpformat, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(334, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainFsfreeze is the go wrapper for REMOTE_PROC_DOMAIN_FSFREEZE. func (l *Libvirt) DomainFsfreeze(Dom Domain, Mountpoints []string, Flags uint32) (rFilesystems int32, err error) { var buf []byte args := DomainFsfreezeArgs { Dom: Dom, Mountpoints: Mountpoints, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(335, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Filesystems: int32 _, err = dec.Decode(&rFilesystems) if err != nil { return } return } // DomainFsthaw is the go wrapper for REMOTE_PROC_DOMAIN_FSTHAW. func (l *Libvirt) DomainFsthaw(Dom Domain, Mountpoints []string, Flags uint32) (rFilesystems int32, err error) { var buf []byte args := DomainFsthawArgs { Dom: Dom, Mountpoints: Mountpoints, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(336, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Filesystems: int32 _, err = dec.Decode(&rFilesystems) if err != nil { return } return } // DomainGetTime is the go wrapper for REMOTE_PROC_DOMAIN_GET_TIME. func (l *Libvirt) DomainGetTime(Dom Domain, Flags uint32) (rSeconds int64, rNseconds uint32, err error) { var buf []byte args := DomainGetTimeArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(337, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Seconds: int64 _, err = dec.Decode(&rSeconds) if err != nil { return } // Nseconds: uint32 _, err = dec.Decode(&rNseconds) if err != nil { return } return } // DomainSetTime is the go wrapper for REMOTE_PROC_DOMAIN_SET_TIME. func (l *Libvirt) DomainSetTime(Dom Domain, Seconds int64, Nseconds uint32, Flags DomainSetTimeFlags) (err error) { var buf []byte args := DomainSetTimeArgs { Dom: Dom, Seconds: Seconds, Nseconds: Nseconds, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(338, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventBlockJob2 is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2. func (l *Libvirt) DomainEventBlockJob2() (err error) { var buf []byte _, err = l.requestStream(339, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeGetFreePages is the go wrapper for REMOTE_PROC_NODE_GET_FREE_PAGES. func (l *Libvirt) NodeGetFreePages(Pages []uint32, StartCell int32, CellCount uint32, Flags uint32) (rCounts []uint64, err error) { var buf []byte args := NodeGetFreePagesArgs { Pages: Pages, StartCell: StartCell, CellCount: CellCount, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(340, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Counts: []uint64 _, err = dec.Decode(&rCounts) if err != nil { return } return } // NetworkGetDhcpLeases is the go wrapper for REMOTE_PROC_NETWORK_GET_DHCP_LEASES. func (l *Libvirt) NetworkGetDhcpLeases(Net Network, Mac OptString, NeedResults int32, Flags uint32) (rLeases []NetworkDhcpLease, rRet uint32, err error) { var buf []byte args := NetworkGetDhcpLeasesArgs { Net: Net, Mac: Mac, NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(341, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Leases: []NetworkDhcpLease _, err = dec.Decode(&rLeases) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // ConnectGetDomainCapabilities is the go wrapper for REMOTE_PROC_CONNECT_GET_DOMAIN_CAPABILITIES. func (l *Libvirt) ConnectGetDomainCapabilities(Emulatorbin OptString, Arch OptString, Machine OptString, Virttype OptString, Flags uint32) (rCapabilities string, err error) { var buf []byte args := ConnectGetDomainCapabilitiesArgs { Emulatorbin: Emulatorbin, Arch: Arch, Machine: Machine, Virttype: Virttype, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(342, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Capabilities: string _, err = dec.Decode(&rCapabilities) if err != nil { return } return } // DomainOpenGraphicsFd is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_GRAPHICS_FD. func (l *Libvirt) DomainOpenGraphicsFd(Dom Domain, Idx uint32, Flags DomainOpenGraphicsFlags) (err error) { var buf []byte args := DomainOpenGraphicsFdArgs { Dom: Dom, Idx: Idx, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(343, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectGetAllDomainStats is the go wrapper for REMOTE_PROC_CONNECT_GET_ALL_DOMAIN_STATS. func (l *Libvirt) ConnectGetAllDomainStats(Doms []Domain, Stats uint32, Flags uint32) (rRetStats []DomainStatsRecord, err error) { var buf []byte args := ConnectGetAllDomainStatsArgs { Doms: Doms, Stats: Stats, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(344, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // RetStats: []DomainStatsRecord _, err = dec.Decode(&rRetStats) if err != nil { return } return } // DomainBlockCopy is the go wrapper for REMOTE_PROC_DOMAIN_BLOCK_COPY. func (l *Libvirt) DomainBlockCopy(Dom Domain, Path string, Destxml string, Params []TypedParam, Flags DomainBlockCopyFlags) (err error) { var buf []byte args := DomainBlockCopyArgs { Dom: Dom, Path: Path, Destxml: Destxml, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(345, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackTunable is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABLE. func (l *Libvirt) DomainEventCallbackTunable() (err error) { var buf []byte _, err = l.requestStream(346, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeAllocPages is the go wrapper for REMOTE_PROC_NODE_ALLOC_PAGES. func (l *Libvirt) NodeAllocPages(PageSizes []uint32, PageCounts []uint64, StartCell int32, CellCount uint32, Flags NodeAllocPagesFlags) (rRet int32, err error) { var buf []byte args := NodeAllocPagesArgs { PageSizes: PageSizes, PageCounts: PageCounts, StartCell: StartCell, CellCount: CellCount, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(347, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Ret: int32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainEventCallbackAgentLifecycle is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_AGENT_LIFECYCLE. func (l *Libvirt) DomainEventCallbackAgentLifecycle() (err error) { var buf []byte _, err = l.requestStream(348, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetFsinfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_FSINFO. func (l *Libvirt) DomainGetFsinfo(Dom Domain, Flags uint32) (rInfo []DomainFsinfo, rRet uint32, err error) { var buf []byte args := DomainGetFsinfoArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(349, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Info: []DomainFsinfo _, err = dec.Decode(&rInfo) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainDefineXMLFlags is the go wrapper for REMOTE_PROC_DOMAIN_DEFINE_XML_FLAGS. func (l *Libvirt) DomainDefineXMLFlags(XML string, Flags DomainDefineFlags) (rDom Domain, err error) { var buf []byte args := DomainDefineXMLFlagsArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(350, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dom: Domain _, err = dec.Decode(&rDom) if err != nil { return } return } // DomainGetIothreadInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_IOTHREAD_INFO. func (l *Libvirt) DomainGetIothreadInfo(Dom Domain, Flags DomainModificationImpact) (rInfo []DomainIothreadInfo, rRet uint32, err error) { var buf []byte args := DomainGetIothreadInfoArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(351, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Info: []DomainIothreadInfo _, err = dec.Decode(&rInfo) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainPinIothread is the go wrapper for REMOTE_PROC_DOMAIN_PIN_IOTHREAD. func (l *Libvirt) DomainPinIothread(Dom Domain, IothreadsID uint32, Cpumap []byte, Flags DomainModificationImpact) (err error) { var buf []byte args := DomainPinIothreadArgs { Dom: Dom, IothreadsID: IothreadsID, Cpumap: Cpumap, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(352, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainInterfaceAddresses is the go wrapper for REMOTE_PROC_DOMAIN_INTERFACE_ADDRESSES. func (l *Libvirt) DomainInterfaceAddresses(Dom Domain, Source uint32, Flags uint32) (rIfaces []DomainInterface, err error) { var buf []byte args := DomainInterfaceAddressesArgs { Dom: Dom, Source: Source, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(353, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Ifaces: []DomainInterface _, err = dec.Decode(&rIfaces) if err != nil { return } return } // DomainEventCallbackDeviceAdded is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_ADDED. func (l *Libvirt) DomainEventCallbackDeviceAdded() (err error) { var buf []byte _, err = l.requestStream(354, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainAddIothread is the go wrapper for REMOTE_PROC_DOMAIN_ADD_IOTHREAD. func (l *Libvirt) DomainAddIothread(Dom Domain, IothreadID uint32, Flags DomainModificationImpact) (err error) { var buf []byte args := DomainAddIothreadArgs { Dom: Dom, IothreadID: IothreadID, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(355, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainDelIothread is the go wrapper for REMOTE_PROC_DOMAIN_DEL_IOTHREAD. func (l *Libvirt) DomainDelIothread(Dom Domain, IothreadID uint32, Flags DomainModificationImpact) (err error) { var buf []byte args := DomainDelIothreadArgs { Dom: Dom, IothreadID: IothreadID, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(356, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetUserPassword is the go wrapper for REMOTE_PROC_DOMAIN_SET_USER_PASSWORD. func (l *Libvirt) DomainSetUserPassword(Dom Domain, User OptString, Password OptString, Flags DomainSetUserPasswordFlags) (err error) { var buf []byte args := DomainSetUserPasswordArgs { Dom: Dom, User: User, Password: Password, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(357, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainRename is the go wrapper for REMOTE_PROC_DOMAIN_RENAME. func (l *Libvirt) DomainRename(Dom Domain, NewName OptString, Flags uint32) (rRetcode int32, err error) { var buf []byte args := DomainRenameArgs { Dom: Dom, NewName: NewName, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(358, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Retcode: int32 _, err = dec.Decode(&rRetcode) if err != nil { return } return } // DomainEventCallbackMigrationIteration is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_MIGRATION_ITERATION. func (l *Libvirt) DomainEventCallbackMigrationIteration() (err error) { var buf []byte _, err = l.requestStream(359, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectRegisterCloseCallback is the go wrapper for REMOTE_PROC_CONNECT_REGISTER_CLOSE_CALLBACK. func (l *Libvirt) ConnectRegisterCloseCallback() (err error) { var buf []byte _, err = l.requestStream(360, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectUnregisterCloseCallback is the go wrapper for REMOTE_PROC_CONNECT_UNREGISTER_CLOSE_CALLBACK. func (l *Libvirt) ConnectUnregisterCloseCallback() (err error) { var buf []byte _, err = l.requestStream(361, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectEventConnectionClosed is the go wrapper for REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLOSED. func (l *Libvirt) ConnectEventConnectionClosed() (err error) { var buf []byte _, err = l.requestStream(362, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackJobCompleted is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_COMPLETED. func (l *Libvirt) DomainEventCallbackJobCompleted() (err error) { var buf []byte _, err = l.requestStream(363, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainMigrateStartPostCopy is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_START_POST_COPY. func (l *Libvirt) DomainMigrateStartPostCopy(Dom Domain, Flags uint32) (err error) { var buf []byte args := DomainMigrateStartPostCopyArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(364, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetPerfEvents is the go wrapper for REMOTE_PROC_DOMAIN_GET_PERF_EVENTS. func (l *Libvirt) DomainGetPerfEvents(Dom Domain, Flags DomainModificationImpact) (rParams []TypedParam, err error) { var buf []byte args := DomainGetPerfEventsArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(365, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } return } // DomainSetPerfEvents is the go wrapper for REMOTE_PROC_DOMAIN_SET_PERF_EVENTS. func (l *Libvirt) DomainSetPerfEvents(Dom Domain, Params []TypedParam, Flags DomainModificationImpact) (err error) { var buf []byte args := DomainSetPerfEventsArgs { Dom: Dom, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(366, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventCallbackDeviceRemovalFailed is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVAL_FAILED. func (l *Libvirt) DomainEventCallbackDeviceRemovalFailed() (err error) { var buf []byte _, err = l.requestStream(367, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectStoragePoolEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_REGISTER_ANY. func (l *Libvirt) ConnectStoragePoolEventRegisterAny(EventID int32, Pool OptStoragePool) (rCallbackID int32, err error) { var buf []byte args := ConnectStoragePoolEventRegisterAnyArgs { EventID: EventID, Pool: Pool, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(368, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CallbackID: int32 _, err = dec.Decode(&rCallbackID) if err != nil { return } return } // ConnectStoragePoolEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_STORAGE_POOL_EVENT_DEREGISTER_ANY. func (l *Libvirt) ConnectStoragePoolEventDeregisterAny(CallbackID int32) (err error) { var buf []byte args := ConnectStoragePoolEventDeregisterAnyArgs { CallbackID: CallbackID, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(369, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolEventLifecycle is the go wrapper for REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE. func (l *Libvirt) StoragePoolEventLifecycle() (err error) { var buf []byte _, err = l.requestStream(370, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetGuestVcpus is the go wrapper for REMOTE_PROC_DOMAIN_GET_GUEST_VCPUS. func (l *Libvirt) DomainGetGuestVcpus(Dom Domain, Flags uint32) (rParams []TypedParam, err error) { var buf []byte args := DomainGetGuestVcpusArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(371, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } return } // DomainSetGuestVcpus is the go wrapper for REMOTE_PROC_DOMAIN_SET_GUEST_VCPUS. func (l *Libvirt) DomainSetGuestVcpus(Dom Domain, Cpumap string, State int32, Flags uint32) (err error) { var buf []byte args := DomainSetGuestVcpusArgs { Dom: Dom, Cpumap: Cpumap, State: State, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(372, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolEventRefresh is the go wrapper for REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH. func (l *Libvirt) StoragePoolEventRefresh() (err error) { var buf []byte _, err = l.requestStream(373, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectNodeDeviceEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_REGISTER_ANY. func (l *Libvirt) ConnectNodeDeviceEventRegisterAny(EventID int32, Dev OptNodeDevice) (rCallbackID int32, err error) { var buf []byte args := ConnectNodeDeviceEventRegisterAnyArgs { EventID: EventID, Dev: Dev, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(374, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CallbackID: int32 _, err = dec.Decode(&rCallbackID) if err != nil { return } return } // ConnectNodeDeviceEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_NODE_DEVICE_EVENT_DEREGISTER_ANY. func (l *Libvirt) ConnectNodeDeviceEventDeregisterAny(CallbackID int32) (err error) { var buf []byte args := ConnectNodeDeviceEventDeregisterAnyArgs { CallbackID: CallbackID, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(375, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeDeviceEventLifecycle is the go wrapper for REMOTE_PROC_NODE_DEVICE_EVENT_LIFECYCLE. func (l *Libvirt) NodeDeviceEventLifecycle() (err error) { var buf []byte _, err = l.requestStream(376, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeDeviceEventUpdate is the go wrapper for REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE. func (l *Libvirt) NodeDeviceEventUpdate() (err error) { var buf []byte _, err = l.requestStream(377, constants.Program, buf, nil, nil) if err != nil { return } return } // StorageVolGetInfoFlags is the go wrapper for REMOTE_PROC_STORAGE_VOL_GET_INFO_FLAGS. func (l *Libvirt) StorageVolGetInfoFlags(Vol StorageVol, Flags uint32) (rType int8, rCapacity uint64, rAllocation uint64, err error) { var buf []byte args := StorageVolGetInfoFlagsArgs { Vol: Vol, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(378, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Type: int8 _, err = dec.Decode(&rType) if err != nil { return } // Capacity: uint64 _, err = dec.Decode(&rCapacity) if err != nil { return } // Allocation: uint64 _, err = dec.Decode(&rAllocation) if err != nil { return } return } // DomainEventCallbackMetadataChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADATA_CHANGE. func (l *Libvirt) DomainEventCallbackMetadataChange() (err error) { var buf []byte _, err = l.requestStream(379, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectSecretEventRegisterAny is the go wrapper for REMOTE_PROC_CONNECT_SECRET_EVENT_REGISTER_ANY. func (l *Libvirt) ConnectSecretEventRegisterAny(EventID int32, OptSecret OptSecret) (rCallbackID int32, err error) { var buf []byte args := ConnectSecretEventRegisterAnyArgs { EventID: EventID, OptSecret: OptSecret, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(380, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CallbackID: int32 _, err = dec.Decode(&rCallbackID) if err != nil { return } return } // ConnectSecretEventDeregisterAny is the go wrapper for REMOTE_PROC_CONNECT_SECRET_EVENT_DEREGISTER_ANY. func (l *Libvirt) ConnectSecretEventDeregisterAny(CallbackID int32) (err error) { var buf []byte args := ConnectSecretEventDeregisterAnyArgs { CallbackID: CallbackID, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(381, constants.Program, buf, nil, nil) if err != nil { return } return } // SecretEventLifecycle is the go wrapper for REMOTE_PROC_SECRET_EVENT_LIFECYCLE. func (l *Libvirt) SecretEventLifecycle() (err error) { var buf []byte _, err = l.requestStream(382, constants.Program, buf, nil, nil) if err != nil { return } return } // SecretEventValueChanged is the go wrapper for REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED. func (l *Libvirt) SecretEventValueChanged() (err error) { var buf []byte _, err = l.requestStream(383, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetVcpu is the go wrapper for REMOTE_PROC_DOMAIN_SET_VCPU. func (l *Libvirt) DomainSetVcpu(Dom Domain, Cpumap string, State int32, Flags DomainModificationImpact) (err error) { var buf []byte args := DomainSetVcpuArgs { Dom: Dom, Cpumap: Cpumap, State: State, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(384, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainEventBlockThreshold is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD. func (l *Libvirt) DomainEventBlockThreshold() (err error) { var buf []byte _, err = l.requestStream(385, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetBlockThreshold is the go wrapper for REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD. func (l *Libvirt) DomainSetBlockThreshold(Dom Domain, Dev string, Threshold uint64, Flags uint32) (err error) { var buf []byte args := DomainSetBlockThresholdArgs { Dom: Dom, Dev: Dev, Threshold: Threshold, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(386, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainMigrateGetMaxDowntime is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_GET_MAX_DOWNTIME. func (l *Libvirt) DomainMigrateGetMaxDowntime(Dom Domain, Flags uint32) (rDowntime uint64, err error) { var buf []byte args := DomainMigrateGetMaxDowntimeArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(387, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Downtime: uint64 _, err = dec.Decode(&rDowntime) if err != nil { return } return } // DomainManagedSaveGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC. func (l *Libvirt) DomainManagedSaveGetXMLDesc(Dom Domain, Flags DomainXMLFlags) (rXML string, err error) { var buf []byte args := DomainManagedSaveGetXMLDescArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(388, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // DomainManagedSaveDefineXML is the go wrapper for REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML. func (l *Libvirt) DomainManagedSaveDefineXML(Dom Domain, Dxml OptString, Flags DomainSaveRestoreFlags) (err error) { var buf []byte args := DomainManagedSaveDefineXMLArgs { Dom: Dom, Dxml: Dxml, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(389, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetLifecycleAction is the go wrapper for REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION. func (l *Libvirt) DomainSetLifecycleAction(Dom Domain, Type uint32, Action uint32, Flags DomainModificationImpact) (err error) { var buf []byte args := DomainSetLifecycleActionArgs { Dom: Dom, Type: Type, Action: Action, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(390, constants.Program, buf, nil, nil) if err != nil { return } return } // StoragePoolLookupByTargetPath is the go wrapper for REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH. func (l *Libvirt) StoragePoolLookupByTargetPath(Path string) (rPool StoragePool, err error) { var buf []byte args := StoragePoolLookupByTargetPathArgs { Path: Path, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(391, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Pool: StoragePool _, err = dec.Decode(&rPool) if err != nil { return } return } // DomainDetachDeviceAlias is the go wrapper for REMOTE_PROC_DOMAIN_DETACH_DEVICE_ALIAS. func (l *Libvirt) DomainDetachDeviceAlias(Dom Domain, Alias string, Flags uint32) (err error) { var buf []byte args := DomainDetachDeviceAliasArgs { Dom: Dom, Alias: Alias, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(392, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectCompareHypervisorCPU is the go wrapper for REMOTE_PROC_CONNECT_COMPARE_HYPERVISOR_CPU. func (l *Libvirt) ConnectCompareHypervisorCPU(Emulator OptString, Arch OptString, Machine OptString, Virttype OptString, XMLCPU string, Flags uint32) (rResult int32, err error) { var buf []byte args := ConnectCompareHypervisorCPUArgs { Emulator: Emulator, Arch: Arch, Machine: Machine, Virttype: Virttype, XMLCPU: XMLCPU, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(393, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Result: int32 _, err = dec.Decode(&rResult) if err != nil { return } return } // ConnectBaselineHypervisorCPU is the go wrapper for REMOTE_PROC_CONNECT_BASELINE_HYPERVISOR_CPU. func (l *Libvirt) ConnectBaselineHypervisorCPU(Emulator OptString, Arch OptString, Machine OptString, Virttype OptString, XMLCPUs []string, Flags uint32) (rCPU string, err error) { var buf []byte args := ConnectBaselineHypervisorCPUArgs { Emulator: Emulator, Arch: Arch, Machine: Machine, Virttype: Virttype, XMLCPUs: XMLCPUs, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(394, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // CPU: string _, err = dec.Decode(&rCPU) if err != nil { return } return } // NodeGetSevInfo is the go wrapper for REMOTE_PROC_NODE_GET_SEV_INFO. func (l *Libvirt) NodeGetSevInfo(Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := NodeGetSevInfoArgs { Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(395, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // DomainGetLaunchSecurityInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_LAUNCH_SECURITY_INFO. func (l *Libvirt) DomainGetLaunchSecurityInfo(Dom Domain, Flags uint32) (rParams []TypedParam, err error) { var buf []byte args := DomainGetLaunchSecurityInfoArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(396, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } return } // NwfilterBindingLookupByPortDev is the go wrapper for REMOTE_PROC_NWFILTER_BINDING_LOOKUP_BY_PORT_DEV. func (l *Libvirt) NwfilterBindingLookupByPortDev(Name string) (rOptNwfilter NwfilterBinding, err error) { var buf []byte args := NwfilterBindingLookupByPortDevArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(397, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // OptNwfilter: NwfilterBinding _, err = dec.Decode(&rOptNwfilter) if err != nil { return } return } // NwfilterBindingGetXMLDesc is the go wrapper for REMOTE_PROC_NWFILTER_BINDING_GET_XML_DESC. func (l *Libvirt) NwfilterBindingGetXMLDesc(OptNwfilter NwfilterBinding, Flags uint32) (rXML string, err error) { var buf []byte args := NwfilterBindingGetXMLDescArgs { OptNwfilter: OptNwfilter, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(398, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // NwfilterBindingCreateXML is the go wrapper for REMOTE_PROC_NWFILTER_BINDING_CREATE_XML. func (l *Libvirt) NwfilterBindingCreateXML(XML string, Flags uint32) (rOptNwfilter NwfilterBinding, err error) { var buf []byte args := NwfilterBindingCreateXMLArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(399, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // OptNwfilter: NwfilterBinding _, err = dec.Decode(&rOptNwfilter) if err != nil { return } return } // NwfilterBindingDelete is the go wrapper for REMOTE_PROC_NWFILTER_BINDING_DELETE. func (l *Libvirt) NwfilterBindingDelete(OptNwfilter NwfilterBinding) (err error) { var buf []byte args := NwfilterBindingDeleteArgs { OptNwfilter: OptNwfilter, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(400, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectListAllNwfilterBindings is the go wrapper for REMOTE_PROC_CONNECT_LIST_ALL_NWFILTER_BINDINGS. func (l *Libvirt) ConnectListAllNwfilterBindings(NeedResults int32, Flags uint32) (rBindings []NwfilterBinding, rRet uint32, err error) { var buf []byte args := ConnectListAllNwfilterBindingsArgs { NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(401, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Bindings: []NwfilterBinding _, err = dec.Decode(&rBindings) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainSetIothreadParams is the go wrapper for REMOTE_PROC_DOMAIN_SET_IOTHREAD_PARAMS. func (l *Libvirt) DomainSetIothreadParams(Dom Domain, IothreadID uint32, Params []TypedParam, Flags uint32) (err error) { var buf []byte args := DomainSetIothreadParamsArgs { Dom: Dom, IothreadID: IothreadID, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(402, constants.Program, buf, nil, nil) if err != nil { return } return } // ConnectGetStoragePoolCapabilities is the go wrapper for REMOTE_PROC_CONNECT_GET_STORAGE_POOL_CAPABILITIES. func (l *Libvirt) ConnectGetStoragePoolCapabilities(Flags uint32) (rCapabilities string, err error) { var buf []byte args := ConnectGetStoragePoolCapabilitiesArgs { Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(403, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Capabilities: string _, err = dec.Decode(&rCapabilities) if err != nil { return } return } // NetworkListAllPorts is the go wrapper for REMOTE_PROC_NETWORK_LIST_ALL_PORTS. func (l *Libvirt) NetworkListAllPorts(OptNetwork Network, NeedResults int32, Flags uint32) (rPorts []NetworkPort, rRet uint32, err error) { var buf []byte args := NetworkListAllPortsArgs { OptNetwork: OptNetwork, NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(404, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Ports: []NetworkPort _, err = dec.Decode(&rPorts) if err != nil { return } // Ret: uint32 _, err = dec.Decode(&rRet) if err != nil { return } return } // NetworkPortLookupByUUID is the go wrapper for REMOTE_PROC_NETWORK_PORT_LOOKUP_BY_UUID. func (l *Libvirt) NetworkPortLookupByUUID(OptNetwork Network, UUID UUID) (rPort NetworkPort, err error) { var buf []byte args := NetworkPortLookupByUUIDArgs { OptNetwork: OptNetwork, UUID: UUID, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(405, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Port: NetworkPort _, err = dec.Decode(&rPort) if err != nil { return } return } // NetworkPortCreateXML is the go wrapper for REMOTE_PROC_NETWORK_PORT_CREATE_XML. func (l *Libvirt) NetworkPortCreateXML(OptNetwork Network, XML string, Flags uint32) (rPort NetworkPort, err error) { var buf []byte args := NetworkPortCreateXMLArgs { OptNetwork: OptNetwork, XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(406, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Port: NetworkPort _, err = dec.Decode(&rPort) if err != nil { return } return } // NetworkPortGetParameters is the go wrapper for REMOTE_PROC_NETWORK_PORT_GET_PARAMETERS. func (l *Libvirt) NetworkPortGetParameters(Port NetworkPort, Nparams int32, Flags uint32) (rParams []TypedParam, rNparams int32, err error) { var buf []byte args := NetworkPortGetParametersArgs { Port: Port, Nparams: Nparams, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(407, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } // Nparams: int32 _, err = dec.Decode(&rNparams) if err != nil { return } return } // NetworkPortSetParameters is the go wrapper for REMOTE_PROC_NETWORK_PORT_SET_PARAMETERS. func (l *Libvirt) NetworkPortSetParameters(Port NetworkPort, Params []TypedParam, Flags uint32) (err error) { var buf []byte args := NetworkPortSetParametersArgs { Port: Port, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(408, constants.Program, buf, nil, nil) if err != nil { return } return } // NetworkPortGetXMLDesc is the go wrapper for REMOTE_PROC_NETWORK_PORT_GET_XML_DESC. func (l *Libvirt) NetworkPortGetXMLDesc(Port NetworkPort, Flags uint32) (rXML string, err error) { var buf []byte args := NetworkPortGetXMLDescArgs { Port: Port, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(409, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // NetworkPortDelete is the go wrapper for REMOTE_PROC_NETWORK_PORT_DELETE. func (l *Libvirt) NetworkPortDelete(Port NetworkPort, Flags uint32) (err error) { var buf []byte args := NetworkPortDeleteArgs { Port: Port, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(410, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainCheckpointCreateXML is the go wrapper for REMOTE_PROC_DOMAIN_CHECKPOINT_CREATE_XML. func (l *Libvirt) DomainCheckpointCreateXML(Dom Domain, XMLDesc string, Flags uint32) (rCheckpoint DomainCheckpoint, err error) { var buf []byte args := DomainCheckpointCreateXMLArgs { Dom: Dom, XMLDesc: XMLDesc, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(411, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Checkpoint: DomainCheckpoint _, err = dec.Decode(&rCheckpoint) if err != nil { return } return } // DomainCheckpointGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_CHECKPOINT_GET_XML_DESC. func (l *Libvirt) DomainCheckpointGetXMLDesc(Checkpoint DomainCheckpoint, Flags uint32) (rXML string, err error) { var buf []byte args := DomainCheckpointGetXMLDescArgs { Checkpoint: Checkpoint, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(412, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // DomainListAllCheckpoints is the go wrapper for REMOTE_PROC_DOMAIN_LIST_ALL_CHECKPOINTS. func (l *Libvirt) DomainListAllCheckpoints(Dom Domain, NeedResults int32, Flags uint32) (rCheckpoints []DomainCheckpoint, rRet int32, err error) { var buf []byte args := DomainListAllCheckpointsArgs { Dom: Dom, NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(413, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Checkpoints: []DomainCheckpoint _, err = dec.Decode(&rCheckpoints) if err != nil { return } // Ret: int32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainCheckpointListAllChildren is the go wrapper for REMOTE_PROC_DOMAIN_CHECKPOINT_LIST_ALL_CHILDREN. func (l *Libvirt) DomainCheckpointListAllChildren(Checkpoint DomainCheckpoint, NeedResults int32, Flags uint32) (rCheckpoints []DomainCheckpoint, rRet int32, err error) { var buf []byte args := DomainCheckpointListAllChildrenArgs { Checkpoint: Checkpoint, NeedResults: NeedResults, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(414, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Checkpoints: []DomainCheckpoint _, err = dec.Decode(&rCheckpoints) if err != nil { return } // Ret: int32 _, err = dec.Decode(&rRet) if err != nil { return } return } // DomainCheckpointLookupByName is the go wrapper for REMOTE_PROC_DOMAIN_CHECKPOINT_LOOKUP_BY_NAME. func (l *Libvirt) DomainCheckpointLookupByName(Dom Domain, Name string, Flags uint32) (rCheckpoint DomainCheckpoint, err error) { var buf []byte args := DomainCheckpointLookupByNameArgs { Dom: Dom, Name: Name, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(415, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Checkpoint: DomainCheckpoint _, err = dec.Decode(&rCheckpoint) if err != nil { return } return } // DomainCheckpointGetParent is the go wrapper for REMOTE_PROC_DOMAIN_CHECKPOINT_GET_PARENT. func (l *Libvirt) DomainCheckpointGetParent(Checkpoint DomainCheckpoint, Flags uint32) (rParent DomainCheckpoint, err error) { var buf []byte args := DomainCheckpointGetParentArgs { Checkpoint: Checkpoint, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(416, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Parent: DomainCheckpoint _, err = dec.Decode(&rParent) if err != nil { return } return } // DomainCheckpointDelete is the go wrapper for REMOTE_PROC_DOMAIN_CHECKPOINT_DELETE. func (l *Libvirt) DomainCheckpointDelete(Checkpoint DomainCheckpoint, Flags DomainCheckpointDeleteFlags) (err error) { var buf []byte args := DomainCheckpointDeleteArgs { Checkpoint: Checkpoint, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(417, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetGuestInfo is the go wrapper for REMOTE_PROC_DOMAIN_GET_GUEST_INFO. func (l *Libvirt) DomainGetGuestInfo(Dom Domain, Types uint32, Flags uint32) (rParams []TypedParam, err error) { var buf []byte args := DomainGetGuestInfoArgs { Dom: Dom, Types: Types, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(418, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Params: []TypedParam _, err = dec.Decode(&rParams) if err != nil { return } return } // ConnectSetIdentity is the go wrapper for REMOTE_PROC_CONNECT_SET_IDENTITY. func (l *Libvirt) ConnectSetIdentity(Params []TypedParam, Flags uint32) (err error) { var buf []byte args := ConnectSetIdentityArgs { Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(419, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainAgentSetResponseTimeout is the go wrapper for REMOTE_PROC_DOMAIN_AGENT_SET_RESPONSE_TIMEOUT. func (l *Libvirt) DomainAgentSetResponseTimeout(Dom Domain, Timeout int32, Flags uint32) (rResult int32, err error) { var buf []byte args := DomainAgentSetResponseTimeoutArgs { Dom: Dom, Timeout: Timeout, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(420, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Result: int32 _, err = dec.Decode(&rResult) if err != nil { return } return } // DomainBackupBegin is the go wrapper for REMOTE_PROC_DOMAIN_BACKUP_BEGIN. func (l *Libvirt) DomainBackupBegin(Dom Domain, BackupXML string, CheckpointXML OptString, Flags DomainBackupBeginFlags) (err error) { var buf []byte args := DomainBackupBeginArgs { Dom: Dom, BackupXML: BackupXML, CheckpointXML: CheckpointXML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(421, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainBackupGetXMLDesc is the go wrapper for REMOTE_PROC_DOMAIN_BACKUP_GET_XML_DESC. func (l *Libvirt) DomainBackupGetXMLDesc(Dom Domain, Flags uint32) (rXML string, err error) { var buf []byte args := DomainBackupGetXMLDescArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(422, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // XML: string _, err = dec.Decode(&rXML) if err != nil { return } return } // DomainEventMemoryFailure is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_MEMORY_FAILURE. func (l *Libvirt) DomainEventMemoryFailure() (err error) { var buf []byte _, err = l.requestStream(423, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainAuthorizedSshKeysGet is the go wrapper for REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_GET. func (l *Libvirt) DomainAuthorizedSshKeysGet(Dom Domain, User string, Flags uint32) (rKeys []string, err error) { var buf []byte args := DomainAuthorizedSshKeysGetArgs { Dom: Dom, User: User, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(424, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Keys: []string _, err = dec.Decode(&rKeys) if err != nil { return } return } // DomainAuthorizedSshKeysSet is the go wrapper for REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_SET. func (l *Libvirt) DomainAuthorizedSshKeysSet(Dom Domain, User string, Keys []string, Flags uint32) (err error) { var buf []byte args := DomainAuthorizedSshKeysSetArgs { Dom: Dom, User: User, Keys: Keys, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(425, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainGetMessages is the go wrapper for REMOTE_PROC_DOMAIN_GET_MESSAGES. func (l *Libvirt) DomainGetMessages(Dom Domain, Flags uint32) (rMsgs []string, err error) { var buf []byte args := DomainGetMessagesArgs { Dom: Dom, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(426, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Msgs: []string _, err = dec.Decode(&rMsgs) if err != nil { return } return } // DomainStartDirtyRateCalc is the go wrapper for REMOTE_PROC_DOMAIN_START_DIRTY_RATE_CALC. func (l *Libvirt) DomainStartDirtyRateCalc(Dom Domain, Seconds int32, Flags uint32) (err error) { var buf []byte args := DomainStartDirtyRateCalcArgs { Dom: Dom, Seconds: Seconds, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(427, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeDeviceDefineXML is the go wrapper for REMOTE_PROC_NODE_DEVICE_DEFINE_XML. func (l *Libvirt) NodeDeviceDefineXML(XMLDesc string, Flags uint32) (rDev NodeDevice, err error) { var buf []byte args := NodeDeviceDefineXMLArgs { XMLDesc: XMLDesc, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(428, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Dev: NodeDevice _, err = dec.Decode(&rDev) if err != nil { return } return } // NodeDeviceUndefine is the go wrapper for REMOTE_PROC_NODE_DEVICE_UNDEFINE. func (l *Libvirt) NodeDeviceUndefine(Name string, Flags uint32) (err error) { var buf []byte args := NodeDeviceUndefineArgs { Name: Name, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(429, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeDeviceCreate is the go wrapper for REMOTE_PROC_NODE_DEVICE_CREATE. func (l *Libvirt) NodeDeviceCreate(Name string, Flags uint32) (err error) { var buf []byte args := NodeDeviceCreateArgs { Name: Name, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(430, constants.Program, buf, nil, nil) if err != nil { return } return } // NwfilterDefineXMLFlags is the go wrapper for REMOTE_PROC_NWFILTER_DEFINE_XML_FLAGS. func (l *Libvirt) NwfilterDefineXMLFlags(XML string, Flags uint32) (rOptNwfilter Nwfilter, err error) { var buf []byte args := NwfilterDefineXMLFlagsArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(431, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // OptNwfilter: Nwfilter _, err = dec.Decode(&rOptNwfilter) if err != nil { return } return } // NetworkDefineXMLFlags is the go wrapper for REMOTE_PROC_NETWORK_DEFINE_XML_FLAGS. func (l *Libvirt) NetworkDefineXMLFlags(XML string, Flags uint32) (rNet Network, err error) { var buf []byte args := NetworkDefineXMLFlagsArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(432, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Net: Network _, err = dec.Decode(&rNet) if err != nil { return } return } // NodeDeviceGetAutostart is the go wrapper for REMOTE_PROC_NODE_DEVICE_GET_AUTOSTART. func (l *Libvirt) NodeDeviceGetAutostart(Name string) (rAutostart int32, err error) { var buf []byte args := NodeDeviceGetAutostartArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(433, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Autostart: int32 _, err = dec.Decode(&rAutostart) if err != nil { return } return } // NodeDeviceSetAutostart is the go wrapper for REMOTE_PROC_NODE_DEVICE_SET_AUTOSTART. func (l *Libvirt) NodeDeviceSetAutostart(Name string, Autostart int32) (err error) { var buf []byte args := NodeDeviceSetAutostartArgs { Name: Name, Autostart: Autostart, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(434, constants.Program, buf, nil, nil) if err != nil { return } return } // NodeDeviceIsPersistent is the go wrapper for REMOTE_PROC_NODE_DEVICE_IS_PERSISTENT. func (l *Libvirt) NodeDeviceIsPersistent(Name string) (rPersistent int32, err error) { var buf []byte args := NodeDeviceIsPersistentArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(435, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Persistent: int32 _, err = dec.Decode(&rPersistent) if err != nil { return } return } // NodeDeviceIsActive is the go wrapper for REMOTE_PROC_NODE_DEVICE_IS_ACTIVE. func (l *Libvirt) NodeDeviceIsActive(Name string) (rActive int32, err error) { var buf []byte args := NodeDeviceIsActiveArgs { Name: Name, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(436, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Active: int32 _, err = dec.Decode(&rActive) if err != nil { return } return } // NetworkCreateXMLFlags is the go wrapper for REMOTE_PROC_NETWORK_CREATE_XML_FLAGS. func (l *Libvirt) NetworkCreateXMLFlags(XML string, Flags uint32) (rNet Network, err error) { var buf []byte args := NetworkCreateXMLFlagsArgs { XML: XML, Flags: Flags, } buf, err = encode(&args) if err != nil { return } var r response r, err = l.requestStream(437, constants.Program, buf, nil, nil) if err != nil { return } // Return value unmarshaling tpd := typedParamDecoder{} ct := map[string]xdr.TypeDecoder{"libvirt.TypedParam": tpd} rdr := bytes.NewReader(r.Payload) dec := xdr.NewDecoderCustomTypes(rdr, 0, ct) // Net: Network _, err = dec.Decode(&rNet) if err != nil { return } return } // DomainEventMemoryDeviceSizeChange is the go wrapper for REMOTE_PROC_DOMAIN_EVENT_MEMORY_DEVICE_SIZE_CHANGE. func (l *Libvirt) DomainEventMemoryDeviceSizeChange() (err error) { var buf []byte _, err = l.requestStream(438, constants.Program, buf, nil, nil) if err != nil { return } return } // DomainSetLaunchSecurityState is the go wrapper for REMOTE_PROC_DOMAIN_SET_LAUNCH_SECURITY_STATE. func (l *Libvirt) DomainSetLaunchSecurityState(Dom Domain, Params []TypedParam, Flags uint32) (err error) { var buf []byte args := DomainSetLaunchSecurityStateArgs { Dom: Dom, Params: Params, Flags: Flags, } buf, err = encode(&args) if err != nil { return } _, err = l.requestStream(439, constants.Program, buf, nil, nil) if err != nil { return } return } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/rpc.go000066400000000000000000000315311463537555000246070ustar00rootroot00000000000000// Copyright 2018 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package libvirt import ( "bytes" "errors" "fmt" "io" "reflect" "strings" "sync/atomic" "github.com/digitalocean/go-libvirt/internal/constants" "github.com/digitalocean/go-libvirt/internal/event" xdr "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" "github.com/digitalocean/go-libvirt/socket" ) // ErrUnsupported is returned if a procedure is not supported by libvirt var ErrUnsupported = errors.New("unsupported procedure requested") // ErrInterrupted is returned if the socket is closed while waiting for the // result of a procedure call. var ErrInterrupted = errors.New("procedure interrupted while awaiting response") // internal rpc response type response struct { Payload []byte Status uint32 } // Error reponse from libvirt type Error struct { Code uint32 Message string } func (e Error) Error() string { return e.Message } // checkError is used to check whether an error is a libvirtError, and if it is, // whether its error code matches the one passed in. It will return false if // these conditions are not met. func checkError(err error, expectedError ErrorNumber) bool { for err != nil { e, ok := err.(Error) if ok { return e.Code == uint32(expectedError) } err = errors.Unwrap(err) } return false } // IsNotFound detects libvirt's ERR_NO_DOMAIN. func IsNotFound(err error) bool { return checkError(err, ErrNoDomain) } // callback sends RPC responses to respective callers. func (l *Libvirt) callback(id int32, res response) { l.cmux.Lock() defer l.cmux.Unlock() c, ok := l.callbacks[id] if !ok { return } c <- res } // Route sends incoming packets to their listeners. func (l *Libvirt) Route(h *socket.Header, buf []byte) { // Route events to their respective listener var event event.Event switch h.Program { case constants.QEMUProgram: if h.Procedure != constants.QEMUProcDomainMonitorEvent { break } event = &DomainEvent{} case constants.Program: event = eventFromProcedureID(h.Procedure) } if event != nil { err := eventDecoder(buf, event) if err != nil { // event was malformed, drop. return } l.stream(event) return } // send response to caller l.callback(h.Serial, response{Payload: buf, Status: h.Status}) } func eventFromProcedureID(procID uint32) event.Event { switch procID { case constants.ProcDomainEventCallbackLifecycle: return &DomainEventCallbackLifecycleMsg{} case constants.ProcDomainEventCallbackReboot: return &DomainEventCallbackRebootMsg{} case constants.ProcDomainEventCallbackRtcChange: return &DomainEventCallbackRtcChangeMsg{} case constants.ProcDomainEventCallbackWatchdog: return &DomainEventCallbackWatchdogMsg{} case constants.ProcDomainEventCallbackIOError: return &DomainEventCallbackIOErrorMsg{} case constants.ProcDomainEventCallbackIOErrorReason: return &DomainEventCallbackIOErrorReasonMsg{} case constants.ProcDomainEventCallbackGraphics: return &DomainEventCallbackGraphicsMsg{} case constants.ProcDomainEventCallbackBlockJob: return &DomainEventCallbackBlockJobMsg{} case constants.ProcDomainEventCallbackDiskChange: return &DomainEventCallbackDiskChangeMsg{} case constants.ProcDomainEventCallbackTrayChange: return &DomainEventCallbackTrayChangeMsg{} case constants.ProcDomainEventCallbackPmwakeup: return &DomainEventCallbackPmwakeupMsg{} case constants.ProcDomainEventCallbackPmsuspend: return &DomainEventCallbackPmsuspendMsg{} case constants.ProcDomainEventCallbackBalloonChange: return &DomainEventCallbackBalloonChangeMsg{} case constants.ProcDomainEventCallbackPmsuspendDisk: return &DomainEventCallbackPmsuspendDiskMsg{} case constants.ProcDomainEventCallbackControlError: return &DomainEventCallbackControlErrorMsg{} case constants.ProcDomainEventCallbackDeviceRemoved: return &DomainEventCallbackDeviceRemovedMsg{} case constants.ProcDomainEventCallbackTunable: return &DomainEventCallbackTunableMsg{} case constants.ProcDomainEventCallbackDeviceAdded: return &DomainEventCallbackDeviceAddedMsg{} case constants.ProcDomainEventCallbackAgentLifecycle: return &DomainEventCallbackAgentLifecycleMsg{} case constants.ProcDomainEventCallbackMigrationIteration: return &DomainEventCallbackMigrationIterationMsg{} case constants.ProcDomainEventCallbackJobCompleted: return &DomainEventCallbackJobCompletedMsg{} case constants.ProcDomainEventCallbackDeviceRemovalFailed: return &DomainEventCallbackDeviceRemovalFailedMsg{} case constants.ProcDomainEventCallbackMetadataChange: return &DomainEventCallbackMetadataChangeMsg{} } return nil } // serial provides atomic access to the next sequential request serial number. func (l *Libvirt) serial() int32 { return atomic.AddInt32(&l.s, 1) } // stream decodes and relays domain events to their respective listener. func (l *Libvirt) stream(e event.Event) { l.emux.RLock() defer l.emux.RUnlock() q, ok := l.events[e.GetCallbackID()] if !ok { return } q.Push(e) } // addStream configures the routing for an event stream. func (l *Libvirt) addStream(s *event.Stream) { l.emux.Lock() defer l.emux.Unlock() l.events[s.CallbackID] = s } // removeStream deletes an event stream. The caller should first notify libvirt // to stop sending events for this stream. Subsequent calls to removeStream are // idempotent and return nil. func (l *Libvirt) removeStream(id int32) error { l.emux.Lock() defer l.emux.Unlock() // if the event is already removed, just return nil q, ok := l.events[id] if ok { delete(l.events, id) q.Shutdown() } return nil } // removeAllStreams deletes all event streams. This is meant to be used to // clean up only once the underlying connection to libvirt is disconnected and // thus does not attempt to notify libvirt to stop sending events. func (l *Libvirt) removeAllStreams() { l.emux.Lock() defer l.emux.Unlock() for _, ev := range l.events { ev.Shutdown() delete(l.events, ev.CallbackID) } } // register configures a method response callback func (l *Libvirt) register(id int32, c chan response) { l.cmux.Lock() defer l.cmux.Unlock() l.callbacks[id] = c } // deregister destroys a method response callback. It is the responsibility of // the caller to manage locking (l.cmux) during this call. func (l *Libvirt) deregister(id int32) { _, ok := l.callbacks[id] if !ok { return } close(l.callbacks[id]) delete(l.callbacks, id) } // deregisterAll closes all waiting callback channels. This is used to clean up // if the connection to libvirt is lost. Callers waiting for responses will // return an error when the response channel is closed, rather than just // hanging. func (l *Libvirt) deregisterAll() { l.cmux.Lock() defer l.cmux.Unlock() for id := range l.callbacks { l.deregister(id) } } // request performs a libvirt RPC request. // returns response returned by server. // if response is not OK, decodes error from it and returns it. func (l *Libvirt) request(proc uint32, program uint32, payload []byte) (response, error) { return l.requestStream(proc, program, payload, nil, nil) } // requestStream performs a libvirt RPC request. The `out` and `in` parameters // are optional, and should be nil when RPC endpoints don't return a stream. func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, out io.Reader, in io.Writer) (response, error) { serial := l.serial() c := make(chan response) l.register(serial, c) defer func() { l.cmux.Lock() defer l.cmux.Unlock() l.deregister(serial) }() err := l.socket.SendPacket(serial, proc, program, payload, socket.Call, socket.StatusOK) if err != nil { return response{}, err } resp, err := l.getResponse(c) if err != nil { return resp, err } if out != nil { abort := make(chan bool) outErr := make(chan error) go func() { outErr <- l.socket.SendStream(serial, proc, program, out, abort) }() // Even without incoming stream server sends confirmation once all data is received resp, err = l.processIncomingStream(c, in) if err != nil { abort <- true return resp, err } err = <-outErr if err != nil { return response{}, err } } switch in { case nil: return resp, nil default: return l.processIncomingStream(c, in) } } // processIncomingStream is called once we've successfully sent a request to // libvirt. It writes the responses back to the stream passed by the caller // until libvirt sends a packet with statusOK or an error. func (l *Libvirt) processIncomingStream(c chan response, inStream io.Writer) (response, error) { for { resp, err := l.getResponse(c) if err != nil { return resp, err } // StatusOK indicates end of stream if resp.Status == socket.StatusOK { return resp, nil } // FIXME: this smells. // StatusError is handled in getResponse, so this must be StatusContinue // StatusContinue is only valid here for stream packets // libvirtd breaks protocol and returns StatusContinue with an // empty response Payload when the stream finishes if len(resp.Payload) == 0 { return resp, nil } if inStream != nil { _, err = inStream.Write(resp.Payload) if err != nil { return response{}, err } } } } func (l *Libvirt) getResponse(c chan response) (response, error) { resp, ok := <-c if !ok { // The channel was closed before a response was received. This means // that the socket was unexpectedly closed during the RPC call. In // this case, we must assume the worst, such as libvirt crashed while // attempting to execute the call. return resp, ErrInterrupted } if resp.Status == socket.StatusError { return resp, decodeError(resp.Payload) } return resp, nil } // encode XDR encodes the provided data. func encode(data interface{}) ([]byte, error) { var buf bytes.Buffer _, err := xdr.Marshal(&buf, data) return buf.Bytes(), err } // decodeError extracts an error message from the provider buffer. func decodeError(buf []byte) error { dec := xdr.NewDecoder(bytes.NewReader(buf)) e := struct { Code uint32 DomainID uint32 Padding uint8 Message string Level uint32 }{} _, err := dec.Decode(&e) if err != nil { return err } if strings.Contains(e.Message, "unknown procedure") { return ErrUnsupported } // if libvirt returns ERR_OK, ignore the error if ErrorNumber(e.Code) == ErrOk { return nil } return Error{Code: uint32(e.Code), Message: e.Message} } // eventDecoder decodes an event from a xdr buffer. func eventDecoder(buf []byte, e interface{}) error { dec := xdr.NewDecoder(bytes.NewReader(buf)) _, err := dec.Decode(e) return err } type typedParamDecoder struct{} // Decode decodes a TypedParam. These are part of the libvirt spec, and not xdr // proper. TypedParams contain a name, which is called Field for some reason, // and a Value, which itself has a "discriminant" - an integer enum encoding the // actual type, and a value, the length of which varies based on the actual // type. func (tpd typedParamDecoder) Decode(d *xdr.Decoder, v reflect.Value) (int, error) { // Get the name of the typed param first name, n, err := d.DecodeString() if err != nil { return n, err } val, n2, err := tpd.decodeTypedParamValue(d) n += n2 if err != nil { return n, err } tp := &TypedParam{Field: name, Value: *val} v.Set(reflect.ValueOf(*tp)) return n, nil } // decodeTypedParamValue decodes the Value part of a TypedParam. func (typedParamDecoder) decodeTypedParamValue(d *xdr.Decoder) (*TypedParamValue, int, error) { // All TypedParamValues begin with a uint32 discriminant that tells us what // type they are. discriminant, n, err := d.DecodeUint() if err != nil { return nil, n, err } var n2 int var tpv *TypedParamValue switch discriminant { case 1: var val int32 n2, err = d.Decode(&val) tpv = &TypedParamValue{D: discriminant, I: val} case 2: var val uint32 n2, err = d.Decode(&val) tpv = &TypedParamValue{D: discriminant, I: val} case 3: var val int64 n2, err = d.Decode(&val) tpv = &TypedParamValue{D: discriminant, I: val} case 4: var val uint64 n2, err = d.Decode(&val) tpv = &TypedParamValue{D: discriminant, I: val} case 5: var val float64 n2, err = d.Decode(&val) tpv = &TypedParamValue{D: discriminant, I: val} case 6: var val int32 n2, err = d.Decode(&val) tpv = &TypedParamValue{D: discriminant, I: val} case 7: var val string n2, err = d.Decode(&val) tpv = &TypedParamValue{D: discriminant, I: val} default: err = fmt.Errorf("invalid parameter type %v", discriminant) } n += n2 return tpv, n, err } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/rpc_test.go000066400000000000000000000300411463537555000256410ustar00rootroot00000000000000// Copyright 2016 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package libvirt import ( "bytes" "fmt" "sync" "testing" "github.com/digitalocean/go-libvirt/internal/constants" "github.com/digitalocean/go-libvirt/internal/event" xdr "github.com/digitalocean/go-libvirt/internal/go-xdr/xdr2" "github.com/digitalocean/go-libvirt/libvirttest" "github.com/digitalocean/go-libvirt/socket" "github.com/stretchr/testify/assert" ) var ( // dc229f87d4de47198cfd2e21c6105b01 testUUID = [UUIDBuflen]byte{ 0xdc, 0x22, 0x9f, 0x87, 0xd4, 0xde, 0x47, 0x19, 0x8c, 0xfd, 0x2e, 0x21, 0xc6, 0x10, 0x5b, 0x01, } testEventHeader = []byte{ 0x00, 0x00, 0x00, 0xb0, // length 0x20, 0x00, 0x80, 0x87, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x06, // procedure 0x00, 0x00, 0x00, 0x01, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } testEvent = []byte{ 0x00, 0x00, 0x00, 0x01, // callback id // domain name ("test") 0x00, 0x00, 0x00, 0x04, 0x74, 0x65, 0x73, 0x74, // uuid (dc229f87d4de47198cfd2e21c6105b01) 0xdc, 0x22, 0x9f, 0x87, 0xd4, 0xde, 0x47, 0x19, 0x8c, 0xfd, 0x2e, 0x21, 0xc6, 0x10, 0x5b, 0x01, // domain id (14) 0x00, 0x00, 0x00, 0x0e, // event name (BLOCK_JOB_COMPLETED) 0x00, 0x00, 0x00, 0x13, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x4a, 0x4f, 0x42, 0x5f, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, 0x44, 0x00, // seconds (1462211891) 0x00, 0x00, 0x00, 0x00, 0x57, 0x27, 0x95, 0x33, // microseconds (931791) 0x00, 0x0e, 0x37, 0xcf, // event json data // ({"device":"drive-ide0-0-0","len":0,"offset":0,"speed":0,"type":"commit"}) 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x48, 0x7b, 0x22, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x22, 0x3a, 0x22, 0x64, 0x72, 0x69, 0x76, 0x65, 0x2d, 0x69, 0x64, 0x65, 0x30, 0x2d, 0x30, 0x2d, 0x30, 0x22, 0x2c, 0x22, 0x6c, 0x65, 0x6e, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x73, 0x70, 0x65, 0x65, 0x64, 0x22, 0x3a, 0x30, 0x2c, 0x22, 0x74, 0x79, 0x70, 0x65, 0x22, 0x3a, 0x22, 0x63, 0x6f, 0x6d, 0x6d, 0x69, 0x74, 0x22, 0x7d, } testLifeCycle = []byte{ 0x00, 0x00, 0x00, 0x01, // callback id // domain name ("test") 0x00, 0x00, 0x00, 0x04, 0x74, 0x65, 0x73, 0x74, // event data 0x00, 0x00, 0x00, 0x50, 0xad, 0xf7, 0x3f, 0xbe, 0xca, 0x48, 0xac, 0x95, 0x13, 0x8a, 0x31, 0xf4, 0xfe, 0x03, 0x2a, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, } testErrorMessage = []byte{ 0x00, 0x00, 0x00, 0x37, // code (55, errOperationInvalid) 0x00, 0x00, 0x00, 0x0a, // domain id // message ("Requested operation is not valid: domain is not running") 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x37, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x3a, 0x20, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x69, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x72, 0x75, 0x6e, 0x6e, 0x69, 0x6e, 0x67, 0x00, // error level 0x00, 0x00, 0x00, 0x02, } testErrorNotFoundMessage = []byte{ 0x00, 0x00, 0x00, 0x2a, // code (42 errDoDmain) 0x00, 0x00, 0x00, 0x0a, // domain id // message 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x66, 0x6f, 0x75, 0x6e, 0x64, 0x3a, 0x20, 0x6e, 0x6f, 0x20, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x6d, 0x61, 0x74, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x6e, 0x61, 0x6d, 0x65, 0x20, 0x27, 0x74, 0x65, 0x73, 0x74, 0x2d, 0x2d, 0x2d, 0x27, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, // error level 0x00, 0x00, 0x00, 0x01, } ) func TestDecodeEvent(t *testing.T) { var e DomainEvent err := eventDecoder(testEvent, &e) if err != nil { t.Error(err) } expCbID := int32(1) if e.CallbackID != expCbID { t.Errorf("expected callback id %d, got %d", expCbID, e.CallbackID) } expName := "test" if e.Domain.Name != expName { t.Errorf("expected domain %s, got %s", expName, e.Domain.Name) } expUUID := testUUID if !bytes.Equal(e.Domain.UUID[:], expUUID[:]) { t.Errorf("expected uuid:\t%x, got\n\t\t\t%x", expUUID, e.Domain.UUID) } expID := int32(14) if e.Domain.ID != expID { t.Errorf("expected id %d, got %d", expID, e.Domain.ID) } expEvent := "BLOCK_JOB_COMPLETED" if e.Event != expEvent { t.Errorf("expected %s, got %s", expEvent, e.Event) } expSec := uint64(1462211891) if e.Seconds != expSec { t.Errorf("expected seconds to be %d, got %d", expSec, e.Seconds) } expMs := uint32(931791) if e.Microseconds != expMs { t.Errorf("expected microseconds to be %d, got %d", expMs, e.Microseconds) } expDetails := []byte(`{"device":"drive-ide0-0-0","len":0,"offset":0,"speed":0,"type":"commit"}`) if e.Domain.ID != expID { t.Errorf("expected data %s, got %s", expDetails, e.Details) } } func TestDecodeError(t *testing.T) { expectedMsg := "Requested operation is not valid: domain is not running" expectedCode := ErrOperationInvalid err := decodeError(testErrorMessage) e := err.(Error) if e.Message != expectedMsg { t.Errorf("expected error message %s, got %s", expectedMsg, err.Error()) } if e.Code != uint32(expectedCode) { t.Errorf("expected code %d, got %d", expectedCode, e.Code) } } func TestErrNotFound(t *testing.T) { err := decodeError(testErrorNotFoundMessage) ok := IsNotFound(err) if !ok { t.Errorf("expected true, got %t", ok) } err = fmt.Errorf("something went wrong: %w", err) ok = IsNotFound(err) if !ok { t.Errorf("expected true, got %t", ok) } } func TestEncode(t *testing.T) { data := "test" buf, err := encode(data) if err != nil { t.Error(err) } dec := xdr.NewDecoder(bytes.NewReader(buf)) res, _, err := dec.DecodeString() if err != nil { t.Error(err) } if res != data { t.Errorf("expected %s, got %s", data, res) } } func TestRegister(t *testing.T) { l := &Libvirt{} l.callbacks = make(map[int32]chan response) id := int32(1) c := make(chan response) l.register(id, c) if _, ok := l.callbacks[id]; !ok { t.Error("expected callback to register") } } func TestDeregister(t *testing.T) { id := int32(1) l := &Libvirt{} l.callbacks = map[int32]chan response{ id: make(chan response), } l.deregister(id) if _, ok := l.callbacks[id]; ok { t.Error("expected callback to deregister") } } func TestAddStream(t *testing.T) { id := int32(1) l := &Libvirt{} l.events = make(map[int32]*event.Stream) stream := event.NewStream(0, id) defer stream.Shutdown() l.addStream(stream) if _, ok := l.events[id]; !ok { t.Error("expected event stream to exist") } } func TestRemoveStream(t *testing.T) { id := int32(1) dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() stream := event.NewStream(constants.QEMUProgram, id) defer stream.Shutdown() l.addStream(stream) fmt.Println("removing stream") err = l.removeStream(id) if err != nil { t.Fatal(err) } if _, ok := l.events[id]; ok { t.Error("expected event stream to be removed") } } func TestRemoveAllStreams(t *testing.T) { id1 := int32(1) id2 := int32(2) dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() // verify it's a successful no-op when no streams have been added l.removeAllStreams() if len(l.events) != 0 { t.Fatal("expected no streams after remove all") } stream := event.NewStream(constants.QEMUProgram, id1) defer stream.Shutdown() l.addStream(stream) stream2 := event.NewStream(constants.QEMUProgram, id2) defer stream2.Shutdown() l.addStream(stream2) l.removeAllStreams() if len(l.events) != 0 { t.Error("expected all event streams to be removed") } } func TestStream(t *testing.T) { id := int32(1) stream := event.NewStream(constants.Program, 1) defer stream.Shutdown() l := &Libvirt{} l.events = map[int32]*event.Stream{ id: stream, } var streamEvent DomainEvent err := eventDecoder(testEvent, &streamEvent) if err != nil { // event was malformed, drop. t.Error(err) } l.stream(streamEvent) e := <-stream.Recv() if e.(DomainEvent).Event != "BLOCK_JOB_COMPLETED" { t.Error("expected event") } } func TestSerial(t *testing.T) { count := int32(10) l := &Libvirt{} var wg sync.WaitGroup for i := 0; i < 10; i++ { wg.Add(1) go func() { l.serial() wg.Done() }() } wg.Wait() expected := count + int32(1) actual := l.serial() if expected != actual { t.Errorf("expected serial to be %d, got %d", expected, actual) } } func TestLookup(t *testing.T) { name := "test" dialer := libvirttest.New() l := NewWithDialer(dialer) err := l.Connect() if err != nil { t.Fatalf("connect failed: %v", err) } defer l.Disconnect() d, err := l.lookup(name) if err != nil { t.Error(err) } if d.Name != name { t.Errorf("expected domain %s, got %s", name, d.Name) } } func TestDeregisterAll(t *testing.T) { dialer := libvirttest.New() c1 := make(chan response) c2 := make(chan response) l := NewWithDialer(dialer) if len(l.callbacks) != 0 { t.Error("expected callback map to be empty at test start") } l.register(1, c1) l.register(2, c2) if len(l.callbacks) != 2 { t.Error("expected callback map to have 2 entries after inserts") } l.deregisterAll() if len(l.callbacks) != 0 { t.Error("expected callback map to be empty after deregisterAll") } } // TestRouteDeadlock ensures that go-libvirt doesn't hang when trying to send // both an event and a response (to a request) at the same time. // // Events are inherently asynchronous - the client may not be ready to receive // an event when it arrives. We don't want that to prevent go-libvirt from // continuing to receive responses to outstanding requests. This test checks for // deadlocks where the client doesn't immediately consume incoming events. func TestRouteDeadlock(t *testing.T) { id := int32(1) rch := make(chan response, 1) l := &Libvirt{ callbacks: map[int32]chan response{ id: rch, }, events: make(map[int32]*event.Stream), } stream := event.NewStream(constants.Program, id) l.addStream(stream) respHeader := &socket.Header{ Program: constants.Program, Serial: id, Status: socket.StatusOK, } eventHeader := &socket.Header{ Program: constants.Program, Procedure: constants.ProcDomainEventCallbackLifecycle, Status: socket.StatusOK, } send := func(respCount, evCount int) { // Send the events first for i := 0; i < evCount; i++ { l.Route(eventHeader, testLifeCycle) } // Now send the requests. for i := 0; i < respCount; i++ { l.Route(respHeader, []byte{}) } } cases := []struct{ rCount, eCount int }{ {2, 0}, {0, 2}, {1, 1}, {2, 2}, {50, 50}, } for _, tc := range cases { fmt.Printf("testing %d responses and %d events\n", tc.rCount, tc.eCount) go send(tc.rCount, tc.eCount) for i := 0; i < tc.rCount; i++ { r := <-rch assert.Equal(t, r.Status, uint32(socket.StatusOK)) } for i := 0; i < tc.eCount; i++ { e := <-stream.Recv() fmt.Printf("event %v/%v received\n", i, len(cases)) assert.Equal(t, "test", e.(*DomainEventCallbackLifecycleMsg).Msg.Dom.Name) } } // finally verify that canceling the context doesn't cause a deadlock. fmt.Println("checking for deadlock after context cancellation") send(0, 50) } func TestGetResponseInterrupted(t *testing.T) { dialer := libvirttest.New() l := NewWithDialer(dialer) c := make(chan response) close(c) _, err := l.getResponse(c) assert.Equal(t, ErrInterrupted, err) } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/scripts/000077500000000000000000000000001463537555000251605ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/scripts/gen-consts.sh000077500000000000000000000033211463537555000275760ustar00rootroot00000000000000#!/bin/bash # # This runs the first code generator used by go-libvirt: c-for-go. This script # is run from the 'go generate ./...' command, and only needs to be run when # changing to a different version of libvirt. # Set TOP to the root of this repo, and SCRIPTS to the absolute path to the # scripts/ directory. TOP="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" if [ -z "${LIBVIRT_SOURCE}" ]; then echo "Set LIBVIRT_SOURCE to the root of the libvirt sources you want to use first." exit 1 fi if [ -z "$GOBIN" ]; then export GOBIN="$TOP/bin" fi # Ensure this specific tooling comes first on the PATH export PATH="$GOBIN:$PATH" # Make sure c-for-go is installed echo "Attempting to install c-for-go..." if ! go install github.com/xlab/c-for-go@v1.1.0 ; then echo "failed to install c-for-go." exit 1 fi # Make sure goyacc is installed (needed for the lvgen/ generator) echo "Attempting to install goyacc..." if ! go install golang.org/x/tools/cmd/goyacc@v0.18.0; then echo "failed to install goyacc. Please install it manually from https://golang.org/x/tools/cmd/goyacc" exit 1 fi # Ensure fresh output is in libvirt/ rm -rf libvirt/ # Temporarily symlink the libvirt sources to a subdirectory because c-for-go # lacks a mechanism for us to pass it a search path for header files. LVDIR=lv_source ln -sF "${LIBVIRT_SOURCE}" "${LVDIR}" if ! c-for-go -nostamp -nocgo -ccincl libvirt.yml; then echo "c-for-go failed" exit 1 fi # Use the generated 'const.go' mv libvirt/const.go "${SCRIPTS}/../const.gen.go" # Remove unused generated files rm -f \ libvirt/cgo_helpers.go \ libvirt/doc.go \ libvirt/types.go rm "${LVDIR}" golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/scripts/licensecheck.sh000077500000000000000000000020751463537555000301430ustar00rootroot00000000000000#!/bin/bash # Verify that the correct license block is present in all Go source # files. read -r -d '' EXPECTED < 0 { return ssh.PublicKeysCallback(am.getSigners) } } return nil }) return am } // Password adds the password auth method to the allowed list. func (am *SSHAuthMethods) Password() *SSHAuthMethods { am.authMethodGenerators = append(am.authMethodGenerators, func(s *SSH) ssh.AuthMethod { if s.password == "" { am.errors = append(am.errors, errors.New("no ssh password set")) return nil } return ssh.Password(s.password) }) return am } // KeyboardInteractive adds the keyboard-interactive auth method to the // allowed list (currently unimplemented). func (am *SSHAuthMethods) KeyboardInteractive() *SSHAuthMethods { // Not implemented return am } func (am *SSHAuthMethods) getSigners() ([]ssh.Signer, error) { return am.signers, nil } func (am *SSHAuthMethods) authMethods(s *SSH) []ssh.AuthMethod { am.signers = nil am.errors = nil methods := []ssh.AuthMethod{} for _, g := range am.authMethodGenerators { if m := g(s); m != nil { methods = append(methods, m) } } return methods } // NewSSH returns an ssh dialer for connecting to libvirt running on another // server. func NewSSH(hostAddr string, opts ...SSHOption) *SSH { defaultUsername := "" if currentUser, err := user.Current(); err == nil { defaultUsername = currentUser.Username } s := &SSH{ dialTimeout: defaultSSHTimeout, username: defaultUsername, hostname: hostAddr, port: defaultSSHPort, remoteSocket: defaultSocket, knownHostsFile: defaultSSHKnownHostsFile(), keyFile: defaultSSHKeyFile(), authMethods: (&SSHAuthMethods{}).Agent().PrivKey().Password().KeyboardInteractive(), } for _, opt := range opts { opt(s) } return s } func appendKnownHost(knownHostsFile string, host string, key ssh.PublicKey) { if err := os.MkdirAll(filepath.Dir(knownHostsFile), 0700); err != nil { return } f, err := os.OpenFile(knownHostsFile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0600) if err != nil { return } defer f.Close() fmt.Fprintf(f, "%s\n", knownhosts.Line([]string{host}, key)) } func (s *SSH) checkHostKey(host string, remote net.Addr, key ssh.PublicKey) error { checkKnown, err := knownhosts.New(s.knownHostsFile) if err != nil { if errors.Is(err, fs.ErrNotExist) && s.acceptUnknownHostKey { appendKnownHost(s.knownHostsFile, host, key) return nil } return err } result := checkKnown(host, remote, key) if keyErr, ok := result.(*knownhosts.KeyError); ok { if len(keyErr.Want) == 0 && s.acceptUnknownHostKey { appendKnownHost(s.knownHostsFile, host, key) return nil } } return result } func (s *SSH) config() (*ssh.ClientConfig, error) { hostKeyCallback := s.checkHostKey if s.insecureIgnoreHostKey { hostKeyCallback = ssh.InsecureIgnoreHostKey() //nolint:gosec } return &ssh.ClientConfig{ User: s.username, HostKeyCallback: hostKeyCallback, Auth: s.authMethods.authMethods(s), Timeout: s.dialTimeout, }, nil } // Dial connects to libvirt running on another server over ssh. func (s *SSH) Dial() (net.Conn, error) { conf, err := s.config() if err != nil { return nil, err } sshClient, err := ssh.Dial("tcp", net.JoinHostPort(s.hostname, s.port), conf) if err != nil { if strings.HasPrefix(err.Error(), "ssh: handshake failed: ssh: unable to authenticate") { err = errors.Join(append([]error{err}, s.authMethods.errors...)...) } return nil, err } c, err := sshClient.Dial("unix", s.remoteSocket) if err != nil { return nil, fmt.Errorf("failed to connect to remote libvirt socket %s: %w", s.remoteSocket, err) } return c, nil } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/socket/dialers/local.go000066400000000000000000000023061463537555000300260ustar00rootroot00000000000000package dialers import ( "net" "time" ) const ( // defaultSocket specifies the default path to the libvirt unix socket. defaultSocket = "/var/run/libvirt/libvirt-sock" // defaultLocalTimeout specifies the default libvirt dial timeout. defaultLocalTimeout = 15 * time.Second ) // Local implements connecting to a local libvirtd over the unix socket. type Local struct { timeout time.Duration socket string } // LocalOption is a function for setting local socket options. type LocalOption func(*Local) // WithLocalTimeout sets the dial timeout. func WithLocalTimeout(timeout time.Duration) LocalOption { return func(l *Local) { l.timeout = timeout } } // WithSocket sets the path to the local libvirt socket. func WithSocket(socket string) LocalOption { return func(l *Local) { l.socket = socket } } // NewLocal is a default dialer to simply connect to a locally running libvirt's // socket. func NewLocal(opts ...LocalOption) *Local { l := &Local{ timeout: defaultLocalTimeout, socket: defaultSocket, } for _, opt := range opts { opt(l) } return l } // Dial connects to a local socket func (l *Local) Dial() (net.Conn, error) { return net.DialTimeout("unix", l.socket, l.timeout) } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/socket/dialers/remote.go000066400000000000000000000024211463537555000302250ustar00rootroot00000000000000package dialers import ( "net" "time" ) const ( // defaultRemotePort specifies the default libvirtd port. defaultRemotePort = "16509" // defaultRemoteTimeout specifies the default libvirt dial timeout. defaultRemoteTimeout = 20 * time.Second ) // Remote implements connecting to a remote server's libvirt using tcp type Remote struct { timeout time.Duration host, port string } // RemoteOption is a function for setting remote dialer options. type RemoteOption func(*Remote) // WithRemoteTimeout sets the dial timeout. func WithRemoteTimeout(timeout time.Duration) RemoteOption { return func(r *Remote) { r.timeout = timeout } } // UsePort sets the port to dial for libirt on the target host server. func UsePort(port string) RemoteOption { return func(r *Remote) { r.port = port } } // NewRemote is a dialer for connecting to libvirt running on another server. func NewRemote(hostAddr string, opts ...RemoteOption) *Remote { r := &Remote{ timeout: defaultRemoteTimeout, host: hostAddr, port: defaultRemotePort, } for _, opt := range opts { opt(r) } return r } // Dial connects to libvirt running on another server. func (r *Remote) Dial() (net.Conn, error) { return net.DialTimeout( "tcp", net.JoinHostPort(r.host, r.port), r.timeout, ) } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/socket/dialers/tls.go000066400000000000000000000107611463537555000275420ustar00rootroot00000000000000package dialers import ( "crypto/tls" "crypto/x509" "errors" "fmt" "io/fs" "net" "os" "os/user" "path/filepath" "time" ) const ( // defaultTLSPort specifies the default libvirtd port. defaultTLSPort = "16514" // defaultTLSTimeout specifies the default libvirt dial timeout. defaultTLSTimeout = 20 * time.Second ) type certDirs struct { KeyPath string CertPath string } // TLS implements connecting to a remote server's libvirt using tls type TLS struct { timeout time.Duration host, port string insecureSkipVerify bool certSearchPaths []certDirs caSearchPaths []string } // TLSOption is a function for setting remote dialer options. type TLSOption func(*TLS) // WithInsecureNoVerify ignores the validity of the server certificate. func WithInsecureNoVerify() TLSOption { return func(r *TLS) { r.insecureSkipVerify = true } } // UseTLSPort sets the port to dial for libirt on the target host server. func UseTLSPort(port string) TLSOption { return func(r *TLS) { r.port = port } } // UsePKIPath sets the search path for TLS certificate files. func UsePKIPath(pkiPath string) TLSOption { return func(r *TLS) { r.certSearchPaths = []certDirs{ { KeyPath: pkiPath, CertPath: pkiPath, }, } r.caSearchPaths = []string{pkiPath} } } // NewTLS is a dialer for connecting to libvirt running on another server. func NewTLS(hostAddr string, opts ...TLSOption) *TLS { r := &TLS{ timeout: defaultTLSTimeout, host: hostAddr, port: defaultTLSPort, certSearchPaths: []certDirs{ { KeyPath: "/etc/pki/libvirt/private/", CertPath: "/etc/pki/libvirt/", }, }, caSearchPaths: []string{"/etc/pki/CA/"}, } if u, err := user.Current(); err != nil || u.Uid != "0" { cd := filepath.Join(u.HomeDir, ".pki", "libvirt") r.certSearchPaths = append([]certDirs{{KeyPath: cd, CertPath: cd}}, r.certSearchPaths...) // Some libvirt docs erroneously state that the user location for the // CA cert is in ~/.pki/ but it is in fact in ~/.pki/libvirt/ r.caSearchPaths = append([]string{cd}, r.caSearchPaths...) } for _, opt := range opts { opt(r) } return r } func (r *TLS) clientCert() (*tls.Certificate, error) { var errs []error for _, dirs := range r.certSearchPaths { certFile, err := os.ReadFile(filepath.Join(dirs.CertPath, "clientcert.pem")) if err != nil { errs = append(errs, fmt.Errorf("could not read tls client cert: %w", err)) continue } keyFile, err := os.ReadFile(filepath.Join(dirs.KeyPath, "clientkey.pem")) if err != nil { errs = append(errs, fmt.Errorf("could not read tls private key: %w", err)) continue } cert, err := tls.X509KeyPair(certFile, keyFile) if err != nil { return nil, fmt.Errorf("invalid tls client cert: %w", err) } return &cert, nil } return nil, errors.Join(errs...) } func (r *TLS) caCerts(optional bool) (*x509.CertPool, error) { var errs []error pool := x509.NewCertPool() for _, dir := range r.caSearchPaths { if caFile, err := os.ReadFile(filepath.Join(dir, "cacert.pem")); err == nil { pool.AppendCertsFromPEM(caFile) return pool, nil } else if !(optional && errors.Is(err, fs.ErrNotExist)) { errs = append(errs, fmt.Errorf("could not read tls CA cert: %w", err)) } } return nil, errors.Join(errs...) } func (r *TLS) config() (*tls.Config, error) { cert, err := r.clientCert() if err != nil { return nil, err } rootCAs, err := r.caCerts(r.insecureSkipVerify) if err != nil { return nil, err } return &tls.Config{ Certificates: []tls.Certificate{*cert}, RootCAs: rootCAs, InsecureSkipVerify: r.insecureSkipVerify, //nolint:gosec }, nil } // Dial connects to libvirt running on another server. func (r *TLS) Dial() (net.Conn, error) { conf, err := r.config() if err != nil { return nil, err } netDialer := net.Dialer{ Timeout: r.timeout, } c, err := tls.DialWithDialer( &netDialer, "tcp", net.JoinHostPort(r.host, r.port), conf, ) if err != nil { return nil, err } // When running over TLS, after connection libvirt writes a single byte to // the socket to indicate whether the server's check of the client's // certificate has succeeded. // See https://github.com/digitalocean/go-libvirt/issues/89#issuecomment-1607300636 // for more details. buf := make([]byte, 1) if n, err := c.Read(buf); err != nil { c.Close() return nil, err } else if n != 1 || buf[0] != byte(1) { c.Close() return nil, errors.New("server verification (of our certificate or IP address) failed") } return c, nil } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/socket/socket.go000066400000000000000000000214241463537555000266030ustar00rootroot00000000000000package socket import ( "bufio" "encoding/binary" "errors" "io" "net" "sync" "syscall" "time" "unsafe" "github.com/digitalocean/go-libvirt/internal/constants" ) const disconnectTimeout = 5 * time.Second // request and response statuses const ( // StatusOK is always set for method calls or events. // For replies it indicates successful completion of the method. // For streams it indicates confirmation of the end of file on the stream. StatusOK = iota // StatusError for replies indicates that the method call failed // and error information is being returned. For streams this indicates // that not all data was sent and the stream has aborted. StatusError // StatusContinue is only used for streams. // This indicates that further data packets will be following. StatusContinue ) // request and response types const ( // Call is used when making calls to the remote server. Call = iota // Reply indicates a server reply. Reply // Message is an asynchronous notification. Message // Stream represents a stream data packet. Stream // CallWithFDs is used by a client to indicate the request has // arguments with file descriptors. CallWithFDs // ReplyWithFDs is used by a server to indicate the request has // arguments with file descriptors. ReplyWithFDs ) // Dialer is an interface for connecting to libvirt's underlying socket. type Dialer interface { Dial() (net.Conn, error) } // Router is an interface used to route packets to the appropriate clients. type Router interface { Route(*Header, []byte) } // Socket represents a libvirt Socket and its connection state type Socket struct { dialer Dialer router Router conn net.Conn reader *bufio.Reader writer *bufio.Writer // used to serialize any Socket writes and any updates to conn, r, or w mu *sync.Mutex // disconnected is closed when the listen goroutine associated with a // Socket connection has returned. disconnected chan struct{} } // packet represents a RPC request or response. type packet struct { // Size of packet, in bytes, including length. // Len + Header + Payload Len uint32 Header Header } // Global packet instance, for use with unsafe.Sizeof() var _p packet // Header is a libvirt rpc packet header type Header struct { // Program identifier Program uint32 // Program version Version uint32 // Remote procedure identifier Procedure uint32 // Call type, e.g., Reply Type uint32 // Call serial number Serial int32 // Request status, e.g., StatusOK Status uint32 } // New initializes a new type for managing the Socket. func New(dialer Dialer, router Router) *Socket { s := &Socket{ dialer: dialer, router: router, disconnected: make(chan struct{}), mu: &sync.Mutex{}, } // we start with a closed channel since that indicates no connection close(s.disconnected) return s } // Connect uses the dialer provided on creation to establish // underlying physical connection to the desired libvirt. func (s *Socket) Connect() error { s.mu.Lock() defer s.mu.Unlock() if !s.isDisconnected() { return errors.New("already connected to socket") } conn, err := s.dialer.Dial() if err != nil { return err } s.conn = conn s.reader = bufio.NewReader(conn) s.writer = bufio.NewWriter(conn) s.disconnected = make(chan struct{}) go s.listenAndRoute() return nil } // Disconnect closes the Socket connection to libvirt and waits for the reader // gorouting to shut down. func (s *Socket) Disconnect() error { // just return if we're already disconnected if s.isDisconnected() { return nil } err := s.conn.Close() if err != nil { return err } // now we wait for the reader to return so as not to avoid it nil // referencing // Put this in a select, // and have it only nil out the conn value if it doesn't fail select { case <-s.disconnected: case <-time.After(disconnectTimeout): return errors.New("timed out waiting for Disconnect cleanup") } return nil } // Disconnected returns a channel that will be closed once the current // connection is closed. This can happen due to an explicit call to Disconnect // from the client, or due to non-temporary Read or Write errors encountered. func (s *Socket) Disconnected() <-chan struct{} { return s.disconnected } // isDisconnected is a non-blocking function to query whether a connection // is disconnected or not. func (s *Socket) isDisconnected() bool { select { case <-s.disconnected: return true default: return false } } // listenAndRoute reads packets from the Socket and calls the provided // Router function to route them func (s *Socket) listenAndRoute() { // only returns once it detects a non-temporary error related to the // underlying connection listen(s.reader, s.router) // signal any clients listening that the connection has been disconnected close(s.disconnected) } // listen processes incoming data and routes // responses to their respective callback handler. func listen(s io.Reader, router Router) { for { // response packet length length, err := pktlen(s) if err != nil { if isTemporary(err) { continue } // connection is no longer valid, so shutdown return } // response header h, err := extractHeader(s) if err != nil { // invalid packet continue } // payload: packet length minus what was previously read size := int(length) - int(unsafe.Sizeof(_p)) buf := make([]byte, size) _, err = io.ReadFull(s, buf) if err != nil { // invalid packet continue } // route response to caller router.Route(h, buf) } } // isTemporary returns true if the error returned from a read is transient. // If the error type is an OpError, check whether the net connection // error condition is temporary (which means we can keep using the // connection). // Errors not of the net.OpError type tend to be things like io.EOF, // syscall.EINVAL, or io.ErrClosedPipe (i.e. all things that // indicate the connection in use is no longer valid.) func isTemporary(err error) bool { opErr, ok := err.(*net.OpError) if ok { return opErr.Temporary() } return false } // pktlen returns the length of an incoming RPC packet. Read errors will // result in a returned response length of 0 and a non-nil error. func pktlen(r io.Reader) (uint32, error) { buf := make([]byte, unsafe.Sizeof(_p.Len)) // extract the packet's length from the header _, err := io.ReadFull(r, buf) if err != nil { return 0, err } return binary.BigEndian.Uint32(buf), nil } // extractHeader returns the decoded header from an incoming response. func extractHeader(r io.Reader) (*Header, error) { buf := make([]byte, unsafe.Sizeof(_p.Header)) // extract the packet's header from r _, err := io.ReadFull(r, buf) if err != nil { return nil, err } return &Header{ Program: binary.BigEndian.Uint32(buf[0:4]), Version: binary.BigEndian.Uint32(buf[4:8]), Procedure: binary.BigEndian.Uint32(buf[8:12]), Type: binary.BigEndian.Uint32(buf[12:16]), Serial: int32(binary.BigEndian.Uint32(buf[16:20])), Status: binary.BigEndian.Uint32(buf[20:24]), }, nil } // SendPacket sends a packet to libvirt on the socket connection. func (s *Socket) SendPacket( serial int32, proc uint32, program uint32, payload []byte, typ uint32, status uint32, ) error { p := packet{ Header: Header{ Program: program, Version: constants.ProtocolVersion, Procedure: proc, Type: typ, Serial: serial, Status: status, }, } size := int(unsafe.Sizeof(p.Len)) + int(unsafe.Sizeof(p.Header)) if payload != nil { size += len(payload) } p.Len = uint32(size) if s.isDisconnected() { // this mirrors what a lot of net code return on use of a no // longer valid connection return syscall.EINVAL } s.mu.Lock() defer s.mu.Unlock() err := binary.Write(s.writer, binary.BigEndian, p) if err != nil { return err } // write payload if payload != nil { err = binary.Write(s.writer, binary.BigEndian, payload) if err != nil { return err } } return s.writer.Flush() } // SendStream sends a stream of packets to libvirt on the socket connection. func (s *Socket) SendStream(serial int32, proc uint32, program uint32, stream io.Reader, abort chan bool) error { // Keep total packet length under 4 MiB to follow possible limitation in libvirt server code buf := make([]byte, 4*MiB-unsafe.Sizeof(_p)) for { select { case <-abort: return s.SendPacket(serial, proc, program, nil, Stream, StatusError) default: } n, err := stream.Read(buf) if n > 0 { err2 := s.SendPacket(serial, proc, program, buf[:n], Stream, StatusContinue) if err2 != nil { return err2 } } if err != nil { if err == io.EOF { return s.SendPacket(serial, proc, program, nil, Stream, StatusOK) } // keep original error err2 := s.SendPacket(serial, proc, program, nil, Stream, StatusError) if err2 != nil { return err2 } return err } } } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/socket/socket_test.go000066400000000000000000000024601463537555000276410ustar00rootroot00000000000000package socket import ( "bytes" "testing" "github.com/digitalocean/go-libvirt/internal/constants" ) var testHeader = []byte{ 0x20, 0x00, 0x80, 0x86, // program 0x00, 0x00, 0x00, 0x01, // version 0x00, 0x00, 0x00, 0x01, // procedure 0x00, 0x00, 0x00, 0x00, // type 0x00, 0x00, 0x00, 0x00, // serial 0x00, 0x00, 0x00, 0x00, // status } func TestPktLen(t *testing.T) { data := []byte{0x00, 0x00, 0x00, 0xa} // uint32:10 r := bytes.NewBuffer(data) expected := uint32(10) actual, err := pktlen(r) if err != nil { t.Error(err) } if expected != actual { t.Errorf("expected packet length %q, got %q", expected, actual) } } func TestExtractHeader(t *testing.T) { r := bytes.NewBuffer(testHeader) h, err := extractHeader(r) if err != nil { t.Error(err) } if h.Program != constants.Program { t.Errorf("expected Program %q, got %q", constants.Program, h.Program) } if h.Version != constants.ProtocolVersion { t.Errorf("expected version %q, got %q", constants.ProtocolVersion, h.Version) } if h.Procedure != constants.ProcConnectOpen { t.Errorf("expected procedure %q, got %q", constants.ProcConnectOpen, h.Procedure) } if h.Type != Call { t.Errorf("expected type %q, got %q", Call, h.Type) } if h.Status != StatusOK { t.Errorf("expected status %q, got %q", StatusOK, h.Status) } } golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/socket/units.go000066400000000000000000000014521463537555000264540ustar00rootroot00000000000000// Copyright 2016 The go-libvirt Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // This module provides different units of measurement to make other // code more readable. package socket const ( // B - byte B = 1 // KiB - kibibyte KiB = 1024 * B // MiB - mebibyte MiB = 1024 * KiB ) golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/testdata/000077500000000000000000000000001463537555000253025ustar00rootroot00000000000000golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/testdata/test-domain.xml000066400000000000000000000020071463537555000302470ustar00rootroot00000000000000 test 1024 1024 afc2ef71-66e0-45a7-a5ec-d8ba1ea8177d hvm destroy restart restart 1 /usr/bin/qemu-system-x86_64 golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/testdata/test-pool.xml000066400000000000000000000002051463537555000277470ustar00rootroot00000000000000 test /tmp golang-github-digitalocean-go-libvirt-0.0~git20240610.f66fb3c/testdata/test-secret.xml000066400000000000000000000003111463537555000302610ustar00rootroot00000000000000 test 19fdc2f2-fa64-46f3-bacf-42a8aafca6dd /tmp