From f314e95419ac399d200f733c219a49e85466bb53 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sun, 4 Feb 2018 17:33:55 +0400 Subject: [PATCH 01/20] Extract sendPacket and getResponse methods from request() --- rpc.go | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/rpc.go b/rpc.go index f4d8c0b..4161fcc 100644 --- a/rpc.go +++ b/rpc.go @@ -298,6 +298,20 @@ func (l *Libvirt) request(proc uint32, program uint32, payload []byte) (response l.register(serial, c) + err := l.sendPacket(serial, proc, program, payload, Call, StatusOK) + if err != nil { + return response{}, err + } + + resp, err := l.getResponse(c) + if err != nil { + return resp, err + } + + return resp, nil +} + +func (l *Libvirt) sendPacket(serial uint32, proc uint32, program uint32, payload []byte, typ uint32, status uint32) error { size := constants.PacketLengthSize + constants.HeaderSize if payload != nil { size += len(payload) @@ -309,9 +323,9 @@ func (l *Libvirt) request(proc uint32, program uint32, payload []byte) (response Program: program, Version: constants.ProtocolVersion, Procedure: proc, - Type: Call, + Type: typ, Serial: serial, - Status: StatusOK, + Status: status, }, } @@ -320,21 +334,25 @@ func (l *Libvirt) request(proc uint32, program uint32, payload []byte) (response defer l.mu.Unlock() err := binary.Write(l.w, binary.BigEndian, p) if err != nil { - return response{}, err + return err } // write payload if payload != nil { err = binary.Write(l.w, binary.BigEndian, payload) if err != nil { - return response{}, err + return err } } if err := l.w.Flush(); err != nil { - return response{}, err + return err } + return nil +} + +func (l *Libvirt) getResponse(c chan response) (response, error) { resp := <-c if resp.Status != StatusOK { return resp, decodeError(resp.Payload) From 0c23de2f7e162d24223fe9793fc8c904f1b3d3f0 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sun, 4 Feb 2018 17:39:49 +0400 Subject: [PATCH 02/20] Deregister channels in request() method --- rpc.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rpc.go b/rpc.go index 4161fcc..bea3317 100644 --- a/rpc.go +++ b/rpc.go @@ -195,8 +195,6 @@ func (l *Libvirt) callback(id uint32, res response) { if ok { c <- res } - - l.deregister(id) } // route sends incoming packets to their listeners. @@ -297,6 +295,7 @@ func (l *Libvirt) request(proc uint32, program uint32, payload []byte) (response c := make(chan response) l.register(serial, c) + defer l.deregister(serial) err := l.sendPacket(serial, proc, program, payload, Call, StatusOK) if err != nil { From 07dbf8603aa1ac3c9a3762f5baee0ec45b29655c Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Mon, 5 Feb 2018 01:28:14 +0400 Subject: [PATCH 03/20] Drain callback channel when try to deregister it callback() is blocked on sending into channel otherwise. --- rpc.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/rpc.go b/rpc.go index bea3317..6e019d0 100644 --- a/rpc.go +++ b/rpc.go @@ -191,10 +191,10 @@ func (l *Libvirt) listen() { func (l *Libvirt) callback(id uint32, res response) { l.cm.Lock() c, ok := l.callbacks[id] - l.cm.Unlock() if ok { c <- res } + l.cm.Unlock() } // route sends incoming packets to their listeners. @@ -281,7 +281,19 @@ func (l *Libvirt) register(id uint32, c chan response) { // deregister destroys a method response callback func (l *Libvirt) deregister(id uint32) { - l.cm.Lock() + lockChan := make(chan bool) + go func() { + l.cm.Lock() + lockChan <- true + }() +Loop: + for { + select { + case _ = <-l.callbacks[id]: + case _ = <-lockChan: + break Loop + } + } close(l.callbacks[id]) delete(l.callbacks, id) l.cm.Unlock() From bfac3da6dc7f0dcdf84ae6f51f18b0b77f5ffc18 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sun, 25 Feb 2018 22:35:22 +0400 Subject: [PATCH 04/20] Treat only StatusError as error, not StatusContinue --- rpc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc.go b/rpc.go index 6e019d0..680060c 100644 --- a/rpc.go +++ b/rpc.go @@ -365,7 +365,7 @@ func (l *Libvirt) sendPacket(serial uint32, proc uint32, program uint32, payload func (l *Libvirt) getResponse(c chan response) (response, error) { resp := <-c - if resp.Status != StatusOK { + if resp.Status == StatusError { return resp, decodeError(resp.Payload) } From 81b15d47751788ebba8e1cce5d8a41c9a5eeca09 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sun, 25 Feb 2018 23:16:01 +0400 Subject: [PATCH 05/20] Add input and output streams handling to rpc layer --- rpc.go | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/rpc.go b/rpc.go index 680060c..80653df 100644 --- a/rpc.go +++ b/rpc.go @@ -303,6 +303,10 @@ Loop: // 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) +} + +func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, outStream io.Reader, inStream io.Writer) (response, error) { serial := l.serial() c := make(chan response) @@ -319,6 +323,84 @@ func (l *Libvirt) request(proc uint32, program uint32, payload []byte) (response return resp, err } + var abortOutStream chan bool + var outStreamErr chan error + if outStream != nil { + abortOutStream = make(chan bool) + outStreamErr = make(chan error) + go func() { + var err error + var n int + buf := make([]byte, 1<<22-24) + for { + select { + case <-abortOutStream: + err = l.sendPacket(serial, proc, program, nil, Stream, StatusError) + break + default: + } + n, err = outStream.Read(buf) + if err != nil { + if err == io.EOF { + err = l.sendPacket(serial, proc, program, nil, Stream, StatusOK) + break + } else { + // keep original error + err := l.sendPacket(serial, proc, program, nil, Stream, StatusError) + if err != nil { + outStreamErr <- err + return + } else { + break + } + } + } + if n > 0 { + err = l.sendPacket(serial, proc, program, buf[:n], Stream, StatusContinue) + if err != nil { + break + } + } + } + outStreamErr <- err + }() + } + + // Even without incoming stream server sends confirmation once all data is received + if outStream != nil || inStream != nil { + for { + resp, err = l.getResponse(c) + if err != nil { + if outStream != nil { + abortOutStream <- true + } + return resp, err + } + // Continue is valid here only for stream packets + if resp.Status == StatusContinue { + if inStream != nil { + _, err = inStream.Write(resp.Payload) + if err != nil { + if outStream != nil { + abortOutStream <- true + } + return response{}, err + } + } + } else { + // StatusError is handled in getResponse, so this is StatusOK, end of stream + break + } + } + } + + if outStream != nil { + err = <-outStreamErr + if err != nil { + return response{}, nil + } + } + return resp, nil } From 5d8cdfc854886bb069299ea3990bf48c24e5fc0a Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Mon, 26 Feb 2018 00:51:13 +0400 Subject: [PATCH 06/20] Capture comment before libvirt proc declaration It contains annotations that we can use to insert streams in proc arguments. --- internal/lvgen/lvlexer.go | 7 +- internal/lvgen/sunrpc.y | 8 + internal/lvgen/y.go | 283 ++++++------ internal/lvgen/y.output | 908 ++++++++++++++++++++------------------ 4 files changed, 632 insertions(+), 574 deletions(-) diff --git a/internal/lvgen/lvlexer.go b/internal/lvgen/lvlexer.go index 40dcbed..be133fc 100644 --- a/internal/lvgen/lvlexer.go +++ b/internal/lvgen/lvlexer.go @@ -259,12 +259,17 @@ func lexText(l *Lexer) stateFn { // lexBlockComment is used when we find a comment marker '/*' in the input. func lexBlockComment(l *Lexer) stateFn { + 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. l.next() l.next() - l.ignore() + if metadataComment { + l.emit(METADATACOMMENT) + } else { + l.ignore() + } return lexText } if l.next() == eof { diff --git a/internal/lvgen/sunrpc.y b/internal/lvgen/sunrpc.y index a8d2247..22665a3 100644 --- a/internal/lvgen/sunrpc.y +++ b/internal/lvgen/sunrpc.y @@ -56,6 +56,7 @@ import ( %token IDENTIFIER CONSTANT ERROR // RPCL additional tokens: %token PROGRAM VERSION +%token METADATACOMMENT %% @@ -99,6 +100,13 @@ enum_value return 1 } } + | METADATACOMMENT enum_value_ident '=' value { + err := AddEnumVal($2.val, $4.val) + if err != nil { + yylex.Error(err.Error()) + return 1 + } + } | enum_value_ident '=' value { err := AddEnumVal($1.val, $3.val) if err != nil { diff --git a/internal/lvgen/y.go b/internal/lvgen/y.go index 8dbf7c9..b6d1204 100644 --- a/internal/lvgen/y.go +++ b/internal/lvgen/y.go @@ -59,6 +59,7 @@ const CONSTANT = 57366 const ERROR = 57367 const PROGRAM = 57368 const VERSION = 57369 +const METADATACOMMENT = 57370 var yyToknames = [...]string{ "$end", @@ -88,6 +89,7 @@ var yyToknames = [...]string{ "ERROR", "PROGRAM", "VERSION", + "METADATACOMMENT", "';'", "'{'", "'}'", @@ -108,7 +110,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -//line sunrpc.y:259 +//line sunrpc.y:267 //line yacctab:1 var yyExca = [...]int{ @@ -119,106 +121,107 @@ var yyExca = [...]int{ const yyPrivate = 57344 -const yyLast = 148 +const yyLast = 153 var yyAct = [...]int{ - 84, 77, 36, 111, 103, 76, 61, 67, 32, 129, - 55, 126, 128, 100, 37, 117, 85, 86, 78, 63, - 98, 97, 73, 31, 74, 69, 131, 115, 71, 89, - 41, 94, 72, 62, 40, 10, 39, 43, 42, 13, - 30, 118, 14, 38, 107, 48, 49, 50, 51, 47, - 90, 11, 79, 64, 10, 70, 106, 96, 13, 54, - 12, 14, 52, 29, 134, 127, 119, 108, 91, 75, - 80, 15, 16, 110, 87, 88, 85, 86, 59, 60, - 63, 93, 83, 48, 49, 50, 51, 92, 95, 58, - 82, 27, 25, 23, 20, 102, 18, 99, 2, 105, - 101, 46, 8, 66, 45, 7, 109, 44, 4, 104, - 113, 105, 114, 116, 120, 28, 122, 81, 8, 68, - 123, 7, 26, 124, 4, 121, 125, 112, 130, 53, - 24, 132, 133, 65, 22, 35, 34, 33, 21, 19, - 57, 56, 17, 9, 6, 5, 3, 1, + 86, 79, 36, 115, 107, 78, 62, 32, 68, 55, + 57, 133, 130, 132, 104, 121, 87, 88, 80, 64, + 37, 102, 75, 31, 76, 101, 114, 135, 119, 72, + 92, 41, 97, 89, 63, 40, 10, 39, 43, 42, + 13, 73, 30, 14, 38, 122, 48, 49, 50, 51, + 47, 111, 93, 81, 71, 11, 110, 138, 10, 65, + 99, 54, 13, 52, 12, 14, 29, 131, 123, 74, + 77, 112, 94, 59, 82, 15, 90, 91, 58, 70, + 16, 64, 85, 96, 87, 88, 60, 61, 95, 84, + 100, 98, 48, 49, 50, 51, 113, 59, 106, 27, + 103, 25, 109, 105, 23, 20, 18, 67, 46, 8, + 108, 45, 7, 44, 4, 109, 2, 120, 124, 117, + 126, 118, 83, 69, 127, 8, 26, 128, 7, 125, + 4, 129, 134, 28, 116, 136, 137, 53, 24, 66, + 22, 35, 34, 33, 21, 19, 56, 17, 9, 6, + 5, 3, 1, } var yyPact = [...]int{ - 45, -1000, -1000, 44, -1000, -1000, -1000, -1000, -1000, -1000, - 73, 71, -1000, 70, 69, 68, 45, 34, -1000, 8, - -1000, 26, 33, -1000, -1000, -1000, 30, -1000, -1000, 66, - 55, -1000, -1000, -1000, -1000, -1000, -4, -1000, 64, -1000, + 49, -1000, -1000, 51, -1000, -1000, -1000, -1000, -1000, -1000, + 83, 82, -1000, 81, 78, 76, 49, 36, -1000, 9, + -1000, 27, 33, -1000, -1000, -1000, 31, -1000, -1000, 50, + 63, -1000, -1000, -1000, -1000, -1000, -4, -1000, 73, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, 89, -2, 25, -3, 0, -1000, -1000, - -1000, -11, 57, -1000, -1000, 26, -20, 22, 42, 67, - -1000, 66, 53, 53, -7, -1000, 20, 40, 26, -1, - -2, 28, -1000, -1000, -1000, -1000, -1000, -13, -16, -1000, - -1000, 26, -26, 57, 53, -1000, 26, -1000, -1000, -1000, - 27, -1000, -1000, 14, 39, 50, 105, -5, 26, -23, - -1000, 11, 38, 53, -1000, 53, -1000, 26, -1000, 105, - -1000, -29, 37, -27, -1000, -31, 26, -1000, -6, 26, - -1000, 53, -1000, 36, -1000, + -1000, -1000, -1000, 93, 52, 23, -3, 8, 74, -1000, + -1000, -1000, -12, 58, -1000, -1000, 27, -21, 22, 45, + 66, -1000, 50, 61, 0, 61, -7, -1000, 21, 43, + 27, -1, 52, 30, -1000, -1000, -1000, -1000, -1000, 61, + -10, -16, -1000, -1000, 27, -26, 58, 61, -1000, 27, + -1000, -1000, -1000, -1000, 26, -1000, -1000, 20, 42, 3, + 114, -5, 27, -24, -1000, 14, 39, 61, -1000, 61, + -1000, 27, -1000, 114, -1000, -29, 38, -27, -1000, -30, + 27, -1000, -6, 27, -1000, 61, -1000, 28, -1000, } var yyPgo = [...]int{ - 0, 147, 98, 0, 146, 107, 145, 144, 104, 101, - 143, 142, 10, 141, 140, 139, 138, 1, 8, 137, - 136, 135, 2, 6, 14, 134, 133, 5, 130, 129, - 3, 127, 126, 125, 122, 7, 119, 117, 4, 109, - 106, + 0, 152, 116, 0, 151, 113, 150, 149, 111, 108, + 148, 147, 9, 146, 10, 145, 144, 1, 7, 143, + 142, 141, 2, 6, 20, 140, 139, 5, 138, 137, + 3, 134, 131, 129, 126, 8, 123, 122, 4, 110, + 96, } var yyR1 = [...]int{ 0, 1, 3, 3, 2, 2, 4, 4, 4, 4, - 4, 4, 5, 12, 12, 13, 13, 11, 14, 6, - 6, 15, 16, 7, 17, 17, 17, 17, 18, 22, + 4, 4, 5, 12, 12, 13, 13, 13, 11, 14, + 6, 6, 15, 16, 7, 17, 17, 17, 17, 18, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, - 24, 24, 24, 24, 23, 19, 20, 20, 21, 26, - 8, 25, 27, 27, 29, 9, 28, 30, 30, 32, - 31, 33, 31, 10, 34, 35, 35, 36, 37, 38, - 38, 39, 40, + 22, 24, 24, 24, 24, 23, 19, 20, 20, 21, + 26, 8, 25, 27, 27, 29, 9, 28, 30, 30, + 32, 31, 33, 31, 10, 34, 35, 35, 36, 37, + 38, 38, 39, 40, } var yyR2 = [...]int{ 0, 1, 1, 1, 2, 3, 1, 1, 1, 1, - 1, 1, 5, 1, 3, 1, 3, 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, + 1, 1, 5, 1, 3, 1, 4, 3, 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 = [...]int{ -1000, -1, -2, -4, -5, -6, -7, -8, -9, -10, - 9, 6, 15, 13, 16, 26, 28, -11, 23, -15, - 23, -16, -25, 23, -28, 23, -34, 23, -2, 29, - 32, -17, -18, -19, -20, -21, -22, -24, 17, 10, + 9, 6, 15, 13, 16, 26, 29, -11, 23, -15, + 23, -16, -25, 23, -28, 23, -34, 23, -2, 30, + 33, -17, -18, -19, -20, -21, -22, -24, 17, 10, 8, 4, 12, 11, -5, -8, -9, 23, 19, 20, - 21, 22, 29, -29, 29, -12, -13, -14, 23, 23, - 24, -23, 37, 23, -24, -26, 14, -35, -36, 27, - 30, 31, 32, 33, 35, -23, -27, -17, 38, 30, - 28, -37, 23, -12, -3, 23, 24, -3, -3, 36, - 30, 28, -18, -22, 32, -35, 29, 34, 36, -27, - 39, -23, -3, -38, -39, -22, 29, 30, 28, -40, - 23, -30, -31, 5, 7, 32, -38, 38, 30, 28, - -3, -33, -3, -22, -30, -32, 40, 28, 39, 40, - -17, 32, -17, -3, 28, + 21, 22, 30, -29, 30, -12, -13, -14, 28, 23, + 23, 24, -23, 38, 23, -24, -26, 14, -35, -36, + 27, 31, 32, 33, -14, 34, 36, -23, -27, -17, + 39, 31, 29, -37, 23, -12, -3, 23, 24, 33, + -3, -3, 37, 31, 29, -18, -22, 33, -35, 30, + -3, 35, 37, -27, 40, -23, -3, -38, -39, -22, + 30, 31, 29, -40, 23, -30, -31, 5, 7, 33, + -38, 39, 31, 29, -3, -33, -3, -22, -30, -32, + 41, 29, 40, 41, -17, 33, -17, -3, 29, } var yyDef = [...]int{ 0, -2, 1, 0, 6, 7, 8, 9, 10, 11, - 0, 0, 22, 0, 0, 0, 4, 0, 17, 0, - 21, 0, 0, 51, 54, 56, 0, 64, 5, 0, - 0, 23, 24, 25, 26, 27, 0, 29, 0, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 49, 0, 0, 0, 13, 15, 18, 19, - 20, 28, 0, 44, 30, 0, 0, 0, 0, 0, - 12, 0, 0, 0, 0, 48, 0, 0, 0, 0, - 65, 0, 68, 14, 16, 2, 3, 0, 0, 47, - 50, 52, 0, 0, 0, 66, 0, 45, 46, 53, - 0, 28, 63, 0, 0, 0, 0, 0, 69, 0, - 72, 0, 0, 0, 61, 0, 70, 0, 55, 57, - 59, 0, 0, 0, 58, 0, 0, 67, 0, 0, - 62, 0, 60, 0, 71, + 0, 0, 23, 0, 0, 0, 4, 0, 18, 0, + 22, 0, 0, 52, 55, 57, 0, 65, 5, 0, + 0, 24, 25, 26, 27, 28, 0, 30, 0, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 50, 0, 0, 0, 13, 15, 0, 19, + 20, 21, 29, 0, 45, 31, 0, 0, 0, 0, + 0, 12, 0, 0, 0, 0, 0, 49, 0, 0, + 0, 0, 66, 0, 69, 14, 17, 2, 3, 0, + 0, 0, 48, 51, 53, 0, 0, 0, 67, 0, + 16, 46, 47, 54, 0, 29, 64, 0, 0, 0, + 0, 0, 70, 0, 73, 0, 0, 0, 62, 0, + 71, 0, 56, 58, 60, 0, 0, 0, 59, 0, + 0, 68, 0, 0, 63, 0, 61, 0, 72, } var yyTok1 = [...]int{ @@ -226,21 +229,21 @@ var yyTok1 = [...]int{ 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, - 38, 39, 37, 3, 31, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 40, 28, - 35, 32, 36, 3, 3, 3, 3, 3, 3, 3, + 39, 40, 38, 3, 32, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 41, 29, + 36, 33, 37, 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, 33, 3, 34, 3, 3, 3, 3, 3, 3, + 3, 34, 3, 35, 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, 29, 3, 30, + 3, 3, 3, 30, 3, 31, } var yyTok2 = [...]int{ 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, + 22, 23, 24, 25, 26, 27, 28, } var yyTok3 = [...]int{ 0, @@ -585,13 +588,13 @@ yydefault: case 12: yyDollar = yyS[yypt-5 : yypt+1] - //line sunrpc.y:86 + //line sunrpc.y:87 { StartEnum(yyDollar[2].val) } case 15: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:95 + //line sunrpc.y:96 { err := AddEnumAutoVal(yyDollar[1].val) if err != nil { @@ -600,8 +603,18 @@ yydefault: } } case 16: + yyDollar = yyS[yypt-4 : yypt+1] + //line sunrpc.y:103 + { + err := AddEnumVal(yyDollar[2].val, yyDollar[4].val) + if err != nil { + yylex.Error(err.Error()) + return 1 + } + } + case 17: yyDollar = yyS[yypt-3 : yypt+1] - //line sunrpc.y:102 + //line sunrpc.y:110 { err := AddEnumVal(yyDollar[1].val, yyDollar[3].val) if err != nil { @@ -609,9 +622,9 @@ yydefault: return 1 } } - case 20: + case 21: yyDollar = yyS[yypt-4 : yypt+1] - //line sunrpc.y:124 + //line sunrpc.y:132 { err := AddConst(yyDollar[2].val, yyDollar[4].val) if err != nil { @@ -619,147 +632,147 @@ yydefault: return 1 } } - case 22: + case 23: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:138 + //line sunrpc.y:146 { StartTypedef() } - case 28: + case 29: yyDollar = yyS[yypt-2 : yypt+1] - //line sunrpc.y:149 + //line sunrpc.y:157 { AddDeclaration(yyDollar[2].val, yyDollar[1].val) } - case 30: + case 31: yyDollar = yyS[yypt-2 : yypt+1] - //line sunrpc.y:154 + //line sunrpc.y:162 { yyVAL.val = "u" + yyDollar[2].val } - case 31: + case 32: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:155 + //line sunrpc.y:163 { yyVAL.val = "float32" } - case 32: + case 33: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:156 + //line sunrpc.y:164 { yyVAL.val = "float64" } - case 33: + case 34: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:157 + //line sunrpc.y:165 { yyVAL.val = "bool" } - case 34: + case 35: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:158 + //line sunrpc.y:166 { yyVAL.val = "string" } - case 35: - yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:159 - { - yyVAL.val = "byte" - } - case 40: + case 36: yyDollar = yyS[yypt-1 : yypt+1] //line sunrpc.y:167 { - yyVAL.val = "int64" + yyVAL.val = "byte" } case 41: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:168 + //line sunrpc.y:175 { - yyVAL.val = "int32" + yyVAL.val = "int64" } case 42: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:169 + //line sunrpc.y:176 { - yyVAL.val = "int16" + yyVAL.val = "int32" } case 43: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:170 + //line sunrpc.y:177 + { + yyVAL.val = "int16" + } + case 44: + yyDollar = yyS[yypt-1 : yypt+1] + //line sunrpc.y:178 { yyVAL.val = "int8" } - case 45: + case 46: yyDollar = yyS[yypt-5 : yypt+1] - //line sunrpc.y:178 + //line sunrpc.y:186 { AddFixedArray(yyDollar[2].val, yyDollar[1].val, yyDollar[4].val) } - case 46: + case 47: yyDollar = yyS[yypt-5 : yypt+1] - //line sunrpc.y:182 + //line sunrpc.y:190 { AddVariableArray(yyDollar[2].val, yyDollar[1].val, yyDollar[4].val) } - case 47: + case 48: yyDollar = yyS[yypt-4 : yypt+1] - //line sunrpc.y:183 + //line sunrpc.y:191 { AddVariableArray(yyDollar[2].val, yyDollar[1].val, "") } - case 48: + case 49: yyDollar = yyS[yypt-3 : yypt+1] - //line sunrpc.y:191 + //line sunrpc.y:199 { AddOptValue(yyDollar[3].val, yyDollar[1].val) } - case 49: + case 50: yyDollar = yyS[yypt-3 : yypt+1] - //line sunrpc.y:195 + //line sunrpc.y:203 { StartStruct(yyDollar[2].val) } - case 50: + case 51: yyDollar = yyS[yypt-6 : yypt+1] - //line sunrpc.y:195 + //line sunrpc.y:203 { AddStruct() } - case 54: + case 55: yyDollar = yyS[yypt-2 : yypt+1] - //line sunrpc.y:208 + //line sunrpc.y:216 { StartUnion(yyDollar[2].val) } - case 55: + case 56: yyDollar = yyS[yypt-10 : yypt+1] - //line sunrpc.y:208 + //line sunrpc.y:216 { AddUnion() } - case 59: + case 60: yyDollar = yyS[yypt-2 : yypt+1] - //line sunrpc.y:221 + //line sunrpc.y:229 { StartCase(yyDollar[2].val) } - case 60: + case 61: yyDollar = yyS[yypt-5 : yypt+1] - //line sunrpc.y:221 + //line sunrpc.y:229 { AddCase() } - case 61: + case 62: yyDollar = yyS[yypt-1 : yypt+1] - //line sunrpc.y:222 + //line sunrpc.y:230 { StartCase("default") } - case 62: + case 63: yyDollar = yyS[yypt-4 : yypt+1] - //line sunrpc.y:222 + //line sunrpc.y:230 { AddCase() } diff --git a/internal/lvgen/y.output b/internal/lvgen/y.output index f23bce4..3c010da 100644 --- a/internal/lvgen/y.output +++ b/internal/lvgen/y.output @@ -30,7 +30,7 @@ state 1 state 2 specification: definition_list. (1) - . reduce 1 (src line 62) + . reduce 1 (src line 63) state 3 @@ -44,37 +44,37 @@ state 3 state 4 definition: enum_definition. (6) - . reduce 6 (src line 76) + . reduce 6 (src line 77) state 5 definition: const_definition. (7) - . reduce 7 (src line 78) + . reduce 7 (src line 79) state 6 definition: typedef_definition. (8) - . reduce 8 (src line 79) + . reduce 8 (src line 80) state 7 definition: struct_definition. (9) - . reduce 9 (src line 80) + . reduce 9 (src line 81) state 8 definition: union_definition. (10) - . reduce 10 (src line 81) + . reduce 10 (src line 82) state 9 definition: program_definition. (11) - . reduce 11 (src line 82) + . reduce 11 (src line 83) state 10 @@ -95,15 +95,15 @@ state 11 const_ident goto 19 state 12 - typedef_definition: TYPEDEF.$$22 declaration - $$22: . (22) + typedef_definition: TYPEDEF.$$23 declaration + $$23: . (23) - . reduce 22 (src line 137) + . reduce 23 (src line 145) - $$22 goto 21 + $$23 goto 21 state 13 - struct_definition: STRUCT.struct_ident '{' $$49 declaration_list '}' + struct_definition: STRUCT.struct_ident '{' $$50 declaration_list '}' IDENTIFIER shift 23 . error @@ -111,7 +111,7 @@ state 13 struct_ident goto 22 state 14 - union_definition: UNION.union_ident $$54 SWITCH '(' simple_declaration ')' '{' case_list '}' + union_definition: UNION.union_ident $$55 SWITCH '(' simple_declaration ')' '{' case_list '}' IDENTIFIER shift 25 . error @@ -136,7 +136,7 @@ state 16 TYPEDEF shift 12 UNION shift 14 PROGRAM shift 15 - . reduce 4 (src line 71) + . reduce 4 (src line 72) definition_list goto 28 definition goto 3 @@ -155,9 +155,9 @@ state 17 state 18 - enum_ident: IDENTIFIER. (17) + enum_ident: IDENTIFIER. (18) - . reduce 17 (src line 111) + . reduce 18 (src line 119) state 19 @@ -169,13 +169,13 @@ state 19 state 20 - const_ident: IDENTIFIER. (21) + const_ident: IDENTIFIER. (22) - . reduce 21 (src line 133) + . reduce 22 (src line 141) state 21 - typedef_definition: TYPEDEF $$22.declaration + typedef_definition: TYPEDEF $$23.declaration BOOL shift 41 DOUBLE shift 40 @@ -205,30 +205,30 @@ state 21 int_spec goto 37 state 22 - struct_definition: STRUCT struct_ident.'{' $$49 declaration_list '}' + struct_definition: STRUCT struct_ident.'{' $$50 declaration_list '}' '{' shift 52 . error state 23 - struct_ident: IDENTIFIER. (51) + struct_ident: IDENTIFIER. (52) - . reduce 51 (src line 198) + . reduce 52 (src line 206) state 24 - union_definition: UNION union_ident.$$54 SWITCH '(' simple_declaration ')' '{' case_list '}' - $$54: . (54) + union_definition: UNION union_ident.$$55 SWITCH '(' simple_declaration ')' '{' case_list '}' + $$55: . (55) - . reduce 54 (src line 207) + . reduce 55 (src line 215) - $$54 goto 53 + $$55 goto 53 state 25 - union_ident: IDENTIFIER. (56) + union_ident: IDENTIFIER. (57) - . reduce 56 (src line 211) + . reduce 57 (src line 219) state 26 @@ -239,21 +239,22 @@ state 26 state 27 - program_ident: IDENTIFIER. (64) + program_ident: IDENTIFIER. (65) - . reduce 64 (src line 229) + . reduce 65 (src line 237) state 28 definition_list: definition ';' definition_list. (5) - . reduce 5 (src line 73) + . reduce 5 (src line 74) state 29 enum_definition: ENUM enum_ident '{'.enum_value_list '}' - IDENTIFIER shift 58 + IDENTIFIER shift 59 + METADATACOMMENT shift 58 . error enum_value_list goto 55 @@ -264,39 +265,39 @@ state 30 const_definition: CONST const_ident '='.IDENTIFIER const_definition: CONST const_ident '='.CONSTANT - IDENTIFIER shift 59 - CONSTANT shift 60 + IDENTIFIER shift 60 + CONSTANT shift 61 . error state 31 - typedef_definition: TYPEDEF $$22 declaration. (23) + typedef_definition: TYPEDEF $$23 declaration. (24) - . reduce 23 (src line 138) + . reduce 24 (src line 146) state 32 - declaration: simple_declaration. (24) + declaration: simple_declaration. (25) - . reduce 24 (src line 141) + . reduce 25 (src line 149) state 33 - declaration: fixed_array_declaration. (25) + declaration: fixed_array_declaration. (26) - . reduce 25 (src line 143) + . reduce 26 (src line 151) state 34 - declaration: variable_array_declaration. (26) + declaration: variable_array_declaration. (27) - . reduce 26 (src line 144) + . reduce 27 (src line 152) state 35 - declaration: pointer_declaration. (27) + declaration: pointer_declaration. (28) - . reduce 27 (src line 145) + . reduce 28 (src line 153) state 36 @@ -306,16 +307,16 @@ state 36 variable_array_declaration: type_specifier.variable_ident '<' '>' pointer_declaration: type_specifier.'*' variable_ident - IDENTIFIER shift 63 - '*' shift 62 + IDENTIFIER shift 64 + '*' shift 63 . error - variable_ident goto 61 + variable_ident goto 62 state 37 - type_specifier: int_spec. (29) + type_specifier: int_spec. (30) - . reduce 29 (src line 152) + . reduce 30 (src line 160) state 38 @@ -327,114 +328,114 @@ state 38 CHAR shift 51 . error - int_spec goto 64 + int_spec goto 65 state 39 - type_specifier: FLOAT. (31) + type_specifier: FLOAT. (32) - . reduce 31 (src line 155) + . reduce 32 (src line 163) state 40 - type_specifier: DOUBLE. (32) + type_specifier: DOUBLE. (33) - . reduce 32 (src line 156) + . reduce 33 (src line 164) state 41 - type_specifier: BOOL. (33) + type_specifier: BOOL. (34) - . reduce 33 (src line 157) + . reduce 34 (src line 165) state 42 - type_specifier: STRING. (34) + type_specifier: STRING. (35) - . reduce 34 (src line 158) + . reduce 35 (src line 166) state 43 - type_specifier: OPAQUE. (35) + type_specifier: OPAQUE. (36) - . reduce 35 (src line 159) + . reduce 36 (src line 167) state 44 - type_specifier: enum_definition. (36) + type_specifier: enum_definition. (37) - . reduce 36 (src line 160) + . reduce 37 (src line 168) state 45 - type_specifier: struct_definition. (37) + type_specifier: struct_definition. (38) - . reduce 37 (src line 161) + . reduce 38 (src line 169) state 46 - type_specifier: union_definition. (38) + type_specifier: union_definition. (39) - . reduce 38 (src line 162) + . reduce 39 (src line 170) state 47 - type_specifier: IDENTIFIER. (39) + type_specifier: IDENTIFIER. (40) - . reduce 39 (src line 163) + . reduce 40 (src line 171) state 48 - int_spec: HYPER. (40) + int_spec: HYPER. (41) - . reduce 40 (src line 166) + . reduce 41 (src line 174) state 49 - int_spec: INT. (41) + int_spec: INT. (42) - . reduce 41 (src line 168) + . reduce 42 (src line 176) state 50 - int_spec: SHORT. (42) + int_spec: SHORT. (43) - . reduce 42 (src line 169) + . reduce 43 (src line 177) state 51 - int_spec: CHAR. (43) + int_spec: CHAR. (44) - . reduce 43 (src line 170) + . reduce 44 (src line 178) state 52 - struct_definition: STRUCT struct_ident '{'.$$49 declaration_list '}' - $$49: . (49) + struct_definition: STRUCT struct_ident '{'.$$50 declaration_list '}' + $$50: . (50) - . reduce 49 (src line 194) + . reduce 50 (src line 202) - $$49 goto 65 + $$50 goto 66 state 53 - union_definition: UNION union_ident $$54.SWITCH '(' simple_declaration ')' '{' case_list '}' + union_definition: UNION union_ident $$55.SWITCH '(' simple_declaration ')' '{' case_list '}' - SWITCH shift 66 + SWITCH shift 67 . error state 54 program_definition: PROGRAM program_ident '{'.version_list '}' '=' value - VERSION shift 69 + VERSION shift 70 . error - version_list goto 67 - version goto 68 + version_list goto 68 + version goto 69 state 55 enum_definition: ENUM enum_ident '{' enum_value_list.'}' - '}' shift 70 + '}' shift 71 . error @@ -442,69 +443,77 @@ state 56 enum_value_list: enum_value. (13) enum_value_list: enum_value.',' enum_value_list - ',' shift 71 - . reduce 13 (src line 89) + ',' shift 72 + . reduce 13 (src line 90) state 57 enum_value: enum_value_ident. (15) enum_value: enum_value_ident.'=' value - '=' shift 72 - . reduce 15 (src line 94) + '=' shift 73 + . reduce 15 (src line 95) state 58 - enum_value_ident: IDENTIFIER. (18) + enum_value: METADATACOMMENT.enum_value_ident '=' value - . reduce 18 (src line 115) + IDENTIFIER shift 59 + . error + enum_value_ident goto 74 state 59 - const_definition: CONST const_ident '=' IDENTIFIER. (19) + enum_value_ident: IDENTIFIER. (19) - . reduce 19 (src line 122) + . reduce 19 (src line 123) state 60 - const_definition: CONST const_ident '=' CONSTANT. (20) + const_definition: CONST const_ident '=' IDENTIFIER. (20) - . reduce 20 (src line 124) + . reduce 20 (src line 130) state 61 - simple_declaration: type_specifier variable_ident. (28) + const_definition: CONST const_ident '=' CONSTANT. (21) + + . reduce 21 (src line 132) + + +state 62 + simple_declaration: type_specifier variable_ident. (29) fixed_array_declaration: type_specifier variable_ident.'[' value ']' variable_array_declaration: type_specifier variable_ident.'<' value '>' variable_array_declaration: type_specifier variable_ident.'<' '>' - '[' shift 73 - '<' shift 74 - . reduce 28 (src line 148) + '[' shift 75 + '<' shift 76 + . reduce 29 (src line 156) -state 62 - pointer_declaration: type_specifier '*'.variable_ident - - IDENTIFIER shift 63 - . error - - variable_ident goto 75 - state 63 - variable_ident: IDENTIFIER. (44) + pointer_declaration: type_specifier '*'.variable_ident - . reduce 44 (src line 173) + IDENTIFIER shift 64 + . error + variable_ident goto 77 state 64 - type_specifier: UNSIGNED int_spec. (30) + variable_ident: IDENTIFIER. (45) - . reduce 30 (src line 154) + . reduce 45 (src line 181) state 65 - struct_definition: STRUCT struct_ident '{' $$49.declaration_list '}' + type_specifier: UNSIGNED int_spec. (31) + + . reduce 31 (src line 162) + + +state 66 + struct_definition: STRUCT struct_ident '{' $$50.declaration_list '}' BOOL shift 41 DOUBLE shift 40 @@ -525,113 +534,121 @@ state 65 enum_definition goto 44 struct_definition goto 45 union_definition goto 46 - declaration goto 77 + declaration goto 79 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 76 - -state 66 - union_definition: UNION union_ident $$54 SWITCH.'(' simple_declaration ')' '{' case_list '}' - - '(' shift 78 - . error - + declaration_list goto 78 state 67 - program_definition: PROGRAM program_ident '{' version_list.'}' '=' value + union_definition: UNION union_ident $$55 SWITCH.'(' simple_declaration ')' '{' case_list '}' - '}' shift 79 + '(' shift 80 . error state 68 - version_list: version.';' - version_list: version.';' version_list + program_definition: PROGRAM program_ident '{' version_list.'}' '=' value - ';' shift 80 + '}' shift 81 . error state 69 - version: VERSION.version_ident '{' procedure_list '}' '=' value ';' + version_list: version.';' + version_list: version.';' version_list - IDENTIFIER shift 82 + ';' shift 82 . error - version_ident goto 81 state 70 - enum_definition: ENUM enum_ident '{' enum_value_list '}'. (12) + version: VERSION.version_ident '{' procedure_list '}' '=' value ';' - . reduce 12 (src line 85) - - -state 71 - enum_value_list: enum_value ','.enum_value_list - - IDENTIFIER shift 58 + IDENTIFIER shift 84 . error - enum_value_list goto 83 + version_ident goto 83 + +state 71 + enum_definition: ENUM enum_ident '{' enum_value_list '}'. (12) + + . reduce 12 (src line 86) + + +state 72 + enum_value_list: enum_value ','.enum_value_list + + IDENTIFIER shift 59 + METADATACOMMENT shift 58 + . error + + enum_value_list goto 85 enum_value goto 56 enum_value_ident goto 57 -state 72 +state 73 enum_value: enum_value_ident '='.value - IDENTIFIER shift 85 - CONSTANT shift 86 + IDENTIFIER shift 87 + CONSTANT shift 88 . error - value goto 84 - -state 73 - fixed_array_declaration: type_specifier variable_ident '['.value ']' - - IDENTIFIER shift 85 - CONSTANT shift 86 - . error - - value goto 87 + value goto 86 state 74 + enum_value: METADATACOMMENT enum_value_ident.'=' value + + '=' shift 89 + . error + + +state 75 + fixed_array_declaration: type_specifier variable_ident '['.value ']' + + IDENTIFIER shift 87 + CONSTANT shift 88 + . error + + value goto 90 + +state 76 variable_array_declaration: type_specifier variable_ident '<'.value '>' variable_array_declaration: type_specifier variable_ident '<'.'>' - IDENTIFIER shift 85 - CONSTANT shift 86 - '>' shift 89 - . error - - value goto 88 - -state 75 - pointer_declaration: type_specifier '*' variable_ident. (48) - - . reduce 48 (src line 190) - - -state 76 - struct_definition: STRUCT struct_ident '{' $$49 declaration_list.'}' - - '}' shift 90 + IDENTIFIER shift 87 + CONSTANT shift 88 + '>' shift 92 . error + value goto 91 state 77 - declaration_list: declaration.';' - declaration_list: declaration.';' declaration_list + pointer_declaration: type_specifier '*' variable_ident. (49) - ';' shift 91 - . error + . reduce 49 (src line 198) state 78 - union_definition: UNION union_ident $$54 SWITCH '('.simple_declaration ')' '{' case_list '}' + struct_definition: STRUCT struct_ident '{' $$50 declaration_list.'}' + + '}' shift 93 + . error + + +state 79 + declaration_list: declaration.';' + declaration_list: declaration.';' declaration_list + + ';' shift 94 + . error + + +state 80 + union_definition: UNION union_ident $$55 SWITCH '('.simple_declaration ')' '{' case_list '}' BOOL shift 41 DOUBLE shift 40 @@ -652,92 +669,101 @@ state 78 enum_definition goto 44 struct_definition goto 45 union_definition goto 46 - simple_declaration goto 92 - type_specifier goto 93 + simple_declaration goto 95 + type_specifier goto 96 int_spec goto 37 -state 79 +state 81 program_definition: PROGRAM program_ident '{' version_list '}'.'=' value - '=' shift 94 - . error - - -state 80 - version_list: version ';'. (65) - version_list: version ';'.version_list - - VERSION shift 69 - . reduce 65 (src line 233) - - version_list goto 95 - version goto 68 - -state 81 - version: VERSION version_ident.'{' procedure_list '}' '=' value ';' - - '{' shift 96 + '=' shift 97 . error state 82 - version_ident: IDENTIFIER. (68) + version_list: version ';'. (66) + version_list: version ';'.version_list - . reduce 68 (src line 242) + VERSION shift 70 + . reduce 66 (src line 241) + version_list goto 98 + version goto 69 state 83 - enum_value_list: enum_value ',' enum_value_list. (14) + version: VERSION version_ident.'{' procedure_list '}' '=' value ';' - . reduce 14 (src line 91) + '{' shift 99 + . error state 84 - enum_value: enum_value_ident '=' value. (16) + version_ident: IDENTIFIER. (69) - . reduce 16 (src line 102) + . reduce 69 (src line 250) state 85 - value: IDENTIFIER. (2) + enum_value_list: enum_value ',' enum_value_list. (14) - . reduce 2 (src line 66) + . reduce 14 (src line 92) state 86 - value: CONSTANT. (3) + enum_value: enum_value_ident '=' value. (17) - . reduce 3 (src line 68) + . reduce 17 (src line 110) state 87 - fixed_array_declaration: type_specifier variable_ident '[' value.']' + value: IDENTIFIER. (2) - ']' shift 97 - . error + . reduce 2 (src line 67) state 88 - variable_array_declaration: type_specifier variable_ident '<' value.'>' + value: CONSTANT. (3) - '>' shift 98 - . error + . reduce 3 (src line 69) state 89 - variable_array_declaration: type_specifier variable_ident '<' '>'. (47) + enum_value: METADATACOMMENT enum_value_ident '='.value - . reduce 47 (src line 183) + IDENTIFIER shift 87 + CONSTANT shift 88 + . error + value goto 100 state 90 - struct_definition: STRUCT struct_ident '{' $$49 declaration_list '}'. (50) + fixed_array_declaration: type_specifier variable_ident '[' value.']' - . reduce 50 (src line 195) + ']' shift 101 + . error state 91 - declaration_list: declaration ';'. (52) + variable_array_declaration: type_specifier variable_ident '<' value.'>' + + '>' shift 102 + . error + + +state 92 + variable_array_declaration: type_specifier variable_ident '<' '>'. (48) + + . reduce 48 (src line 191) + + +state 93 + struct_definition: STRUCT struct_ident '{' $$50 declaration_list '}'. (51) + + . reduce 51 (src line 203) + + +state 94 + declaration_list: declaration ';'. (53) declaration_list: declaration ';'.declaration_list BOOL shift 41 @@ -754,51 +780,51 @@ state 91 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 - . reduce 52 (src line 202) + . reduce 53 (src line 210) enum_definition goto 44 struct_definition goto 45 union_definition goto 46 - declaration goto 77 + declaration goto 79 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 99 - -state 92 - union_definition: UNION union_ident $$54 SWITCH '(' simple_declaration.')' '{' case_list '}' - - ')' shift 100 - . error - - -state 93 - simple_declaration: type_specifier.variable_ident - - IDENTIFIER shift 63 - . error - - variable_ident goto 101 - -state 94 - program_definition: PROGRAM program_ident '{' version_list '}' '='.value - - IDENTIFIER shift 85 - CONSTANT shift 86 - . error - - value goto 102 + declaration_list goto 103 state 95 - version_list: version ';' version_list. (66) + union_definition: UNION union_ident $$55 SWITCH '(' simple_declaration.')' '{' case_list '}' - . reduce 66 (src line 235) + ')' shift 104 + . error state 96 + simple_declaration: type_specifier.variable_ident + + IDENTIFIER shift 64 + . error + + variable_ident goto 105 + +state 97 + program_definition: PROGRAM program_ident '{' version_list '}' '='.value + + IDENTIFIER shift 87 + CONSTANT shift 88 + . error + + value goto 106 + +state 98 + version_list: version ';' version_list. (67) + + . reduce 67 (src line 243) + + +state 99 version: VERSION version_ident '{'.procedure_list '}' '=' value ';' BOOL shift 41 @@ -820,90 +846,96 @@ state 96 enum_definition goto 44 struct_definition goto 45 union_definition goto 46 - type_specifier goto 105 + type_specifier goto 109 int_spec goto 37 - procedure_list goto 103 - procedure goto 104 - -state 97 - fixed_array_declaration: type_specifier variable_ident '[' value ']'. (45) - - . reduce 45 (src line 177) - - -state 98 - variable_array_declaration: type_specifier variable_ident '<' value '>'. (46) - - . reduce 46 (src line 181) - - -state 99 - declaration_list: declaration ';' declaration_list. (53) - - . reduce 53 (src line 204) - + procedure_list goto 107 + procedure goto 108 state 100 - union_definition: UNION union_ident $$54 SWITCH '(' simple_declaration ')'.'{' case_list '}' + enum_value: METADATACOMMENT enum_value_ident '=' value. (16) - '{' shift 106 - . error + . reduce 16 (src line 103) state 101 - simple_declaration: type_specifier variable_ident. (28) + fixed_array_declaration: type_specifier variable_ident '[' value ']'. (46) - . reduce 28 (src line 148) + . reduce 46 (src line 185) state 102 - program_definition: PROGRAM program_ident '{' version_list '}' '=' value. (63) + variable_array_declaration: type_specifier variable_ident '<' value '>'. (47) - . reduce 63 (src line 225) + . reduce 47 (src line 189) state 103 - version: VERSION version_ident '{' procedure_list.'}' '=' value ';' + declaration_list: declaration ';' declaration_list. (54) - '}' shift 107 - . error + . reduce 54 (src line 212) state 104 - procedure_list: procedure.';' - procedure_list: procedure.';' procedure_list + union_definition: UNION union_ident $$55 SWITCH '(' simple_declaration ')'.'{' case_list '}' - ';' shift 108 + '{' shift 110 . error state 105 - procedure: type_specifier.procedure_ident '(' type_specifier ')' '=' value ';' + simple_declaration: type_specifier variable_ident. (29) - IDENTIFIER shift 110 - . error + . reduce 29 (src line 156) - procedure_ident goto 109 state 106 - union_definition: UNION union_ident $$54 SWITCH '(' simple_declaration ')' '{'.case_list '}' + program_definition: PROGRAM program_ident '{' version_list '}' '=' value. (64) - CASE shift 113 - DEFAULT shift 114 - . error + . reduce 64 (src line 233) - case_list goto 111 - case goto 112 state 107 - version: VERSION version_ident '{' procedure_list '}'.'=' value ';' + version: VERSION version_ident '{' procedure_list.'}' '=' value ';' - '=' shift 115 + '}' shift 111 . error state 108 - procedure_list: procedure ';'. (69) + procedure_list: procedure.';' + procedure_list: procedure.';' procedure_list + + ';' shift 112 + . error + + +state 109 + procedure: type_specifier.procedure_ident '(' type_specifier ')' '=' value ';' + + IDENTIFIER shift 114 + . error + + procedure_ident goto 113 + +state 110 + union_definition: UNION union_ident $$55 SWITCH '(' simple_declaration ')' '{'.case_list '}' + + CASE shift 117 + DEFAULT shift 118 + . error + + case_list goto 115 + case goto 116 + +state 111 + version: VERSION version_ident '{' procedure_list '}'.'=' value ';' + + '=' shift 119 + . error + + +state 112 + procedure_list: procedure ';'. (70) procedure_list: procedure ';'.procedure_list BOOL shift 41 @@ -920,77 +952,77 @@ state 108 SHORT shift 50 CHAR shift 51 IDENTIFIER shift 47 - . reduce 69 (src line 246) + . reduce 70 (src line 254) enum_definition goto 44 struct_definition goto 45 union_definition goto 46 - type_specifier goto 105 + type_specifier goto 109 int_spec goto 37 - procedure_list goto 116 - procedure goto 104 + procedure_list goto 120 + procedure goto 108 -state 109 +state 113 procedure: type_specifier procedure_ident.'(' type_specifier ')' '=' value ';' - '(' shift 117 + '(' shift 121 . error -state 110 - procedure_ident: IDENTIFIER. (72) +state 114 + procedure_ident: IDENTIFIER. (73) - . reduce 72 (src line 255) + . reduce 73 (src line 263) -state 111 - union_definition: UNION union_ident $$54 SWITCH '(' simple_declaration ')' '{' case_list.'}' +state 115 + union_definition: UNION union_ident $$55 SWITCH '(' simple_declaration ')' '{' case_list.'}' - '}' shift 118 + '}' shift 122 . error -state 112 +state 116 case_list: case.';' case_list: case.';' case_list - ';' shift 119 + ';' shift 123 . error -state 113 - case: CASE.value $$59 ':' declaration - - IDENTIFIER shift 85 - CONSTANT shift 86 - . error - - value goto 120 - -state 114 - case: DEFAULT.$$61 ':' declaration - $$61: . (61) - - . reduce 61 (src line 222) - - $$61 goto 121 - -state 115 - version: VERSION version_ident '{' procedure_list '}' '='.value ';' - - IDENTIFIER shift 85 - CONSTANT shift 86 - . error - - value goto 122 - -state 116 - procedure_list: procedure ';' procedure_list. (70) - - . reduce 70 (src line 248) - - state 117 + case: CASE.value $$60 ':' declaration + + IDENTIFIER shift 87 + CONSTANT shift 88 + . error + + value goto 124 + +state 118 + case: DEFAULT.$$62 ':' declaration + $$62: . (62) + + . reduce 62 (src line 230) + + $$62 goto 125 + +state 119 + version: VERSION version_ident '{' procedure_list '}' '='.value ';' + + IDENTIFIER shift 87 + CONSTANT shift 88 + . error + + value goto 126 + +state 120 + procedure_list: procedure ';' procedure_list. (71) + + . reduce 71 (src line 256) + + +state 121 procedure: type_specifier procedure_ident '('.type_specifier ')' '=' value ';' BOOL shift 41 @@ -1012,113 +1044,70 @@ state 117 enum_definition goto 44 struct_definition goto 45 union_definition goto 46 - type_specifier goto 123 + type_specifier goto 127 int_spec goto 37 -state 118 - union_definition: UNION union_ident $$54 SWITCH '(' simple_declaration ')' '{' case_list '}'. (55) - - . reduce 55 (src line 208) - - -state 119 - case_list: case ';'. (57) - case_list: case ';'.case_list - - CASE shift 113 - DEFAULT shift 114 - . reduce 57 (src line 215) - - case_list goto 124 - case goto 112 - -state 120 - case: CASE value.$$59 ':' declaration - $$59: . (59) - - . reduce 59 (src line 220) - - $$59 goto 125 - -state 121 - case: DEFAULT $$61.':' declaration - - ':' shift 126 - . error - - state 122 - version: VERSION version_ident '{' procedure_list '}' '=' value.';' + union_definition: UNION union_ident $$55 SWITCH '(' simple_declaration ')' '{' case_list '}'. (56) - ';' shift 127 - . error + . reduce 56 (src line 216) state 123 - procedure: type_specifier procedure_ident '(' type_specifier.')' '=' value ';' + case_list: case ';'. (58) + case_list: case ';'.case_list - ')' shift 128 - . error + CASE shift 117 + DEFAULT shift 118 + . reduce 58 (src line 223) + case_list goto 128 + case goto 116 state 124 - case_list: case ';' case_list. (58) + case: CASE value.$$60 ':' declaration + $$60: . (60) - . reduce 58 (src line 217) + . reduce 60 (src line 228) + $$60 goto 129 state 125 - case: CASE value $$59.':' declaration + case: DEFAULT $$62.':' declaration - ':' shift 129 + ':' shift 130 . error state 126 - case: DEFAULT $$61 ':'.declaration + 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 + ';' shift 131 . error - enum_definition goto 44 - struct_definition goto 45 - union_definition goto 46 - declaration goto 130 - 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 127 - version: VERSION version_ident '{' procedure_list '}' '=' value ';'. (67) + procedure: type_specifier procedure_ident '(' type_specifier.')' '=' value ';' - . reduce 67 (src line 238) + ')' shift 132 + . error state 128 - procedure: type_specifier procedure_ident '(' type_specifier ')'.'=' value ';' + case_list: case ';' case_list. (59) - '=' shift 131 - . error + . reduce 59 (src line 225) state 129 - case: CASE value $$59 ':'.declaration + case: CASE value $$60.':' declaration + + ':' shift 133 + . error + + +state 130 + case: DEFAULT $$62 ':'.declaration BOOL shift 41 DOUBLE shift 40 @@ -1139,7 +1128,7 @@ state 129 enum_definition goto 44 struct_definition goto 45 union_definition goto 46 - declaration goto 132 + declaration goto 134 simple_declaration goto 32 fixed_array_declaration goto 33 variable_array_declaration goto 34 @@ -1147,49 +1136,92 @@ state 129 type_specifier goto 36 int_spec goto 37 -state 130 - case: DEFAULT $$61 ':' declaration. (62) - - . reduce 62 (src line 222) - - state 131 - procedure: type_specifier procedure_ident '(' type_specifier ')' '='.value ';' + version: VERSION version_ident '{' procedure_list '}' '=' value ';'. (68) - IDENTIFIER shift 85 - CONSTANT shift 86 - . error + . reduce 68 (src line 246) - value goto 133 state 132 - case: CASE value $$59 ':' declaration. (60) + procedure: type_specifier procedure_ident '(' type_specifier ')'.'=' value ';' - . reduce 60 (src line 221) + '=' shift 135 + . error state 133 + case: CASE value $$60 ':'.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 136 + 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 134 + case: DEFAULT $$62 ':' declaration. (63) + + . reduce 63 (src line 230) + + +state 135 + procedure: type_specifier procedure_ident '(' type_specifier ')' '='.value ';' + + IDENTIFIER shift 87 + CONSTANT shift 88 + . error + + value goto 137 + +state 136 + case: CASE value $$60 ':' declaration. (61) + + . reduce 61 (src line 229) + + +state 137 procedure: type_specifier procedure_ident '(' type_specifier ')' '=' value.';' - ';' shift 134 + ';' shift 138 . error -state 134 - procedure: type_specifier procedure_ident '(' type_specifier ')' '=' value ';'. (71) +state 138 + procedure: type_specifier procedure_ident '(' type_specifier ')' '=' value ';'. (72) - . reduce 71 (src line 251) + . reduce 72 (src line 259) -40 terminals, 41 nonterminals -73 grammar rules, 135/8000 states +41 terminals, 41 nonterminals +74 grammar rules, 139/8000 states 0 shift/reduce, 0 reduce/reduce conflicts reported 90 working sets used -memory: parser 155/120000 +memory: parser 157/120000 40 extra closures -212 shift entries, 1 exceptions -69 goto entries +218 shift entries, 1 exceptions +71 goto entries 62 entries saved by goto default -Optimizer space used: output 148/120000 -148 table entries, 0 zero -maximum spread: 40, maximum offset: 131 +Optimizer space used: output 153/120000 +153 table entries, 0 zero +maximum spread: 41, maximum offset: 135 From 3613b30fe29af11796ca5f8550d2e30f09b5cae8 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Mon, 26 Feb 2018 00:53:33 +0400 Subject: [PATCH 07/20] Parse proc annotations and store in Proc struct --- internal/lvgen/generate.go | 129 +++++++++++++++++++++++++++++++++---- internal/lvgen/sunrpc.y | 2 +- internal/lvgen/y.go | 2 +- 3 files changed, 118 insertions(+), 15 deletions(-) diff --git a/internal/lvgen/generate.go b/internal/lvgen/generate.go index 47ef82b..1916f18 100644 --- a/internal/lvgen/generate.go +++ b/internal/lvgen/generate.go @@ -159,13 +159,41 @@ type Case struct { // Proc holds information about a libvirt procedure the parser has found. type Proc struct { - 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. + 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 +} + +type ProcMetaGenerate int + +const ( + ProcMetaGenerateNone ProcMetaGenerate = iota + ProcMetaGenerateClient + ProcMetaGenerateServer + ProcMetaGenerateBoth +) + +type ProcMetaPriority int + +const ( + ProcMetaPriorityLow ProcMetaPriority = iota + ProcMetaPriorityHigh +) + +// ProcMeta holds information from annotations attached to a libvirt procedure +type ProcMeta struct { + Generate ProcMetaGenerate + ReadStream int + WriteStream int + Priority ProcMetaPriority + Acls []string + Aclfilter string } type structStack []*Structure @@ -552,7 +580,20 @@ func AddEnumVal(name, val string) error { if err != nil { return fmt.Errorf("invalid enum value %v = %v", name, val) } - return addEnumVal(name, ev) + return addEnumVal(name, ev, nil) +} + +// AddEnumValMeta will add a new enum value with attached metadata to the list. +func AddEnumValMeta(name, val, 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) + } + return addEnumVal(name, ev, metaObj) } // AddEnumAutoVal adds an enum to the list, using the automatically-incremented @@ -560,14 +601,14 @@ func AddEnumVal(name, val string) error { // explicit value. func AddEnumAutoVal(name string) error { CurrentEnumVal++ - return addEnumVal(name, CurrentEnumVal) + return addEnumVal(name, CurrentEnumVal, nil) } -func addEnumVal(name string, val int64) error { +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 - addProc(goname, name, val) + addProc(goname, name, val, meta) return nil } @@ -584,12 +625,16 @@ func AddConst(name, val string) error { // addProc checks an enum value to see if it's a procedure number. If so, we // add the procedure to our list for later generation. -func addProc(goname, lvname string, val int64) { +func addProc(goname, lvname string, val int64, meta *ProcMeta) { if !strings.HasPrefix(goname, "Proc") { return } goname = goname[4:] - proc := &Proc{Num: val, Name: goname, LVName: lvname} + proc := &Proc{Num: val, Name: goname, LVName: lvname, ReadStreamIdx: -1, WriteStreamIdx: -1} + if meta != nil { + proc.ReadStreamIdx = meta.ReadStream + proc.WriteStreamIdx = meta.WriteStream + } Gen.Procs = append(Gen.Procs, *proc) } @@ -605,6 +650,64 @@ func parseNumber(val string) (int64, error) { 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], " ") + if spl[0] == "generate" { + if spl[1] == "none" { + res.Generate = ProcMetaGenerateNone + } else if spl[1] == "client" { + res.Generate = ProcMetaGenerateClient + } else if spl[1] == "server" { + res.Generate = ProcMetaGenerateServer + } else if spl[1] == "both" { + res.Generate = ProcMetaGenerateBoth + } else { + return nil, fmt.Errorf("invalid value for generate: %s", spl[1]) + } + } else if spl[0] == "readstream" { + var err error + res.ReadStream, err = strconv.Atoi(spl[1]) + if err != nil { + return nil, fmt.Errorf("invalid value for readstread: %s", spl[1]) + } + } else if spl[0] == "writestream" { + var err error + res.WriteStream, err = strconv.Atoi(spl[1]) + if err != nil { + return nil, fmt.Errorf("invalid value for readstread: %s", spl[1]) + } + } else if spl[0] == "priority" { + if spl[1] == "low" { + res.Priority = ProcMetaPriorityLow + } else if spl[1] == "high" { + res.Priority = ProcMetaPriorityHigh + } else { + return nil, fmt.Errorf("invalid value for priority: %s", spl[1]) + } + } else if spl[0] == "acl" { + res.Acls = append(res.Acls, spl[1]) + } else if spl[0] == "aclfilter" { + res.Aclfilter = 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) { diff --git a/internal/lvgen/sunrpc.y b/internal/lvgen/sunrpc.y index 22665a3..43ef081 100644 --- a/internal/lvgen/sunrpc.y +++ b/internal/lvgen/sunrpc.y @@ -101,7 +101,7 @@ enum_value } } | METADATACOMMENT enum_value_ident '=' value { - err := AddEnumVal($2.val, $4.val) + err := AddEnumValMeta($2.val, $4.val, $1.val) if err != nil { yylex.Error(err.Error()) return 1 diff --git a/internal/lvgen/y.go b/internal/lvgen/y.go index b6d1204..905a3c9 100644 --- a/internal/lvgen/y.go +++ b/internal/lvgen/y.go @@ -606,7 +606,7 @@ yydefault: yyDollar = yyS[yypt-4 : yypt+1] //line sunrpc.y:103 { - err := AddEnumVal(yyDollar[2].val, yyDollar[4].val) + err := AddEnumValMeta(yyDollar[2].val, yyDollar[4].val, yyDollar[1].val) if err != nil { yylex.Error(err.Error()) return 1 From 02e0818aef1b95bd7278859267f4cd9f04ee2656 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Mon, 26 Feb 2018 00:56:27 +0400 Subject: [PATCH 08/20] Add streams to proc arguments, use requestStream This makes functions look just like in actual libvirt API, except virStreamPtr is replaced with io.Reader for outgoing streams and io.Writer for incoming streams. --- internal/lvgen/procedures.tmpl | 16 +- libvirt.gen.go | 795 +++++++++++++++++---------------- 2 files changed, 411 insertions(+), 400 deletions(-) diff --git a/internal/lvgen/procedures.tmpl b/internal/lvgen/procedures.tmpl index 4763c86..372b0b1 100644 --- a/internal/lvgen/procedures.tmpl +++ b/internal/lvgen/procedures.tmpl @@ -23,6 +23,7 @@ package libvirt import ( "bytes" "fmt" + "io" "github.com/davecgh/go-xdr/xdr2" "github.com/digitalocean/go-libvirt/internal/constants" @@ -126,9 +127,15 @@ func decodeTypedParams(dec *xdr.Decoder) ([]TypedParam, error) { return params, nil } -{{range .Procs}} +{{range $proc := .Procs}} // {{.Name}} is the go wrapper for {{.LVName}}. -func (l *Libvirt) {{.Name}}({{range $ix, $arg := .Args}}{{if $ix}}, {{end}}{{.Name}} {{.Type}}{{end}}) ({{range .Ret}}r{{.Name}} {{.Type}}, {{end}}err error) { +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}} { @@ -141,7 +148,10 @@ func (l *Libvirt) {{.Name}}({{range $ix, $arg := .Args}}{{if $ix}}, {{end}}{{.Na } {{end}} {{if .RetStruct}} var r response{{end}} - {{if .RetStruct}}r{{else}}_{{end}}, err = l.request({{.Num}}, constants.Program, buf) + {{if .RetStruct}}r{{else}}_{{end}}, err = l.requestStream({{.Num}}, constants.Program, buf, + {{- if (ne .WriteStreamIdx -1)}} outStream,{{else}} nil,{{end}} + {{- if (ne .ReadStreamIdx -1)}} inStream{{else}} nil{{end -}} + ) if err != nil { return } diff --git a/libvirt.gen.go b/libvirt.gen.go index 698318e..5a29655 100644 --- a/libvirt.gen.go +++ b/libvirt.gen.go @@ -23,6 +23,7 @@ package libvirt import ( "bytes" "fmt" + "io" "github.com/davecgh/go-xdr/xdr2" "github.com/digitalocean/go-libvirt/internal/constants" @@ -3952,7 +3953,7 @@ func (l *Libvirt) ConnectOpen(Name OptString, Flags ConnectFlags) (err error) { } - _, err = l.request(1, constants.Program, buf) + _, err = l.requestStream(1, constants.Program, buf, nil, nil) if err != nil { return } @@ -3965,7 +3966,7 @@ func (l *Libvirt) ConnectClose() (err error) { var buf []byte - _, err = l.request(2, constants.Program, buf) + _, err = l.requestStream(2, constants.Program, buf, nil, nil) if err != nil { return } @@ -3978,7 +3979,7 @@ func (l *Libvirt) ConnectGetType() (rType string, err error) { var buf []byte var r response - r, err = l.request(3, constants.Program, buf) + r, err = l.requestStream(3, constants.Program, buf, nil, nil) if err != nil { return } @@ -4000,7 +4001,7 @@ func (l *Libvirt) ConnectGetVersion() (rHvVer uint64, err error) { var buf []byte var r response - r, err = l.request(4, constants.Program, buf) + r, err = l.requestStream(4, constants.Program, buf, nil, nil) if err != nil { return } @@ -4031,7 +4032,7 @@ func (l *Libvirt) ConnectGetMaxVcpus(Type OptString) (rMaxVcpus int32, err error } var r response - r, err = l.request(5, constants.Program, buf) + r, err = l.requestStream(5, constants.Program, buf, nil, nil) if err != nil { return } @@ -4053,7 +4054,7 @@ func (l *Libvirt) NodeGetInfo() (rModel [32]int8, rMemory uint64, rCpus int32, r var buf []byte var r response - r, err = l.request(6, constants.Program, buf) + r, err = l.requestStream(6, constants.Program, buf, nil, nil) if err != nil { return } @@ -4110,7 +4111,7 @@ func (l *Libvirt) ConnectGetCapabilities() (rCapabilities string, err error) { var buf []byte var r response - r, err = l.request(7, constants.Program, buf) + r, err = l.requestStream(7, constants.Program, buf, nil, nil) if err != nil { return } @@ -4142,7 +4143,7 @@ func (l *Libvirt) DomainAttachDevice(Dom Domain, XML string) (err error) { } - _, err = l.request(8, constants.Program, buf) + _, err = l.requestStream(8, constants.Program, buf, nil, nil) if err != nil { return } @@ -4164,7 +4165,7 @@ func (l *Libvirt) DomainCreate(Dom Domain) (err error) { } - _, err = l.request(9, constants.Program, buf) + _, err = l.requestStream(9, constants.Program, buf, nil, nil) if err != nil { return } @@ -4187,7 +4188,7 @@ func (l *Libvirt) DomainCreateXML(XMLDesc string, Flags DomainCreateFlags) (rDom } var r response - r, err = l.request(10, constants.Program, buf) + r, err = l.requestStream(10, constants.Program, buf, nil, nil) if err != nil { return } @@ -4218,7 +4219,7 @@ func (l *Libvirt) DomainDefineXML(XML string) (rDom Domain, err error) { } var r response - r, err = l.request(11, constants.Program, buf) + r, err = l.requestStream(11, constants.Program, buf, nil, nil) if err != nil { return } @@ -4249,7 +4250,7 @@ func (l *Libvirt) DomainDestroy(Dom Domain) (err error) { } - _, err = l.request(12, constants.Program, buf) + _, err = l.requestStream(12, constants.Program, buf, nil, nil) if err != nil { return } @@ -4272,7 +4273,7 @@ func (l *Libvirt) DomainDetachDevice(Dom Domain, XML string) (err error) { } - _, err = l.request(13, constants.Program, buf) + _, err = l.requestStream(13, constants.Program, buf, nil, nil) if err != nil { return } @@ -4295,7 +4296,7 @@ func (l *Libvirt) DomainGetXMLDesc(Dom Domain, Flags DomainXMLFlags) (rXML strin } var r response - r, err = l.request(14, constants.Program, buf) + r, err = l.requestStream(14, constants.Program, buf, nil, nil) if err != nil { return } @@ -4326,7 +4327,7 @@ func (l *Libvirt) DomainGetAutostart(Dom Domain) (rAutostart int32, err error) { } var r response - r, err = l.request(15, constants.Program, buf) + r, err = l.requestStream(15, constants.Program, buf, nil, nil) if err != nil { return } @@ -4357,7 +4358,7 @@ func (l *Libvirt) DomainGetInfo(Dom Domain) (rState uint8, rMaxMem uint64, rMemo } var r response - r, err = l.request(16, constants.Program, buf) + r, err = l.requestStream(16, constants.Program, buf, nil, nil) if err != nil { return } @@ -4408,7 +4409,7 @@ func (l *Libvirt) DomainGetMaxMemory(Dom Domain) (rMemory uint64, err error) { } var r response - r, err = l.request(17, constants.Program, buf) + r, err = l.requestStream(17, constants.Program, buf, nil, nil) if err != nil { return } @@ -4439,7 +4440,7 @@ func (l *Libvirt) DomainGetMaxVcpus(Dom Domain) (rNum int32, err error) { } var r response - r, err = l.request(18, constants.Program, buf) + r, err = l.requestStream(18, constants.Program, buf, nil, nil) if err != nil { return } @@ -4470,7 +4471,7 @@ func (l *Libvirt) DomainGetOsType(Dom Domain) (rType string, err error) { } var r response - r, err = l.request(19, constants.Program, buf) + r, err = l.requestStream(19, constants.Program, buf, nil, nil) if err != nil { return } @@ -4503,7 +4504,7 @@ func (l *Libvirt) DomainGetVcpus(Dom Domain, Maxinfo int32, Maplen int32) (rInfo } var r response - r, err = l.request(20, constants.Program, buf) + r, err = l.requestStream(20, constants.Program, buf, nil, nil) if err != nil { return } @@ -4539,7 +4540,7 @@ func (l *Libvirt) ConnectListDefinedDomains(Maxnames int32) (rNames []string, er } var r response - r, err = l.request(21, constants.Program, buf) + r, err = l.requestStream(21, constants.Program, buf, nil, nil) if err != nil { return } @@ -4570,7 +4571,7 @@ func (l *Libvirt) DomainLookupByID(ID int32) (rDom Domain, err error) { } var r response - r, err = l.request(22, constants.Program, buf) + r, err = l.requestStream(22, constants.Program, buf, nil, nil) if err != nil { return } @@ -4601,7 +4602,7 @@ func (l *Libvirt) DomainLookupByName(Name string) (rDom Domain, err error) { } var r response - r, err = l.request(23, constants.Program, buf) + r, err = l.requestStream(23, constants.Program, buf, nil, nil) if err != nil { return } @@ -4632,7 +4633,7 @@ func (l *Libvirt) DomainLookupByUUID(UUID UUID) (rDom Domain, err error) { } var r response - r, err = l.request(24, constants.Program, buf) + r, err = l.requestStream(24, constants.Program, buf, nil, nil) if err != nil { return } @@ -4654,7 +4655,7 @@ func (l *Libvirt) ConnectNumOfDefinedDomains() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(25, constants.Program, buf) + r, err = l.requestStream(25, constants.Program, buf, nil, nil) if err != nil { return } @@ -4687,7 +4688,7 @@ func (l *Libvirt) DomainPinVcpu(Dom Domain, Vcpu uint32, Cpumap []byte) (err err } - _, err = l.request(26, constants.Program, buf) + _, err = l.requestStream(26, constants.Program, buf, nil, nil) if err != nil { return } @@ -4710,7 +4711,7 @@ func (l *Libvirt) DomainReboot(Dom Domain, Flags DomainRebootFlagValues) (err er } - _, err = l.request(27, constants.Program, buf) + _, err = l.requestStream(27, constants.Program, buf, nil, nil) if err != nil { return } @@ -4732,7 +4733,7 @@ func (l *Libvirt) DomainResume(Dom Domain) (err error) { } - _, err = l.request(28, constants.Program, buf) + _, err = l.requestStream(28, constants.Program, buf, nil, nil) if err != nil { return } @@ -4755,7 +4756,7 @@ func (l *Libvirt) DomainSetAutostart(Dom Domain, Autostart int32) (err error) { } - _, err = l.request(29, constants.Program, buf) + _, err = l.requestStream(29, constants.Program, buf, nil, nil) if err != nil { return } @@ -4778,7 +4779,7 @@ func (l *Libvirt) DomainSetMaxMemory(Dom Domain, Memory uint64) (err error) { } - _, err = l.request(30, constants.Program, buf) + _, err = l.requestStream(30, constants.Program, buf, nil, nil) if err != nil { return } @@ -4801,7 +4802,7 @@ func (l *Libvirt) DomainSetMemory(Dom Domain, Memory uint64) (err error) { } - _, err = l.request(31, constants.Program, buf) + _, err = l.requestStream(31, constants.Program, buf, nil, nil) if err != nil { return } @@ -4824,7 +4825,7 @@ func (l *Libvirt) DomainSetVcpus(Dom Domain, Nvcpus uint32) (err error) { } - _, err = l.request(32, constants.Program, buf) + _, err = l.requestStream(32, constants.Program, buf, nil, nil) if err != nil { return } @@ -4846,7 +4847,7 @@ func (l *Libvirt) DomainShutdown(Dom Domain) (err error) { } - _, err = l.request(33, constants.Program, buf) + _, err = l.requestStream(33, constants.Program, buf, nil, nil) if err != nil { return } @@ -4868,7 +4869,7 @@ func (l *Libvirt) DomainSuspend(Dom Domain) (err error) { } - _, err = l.request(34, constants.Program, buf) + _, err = l.requestStream(34, constants.Program, buf, nil, nil) if err != nil { return } @@ -4890,7 +4891,7 @@ func (l *Libvirt) DomainUndefine(Dom Domain) (err error) { } - _, err = l.request(35, constants.Program, buf) + _, err = l.requestStream(35, constants.Program, buf, nil, nil) if err != nil { return } @@ -4912,7 +4913,7 @@ func (l *Libvirt) ConnectListDefinedNetworks(Maxnames int32) (rNames []string, e } var r response - r, err = l.request(36, constants.Program, buf) + r, err = l.requestStream(36, constants.Program, buf, nil, nil) if err != nil { return } @@ -4943,7 +4944,7 @@ func (l *Libvirt) ConnectListDomains(Maxids int32) (rIds []int32, err error) { } var r response - r, err = l.request(37, constants.Program, buf) + r, err = l.requestStream(37, constants.Program, buf, nil, nil) if err != nil { return } @@ -4974,7 +4975,7 @@ func (l *Libvirt) ConnectListNetworks(Maxnames int32) (rNames []string, err erro } var r response - r, err = l.request(38, constants.Program, buf) + r, err = l.requestStream(38, constants.Program, buf, nil, nil) if err != nil { return } @@ -5005,7 +5006,7 @@ func (l *Libvirt) NetworkCreate(Net Network) (err error) { } - _, err = l.request(39, constants.Program, buf) + _, err = l.requestStream(39, constants.Program, buf, nil, nil) if err != nil { return } @@ -5027,7 +5028,7 @@ func (l *Libvirt) NetworkCreateXML(XML string) (rNet Network, err error) { } var r response - r, err = l.request(40, constants.Program, buf) + r, err = l.requestStream(40, constants.Program, buf, nil, nil) if err != nil { return } @@ -5058,7 +5059,7 @@ func (l *Libvirt) NetworkDefineXML(XML string) (rNet Network, err error) { } var r response - r, err = l.request(41, constants.Program, buf) + r, err = l.requestStream(41, constants.Program, buf, nil, nil) if err != nil { return } @@ -5089,7 +5090,7 @@ func (l *Libvirt) NetworkDestroy(Net Network) (err error) { } - _, err = l.request(42, constants.Program, buf) + _, err = l.requestStream(42, constants.Program, buf, nil, nil) if err != nil { return } @@ -5112,7 +5113,7 @@ func (l *Libvirt) NetworkGetXMLDesc(Net Network, Flags uint32) (rXML string, err } var r response - r, err = l.request(43, constants.Program, buf) + r, err = l.requestStream(43, constants.Program, buf, nil, nil) if err != nil { return } @@ -5143,7 +5144,7 @@ func (l *Libvirt) NetworkGetAutostart(Net Network) (rAutostart int32, err error) } var r response - r, err = l.request(44, constants.Program, buf) + r, err = l.requestStream(44, constants.Program, buf, nil, nil) if err != nil { return } @@ -5174,7 +5175,7 @@ func (l *Libvirt) NetworkGetBridgeName(Net Network) (rName string, err error) { } var r response - r, err = l.request(45, constants.Program, buf) + r, err = l.requestStream(45, constants.Program, buf, nil, nil) if err != nil { return } @@ -5205,7 +5206,7 @@ func (l *Libvirt) NetworkLookupByName(Name string) (rNet Network, err error) { } var r response - r, err = l.request(46, constants.Program, buf) + r, err = l.requestStream(46, constants.Program, buf, nil, nil) if err != nil { return } @@ -5236,7 +5237,7 @@ func (l *Libvirt) NetworkLookupByUUID(UUID UUID) (rNet Network, err error) { } var r response - r, err = l.request(47, constants.Program, buf) + r, err = l.requestStream(47, constants.Program, buf, nil, nil) if err != nil { return } @@ -5268,7 +5269,7 @@ func (l *Libvirt) NetworkSetAutostart(Net Network, Autostart int32) (err error) } - _, err = l.request(48, constants.Program, buf) + _, err = l.requestStream(48, constants.Program, buf, nil, nil) if err != nil { return } @@ -5290,7 +5291,7 @@ func (l *Libvirt) NetworkUndefine(Net Network) (err error) { } - _, err = l.request(49, constants.Program, buf) + _, err = l.requestStream(49, constants.Program, buf, nil, nil) if err != nil { return } @@ -5303,7 +5304,7 @@ func (l *Libvirt) ConnectNumOfDefinedNetworks() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(50, constants.Program, buf) + r, err = l.requestStream(50, constants.Program, buf, nil, nil) if err != nil { return } @@ -5325,7 +5326,7 @@ func (l *Libvirt) ConnectNumOfDomains() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(51, constants.Program, buf) + r, err = l.requestStream(51, constants.Program, buf, nil, nil) if err != nil { return } @@ -5347,7 +5348,7 @@ func (l *Libvirt) ConnectNumOfNetworks() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(52, constants.Program, buf) + r, err = l.requestStream(52, constants.Program, buf, nil, nil) if err != nil { return } @@ -5380,7 +5381,7 @@ func (l *Libvirt) DomainCoreDump(Dom Domain, To string, Flags DomainCoreDumpFlag } - _, err = l.request(53, constants.Program, buf) + _, err = l.requestStream(53, constants.Program, buf, nil, nil) if err != nil { return } @@ -5402,7 +5403,7 @@ func (l *Libvirt) DomainRestore(From string) (err error) { } - _, err = l.request(54, constants.Program, buf) + _, err = l.requestStream(54, constants.Program, buf, nil, nil) if err != nil { return } @@ -5425,7 +5426,7 @@ func (l *Libvirt) DomainSave(Dom Domain, To string) (err error) { } - _, err = l.request(55, constants.Program, buf) + _, err = l.requestStream(55, constants.Program, buf, nil, nil) if err != nil { return } @@ -5447,7 +5448,7 @@ func (l *Libvirt) DomainGetSchedulerType(Dom Domain) (rType string, rNparams int } var r response - r, err = l.request(56, constants.Program, buf) + r, err = l.requestStream(56, constants.Program, buf, nil, nil) if err != nil { return } @@ -5484,7 +5485,7 @@ func (l *Libvirt) DomainGetSchedulerParameters(Dom Domain, Nparams int32) (rPara } var r response - r, err = l.request(57, constants.Program, buf) + r, err = l.requestStream(57, constants.Program, buf, nil, nil) if err != nil { return } @@ -5517,7 +5518,7 @@ func (l *Libvirt) DomainSetSchedulerParameters(Dom Domain, Params []TypedParam) } - _, err = l.request(58, constants.Program, buf) + _, err = l.requestStream(58, constants.Program, buf, nil, nil) if err != nil { return } @@ -5530,7 +5531,7 @@ func (l *Libvirt) ConnectGetHostname() (rHostname string, err error) { var buf []byte var r response - r, err = l.request(59, constants.Program, buf) + r, err = l.requestStream(59, constants.Program, buf, nil, nil) if err != nil { return } @@ -5561,7 +5562,7 @@ func (l *Libvirt) ConnectSupportsFeature(Feature int32) (rSupported int32, err e } var r response - r, err = l.request(60, constants.Program, buf) + r, err = l.requestStream(60, constants.Program, buf, nil, nil) if err != nil { return } @@ -5595,7 +5596,7 @@ func (l *Libvirt) DomainMigratePrepare(UriIn OptString, Flags uint64, Dname OptS } var r response - r, err = l.request(61, constants.Program, buf) + r, err = l.requestStream(61, constants.Program, buf, nil, nil) if err != nil { return } @@ -5636,7 +5637,7 @@ func (l *Libvirt) DomainMigratePerform(Dom Domain, Cookie []byte, Uri string, Fl } - _, err = l.request(62, constants.Program, buf) + _, err = l.requestStream(62, constants.Program, buf, nil, nil) if err != nil { return } @@ -5661,7 +5662,7 @@ func (l *Libvirt) DomainMigrateFinish(Dname string, Cookie []byte, Uri string, F } var r response - r, err = l.request(63, constants.Program, buf) + r, err = l.requestStream(63, constants.Program, buf, nil, nil) if err != nil { return } @@ -5693,7 +5694,7 @@ func (l *Libvirt) DomainBlockStats(Dom Domain, Path string) (rRdReq int64, rRdBy } var r response - r, err = l.request(64, constants.Program, buf) + r, err = l.requestStream(64, constants.Program, buf, nil, nil) if err != nil { return } @@ -5745,7 +5746,7 @@ func (l *Libvirt) DomainInterfaceStats(Dom Domain, Device string) (rRxBytes int6 } var r response - r, err = l.request(65, constants.Program, buf) + r, err = l.requestStream(65, constants.Program, buf, nil, nil) if err != nil { return } @@ -5802,7 +5803,7 @@ func (l *Libvirt) AuthList() (rTypes []AuthType, err error) { var buf []byte var r response - r, err = l.request(66, constants.Program, buf) + r, err = l.requestStream(66, constants.Program, buf, nil, nil) if err != nil { return } @@ -5824,7 +5825,7 @@ func (l *Libvirt) AuthSaslInit() (rMechlist string, err error) { var buf []byte var r response - r, err = l.request(67, constants.Program, buf) + r, err = l.requestStream(67, constants.Program, buf, nil, nil) if err != nil { return } @@ -5857,7 +5858,7 @@ func (l *Libvirt) AuthSaslStart(Mech string, Nil int32, Data []int8) (rComplete } var r response - r, err = l.request(68, constants.Program, buf) + r, err = l.requestStream(68, constants.Program, buf, nil, nil) if err != nil { return } @@ -5899,7 +5900,7 @@ func (l *Libvirt) AuthSaslStep(Nil int32, Data []int8) (rComplete int32, rNil in } var r response - r, err = l.request(69, constants.Program, buf) + r, err = l.requestStream(69, constants.Program, buf, nil, nil) if err != nil { return } @@ -5931,7 +5932,7 @@ func (l *Libvirt) AuthPolkit() (rComplete int32, err error) { var buf []byte var r response - r, err = l.request(70, constants.Program, buf) + r, err = l.requestStream(70, constants.Program, buf, nil, nil) if err != nil { return } @@ -5953,7 +5954,7 @@ func (l *Libvirt) ConnectNumOfStoragePools() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(71, constants.Program, buf) + r, err = l.requestStream(71, constants.Program, buf, nil, nil) if err != nil { return } @@ -5984,7 +5985,7 @@ func (l *Libvirt) ConnectListStoragePools(Maxnames int32) (rNames []string, err } var r response - r, err = l.request(72, constants.Program, buf) + r, err = l.requestStream(72, constants.Program, buf, nil, nil) if err != nil { return } @@ -6006,7 +6007,7 @@ func (l *Libvirt) ConnectNumOfDefinedStoragePools() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(73, constants.Program, buf) + r, err = l.requestStream(73, constants.Program, buf, nil, nil) if err != nil { return } @@ -6037,7 +6038,7 @@ func (l *Libvirt) ConnectListDefinedStoragePools(Maxnames int32) (rNames []strin } var r response - r, err = l.request(74, constants.Program, buf) + r, err = l.requestStream(74, constants.Program, buf, nil, nil) if err != nil { return } @@ -6070,7 +6071,7 @@ func (l *Libvirt) ConnectFindStoragePoolSources(Type string, SrcSpec OptString, } var r response - r, err = l.request(75, constants.Program, buf) + r, err = l.requestStream(75, constants.Program, buf, nil, nil) if err != nil { return } @@ -6102,7 +6103,7 @@ func (l *Libvirt) StoragePoolCreateXML(XML string, Flags StoragePoolCreateFlags) } var r response - r, err = l.request(76, constants.Program, buf) + r, err = l.requestStream(76, constants.Program, buf, nil, nil) if err != nil { return } @@ -6134,7 +6135,7 @@ func (l *Libvirt) StoragePoolDefineXML(XML string, Flags uint32) (rPool StorageP } var r response - r, err = l.request(77, constants.Program, buf) + r, err = l.requestStream(77, constants.Program, buf, nil, nil) if err != nil { return } @@ -6166,7 +6167,7 @@ func (l *Libvirt) StoragePoolCreate(Pool StoragePool, Flags StoragePoolCreateFla } - _, err = l.request(78, constants.Program, buf) + _, err = l.requestStream(78, constants.Program, buf, nil, nil) if err != nil { return } @@ -6189,7 +6190,7 @@ func (l *Libvirt) StoragePoolBuild(Pool StoragePool, Flags StoragePoolBuildFlags } - _, err = l.request(79, constants.Program, buf) + _, err = l.requestStream(79, constants.Program, buf, nil, nil) if err != nil { return } @@ -6211,7 +6212,7 @@ func (l *Libvirt) StoragePoolDestroy(Pool StoragePool) (err error) { } - _, err = l.request(80, constants.Program, buf) + _, err = l.requestStream(80, constants.Program, buf, nil, nil) if err != nil { return } @@ -6234,7 +6235,7 @@ func (l *Libvirt) StoragePoolDelete(Pool StoragePool, Flags StoragePoolDeleteFla } - _, err = l.request(81, constants.Program, buf) + _, err = l.requestStream(81, constants.Program, buf, nil, nil) if err != nil { return } @@ -6256,7 +6257,7 @@ func (l *Libvirt) StoragePoolUndefine(Pool StoragePool) (err error) { } - _, err = l.request(82, constants.Program, buf) + _, err = l.requestStream(82, constants.Program, buf, nil, nil) if err != nil { return } @@ -6279,7 +6280,7 @@ func (l *Libvirt) StoragePoolRefresh(Pool StoragePool, Flags uint32) (err error) } - _, err = l.request(83, constants.Program, buf) + _, err = l.requestStream(83, constants.Program, buf, nil, nil) if err != nil { return } @@ -6301,7 +6302,7 @@ func (l *Libvirt) StoragePoolLookupByName(Name string) (rPool StoragePool, err e } var r response - r, err = l.request(84, constants.Program, buf) + r, err = l.requestStream(84, constants.Program, buf, nil, nil) if err != nil { return } @@ -6332,7 +6333,7 @@ func (l *Libvirt) StoragePoolLookupByUUID(UUID UUID) (rPool StoragePool, err err } var r response - r, err = l.request(85, constants.Program, buf) + r, err = l.requestStream(85, constants.Program, buf, nil, nil) if err != nil { return } @@ -6363,7 +6364,7 @@ func (l *Libvirt) StoragePoolLookupByVolume(Vol StorageVol) (rPool StoragePool, } var r response - r, err = l.request(86, constants.Program, buf) + r, err = l.requestStream(86, constants.Program, buf, nil, nil) if err != nil { return } @@ -6394,7 +6395,7 @@ func (l *Libvirt) StoragePoolGetInfo(Pool StoragePool) (rState uint8, rCapacity } var r response - r, err = l.request(87, constants.Program, buf) + r, err = l.requestStream(87, constants.Program, buf, nil, nil) if err != nil { return } @@ -6441,7 +6442,7 @@ func (l *Libvirt) StoragePoolGetXMLDesc(Pool StoragePool, Flags StorageXMLFlags) } var r response - r, err = l.request(88, constants.Program, buf) + r, err = l.requestStream(88, constants.Program, buf, nil, nil) if err != nil { return } @@ -6472,7 +6473,7 @@ func (l *Libvirt) StoragePoolGetAutostart(Pool StoragePool) (rAutostart int32, e } var r response - r, err = l.request(89, constants.Program, buf) + r, err = l.requestStream(89, constants.Program, buf, nil, nil) if err != nil { return } @@ -6504,7 +6505,7 @@ func (l *Libvirt) StoragePoolSetAutostart(Pool StoragePool, Autostart int32) (er } - _, err = l.request(90, constants.Program, buf) + _, err = l.requestStream(90, constants.Program, buf, nil, nil) if err != nil { return } @@ -6526,7 +6527,7 @@ func (l *Libvirt) StoragePoolNumOfVolumes(Pool StoragePool) (rNum int32, err err } var r response - r, err = l.request(91, constants.Program, buf) + r, err = l.requestStream(91, constants.Program, buf, nil, nil) if err != nil { return } @@ -6558,7 +6559,7 @@ func (l *Libvirt) StoragePoolListVolumes(Pool StoragePool, Maxnames int32) (rNam } var r response - r, err = l.request(92, constants.Program, buf) + r, err = l.requestStream(92, constants.Program, buf, nil, nil) if err != nil { return } @@ -6591,7 +6592,7 @@ func (l *Libvirt) StorageVolCreateXML(Pool StoragePool, XML string, Flags Storag } var r response - r, err = l.request(93, constants.Program, buf) + r, err = l.requestStream(93, constants.Program, buf, nil, nil) if err != nil { return } @@ -6623,7 +6624,7 @@ func (l *Libvirt) StorageVolDelete(Vol StorageVol, Flags StorageVolDeleteFlags) } - _, err = l.request(94, constants.Program, buf) + _, err = l.requestStream(94, constants.Program, buf, nil, nil) if err != nil { return } @@ -6646,7 +6647,7 @@ func (l *Libvirt) StorageVolLookupByName(Pool StoragePool, Name string) (rVol St } var r response - r, err = l.request(95, constants.Program, buf) + r, err = l.requestStream(95, constants.Program, buf, nil, nil) if err != nil { return } @@ -6677,7 +6678,7 @@ func (l *Libvirt) StorageVolLookupByKey(Key string) (rVol StorageVol, err error) } var r response - r, err = l.request(96, constants.Program, buf) + r, err = l.requestStream(96, constants.Program, buf, nil, nil) if err != nil { return } @@ -6708,7 +6709,7 @@ func (l *Libvirt) StorageVolLookupByPath(Path string) (rVol StorageVol, err erro } var r response - r, err = l.request(97, constants.Program, buf) + r, err = l.requestStream(97, constants.Program, buf, nil, nil) if err != nil { return } @@ -6739,7 +6740,7 @@ func (l *Libvirt) StorageVolGetInfo(Vol StorageVol) (rType int8, rCapacity uint6 } var r response - r, err = l.request(98, constants.Program, buf) + r, err = l.requestStream(98, constants.Program, buf, nil, nil) if err != nil { return } @@ -6781,7 +6782,7 @@ func (l *Libvirt) StorageVolGetXMLDesc(Vol StorageVol, Flags uint32) (rXML strin } var r response - r, err = l.request(99, constants.Program, buf) + r, err = l.requestStream(99, constants.Program, buf, nil, nil) if err != nil { return } @@ -6812,7 +6813,7 @@ func (l *Libvirt) StorageVolGetPath(Vol StorageVol) (rName string, err error) { } var r response - r, err = l.request(100, constants.Program, buf) + r, err = l.requestStream(100, constants.Program, buf, nil, nil) if err != nil { return } @@ -6844,7 +6845,7 @@ func (l *Libvirt) NodeGetCellsFreeMemory(StartCell int32, Maxcells int32) (rCell } var r response - r, err = l.request(101, constants.Program, buf) + r, err = l.requestStream(101, constants.Program, buf, nil, nil) if err != nil { return } @@ -6866,7 +6867,7 @@ func (l *Libvirt) NodeGetFreeMemory() (rFreeMem uint64, err error) { var buf []byte var r response - r, err = l.request(102, constants.Program, buf) + r, err = l.requestStream(102, constants.Program, buf, nil, nil) if err != nil { return } @@ -6901,7 +6902,7 @@ func (l *Libvirt) DomainBlockPeek(Dom Domain, Path string, Offset uint64, Size u } var r response - r, err = l.request(103, constants.Program, buf) + r, err = l.requestStream(103, constants.Program, buf, nil, nil) if err != nil { return } @@ -6935,7 +6936,7 @@ func (l *Libvirt) DomainMemoryPeek(Dom Domain, Offset uint64, Size uint32, Flags } var r response - r, err = l.request(104, constants.Program, buf) + r, err = l.requestStream(104, constants.Program, buf, nil, nil) if err != nil { return } @@ -6957,7 +6958,7 @@ func (l *Libvirt) ConnectDomainEventRegister() (rCbRegistered int32, err error) var buf []byte var r response - r, err = l.request(105, constants.Program, buf) + r, err = l.requestStream(105, constants.Program, buf, nil, nil) if err != nil { return } @@ -6979,7 +6980,7 @@ func (l *Libvirt) ConnectDomainEventDeregister() (rCbRegistered int32, err error var buf []byte var r response - r, err = l.request(106, constants.Program, buf) + r, err = l.requestStream(106, constants.Program, buf, nil, nil) if err != nil { return } @@ -7001,7 +7002,7 @@ func (l *Libvirt) DomainEventLifecycle() (err error) { var buf []byte - _, err = l.request(107, constants.Program, buf) + _, err = l.requestStream(107, constants.Program, buf, nil, nil) if err != nil { return } @@ -7027,7 +7028,7 @@ func (l *Libvirt) DomainMigratePrepare2(UriIn OptString, Flags uint64, Dname Opt } var r response - r, err = l.request(108, constants.Program, buf) + r, err = l.requestStream(108, constants.Program, buf, nil, nil) if err != nil { return } @@ -7067,7 +7068,7 @@ func (l *Libvirt) DomainMigrateFinish2(Dname string, Cookie []byte, Uri string, } var r response - r, err = l.request(109, constants.Program, buf) + r, err = l.requestStream(109, constants.Program, buf, nil, nil) if err != nil { return } @@ -7089,7 +7090,7 @@ func (l *Libvirt) ConnectGetUri() (rUri string, err error) { var buf []byte var r response - r, err = l.request(110, constants.Program, buf) + r, err = l.requestStream(110, constants.Program, buf, nil, nil) if err != nil { return } @@ -7121,7 +7122,7 @@ func (l *Libvirt) NodeNumOfDevices(Cap OptString, Flags uint32) (rNum int32, err } var r response - r, err = l.request(111, constants.Program, buf) + r, err = l.requestStream(111, constants.Program, buf, nil, nil) if err != nil { return } @@ -7154,7 +7155,7 @@ func (l *Libvirt) NodeListDevices(Cap OptString, Maxnames int32, Flags uint32) ( } var r response - r, err = l.request(112, constants.Program, buf) + r, err = l.requestStream(112, constants.Program, buf, nil, nil) if err != nil { return } @@ -7185,7 +7186,7 @@ func (l *Libvirt) NodeDeviceLookupByName(Name string) (rDev NodeDevice, err erro } var r response - r, err = l.request(113, constants.Program, buf) + r, err = l.requestStream(113, constants.Program, buf, nil, nil) if err != nil { return } @@ -7217,7 +7218,7 @@ func (l *Libvirt) NodeDeviceGetXMLDesc(Name string, Flags uint32) (rXML string, } var r response - r, err = l.request(114, constants.Program, buf) + r, err = l.requestStream(114, constants.Program, buf, nil, nil) if err != nil { return } @@ -7248,7 +7249,7 @@ func (l *Libvirt) NodeDeviceGetParent(Name string) (rParent OptString, err error } var r response - r, err = l.request(115, constants.Program, buf) + r, err = l.requestStream(115, constants.Program, buf, nil, nil) if err != nil { return } @@ -7279,7 +7280,7 @@ func (l *Libvirt) NodeDeviceNumOfCaps(Name string) (rNum int32, err error) { } var r response - r, err = l.request(116, constants.Program, buf) + r, err = l.requestStream(116, constants.Program, buf, nil, nil) if err != nil { return } @@ -7311,7 +7312,7 @@ func (l *Libvirt) NodeDeviceListCaps(Name string, Maxnames int32) (rNames []stri } var r response - r, err = l.request(117, constants.Program, buf) + r, err = l.requestStream(117, constants.Program, buf, nil, nil) if err != nil { return } @@ -7342,7 +7343,7 @@ func (l *Libvirt) NodeDeviceDettach(Name string) (err error) { } - _, err = l.request(118, constants.Program, buf) + _, err = l.requestStream(118, constants.Program, buf, nil, nil) if err != nil { return } @@ -7364,7 +7365,7 @@ func (l *Libvirt) NodeDeviceReAttach(Name string) (err error) { } - _, err = l.request(119, constants.Program, buf) + _, err = l.requestStream(119, constants.Program, buf, nil, nil) if err != nil { return } @@ -7386,7 +7387,7 @@ func (l *Libvirt) NodeDeviceReset(Name string) (err error) { } - _, err = l.request(120, constants.Program, buf) + _, err = l.requestStream(120, constants.Program, buf, nil, nil) if err != nil { return } @@ -7408,7 +7409,7 @@ func (l *Libvirt) DomainGetSecurityLabel(Dom Domain) (rLabel []int8, rEnforcing } var r response - r, err = l.request(121, constants.Program, buf) + r, err = l.requestStream(121, constants.Program, buf, nil, nil) if err != nil { return } @@ -7435,7 +7436,7 @@ func (l *Libvirt) NodeGetSecurityModel() (rModel []int8, rDoi []int8, err error) var buf []byte var r response - r, err = l.request(122, constants.Program, buf) + r, err = l.requestStream(122, constants.Program, buf, nil, nil) if err != nil { return } @@ -7472,7 +7473,7 @@ func (l *Libvirt) NodeDeviceCreateXML(XMLDesc string, Flags uint32) (rDev NodeDe } var r response - r, err = l.request(123, constants.Program, buf) + r, err = l.requestStream(123, constants.Program, buf, nil, nil) if err != nil { return } @@ -7503,7 +7504,7 @@ func (l *Libvirt) NodeDeviceDestroy(Name string) (err error) { } - _, err = l.request(124, constants.Program, buf) + _, err = l.requestStream(124, constants.Program, buf, nil, nil) if err != nil { return } @@ -7528,7 +7529,7 @@ func (l *Libvirt) StorageVolCreateXMLFrom(Pool StoragePool, XML string, Clonevol } var r response - r, err = l.request(125, constants.Program, buf) + r, err = l.requestStream(125, constants.Program, buf, nil, nil) if err != nil { return } @@ -7550,7 +7551,7 @@ func (l *Libvirt) ConnectNumOfInterfaces() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(126, constants.Program, buf) + r, err = l.requestStream(126, constants.Program, buf, nil, nil) if err != nil { return } @@ -7581,7 +7582,7 @@ func (l *Libvirt) ConnectListInterfaces(Maxnames int32) (rNames []string, err er } var r response - r, err = l.request(127, constants.Program, buf) + r, err = l.requestStream(127, constants.Program, buf, nil, nil) if err != nil { return } @@ -7612,7 +7613,7 @@ func (l *Libvirt) InterfaceLookupByName(Name string) (rIface Interface, err erro } var r response - r, err = l.request(128, constants.Program, buf) + r, err = l.requestStream(128, constants.Program, buf, nil, nil) if err != nil { return } @@ -7643,7 +7644,7 @@ func (l *Libvirt) InterfaceLookupByMacString(Mac string) (rIface Interface, err } var r response - r, err = l.request(129, constants.Program, buf) + r, err = l.requestStream(129, constants.Program, buf, nil, nil) if err != nil { return } @@ -7675,7 +7676,7 @@ func (l *Libvirt) InterfaceGetXMLDesc(Iface Interface, Flags uint32) (rXML strin } var r response - r, err = l.request(130, constants.Program, buf) + r, err = l.requestStream(130, constants.Program, buf, nil, nil) if err != nil { return } @@ -7707,7 +7708,7 @@ func (l *Libvirt) InterfaceDefineXML(XML string, Flags uint32) (rIface Interface } var r response - r, err = l.request(131, constants.Program, buf) + r, err = l.requestStream(131, constants.Program, buf, nil, nil) if err != nil { return } @@ -7738,7 +7739,7 @@ func (l *Libvirt) InterfaceUndefine(Iface Interface) (err error) { } - _, err = l.request(132, constants.Program, buf) + _, err = l.requestStream(132, constants.Program, buf, nil, nil) if err != nil { return } @@ -7761,7 +7762,7 @@ func (l *Libvirt) InterfaceCreate(Iface Interface, Flags uint32) (err error) { } - _, err = l.request(133, constants.Program, buf) + _, err = l.requestStream(133, constants.Program, buf, nil, nil) if err != nil { return } @@ -7784,7 +7785,7 @@ func (l *Libvirt) InterfaceDestroy(Iface Interface, Flags uint32) (err error) { } - _, err = l.request(134, constants.Program, buf) + _, err = l.requestStream(134, constants.Program, buf, nil, nil) if err != nil { return } @@ -7808,7 +7809,7 @@ func (l *Libvirt) ConnectDomainXMLFromNative(NativeFormat string, NativeConfig s } var r response - r, err = l.request(135, constants.Program, buf) + r, err = l.requestStream(135, constants.Program, buf, nil, nil) if err != nil { return } @@ -7841,7 +7842,7 @@ func (l *Libvirt) ConnectDomainXMLToNative(NativeFormat string, DomainXML string } var r response - r, err = l.request(136, constants.Program, buf) + r, err = l.requestStream(136, constants.Program, buf, nil, nil) if err != nil { return } @@ -7863,7 +7864,7 @@ func (l *Libvirt) ConnectNumOfDefinedInterfaces() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(137, constants.Program, buf) + r, err = l.requestStream(137, constants.Program, buf, nil, nil) if err != nil { return } @@ -7894,7 +7895,7 @@ func (l *Libvirt) ConnectListDefinedInterfaces(Maxnames int32) (rNames []string, } var r response - r, err = l.request(138, constants.Program, buf) + r, err = l.requestStream(138, constants.Program, buf, nil, nil) if err != nil { return } @@ -7916,7 +7917,7 @@ func (l *Libvirt) ConnectNumOfSecrets() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(139, constants.Program, buf) + r, err = l.requestStream(139, constants.Program, buf, nil, nil) if err != nil { return } @@ -7947,7 +7948,7 @@ func (l *Libvirt) ConnectListSecrets(Maxuuids int32) (rUuids []string, err error } var r response - r, err = l.request(140, constants.Program, buf) + r, err = l.requestStream(140, constants.Program, buf, nil, nil) if err != nil { return } @@ -7978,7 +7979,7 @@ func (l *Libvirt) SecretLookupByUUID(UUID UUID) (rOptSecret Secret, err error) { } var r response - r, err = l.request(141, constants.Program, buf) + r, err = l.requestStream(141, constants.Program, buf, nil, nil) if err != nil { return } @@ -8010,7 +8011,7 @@ func (l *Libvirt) SecretDefineXML(XML string, Flags uint32) (rOptSecret Secret, } var r response - r, err = l.request(142, constants.Program, buf) + r, err = l.requestStream(142, constants.Program, buf, nil, nil) if err != nil { return } @@ -8042,7 +8043,7 @@ func (l *Libvirt) SecretGetXMLDesc(OptSecret Secret, Flags uint32) (rXML string, } var r response - r, err = l.request(143, constants.Program, buf) + r, err = l.requestStream(143, constants.Program, buf, nil, nil) if err != nil { return } @@ -8075,7 +8076,7 @@ func (l *Libvirt) SecretSetValue(OptSecret Secret, Value []byte, Flags uint32) ( } - _, err = l.request(144, constants.Program, buf) + _, err = l.requestStream(144, constants.Program, buf, nil, nil) if err != nil { return } @@ -8098,7 +8099,7 @@ func (l *Libvirt) SecretGetValue(OptSecret Secret, Flags uint32) (rValue []byte, } var r response - r, err = l.request(145, constants.Program, buf) + r, err = l.requestStream(145, constants.Program, buf, nil, nil) if err != nil { return } @@ -8129,7 +8130,7 @@ func (l *Libvirt) SecretUndefine(OptSecret Secret) (err error) { } - _, err = l.request(146, constants.Program, buf) + _, err = l.requestStream(146, constants.Program, buf, nil, nil) if err != nil { return } @@ -8152,7 +8153,7 @@ func (l *Libvirt) SecretLookupByUsage(UsageType int32, UsageID string) (rOptSecr } var r response - r, err = l.request(147, constants.Program, buf) + r, err = l.requestStream(147, constants.Program, buf, nil, nil) if err != nil { return } @@ -8170,7 +8171,7 @@ func (l *Libvirt) SecretLookupByUsage(UsageType int32, UsageID string) (rOptSecr } // DomainMigratePrepareTunnel is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL. -func (l *Libvirt) DomainMigratePrepareTunnel(Flags uint64, Dname OptString, Resource uint64, DomXML string) (err error) { +func (l *Libvirt) DomainMigratePrepareTunnel(Flags uint64, outStream io.Reader, Dname OptString, Resource uint64, DomXML string) (err error) { var buf []byte args := DomainMigratePrepareTunnelArgs { @@ -8186,7 +8187,7 @@ func (l *Libvirt) DomainMigratePrepareTunnel(Flags uint64, Dname OptString, Reso } - _, err = l.request(148, constants.Program, buf) + _, err = l.requestStream(148, constants.Program, buf, outStream, nil) if err != nil { return } @@ -8199,7 +8200,7 @@ func (l *Libvirt) ConnectIsSecure() (rSecure int32, err error) { var buf []byte var r response - r, err = l.request(149, constants.Program, buf) + r, err = l.requestStream(149, constants.Program, buf, nil, nil) if err != nil { return } @@ -8230,7 +8231,7 @@ func (l *Libvirt) DomainIsActive(Dom Domain) (rActive int32, err error) { } var r response - r, err = l.request(150, constants.Program, buf) + r, err = l.requestStream(150, constants.Program, buf, nil, nil) if err != nil { return } @@ -8261,7 +8262,7 @@ func (l *Libvirt) DomainIsPersistent(Dom Domain) (rPersistent int32, err error) } var r response - r, err = l.request(151, constants.Program, buf) + r, err = l.requestStream(151, constants.Program, buf, nil, nil) if err != nil { return } @@ -8292,7 +8293,7 @@ func (l *Libvirt) NetworkIsActive(Net Network) (rActive int32, err error) { } var r response - r, err = l.request(152, constants.Program, buf) + r, err = l.requestStream(152, constants.Program, buf, nil, nil) if err != nil { return } @@ -8323,7 +8324,7 @@ func (l *Libvirt) NetworkIsPersistent(Net Network) (rPersistent int32, err error } var r response - r, err = l.request(153, constants.Program, buf) + r, err = l.requestStream(153, constants.Program, buf, nil, nil) if err != nil { return } @@ -8354,7 +8355,7 @@ func (l *Libvirt) StoragePoolIsActive(Pool StoragePool) (rActive int32, err erro } var r response - r, err = l.request(154, constants.Program, buf) + r, err = l.requestStream(154, constants.Program, buf, nil, nil) if err != nil { return } @@ -8385,7 +8386,7 @@ func (l *Libvirt) StoragePoolIsPersistent(Pool StoragePool) (rPersistent int32, } var r response - r, err = l.request(155, constants.Program, buf) + r, err = l.requestStream(155, constants.Program, buf, nil, nil) if err != nil { return } @@ -8416,7 +8417,7 @@ func (l *Libvirt) InterfaceIsActive(Iface Interface) (rActive int32, err error) } var r response - r, err = l.request(156, constants.Program, buf) + r, err = l.requestStream(156, constants.Program, buf, nil, nil) if err != nil { return } @@ -8438,7 +8439,7 @@ func (l *Libvirt) ConnectGetLibVersion() (rLibVer uint64, err error) { var buf []byte var r response - r, err = l.request(157, constants.Program, buf) + r, err = l.requestStream(157, constants.Program, buf, nil, nil) if err != nil { return } @@ -8470,7 +8471,7 @@ func (l *Libvirt) ConnectCompareCPU(XML string, Flags ConnectCompareCPUFlags) (r } var r response - r, err = l.request(158, constants.Program, buf) + r, err = l.requestStream(158, constants.Program, buf, nil, nil) if err != nil { return } @@ -8503,7 +8504,7 @@ func (l *Libvirt) DomainMemoryStats(Dom Domain, MaxStats uint32, Flags uint32) ( } var r response - r, err = l.request(159, constants.Program, buf) + r, err = l.requestStream(159, constants.Program, buf, nil, nil) if err != nil { return } @@ -8536,7 +8537,7 @@ func (l *Libvirt) DomainAttachDeviceFlags(Dom Domain, XML string, Flags uint32) } - _, err = l.request(160, constants.Program, buf) + _, err = l.requestStream(160, constants.Program, buf, nil, nil) if err != nil { return } @@ -8560,7 +8561,7 @@ func (l *Libvirt) DomainDetachDeviceFlags(Dom Domain, XML string, Flags uint32) } - _, err = l.request(161, constants.Program, buf) + _, err = l.requestStream(161, constants.Program, buf, nil, nil) if err != nil { return } @@ -8583,7 +8584,7 @@ func (l *Libvirt) ConnectBaselineCPU(XMLCPUs []string, Flags ConnectBaselineCPUF } var r response - r, err = l.request(162, constants.Program, buf) + r, err = l.requestStream(162, constants.Program, buf, nil, nil) if err != nil { return } @@ -8614,7 +8615,7 @@ func (l *Libvirt) DomainGetJobInfo(Dom Domain) (rType int32, rTimeElapsed uint64 } var r response - r, err = l.request(163, constants.Program, buf) + r, err = l.requestStream(163, constants.Program, buf, nil, nil) if err != nil { return } @@ -8700,7 +8701,7 @@ func (l *Libvirt) DomainAbortJob(Dom Domain) (err error) { } - _, err = l.request(164, constants.Program, buf) + _, err = l.requestStream(164, constants.Program, buf, nil, nil) if err != nil { return } @@ -8723,7 +8724,7 @@ func (l *Libvirt) StorageVolWipe(Vol StorageVol, Flags uint32) (err error) { } - _, err = l.request(165, constants.Program, buf) + _, err = l.requestStream(165, constants.Program, buf, nil, nil) if err != nil { return } @@ -8747,7 +8748,7 @@ func (l *Libvirt) DomainMigrateSetMaxDowntime(Dom Domain, Downtime uint64, Flags } - _, err = l.request(166, constants.Program, buf) + _, err = l.requestStream(166, constants.Program, buf, nil, nil) if err != nil { return } @@ -8769,7 +8770,7 @@ func (l *Libvirt) ConnectDomainEventRegisterAny(EventID int32) (err error) { } - _, err = l.request(167, constants.Program, buf) + _, err = l.requestStream(167, constants.Program, buf, nil, nil) if err != nil { return } @@ -8791,7 +8792,7 @@ func (l *Libvirt) ConnectDomainEventDeregisterAny(EventID int32) (err error) { } - _, err = l.request(168, constants.Program, buf) + _, err = l.requestStream(168, constants.Program, buf, nil, nil) if err != nil { return } @@ -8804,7 +8805,7 @@ func (l *Libvirt) DomainEventReboot() (err error) { var buf []byte - _, err = l.request(169, constants.Program, buf) + _, err = l.requestStream(169, constants.Program, buf, nil, nil) if err != nil { return } @@ -8817,7 +8818,7 @@ func (l *Libvirt) DomainEventRtcChange() (err error) { var buf []byte - _, err = l.request(170, constants.Program, buf) + _, err = l.requestStream(170, constants.Program, buf, nil, nil) if err != nil { return } @@ -8830,7 +8831,7 @@ func (l *Libvirt) DomainEventWatchdog() (err error) { var buf []byte - _, err = l.request(171, constants.Program, buf) + _, err = l.requestStream(171, constants.Program, buf, nil, nil) if err != nil { return } @@ -8843,7 +8844,7 @@ func (l *Libvirt) DomainEventIOError() (err error) { var buf []byte - _, err = l.request(172, constants.Program, buf) + _, err = l.requestStream(172, constants.Program, buf, nil, nil) if err != nil { return } @@ -8856,7 +8857,7 @@ func (l *Libvirt) DomainEventGraphics() (err error) { var buf []byte - _, err = l.request(173, constants.Program, buf) + _, err = l.requestStream(173, constants.Program, buf, nil, nil) if err != nil { return } @@ -8880,7 +8881,7 @@ func (l *Libvirt) DomainUpdateDeviceFlags(Dom Domain, XML string, Flags DomainDe } - _, err = l.request(174, constants.Program, buf) + _, err = l.requestStream(174, constants.Program, buf, nil, nil) if err != nil { return } @@ -8902,7 +8903,7 @@ func (l *Libvirt) NwfilterLookupByName(Name string) (rOptNwfilter Nwfilter, err } var r response - r, err = l.request(175, constants.Program, buf) + r, err = l.requestStream(175, constants.Program, buf, nil, nil) if err != nil { return } @@ -8933,7 +8934,7 @@ func (l *Libvirt) NwfilterLookupByUUID(UUID UUID) (rOptNwfilter Nwfilter, err er } var r response - r, err = l.request(176, constants.Program, buf) + r, err = l.requestStream(176, constants.Program, buf, nil, nil) if err != nil { return } @@ -8965,7 +8966,7 @@ func (l *Libvirt) NwfilterGetXMLDesc(OptNwfilter Nwfilter, Flags uint32) (rXML s } var r response - r, err = l.request(177, constants.Program, buf) + r, err = l.requestStream(177, constants.Program, buf, nil, nil) if err != nil { return } @@ -8987,7 +8988,7 @@ func (l *Libvirt) ConnectNumOfNwfilters() (rNum int32, err error) { var buf []byte var r response - r, err = l.request(178, constants.Program, buf) + r, err = l.requestStream(178, constants.Program, buf, nil, nil) if err != nil { return } @@ -9018,7 +9019,7 @@ func (l *Libvirt) ConnectListNwfilters(Maxnames int32) (rNames []string, err err } var r response - r, err = l.request(179, constants.Program, buf) + r, err = l.requestStream(179, constants.Program, buf, nil, nil) if err != nil { return } @@ -9049,7 +9050,7 @@ func (l *Libvirt) NwfilterDefineXML(XML string) (rOptNwfilter Nwfilter, err erro } var r response - r, err = l.request(180, constants.Program, buf) + r, err = l.requestStream(180, constants.Program, buf, nil, nil) if err != nil { return } @@ -9080,7 +9081,7 @@ func (l *Libvirt) NwfilterUndefine(OptNwfilter Nwfilter) (err error) { } - _, err = l.request(181, constants.Program, buf) + _, err = l.requestStream(181, constants.Program, buf, nil, nil) if err != nil { return } @@ -9103,7 +9104,7 @@ func (l *Libvirt) DomainManagedSave(Dom Domain, Flags uint32) (err error) { } - _, err = l.request(182, constants.Program, buf) + _, err = l.requestStream(182, constants.Program, buf, nil, nil) if err != nil { return } @@ -9126,7 +9127,7 @@ func (l *Libvirt) DomainHasManagedSaveImage(Dom Domain, Flags uint32) (rResult i } var r response - r, err = l.request(183, constants.Program, buf) + r, err = l.requestStream(183, constants.Program, buf, nil, nil) if err != nil { return } @@ -9158,7 +9159,7 @@ func (l *Libvirt) DomainManagedSaveRemove(Dom Domain, Flags uint32) (err error) } - _, err = l.request(184, constants.Program, buf) + _, err = l.requestStream(184, constants.Program, buf, nil, nil) if err != nil { return } @@ -9182,7 +9183,7 @@ func (l *Libvirt) DomainSnapshotCreateXML(Dom Domain, XMLDesc string, Flags uint } var r response - r, err = l.request(185, constants.Program, buf) + r, err = l.requestStream(185, constants.Program, buf, nil, nil) if err != nil { return } @@ -9214,7 +9215,7 @@ func (l *Libvirt) DomainSnapshotGetXMLDesc(Snap DomainSnapshot, Flags uint32) (r } var r response - r, err = l.request(186, constants.Program, buf) + r, err = l.requestStream(186, constants.Program, buf, nil, nil) if err != nil { return } @@ -9246,7 +9247,7 @@ func (l *Libvirt) DomainSnapshotNum(Dom Domain, Flags uint32) (rNum int32, err e } var r response - r, err = l.request(187, constants.Program, buf) + r, err = l.requestStream(187, constants.Program, buf, nil, nil) if err != nil { return } @@ -9279,7 +9280,7 @@ func (l *Libvirt) DomainSnapshotListNames(Dom Domain, Maxnames int32, Flags uint } var r response - r, err = l.request(188, constants.Program, buf) + r, err = l.requestStream(188, constants.Program, buf, nil, nil) if err != nil { return } @@ -9312,7 +9313,7 @@ func (l *Libvirt) DomainSnapshotLookupByName(Dom Domain, Name string, Flags uint } var r response - r, err = l.request(189, constants.Program, buf) + r, err = l.requestStream(189, constants.Program, buf, nil, nil) if err != nil { return } @@ -9344,7 +9345,7 @@ func (l *Libvirt) DomainHasCurrentSnapshot(Dom Domain, Flags uint32) (rResult in } var r response - r, err = l.request(190, constants.Program, buf) + r, err = l.requestStream(190, constants.Program, buf, nil, nil) if err != nil { return } @@ -9376,7 +9377,7 @@ func (l *Libvirt) DomainSnapshotCurrent(Dom Domain, Flags uint32) (rSnap DomainS } var r response - r, err = l.request(191, constants.Program, buf) + r, err = l.requestStream(191, constants.Program, buf, nil, nil) if err != nil { return } @@ -9408,7 +9409,7 @@ func (l *Libvirt) DomainRevertToSnapshot(Snap DomainSnapshot, Flags uint32) (err } - _, err = l.request(192, constants.Program, buf) + _, err = l.requestStream(192, constants.Program, buf, nil, nil) if err != nil { return } @@ -9431,7 +9432,7 @@ func (l *Libvirt) DomainSnapshotDelete(Snap DomainSnapshot, Flags DomainSnapshot } - _, err = l.request(193, constants.Program, buf) + _, err = l.requestStream(193, constants.Program, buf, nil, nil) if err != nil { return } @@ -9455,7 +9456,7 @@ func (l *Libvirt) DomainGetBlockInfo(Dom Domain, Path string, Flags uint32) (rAl } var r response - r, err = l.request(194, constants.Program, buf) + r, err = l.requestStream(194, constants.Program, buf, nil, nil) if err != nil { return } @@ -9487,7 +9488,7 @@ func (l *Libvirt) DomainEventIOErrorReason() (err error) { var buf []byte - _, err = l.request(195, constants.Program, buf) + _, err = l.requestStream(195, constants.Program, buf, nil, nil) if err != nil { return } @@ -9510,7 +9511,7 @@ func (l *Libvirt) DomainCreateWithFlags(Dom Domain, Flags uint32) (rDom Domain, } var r response - r, err = l.request(196, constants.Program, buf) + r, err = l.requestStream(196, constants.Program, buf, nil, nil) if err != nil { return } @@ -9543,7 +9544,7 @@ func (l *Libvirt) DomainSetMemoryParameters(Dom Domain, Params []TypedParam, Fla } - _, err = l.request(197, constants.Program, buf) + _, err = l.requestStream(197, constants.Program, buf, nil, nil) if err != nil { return } @@ -9567,7 +9568,7 @@ func (l *Libvirt) DomainGetMemoryParameters(Dom Domain, Nparams int32, Flags uin } var r response - r, err = l.request(198, constants.Program, buf) + r, err = l.requestStream(198, constants.Program, buf, nil, nil) if err != nil { return } @@ -9606,7 +9607,7 @@ func (l *Libvirt) DomainSetVcpusFlags(Dom Domain, Nvcpus uint32, Flags uint32) ( } - _, err = l.request(199, constants.Program, buf) + _, err = l.requestStream(199, constants.Program, buf, nil, nil) if err != nil { return } @@ -9629,7 +9630,7 @@ func (l *Libvirt) DomainGetVcpusFlags(Dom Domain, Flags uint32) (rNum int32, err } var r response - r, err = l.request(200, constants.Program, buf) + r, err = l.requestStream(200, constants.Program, buf, nil, nil) if err != nil { return } @@ -9647,7 +9648,7 @@ func (l *Libvirt) DomainGetVcpusFlags(Dom Domain, Flags uint32) (rNum int32, err } // DomainOpenConsole is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_CONSOLE. -func (l *Libvirt) DomainOpenConsole(Dom Domain, DevName OptString, Flags uint32) (err error) { +func (l *Libvirt) DomainOpenConsole(Dom Domain, DevName OptString, inStream io.Writer, Flags uint32) (err error) { var buf []byte args := DomainOpenConsoleArgs { @@ -9662,7 +9663,7 @@ func (l *Libvirt) DomainOpenConsole(Dom Domain, DevName OptString, Flags uint32) } - _, err = l.request(201, constants.Program, buf) + _, err = l.requestStream(201, constants.Program, buf, nil, inStream) if err != nil { return } @@ -9684,7 +9685,7 @@ func (l *Libvirt) DomainIsUpdated(Dom Domain) (rUpdated int32, err error) { } var r response - r, err = l.request(202, constants.Program, buf) + r, err = l.requestStream(202, constants.Program, buf, nil, nil) if err != nil { return } @@ -9715,7 +9716,7 @@ func (l *Libvirt) ConnectGetSysinfo(Flags uint32) (rSysinfo string, err error) { } var r response - r, err = l.request(203, constants.Program, buf) + r, err = l.requestStream(203, constants.Program, buf, nil, nil) if err != nil { return } @@ -9748,7 +9749,7 @@ func (l *Libvirt) DomainSetMemoryFlags(Dom Domain, Memory uint64, Flags uint32) } - _, err = l.request(204, constants.Program, buf) + _, err = l.requestStream(204, constants.Program, buf, nil, nil) if err != nil { return } @@ -9772,7 +9773,7 @@ func (l *Libvirt) DomainSetBlkioParameters(Dom Domain, Params []TypedParam, Flag } - _, err = l.request(205, constants.Program, buf) + _, err = l.requestStream(205, constants.Program, buf, nil, nil) if err != nil { return } @@ -9796,7 +9797,7 @@ func (l *Libvirt) DomainGetBlkioParameters(Dom Domain, Nparams int32, Flags uint } var r response - r, err = l.request(206, constants.Program, buf) + r, err = l.requestStream(206, constants.Program, buf, nil, nil) if err != nil { return } @@ -9835,7 +9836,7 @@ func (l *Libvirt) DomainMigrateSetMaxSpeed(Dom Domain, Bandwidth uint64, Flags u } - _, err = l.request(207, constants.Program, buf) + _, err = l.requestStream(207, constants.Program, buf, nil, nil) if err != nil { return } @@ -9844,7 +9845,7 @@ func (l *Libvirt) DomainMigrateSetMaxSpeed(Dom Domain, Bandwidth uint64, Flags u } // StorageVolUpload is the go wrapper for REMOTE_PROC_STORAGE_VOL_UPLOAD. -func (l *Libvirt) StorageVolUpload(Vol StorageVol, Offset uint64, Length uint64, Flags uint32) (err error) { +func (l *Libvirt) StorageVolUpload(Vol StorageVol, outStream io.Reader, Offset uint64, Length uint64, Flags uint32) (err error) { var buf []byte args := StorageVolUploadArgs { @@ -9860,7 +9861,7 @@ func (l *Libvirt) StorageVolUpload(Vol StorageVol, Offset uint64, Length uint64, } - _, err = l.request(208, constants.Program, buf) + _, err = l.requestStream(208, constants.Program, buf, outStream, nil) if err != nil { return } @@ -9869,7 +9870,7 @@ func (l *Libvirt) StorageVolUpload(Vol StorageVol, Offset uint64, Length uint64, } // StorageVolDownload is the go wrapper for REMOTE_PROC_STORAGE_VOL_DOWNLOAD. -func (l *Libvirt) StorageVolDownload(Vol StorageVol, Offset uint64, Length uint64, Flags uint32) (err error) { +func (l *Libvirt) StorageVolDownload(Vol StorageVol, inStream io.Writer, Offset uint64, Length uint64, Flags uint32) (err error) { var buf []byte args := StorageVolDownloadArgs { @@ -9885,7 +9886,7 @@ func (l *Libvirt) StorageVolDownload(Vol StorageVol, Offset uint64, Length uint6 } - _, err = l.request(209, constants.Program, buf) + _, err = l.requestStream(209, constants.Program, buf, nil, inStream) if err != nil { return } @@ -9908,7 +9909,7 @@ func (l *Libvirt) DomainInjectNmi(Dom Domain, Flags uint32) (err error) { } - _, err = l.request(210, constants.Program, buf) + _, err = l.requestStream(210, constants.Program, buf, nil, nil) if err != nil { return } @@ -9917,7 +9918,7 @@ func (l *Libvirt) DomainInjectNmi(Dom Domain, Flags uint32) (err error) { } // DomainScreenshot is the go wrapper for REMOTE_PROC_DOMAIN_SCREENSHOT. -func (l *Libvirt) DomainScreenshot(Dom Domain, Screen uint32, Flags uint32) (rMime OptString, err error) { +func (l *Libvirt) DomainScreenshot(Dom Domain, inStream io.Writer, Screen uint32, Flags uint32) (rMime OptString, err error) { var buf []byte args := DomainScreenshotArgs { @@ -9932,7 +9933,7 @@ func (l *Libvirt) DomainScreenshot(Dom Domain, Screen uint32, Flags uint32) (rMi } var r response - r, err = l.request(211, constants.Program, buf) + r, err = l.requestStream(211, constants.Program, buf, nil, inStream) if err != nil { return } @@ -9964,7 +9965,7 @@ func (l *Libvirt) DomainGetState(Dom Domain, Flags uint32) (rState int32, rReaso } var r response - r, err = l.request(212, constants.Program, buf) + r, err = l.requestStream(212, constants.Program, buf, nil, nil) if err != nil { return } @@ -10004,7 +10005,7 @@ func (l *Libvirt) DomainMigrateBegin3(Dom Domain, Xmlin OptString, Flags uint64, } var r response - r, err = l.request(213, constants.Program, buf) + r, err = l.requestStream(213, constants.Program, buf, nil, nil) if err != nil { return } @@ -10045,7 +10046,7 @@ func (l *Libvirt) DomainMigratePrepare3(CookieIn []byte, UriIn OptString, Flags } var r response - r, err = l.request(214, constants.Program, buf) + r, err = l.requestStream(214, constants.Program, buf, nil, nil) if err != nil { return } @@ -10068,7 +10069,7 @@ func (l *Libvirt) DomainMigratePrepare3(CookieIn []byte, UriIn OptString, Flags } // DomainMigratePrepareTunnel3 is the go wrapper for REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3. -func (l *Libvirt) DomainMigratePrepareTunnel3(CookieIn []byte, Flags uint64, Dname OptString, Resource uint64, DomXML string) (rCookieOut []byte, err error) { +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 { @@ -10085,7 +10086,7 @@ func (l *Libvirt) DomainMigratePrepareTunnel3(CookieIn []byte, Flags uint64, Dna } var r response - r, err = l.request(215, constants.Program, buf) + r, err = l.requestStream(215, constants.Program, buf, outStream, nil) if err != nil { return } @@ -10123,7 +10124,7 @@ func (l *Libvirt) DomainMigratePerform3(Dom Domain, Xmlin OptString, CookieIn [] } var r response - r, err = l.request(216, constants.Program, buf) + r, err = l.requestStream(216, constants.Program, buf, nil, nil) if err != nil { return } @@ -10159,7 +10160,7 @@ func (l *Libvirt) DomainMigrateFinish3(Dname string, CookieIn []byte, Dconnuri O } var r response - r, err = l.request(217, constants.Program, buf) + r, err = l.requestStream(217, constants.Program, buf, nil, nil) if err != nil { return } @@ -10198,7 +10199,7 @@ func (l *Libvirt) DomainMigrateConfirm3(Dom Domain, CookieIn []byte, Flags uint6 } - _, err = l.request(218, constants.Program, buf) + _, err = l.requestStream(218, constants.Program, buf, nil, nil) if err != nil { return } @@ -10222,7 +10223,7 @@ func (l *Libvirt) DomainSetSchedulerParametersFlags(Dom Domain, Params []TypedPa } - _, err = l.request(219, constants.Program, buf) + _, err = l.requestStream(219, constants.Program, buf, nil, nil) if err != nil { return } @@ -10244,7 +10245,7 @@ func (l *Libvirt) InterfaceChangeBegin(Flags uint32) (err error) { } - _, err = l.request(220, constants.Program, buf) + _, err = l.requestStream(220, constants.Program, buf, nil, nil) if err != nil { return } @@ -10266,7 +10267,7 @@ func (l *Libvirt) InterfaceChangeCommit(Flags uint32) (err error) { } - _, err = l.request(221, constants.Program, buf) + _, err = l.requestStream(221, constants.Program, buf, nil, nil) if err != nil { return } @@ -10288,7 +10289,7 @@ func (l *Libvirt) InterfaceChangeRollback(Flags uint32) (err error) { } - _, err = l.request(222, constants.Program, buf) + _, err = l.requestStream(222, constants.Program, buf, nil, nil) if err != nil { return } @@ -10312,7 +10313,7 @@ func (l *Libvirt) DomainGetSchedulerParametersFlags(Dom Domain, Nparams int32, F } var r response - r, err = l.request(223, constants.Program, buf) + r, err = l.requestStream(223, constants.Program, buf, nil, nil) if err != nil { return } @@ -10335,7 +10336,7 @@ func (l *Libvirt) DomainEventControlError() (err error) { var buf []byte - _, err = l.request(224, constants.Program, buf) + _, err = l.requestStream(224, constants.Program, buf, nil, nil) if err != nil { return } @@ -10360,7 +10361,7 @@ func (l *Libvirt) DomainPinVcpuFlags(Dom Domain, Vcpu uint32, Cpumap []byte, Fla } - _, err = l.request(225, constants.Program, buf) + _, err = l.requestStream(225, constants.Program, buf, nil, nil) if err != nil { return } @@ -10386,7 +10387,7 @@ func (l *Libvirt) DomainSendKey(Dom Domain, Codeset uint32, Holdtime uint32, Key } - _, err = l.request(226, constants.Program, buf) + _, err = l.requestStream(226, constants.Program, buf, nil, nil) if err != nil { return } @@ -10410,7 +10411,7 @@ func (l *Libvirt) NodeGetCPUStats(CPUNum int32, Nparams int32, Flags uint32) (rP } var r response - r, err = l.request(227, constants.Program, buf) + r, err = l.requestStream(227, constants.Program, buf, nil, nil) if err != nil { return } @@ -10448,7 +10449,7 @@ func (l *Libvirt) NodeGetMemoryStats(Nparams int32, CellNum int32, Flags uint32) } var r response - r, err = l.request(228, constants.Program, buf) + r, err = l.requestStream(228, constants.Program, buf, nil, nil) if err != nil { return } @@ -10485,7 +10486,7 @@ func (l *Libvirt) DomainGetControlInfo(Dom Domain, Flags uint32) (rState uint32, } var r response - r, err = l.request(229, constants.Program, buf) + r, err = l.requestStream(229, constants.Program, buf, nil, nil) if err != nil { return } @@ -10529,7 +10530,7 @@ func (l *Libvirt) DomainGetVcpuPinInfo(Dom Domain, Ncpumaps int32, Maplen int32, } var r response - r, err = l.request(230, constants.Program, buf) + r, err = l.requestStream(230, constants.Program, buf, nil, nil) if err != nil { return } @@ -10566,7 +10567,7 @@ func (l *Libvirt) DomainUndefineFlags(Dom Domain, Flags DomainUndefineFlagsValue } - _, err = l.request(231, constants.Program, buf) + _, err = l.requestStream(231, constants.Program, buf, nil, nil) if err != nil { return } @@ -10591,7 +10592,7 @@ func (l *Libvirt) DomainSaveFlags(Dom Domain, To string, Dxml OptString, Flags u } - _, err = l.request(232, constants.Program, buf) + _, err = l.requestStream(232, constants.Program, buf, nil, nil) if err != nil { return } @@ -10615,7 +10616,7 @@ func (l *Libvirt) DomainRestoreFlags(From string, Dxml OptString, Flags uint32) } - _, err = l.request(233, constants.Program, buf) + _, err = l.requestStream(233, constants.Program, buf, nil, nil) if err != nil { return } @@ -10638,7 +10639,7 @@ func (l *Libvirt) DomainDestroyFlags(Dom Domain, Flags DomainDestroyFlagsValues) } - _, err = l.request(234, constants.Program, buf) + _, err = l.requestStream(234, constants.Program, buf, nil, nil) if err != nil { return } @@ -10661,7 +10662,7 @@ func (l *Libvirt) DomainSaveImageGetXMLDesc(File string, Flags uint32) (rXML str } var r response - r, err = l.request(235, constants.Program, buf) + r, err = l.requestStream(235, constants.Program, buf, nil, nil) if err != nil { return } @@ -10694,7 +10695,7 @@ func (l *Libvirt) DomainSaveImageDefineXML(File string, Dxml string, Flags uint3 } - _, err = l.request(236, constants.Program, buf) + _, err = l.requestStream(236, constants.Program, buf, nil, nil) if err != nil { return } @@ -10718,7 +10719,7 @@ func (l *Libvirt) DomainBlockJobAbort(Dom Domain, Path string, Flags DomainBlock } - _, err = l.request(237, constants.Program, buf) + _, err = l.requestStream(237, constants.Program, buf, nil, nil) if err != nil { return } @@ -10742,7 +10743,7 @@ func (l *Libvirt) DomainGetBlockJobInfo(Dom Domain, Path string, Flags uint32) ( } var r response - r, err = l.request(238, constants.Program, buf) + r, err = l.requestStream(238, constants.Program, buf, nil, nil) if err != nil { return } @@ -10796,7 +10797,7 @@ func (l *Libvirt) DomainBlockJobSetSpeed(Dom Domain, Path string, Bandwidth uint } - _, err = l.request(239, constants.Program, buf) + _, err = l.requestStream(239, constants.Program, buf, nil, nil) if err != nil { return } @@ -10821,7 +10822,7 @@ func (l *Libvirt) DomainBlockPull(Dom Domain, Path string, Bandwidth uint64, Fla } - _, err = l.request(240, constants.Program, buf) + _, err = l.requestStream(240, constants.Program, buf, nil, nil) if err != nil { return } @@ -10834,7 +10835,7 @@ func (l *Libvirt) DomainEventBlockJob() (err error) { var buf []byte - _, err = l.request(241, constants.Program, buf) + _, err = l.requestStream(241, constants.Program, buf, nil, nil) if err != nil { return } @@ -10857,7 +10858,7 @@ func (l *Libvirt) DomainMigrateGetMaxSpeed(Dom Domain, Flags uint32) (rBandwidth } var r response - r, err = l.request(242, constants.Program, buf) + r, err = l.requestStream(242, constants.Program, buf, nil, nil) if err != nil { return } @@ -10891,7 +10892,7 @@ func (l *Libvirt) DomainBlockStatsFlags(Dom Domain, Path string, Nparams int32, } var r response - r, err = l.request(243, constants.Program, buf) + r, err = l.requestStream(243, constants.Program, buf, nil, nil) if err != nil { return } @@ -10929,7 +10930,7 @@ func (l *Libvirt) DomainSnapshotGetParent(Snap DomainSnapshot, Flags uint32) (rS } var r response - r, err = l.request(244, constants.Program, buf) + r, err = l.requestStream(244, constants.Program, buf, nil, nil) if err != nil { return } @@ -10961,7 +10962,7 @@ func (l *Libvirt) DomainReset(Dom Domain, Flags uint32) (err error) { } - _, err = l.request(245, constants.Program, buf) + _, err = l.requestStream(245, constants.Program, buf, nil, nil) if err != nil { return } @@ -10984,7 +10985,7 @@ func (l *Libvirt) DomainSnapshotNumChildren(Snap DomainSnapshot, Flags uint32) ( } var r response - r, err = l.request(246, constants.Program, buf) + r, err = l.requestStream(246, constants.Program, buf, nil, nil) if err != nil { return } @@ -11017,7 +11018,7 @@ func (l *Libvirt) DomainSnapshotListChildrenNames(Snap DomainSnapshot, Maxnames } var r response - r, err = l.request(247, constants.Program, buf) + r, err = l.requestStream(247, constants.Program, buf, nil, nil) if err != nil { return } @@ -11039,7 +11040,7 @@ func (l *Libvirt) DomainEventDiskChange() (err error) { var buf []byte - _, err = l.request(248, constants.Program, buf) + _, err = l.requestStream(248, constants.Program, buf, nil, nil) if err != nil { return } @@ -11063,7 +11064,7 @@ func (l *Libvirt) DomainOpenGraphics(Dom Domain, Idx uint32, Flags DomainOpenGra } - _, err = l.request(249, constants.Program, buf) + _, err = l.requestStream(249, constants.Program, buf, nil, nil) if err != nil { return } @@ -11087,7 +11088,7 @@ func (l *Libvirt) NodeSuspendForDuration(Target uint32, Duration uint64, Flags u } - _, err = l.request(250, constants.Program, buf) + _, err = l.requestStream(250, constants.Program, buf, nil, nil) if err != nil { return } @@ -11112,7 +11113,7 @@ func (l *Libvirt) DomainBlockResize(Dom Domain, Disk string, Size uint64, Flags } - _, err = l.request(251, constants.Program, buf) + _, err = l.requestStream(251, constants.Program, buf, nil, nil) if err != nil { return } @@ -11137,7 +11138,7 @@ func (l *Libvirt) DomainSetBlockIOTune(Dom Domain, Disk string, Params []TypedPa } - _, err = l.request(252, constants.Program, buf) + _, err = l.requestStream(252, constants.Program, buf, nil, nil) if err != nil { return } @@ -11162,7 +11163,7 @@ func (l *Libvirt) DomainGetBlockIOTune(Dom Domain, Disk OptString, Nparams int32 } var r response - r, err = l.request(253, constants.Program, buf) + r, err = l.requestStream(253, constants.Program, buf, nil, nil) if err != nil { return } @@ -11201,7 +11202,7 @@ func (l *Libvirt) DomainSetNumaParameters(Dom Domain, Params []TypedParam, Flags } - _, err = l.request(254, constants.Program, buf) + _, err = l.requestStream(254, constants.Program, buf, nil, nil) if err != nil { return } @@ -11225,7 +11226,7 @@ func (l *Libvirt) DomainGetNumaParameters(Dom Domain, Nparams int32, Flags uint3 } var r response - r, err = l.request(255, constants.Program, buf) + r, err = l.requestStream(255, constants.Program, buf, nil, nil) if err != nil { return } @@ -11265,7 +11266,7 @@ func (l *Libvirt) DomainSetInterfaceParameters(Dom Domain, Device string, Params } - _, err = l.request(256, constants.Program, buf) + _, err = l.requestStream(256, constants.Program, buf, nil, nil) if err != nil { return } @@ -11290,7 +11291,7 @@ func (l *Libvirt) DomainGetInterfaceParameters(Dom Domain, Device string, Nparam } var r response - r, err = l.request(257, constants.Program, buf) + r, err = l.requestStream(257, constants.Program, buf, nil, nil) if err != nil { return } @@ -11328,7 +11329,7 @@ func (l *Libvirt) DomainShutdownFlags(Dom Domain, Flags DomainShutdownFlagValues } - _, err = l.request(258, constants.Program, buf) + _, err = l.requestStream(258, constants.Program, buf, nil, nil) if err != nil { return } @@ -11352,7 +11353,7 @@ func (l *Libvirt) StorageVolWipePattern(Vol StorageVol, Algorithm uint32, Flags } - _, err = l.request(259, constants.Program, buf) + _, err = l.requestStream(259, constants.Program, buf, nil, nil) if err != nil { return } @@ -11376,7 +11377,7 @@ func (l *Libvirt) StorageVolResize(Vol StorageVol, Capacity uint64, Flags Storag } - _, err = l.request(260, constants.Program, buf) + _, err = l.requestStream(260, constants.Program, buf, nil, nil) if err != nil { return } @@ -11401,7 +11402,7 @@ func (l *Libvirt) DomainPmSuspendForDuration(Dom Domain, Target uint32, Duration } - _, err = l.request(261, constants.Program, buf) + _, err = l.requestStream(261, constants.Program, buf, nil, nil) if err != nil { return } @@ -11427,7 +11428,7 @@ func (l *Libvirt) DomainGetCPUStats(Dom Domain, Nparams uint32, StartCPU int32, } var r response - r, err = l.request(262, constants.Program, buf) + r, err = l.requestStream(262, constants.Program, buf, nil, nil) if err != nil { return } @@ -11466,7 +11467,7 @@ func (l *Libvirt) DomainGetDiskErrors(Dom Domain, Maxerrors uint32, Flags uint32 } var r response - r, err = l.request(263, constants.Program, buf) + r, err = l.requestStream(263, constants.Program, buf, nil, nil) if err != nil { return } @@ -11507,7 +11508,7 @@ func (l *Libvirt) DomainSetMetadata(Dom Domain, Type int32, Metadata OptString, } - _, err = l.request(264, constants.Program, buf) + _, err = l.requestStream(264, constants.Program, buf, nil, nil) if err != nil { return } @@ -11532,7 +11533,7 @@ func (l *Libvirt) DomainGetMetadata(Dom Domain, Type int32, Uri OptString, Flags } var r response - r, err = l.request(265, constants.Program, buf) + r, err = l.requestStream(265, constants.Program, buf, nil, nil) if err != nil { return } @@ -11567,7 +11568,7 @@ func (l *Libvirt) DomainBlockRebase(Dom Domain, Path string, Base OptString, Ban } - _, err = l.request(266, constants.Program, buf) + _, err = l.requestStream(266, constants.Program, buf, nil, nil) if err != nil { return } @@ -11590,7 +11591,7 @@ func (l *Libvirt) DomainPmWakeup(Dom Domain, Flags uint32) (err error) { } - _, err = l.request(267, constants.Program, buf) + _, err = l.requestStream(267, constants.Program, buf, nil, nil) if err != nil { return } @@ -11603,7 +11604,7 @@ func (l *Libvirt) DomainEventTrayChange() (err error) { var buf []byte - _, err = l.request(268, constants.Program, buf) + _, err = l.requestStream(268, constants.Program, buf, nil, nil) if err != nil { return } @@ -11616,7 +11617,7 @@ func (l *Libvirt) DomainEventPmwakeup() (err error) { var buf []byte - _, err = l.request(269, constants.Program, buf) + _, err = l.requestStream(269, constants.Program, buf, nil, nil) if err != nil { return } @@ -11629,7 +11630,7 @@ func (l *Libvirt) DomainEventPmsuspend() (err error) { var buf []byte - _, err = l.request(270, constants.Program, buf) + _, err = l.requestStream(270, constants.Program, buf, nil, nil) if err != nil { return } @@ -11652,7 +11653,7 @@ func (l *Libvirt) DomainSnapshotIsCurrent(Snap DomainSnapshot, Flags uint32) (rC } var r response - r, err = l.request(271, constants.Program, buf) + r, err = l.requestStream(271, constants.Program, buf, nil, nil) if err != nil { return } @@ -11684,7 +11685,7 @@ func (l *Libvirt) DomainSnapshotHasMetadata(Snap DomainSnapshot, Flags uint32) ( } var r response - r, err = l.request(272, constants.Program, buf) + r, err = l.requestStream(272, constants.Program, buf, nil, nil) if err != nil { return } @@ -11716,7 +11717,7 @@ func (l *Libvirt) ConnectListAllDomains(NeedResults int32, Flags ConnectListAllD } var r response - r, err = l.request(273, constants.Program, buf) + r, err = l.requestStream(273, constants.Program, buf, nil, nil) if err != nil { return } @@ -11754,7 +11755,7 @@ func (l *Libvirt) DomainListAllSnapshots(Dom Domain, NeedResults int32, Flags ui } var r response - r, err = l.request(274, constants.Program, buf) + r, err = l.requestStream(274, constants.Program, buf, nil, nil) if err != nil { return } @@ -11792,7 +11793,7 @@ func (l *Libvirt) DomainSnapshotListAllChildren(Snapshot DomainSnapshot, NeedRes } var r response - r, err = l.request(275, constants.Program, buf) + r, err = l.requestStream(275, constants.Program, buf, nil, nil) if err != nil { return } @@ -11819,7 +11820,7 @@ func (l *Libvirt) DomainEventBalloonChange() (err error) { var buf []byte - _, err = l.request(276, constants.Program, buf) + _, err = l.requestStream(276, constants.Program, buf, nil, nil) if err != nil { return } @@ -11842,7 +11843,7 @@ func (l *Libvirt) DomainGetHostname(Dom Domain, Flags uint32) (rHostname string, } var r response - r, err = l.request(277, constants.Program, buf) + r, err = l.requestStream(277, constants.Program, buf, nil, nil) if err != nil { return } @@ -11873,7 +11874,7 @@ func (l *Libvirt) DomainGetSecurityLabelList(Dom Domain) (rLabels []DomainGetSec } var r response - r, err = l.request(278, constants.Program, buf) + r, err = l.requestStream(278, constants.Program, buf, nil, nil) if err != nil { return } @@ -11911,7 +11912,7 @@ func (l *Libvirt) DomainPinEmulator(Dom Domain, Cpumap []byte, Flags DomainModif } - _, err = l.request(279, constants.Program, buf) + _, err = l.requestStream(279, constants.Program, buf, nil, nil) if err != nil { return } @@ -11935,7 +11936,7 @@ func (l *Libvirt) DomainGetEmulatorPinInfo(Dom Domain, Maplen int32, Flags Domai } var r response - r, err = l.request(280, constants.Program, buf) + r, err = l.requestStream(280, constants.Program, buf, nil, nil) if err != nil { return } @@ -11972,7 +11973,7 @@ func (l *Libvirt) ConnectListAllStoragePools(NeedResults int32, Flags ConnectLis } var r response - r, err = l.request(281, constants.Program, buf) + r, err = l.requestStream(281, constants.Program, buf, nil, nil) if err != nil { return } @@ -12010,7 +12011,7 @@ func (l *Libvirt) StoragePoolListAllVolumes(Pool StoragePool, NeedResults int32, } var r response - r, err = l.request(282, constants.Program, buf) + r, err = l.requestStream(282, constants.Program, buf, nil, nil) if err != nil { return } @@ -12047,7 +12048,7 @@ func (l *Libvirt) ConnectListAllNetworks(NeedResults int32, Flags ConnectListAll } var r response - r, err = l.request(283, constants.Program, buf) + r, err = l.requestStream(283, constants.Program, buf, nil, nil) if err != nil { return } @@ -12084,7 +12085,7 @@ func (l *Libvirt) ConnectListAllInterfaces(NeedResults int32, Flags ConnectListA } var r response - r, err = l.request(284, constants.Program, buf) + r, err = l.requestStream(284, constants.Program, buf, nil, nil) if err != nil { return } @@ -12121,7 +12122,7 @@ func (l *Libvirt) ConnectListAllNodeDevices(NeedResults int32, Flags uint32) (rD } var r response - r, err = l.request(285, constants.Program, buf) + r, err = l.requestStream(285, constants.Program, buf, nil, nil) if err != nil { return } @@ -12158,7 +12159,7 @@ func (l *Libvirt) ConnectListAllNwfilters(NeedResults int32, Flags uint32) (rFil } var r response - r, err = l.request(286, constants.Program, buf) + r, err = l.requestStream(286, constants.Program, buf, nil, nil) if err != nil { return } @@ -12195,7 +12196,7 @@ func (l *Libvirt) ConnectListAllSecrets(NeedResults int32, Flags ConnectListAllS } var r response - r, err = l.request(287, constants.Program, buf) + r, err = l.requestStream(287, constants.Program, buf, nil, nil) if err != nil { return } @@ -12232,7 +12233,7 @@ func (l *Libvirt) NodeSetMemoryParameters(Params []TypedParam, Flags uint32) (er } - _, err = l.request(288, constants.Program, buf) + _, err = l.requestStream(288, constants.Program, buf, nil, nil) if err != nil { return } @@ -12255,7 +12256,7 @@ func (l *Libvirt) NodeGetMemoryParameters(Nparams int32, Flags uint32) (rParams } var r response - r, err = l.request(289, constants.Program, buf) + r, err = l.requestStream(289, constants.Program, buf, nil, nil) if err != nil { return } @@ -12297,7 +12298,7 @@ func (l *Libvirt) DomainBlockCommit(Dom Domain, Disk string, Base OptString, Top } - _, err = l.request(290, constants.Program, buf) + _, err = l.requestStream(290, constants.Program, buf, nil, nil) if err != nil { return } @@ -12324,7 +12325,7 @@ func (l *Libvirt) NetworkUpdate(Net Network, Command uint32, Section uint32, Par } - _, err = l.request(291, constants.Program, buf) + _, err = l.requestStream(291, constants.Program, buf, nil, nil) if err != nil { return } @@ -12337,7 +12338,7 @@ func (l *Libvirt) DomainEventPmsuspendDisk() (err error) { var buf []byte - _, err = l.request(292, constants.Program, buf) + _, err = l.requestStream(292, constants.Program, buf, nil, nil) if err != nil { return } @@ -12361,7 +12362,7 @@ func (l *Libvirt) NodeGetCPUMap(NeedMap int32, NeedOnline int32, Flags uint32) ( } var r response - r, err = l.request(293, constants.Program, buf) + r, err = l.requestStream(293, constants.Program, buf, nil, nil) if err != nil { return } @@ -12405,7 +12406,7 @@ func (l *Libvirt) DomainFstrim(Dom Domain, MountPoint OptString, Minimum uint64, } - _, err = l.request(294, constants.Program, buf) + _, err = l.requestStream(294, constants.Program, buf, nil, nil) if err != nil { return } @@ -12430,7 +12431,7 @@ func (l *Libvirt) DomainSendProcessSignal(Dom Domain, PidValue int64, Signum uin } - _, err = l.request(295, constants.Program, buf) + _, err = l.requestStream(295, constants.Program, buf, nil, nil) if err != nil { return } @@ -12439,7 +12440,7 @@ func (l *Libvirt) DomainSendProcessSignal(Dom Domain, PidValue int64, Signum uin } // DomainOpenChannel is the go wrapper for REMOTE_PROC_DOMAIN_OPEN_CHANNEL. -func (l *Libvirt) DomainOpenChannel(Dom Domain, Name OptString, Flags DomainChannelFlags) (err error) { +func (l *Libvirt) DomainOpenChannel(Dom Domain, Name OptString, inStream io.Writer, Flags DomainChannelFlags) (err error) { var buf []byte args := DomainOpenChannelArgs { @@ -12454,7 +12455,7 @@ func (l *Libvirt) DomainOpenChannel(Dom Domain, Name OptString, Flags DomainChan } - _, err = l.request(296, constants.Program, buf) + _, err = l.requestStream(296, constants.Program, buf, nil, inStream) if err != nil { return } @@ -12478,7 +12479,7 @@ func (l *Libvirt) NodeDeviceLookupScsiHostByWwn(Wwnn string, Wwpn string, Flags } var r response - r, err = l.request(297, constants.Program, buf) + r, err = l.requestStream(297, constants.Program, buf, nil, nil) if err != nil { return } @@ -12510,7 +12511,7 @@ func (l *Libvirt) DomainGetJobStats(Dom Domain, Flags DomainGetJobStatsFlags) (r } var r response - r, err = l.request(298, constants.Program, buf) + r, err = l.requestStream(298, constants.Program, buf, nil, nil) if err != nil { return } @@ -12548,7 +12549,7 @@ func (l *Libvirt) DomainMigrateGetCompressionCache(Dom Domain, Flags uint32) (rC } var r response - r, err = l.request(299, constants.Program, buf) + r, err = l.requestStream(299, constants.Program, buf, nil, nil) if err != nil { return } @@ -12581,7 +12582,7 @@ func (l *Libvirt) DomainMigrateSetCompressionCache(Dom Domain, CacheSize uint64, } - _, err = l.request(300, constants.Program, buf) + _, err = l.requestStream(300, constants.Program, buf, nil, nil) if err != nil { return } @@ -12605,7 +12606,7 @@ func (l *Libvirt) NodeDeviceDetachFlags(Name string, DriverName OptString, Flags } - _, err = l.request(301, constants.Program, buf) + _, err = l.requestStream(301, constants.Program, buf, nil, nil) if err != nil { return } @@ -12629,7 +12630,7 @@ func (l *Libvirt) DomainMigrateBegin3Params(Dom Domain, Params []TypedParam, Fla } var r response - r, err = l.request(302, constants.Program, buf) + r, err = l.requestStream(302, constants.Program, buf, nil, nil) if err != nil { return } @@ -12667,7 +12668,7 @@ func (l *Libvirt) DomainMigratePrepare3Params(Params []TypedParam, CookieIn []by } var r response - r, err = l.request(303, constants.Program, buf) + r, err = l.requestStream(303, constants.Program, buf, nil, nil) if err != nil { return } @@ -12705,7 +12706,7 @@ func (l *Libvirt) DomainMigratePrepareTunnel3Params(Params []TypedParam, CookieI } var r response - r, err = l.request(304, constants.Program, buf) + r, err = l.requestStream(304, constants.Program, buf, nil, nil) if err != nil { return } @@ -12740,7 +12741,7 @@ func (l *Libvirt) DomainMigratePerform3Params(Dom Domain, Dconnuri OptString, Pa } var r response - r, err = l.request(305, constants.Program, buf) + r, err = l.requestStream(305, constants.Program, buf, nil, nil) if err != nil { return } @@ -12774,7 +12775,7 @@ func (l *Libvirt) DomainMigrateFinish3Params(Params []TypedParam, CookieIn []byt } var r response - r, err = l.request(306, constants.Program, buf) + r, err = l.requestStream(306, constants.Program, buf, nil, nil) if err != nil { return } @@ -12814,7 +12815,7 @@ func (l *Libvirt) DomainMigrateConfirm3Params(Dom Domain, Params []TypedParam, C } - _, err = l.request(307, constants.Program, buf) + _, err = l.requestStream(307, constants.Program, buf, nil, nil) if err != nil { return } @@ -12838,7 +12839,7 @@ func (l *Libvirt) DomainSetMemoryStatsPeriod(Dom Domain, Period int32, Flags Dom } - _, err = l.request(308, constants.Program, buf) + _, err = l.requestStream(308, constants.Program, buf, nil, nil) if err != nil { return } @@ -12861,7 +12862,7 @@ func (l *Libvirt) DomainCreateXMLWithFiles(XMLDesc string, Flags DomainCreateFla } var r response - r, err = l.request(309, constants.Program, buf) + r, err = l.requestStream(309, constants.Program, buf, nil, nil) if err != nil { return } @@ -12893,7 +12894,7 @@ func (l *Libvirt) DomainCreateWithFiles(Dom Domain, Flags DomainCreateFlags) (rD } var r response - r, err = l.request(310, constants.Program, buf) + r, err = l.requestStream(310, constants.Program, buf, nil, nil) if err != nil { return } @@ -12915,7 +12916,7 @@ func (l *Libvirt) DomainEventDeviceRemoved() (err error) { var buf []byte - _, err = l.request(311, constants.Program, buf) + _, err = l.requestStream(311, constants.Program, buf, nil, nil) if err != nil { return } @@ -12939,7 +12940,7 @@ func (l *Libvirt) ConnectGetCPUModelNames(Arch string, NeedResults int32, Flags } var r response - r, err = l.request(312, constants.Program, buf) + r, err = l.requestStream(312, constants.Program, buf, nil, nil) if err != nil { return } @@ -12976,7 +12977,7 @@ func (l *Libvirt) ConnectNetworkEventRegisterAny(EventID int32, Net OptNetwork) } var r response - r, err = l.request(313, constants.Program, buf) + r, err = l.requestStream(313, constants.Program, buf, nil, nil) if err != nil { return } @@ -13007,7 +13008,7 @@ func (l *Libvirt) ConnectNetworkEventDeregisterAny(CallbackID int32) (err error) } - _, err = l.request(314, constants.Program, buf) + _, err = l.requestStream(314, constants.Program, buf, nil, nil) if err != nil { return } @@ -13020,7 +13021,7 @@ func (l *Libvirt) NetworkEventLifecycle() (err error) { var buf []byte - _, err = l.request(315, constants.Program, buf) + _, err = l.requestStream(315, constants.Program, buf, nil, nil) if err != nil { return } @@ -13043,7 +13044,7 @@ func (l *Libvirt) ConnectDomainEventCallbackRegisterAny(EventID int32, Dom OptDo } var r response - r, err = l.request(316, constants.Program, buf) + r, err = l.requestStream(316, constants.Program, buf, nil, nil) if err != nil { return } @@ -13074,7 +13075,7 @@ func (l *Libvirt) ConnectDomainEventCallbackDeregisterAny(CallbackID int32) (err } - _, err = l.request(317, constants.Program, buf) + _, err = l.requestStream(317, constants.Program, buf, nil, nil) if err != nil { return } @@ -13087,7 +13088,7 @@ func (l *Libvirt) DomainEventCallbackLifecycle() (err error) { var buf []byte - _, err = l.request(318, constants.Program, buf) + _, err = l.requestStream(318, constants.Program, buf, nil, nil) if err != nil { return } @@ -13100,7 +13101,7 @@ func (l *Libvirt) DomainEventCallbackReboot() (err error) { var buf []byte - _, err = l.request(319, constants.Program, buf) + _, err = l.requestStream(319, constants.Program, buf, nil, nil) if err != nil { return } @@ -13113,7 +13114,7 @@ func (l *Libvirt) DomainEventCallbackRtcChange() (err error) { var buf []byte - _, err = l.request(320, constants.Program, buf) + _, err = l.requestStream(320, constants.Program, buf, nil, nil) if err != nil { return } @@ -13126,7 +13127,7 @@ func (l *Libvirt) DomainEventCallbackWatchdog() (err error) { var buf []byte - _, err = l.request(321, constants.Program, buf) + _, err = l.requestStream(321, constants.Program, buf, nil, nil) if err != nil { return } @@ -13139,7 +13140,7 @@ func (l *Libvirt) DomainEventCallbackIOError() (err error) { var buf []byte - _, err = l.request(322, constants.Program, buf) + _, err = l.requestStream(322, constants.Program, buf, nil, nil) if err != nil { return } @@ -13152,7 +13153,7 @@ func (l *Libvirt) DomainEventCallbackGraphics() (err error) { var buf []byte - _, err = l.request(323, constants.Program, buf) + _, err = l.requestStream(323, constants.Program, buf, nil, nil) if err != nil { return } @@ -13165,7 +13166,7 @@ func (l *Libvirt) DomainEventCallbackIOErrorReason() (err error) { var buf []byte - _, err = l.request(324, constants.Program, buf) + _, err = l.requestStream(324, constants.Program, buf, nil, nil) if err != nil { return } @@ -13178,7 +13179,7 @@ func (l *Libvirt) DomainEventCallbackControlError() (err error) { var buf []byte - _, err = l.request(325, constants.Program, buf) + _, err = l.requestStream(325, constants.Program, buf, nil, nil) if err != nil { return } @@ -13191,7 +13192,7 @@ func (l *Libvirt) DomainEventCallbackBlockJob() (err error) { var buf []byte - _, err = l.request(326, constants.Program, buf) + _, err = l.requestStream(326, constants.Program, buf, nil, nil) if err != nil { return } @@ -13204,7 +13205,7 @@ func (l *Libvirt) DomainEventCallbackDiskChange() (err error) { var buf []byte - _, err = l.request(327, constants.Program, buf) + _, err = l.requestStream(327, constants.Program, buf, nil, nil) if err != nil { return } @@ -13217,7 +13218,7 @@ func (l *Libvirt) DomainEventCallbackTrayChange() (err error) { var buf []byte - _, err = l.request(328, constants.Program, buf) + _, err = l.requestStream(328, constants.Program, buf, nil, nil) if err != nil { return } @@ -13230,7 +13231,7 @@ func (l *Libvirt) DomainEventCallbackPmwakeup() (err error) { var buf []byte - _, err = l.request(329, constants.Program, buf) + _, err = l.requestStream(329, constants.Program, buf, nil, nil) if err != nil { return } @@ -13243,7 +13244,7 @@ func (l *Libvirt) DomainEventCallbackPmsuspend() (err error) { var buf []byte - _, err = l.request(330, constants.Program, buf) + _, err = l.requestStream(330, constants.Program, buf, nil, nil) if err != nil { return } @@ -13256,7 +13257,7 @@ func (l *Libvirt) DomainEventCallbackBalloonChange() (err error) { var buf []byte - _, err = l.request(331, constants.Program, buf) + _, err = l.requestStream(331, constants.Program, buf, nil, nil) if err != nil { return } @@ -13269,7 +13270,7 @@ func (l *Libvirt) DomainEventCallbackPmsuspendDisk() (err error) { var buf []byte - _, err = l.request(332, constants.Program, buf) + _, err = l.requestStream(332, constants.Program, buf, nil, nil) if err != nil { return } @@ -13282,7 +13283,7 @@ func (l *Libvirt) DomainEventCallbackDeviceRemoved() (err error) { var buf []byte - _, err = l.request(333, constants.Program, buf) + _, err = l.requestStream(333, constants.Program, buf, nil, nil) if err != nil { return } @@ -13307,7 +13308,7 @@ func (l *Libvirt) DomainCoreDumpWithFormat(Dom Domain, To string, Dumpformat uin } - _, err = l.request(334, constants.Program, buf) + _, err = l.requestStream(334, constants.Program, buf, nil, nil) if err != nil { return } @@ -13331,7 +13332,7 @@ func (l *Libvirt) DomainFsfreeze(Dom Domain, Mountpoints []string, Flags uint32) } var r response - r, err = l.request(335, constants.Program, buf) + r, err = l.requestStream(335, constants.Program, buf, nil, nil) if err != nil { return } @@ -13364,7 +13365,7 @@ func (l *Libvirt) DomainFsthaw(Dom Domain, Mountpoints []string, Flags uint32) ( } var r response - r, err = l.request(336, constants.Program, buf) + r, err = l.requestStream(336, constants.Program, buf, nil, nil) if err != nil { return } @@ -13396,7 +13397,7 @@ func (l *Libvirt) DomainGetTime(Dom Domain, Flags uint32) (rSeconds int64, rNsec } var r response - r, err = l.request(337, constants.Program, buf) + r, err = l.requestStream(337, constants.Program, buf, nil, nil) if err != nil { return } @@ -13435,7 +13436,7 @@ func (l *Libvirt) DomainSetTime(Dom Domain, Seconds int64, Nseconds uint32, Flag } - _, err = l.request(338, constants.Program, buf) + _, err = l.requestStream(338, constants.Program, buf, nil, nil) if err != nil { return } @@ -13448,7 +13449,7 @@ func (l *Libvirt) DomainEventBlockJob2() (err error) { var buf []byte - _, err = l.request(339, constants.Program, buf) + _, err = l.requestStream(339, constants.Program, buf, nil, nil) if err != nil { return } @@ -13473,7 +13474,7 @@ func (l *Libvirt) NodeGetFreePages(Pages []uint32, StartCell int32, CellCount ui } var r response - r, err = l.request(340, constants.Program, buf) + r, err = l.requestStream(340, constants.Program, buf, nil, nil) if err != nil { return } @@ -13507,7 +13508,7 @@ func (l *Libvirt) NetworkGetDhcpLeases(Net Network, Mac OptString, NeedResults i } var r response - r, err = l.request(341, constants.Program, buf) + r, err = l.requestStream(341, constants.Program, buf, nil, nil) if err != nil { return } @@ -13547,7 +13548,7 @@ func (l *Libvirt) ConnectGetDomainCapabilities(Emulatorbin OptString, Arch OptSt } var r response - r, err = l.request(342, constants.Program, buf) + r, err = l.requestStream(342, constants.Program, buf, nil, nil) if err != nil { return } @@ -13580,7 +13581,7 @@ func (l *Libvirt) DomainOpenGraphicsFd(Dom Domain, Idx uint32, Flags DomainOpenG } - _, err = l.request(343, constants.Program, buf) + _, err = l.requestStream(343, constants.Program, buf, nil, nil) if err != nil { return } @@ -13604,7 +13605,7 @@ func (l *Libvirt) ConnectGetAllDomainStats(Doms []Domain, Stats uint32, Flags Co } var r response - r, err = l.request(344, constants.Program, buf) + r, err = l.requestStream(344, constants.Program, buf, nil, nil) if err != nil { return } @@ -13639,7 +13640,7 @@ func (l *Libvirt) DomainBlockCopy(Dom Domain, Path string, Destxml string, Param } - _, err = l.request(345, constants.Program, buf) + _, err = l.requestStream(345, constants.Program, buf, nil, nil) if err != nil { return } @@ -13652,7 +13653,7 @@ func (l *Libvirt) DomainEventCallbackTunable() (err error) { var buf []byte - _, err = l.request(346, constants.Program, buf) + _, err = l.requestStream(346, constants.Program, buf, nil, nil) if err != nil { return } @@ -13678,7 +13679,7 @@ func (l *Libvirt) NodeAllocPages(PageSizes []uint32, PageCounts []uint64, StartC } var r response - r, err = l.request(347, constants.Program, buf) + r, err = l.requestStream(347, constants.Program, buf, nil, nil) if err != nil { return } @@ -13700,7 +13701,7 @@ func (l *Libvirt) DomainEventCallbackAgentLifecycle() (err error) { var buf []byte - _, err = l.request(348, constants.Program, buf) + _, err = l.requestStream(348, constants.Program, buf, nil, nil) if err != nil { return } @@ -13723,7 +13724,7 @@ func (l *Libvirt) DomainGetFsinfo(Dom Domain, Flags uint32) (rInfo []DomainFsinf } var r response - r, err = l.request(349, constants.Program, buf) + r, err = l.requestStream(349, constants.Program, buf, nil, nil) if err != nil { return } @@ -13760,7 +13761,7 @@ func (l *Libvirt) DomainDefineXMLFlags(XML string, Flags DomainDefineFlags) (rDo } var r response - r, err = l.request(350, constants.Program, buf) + r, err = l.requestStream(350, constants.Program, buf, nil, nil) if err != nil { return } @@ -13792,7 +13793,7 @@ func (l *Libvirt) DomainGetIothreadInfo(Dom Domain, Flags DomainModificationImpa } var r response - r, err = l.request(351, constants.Program, buf) + r, err = l.requestStream(351, constants.Program, buf, nil, nil) if err != nil { return } @@ -13831,7 +13832,7 @@ func (l *Libvirt) DomainPinIothread(Dom Domain, IothreadsID uint32, Cpumap []byt } - _, err = l.request(352, constants.Program, buf) + _, err = l.requestStream(352, constants.Program, buf, nil, nil) if err != nil { return } @@ -13855,7 +13856,7 @@ func (l *Libvirt) DomainInterfaceAddresses(Dom Domain, Source uint32, Flags uint } var r response - r, err = l.request(353, constants.Program, buf) + r, err = l.requestStream(353, constants.Program, buf, nil, nil) if err != nil { return } @@ -13877,7 +13878,7 @@ func (l *Libvirt) DomainEventCallbackDeviceAdded() (err error) { var buf []byte - _, err = l.request(354, constants.Program, buf) + _, err = l.requestStream(354, constants.Program, buf, nil, nil) if err != nil { return } @@ -13901,7 +13902,7 @@ func (l *Libvirt) DomainAddIothread(Dom Domain, IothreadID uint32, Flags DomainM } - _, err = l.request(355, constants.Program, buf) + _, err = l.requestStream(355, constants.Program, buf, nil, nil) if err != nil { return } @@ -13925,7 +13926,7 @@ func (l *Libvirt) DomainDelIothread(Dom Domain, IothreadID uint32, Flags DomainM } - _, err = l.request(356, constants.Program, buf) + _, err = l.requestStream(356, constants.Program, buf, nil, nil) if err != nil { return } @@ -13950,7 +13951,7 @@ func (l *Libvirt) DomainSetUserPassword(Dom Domain, User OptString, Password Opt } - _, err = l.request(357, constants.Program, buf) + _, err = l.requestStream(357, constants.Program, buf, nil, nil) if err != nil { return } @@ -13974,7 +13975,7 @@ func (l *Libvirt) DomainRename(Dom Domain, NewName OptString, Flags uint32) (rRe } var r response - r, err = l.request(358, constants.Program, buf) + r, err = l.requestStream(358, constants.Program, buf, nil, nil) if err != nil { return } @@ -13996,7 +13997,7 @@ func (l *Libvirt) DomainEventCallbackMigrationIteration() (err error) { var buf []byte - _, err = l.request(359, constants.Program, buf) + _, err = l.requestStream(359, constants.Program, buf, nil, nil) if err != nil { return } @@ -14009,7 +14010,7 @@ func (l *Libvirt) ConnectRegisterCloseCallback() (err error) { var buf []byte - _, err = l.request(360, constants.Program, buf) + _, err = l.requestStream(360, constants.Program, buf, nil, nil) if err != nil { return } @@ -14022,7 +14023,7 @@ func (l *Libvirt) ConnectUnregisterCloseCallback() (err error) { var buf []byte - _, err = l.request(361, constants.Program, buf) + _, err = l.requestStream(361, constants.Program, buf, nil, nil) if err != nil { return } @@ -14035,7 +14036,7 @@ func (l *Libvirt) ConnectEventConnectionClosed() (err error) { var buf []byte - _, err = l.request(362, constants.Program, buf) + _, err = l.requestStream(362, constants.Program, buf, nil, nil) if err != nil { return } @@ -14048,7 +14049,7 @@ func (l *Libvirt) DomainEventCallbackJobCompleted() (err error) { var buf []byte - _, err = l.request(363, constants.Program, buf) + _, err = l.requestStream(363, constants.Program, buf, nil, nil) if err != nil { return } @@ -14071,7 +14072,7 @@ func (l *Libvirt) DomainMigrateStartPostCopy(Dom Domain, Flags uint32) (err erro } - _, err = l.request(364, constants.Program, buf) + _, err = l.requestStream(364, constants.Program, buf, nil, nil) if err != nil { return } @@ -14094,7 +14095,7 @@ func (l *Libvirt) DomainGetPerfEvents(Dom Domain, Flags DomainModificationImpact } var r response - r, err = l.request(365, constants.Program, buf) + r, err = l.requestStream(365, constants.Program, buf, nil, nil) if err != nil { return } @@ -14128,7 +14129,7 @@ func (l *Libvirt) DomainSetPerfEvents(Dom Domain, Params []TypedParam, Flags Dom } - _, err = l.request(366, constants.Program, buf) + _, err = l.requestStream(366, constants.Program, buf, nil, nil) if err != nil { return } @@ -14141,7 +14142,7 @@ func (l *Libvirt) DomainEventCallbackDeviceRemovalFailed() (err error) { var buf []byte - _, err = l.request(367, constants.Program, buf) + _, err = l.requestStream(367, constants.Program, buf, nil, nil) if err != nil { return } @@ -14164,7 +14165,7 @@ func (l *Libvirt) ConnectStoragePoolEventRegisterAny(EventID int32, Pool OptStor } var r response - r, err = l.request(368, constants.Program, buf) + r, err = l.requestStream(368, constants.Program, buf, nil, nil) if err != nil { return } @@ -14195,7 +14196,7 @@ func (l *Libvirt) ConnectStoragePoolEventDeregisterAny(CallbackID int32) (err er } - _, err = l.request(369, constants.Program, buf) + _, err = l.requestStream(369, constants.Program, buf, nil, nil) if err != nil { return } @@ -14208,7 +14209,7 @@ func (l *Libvirt) StoragePoolEventLifecycle() (err error) { var buf []byte - _, err = l.request(370, constants.Program, buf) + _, err = l.requestStream(370, constants.Program, buf, nil, nil) if err != nil { return } @@ -14231,7 +14232,7 @@ func (l *Libvirt) DomainGetGuestVcpus(Dom Domain, Flags uint32) (rParams []Typed } var r response - r, err = l.request(371, constants.Program, buf) + r, err = l.requestStream(371, constants.Program, buf, nil, nil) if err != nil { return } @@ -14266,7 +14267,7 @@ func (l *Libvirt) DomainSetGuestVcpus(Dom Domain, Cpumap string, State int32, Fl } - _, err = l.request(372, constants.Program, buf) + _, err = l.requestStream(372, constants.Program, buf, nil, nil) if err != nil { return } @@ -14279,7 +14280,7 @@ func (l *Libvirt) StoragePoolEventRefresh() (err error) { var buf []byte - _, err = l.request(373, constants.Program, buf) + _, err = l.requestStream(373, constants.Program, buf, nil, nil) if err != nil { return } @@ -14302,7 +14303,7 @@ func (l *Libvirt) ConnectNodeDeviceEventRegisterAny(EventID int32, Dev OptNodeDe } var r response - r, err = l.request(374, constants.Program, buf) + r, err = l.requestStream(374, constants.Program, buf, nil, nil) if err != nil { return } @@ -14333,7 +14334,7 @@ func (l *Libvirt) ConnectNodeDeviceEventDeregisterAny(CallbackID int32) (err err } - _, err = l.request(375, constants.Program, buf) + _, err = l.requestStream(375, constants.Program, buf, nil, nil) if err != nil { return } @@ -14346,7 +14347,7 @@ func (l *Libvirt) NodeDeviceEventLifecycle() (err error) { var buf []byte - _, err = l.request(376, constants.Program, buf) + _, err = l.requestStream(376, constants.Program, buf, nil, nil) if err != nil { return } @@ -14359,7 +14360,7 @@ func (l *Libvirt) NodeDeviceEventUpdate() (err error) { var buf []byte - _, err = l.request(377, constants.Program, buf) + _, err = l.requestStream(377, constants.Program, buf, nil, nil) if err != nil { return } @@ -14382,7 +14383,7 @@ func (l *Libvirt) StorageVolGetInfoFlags(Vol StorageVol, Flags uint32) (rType in } var r response - r, err = l.request(378, constants.Program, buf) + r, err = l.requestStream(378, constants.Program, buf, nil, nil) if err != nil { return } @@ -14414,7 +14415,7 @@ func (l *Libvirt) DomainEventCallbackMetadataChange() (err error) { var buf []byte - _, err = l.request(379, constants.Program, buf) + _, err = l.requestStream(379, constants.Program, buf, nil, nil) if err != nil { return } @@ -14437,7 +14438,7 @@ func (l *Libvirt) ConnectSecretEventRegisterAny(EventID int32, OptSecret OptSecr } var r response - r, err = l.request(380, constants.Program, buf) + r, err = l.requestStream(380, constants.Program, buf, nil, nil) if err != nil { return } @@ -14468,7 +14469,7 @@ func (l *Libvirt) ConnectSecretEventDeregisterAny(CallbackID int32) (err error) } - _, err = l.request(381, constants.Program, buf) + _, err = l.requestStream(381, constants.Program, buf, nil, nil) if err != nil { return } @@ -14481,7 +14482,7 @@ func (l *Libvirt) SecretEventLifecycle() (err error) { var buf []byte - _, err = l.request(382, constants.Program, buf) + _, err = l.requestStream(382, constants.Program, buf, nil, nil) if err != nil { return } @@ -14494,7 +14495,7 @@ func (l *Libvirt) SecretEventValueChanged() (err error) { var buf []byte - _, err = l.request(383, constants.Program, buf) + _, err = l.requestStream(383, constants.Program, buf, nil, nil) if err != nil { return } @@ -14519,7 +14520,7 @@ func (l *Libvirt) DomainSetVcpu(Dom Domain, Cpumap string, State int32, Flags Do } - _, err = l.request(384, constants.Program, buf) + _, err = l.requestStream(384, constants.Program, buf, nil, nil) if err != nil { return } @@ -14532,7 +14533,7 @@ func (l *Libvirt) DomainEventBlockThreshold() (err error) { var buf []byte - _, err = l.request(385, constants.Program, buf) + _, err = l.requestStream(385, constants.Program, buf, nil, nil) if err != nil { return } @@ -14557,7 +14558,7 @@ func (l *Libvirt) DomainSetBlockThreshold(Dom Domain, Dev string, Threshold uint } - _, err = l.request(386, constants.Program, buf) + _, err = l.requestStream(386, constants.Program, buf, nil, nil) if err != nil { return } @@ -14580,7 +14581,7 @@ func (l *Libvirt) DomainMigrateGetMaxDowntime(Dom Domain, Flags uint32) (rDownti } var r response - r, err = l.request(387, constants.Program, buf) + r, err = l.requestStream(387, constants.Program, buf, nil, nil) if err != nil { return } @@ -14612,7 +14613,7 @@ func (l *Libvirt) DomainManagedSaveGetXMLDesc(Dom Domain, Flags DomainXMLFlags) } var r response - r, err = l.request(388, constants.Program, buf) + r, err = l.requestStream(388, constants.Program, buf, nil, nil) if err != nil { return } @@ -14645,7 +14646,7 @@ func (l *Libvirt) DomainManagedSaveDefineXML(Dom Domain, Dxml OptString, Flags D } - _, err = l.request(389, constants.Program, buf) + _, err = l.requestStream(389, constants.Program, buf, nil, nil) if err != nil { return } @@ -14670,7 +14671,7 @@ func (l *Libvirt) DomainSetLifecycleAction(Dom Domain, Type uint32, Action uint3 } - _, err = l.request(390, constants.Program, buf) + _, err = l.requestStream(390, constants.Program, buf, nil, nil) if err != nil { return } From 81923720d15c1da0040791d8e918af1d70a350cd Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 1 Mar 2018 10:57:28 +0400 Subject: [PATCH 09/20] Fix golint errors --- internal/lvgen/generate.go | 4 ++++ rpc.go | 10 ++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/lvgen/generate.go b/internal/lvgen/generate.go index 1916f18..d0c385d 100644 --- a/internal/lvgen/generate.go +++ b/internal/lvgen/generate.go @@ -170,8 +170,10 @@ type Proc struct { WriteStreamIdx int // The index of read stream in function argument list } +// ProcMetaGenerate is a type for flags from @generate annotation type ProcMetaGenerate int +// @generate annotation can be none, client, server or both const ( ProcMetaGenerateNone ProcMetaGenerate = iota ProcMetaGenerateClient @@ -179,8 +181,10 @@ const ( ProcMetaGenerateBoth ) +// ProcMetaPriority is a type for values from @priority annotation type ProcMetaPriority int +// @priority annotation can be low or high const ( ProcMetaPriorityLow ProcMetaPriority = iota ProcMetaPriorityHigh diff --git a/rpc.go b/rpc.go index 80653df..e1ee7ff 100644 --- a/rpc.go +++ b/rpc.go @@ -343,17 +343,15 @@ func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, out if err != nil { if err == io.EOF { err = l.sendPacket(serial, proc, program, nil, Stream, StatusOK) - break } else { // keep original error err := l.sendPacket(serial, proc, program, nil, Stream, StatusError) if err != nil { outStreamErr <- err return - } else { - break } } + break } if n > 0 { err = l.sendPacket(serial, proc, program, buf[:n], Stream, StatusContinue) @@ -438,11 +436,7 @@ func (l *Libvirt) sendPacket(serial uint32, proc uint32, program uint32, payload } } - if err := l.w.Flush(); err != nil { - return err - } - - return nil + return l.w.Flush() } func (l *Libvirt) getResponse(c chan response) (response, error) { From 980f867cc245a4dcde9f6a9c86f29bd96ac2ac52 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 1 Mar 2018 10:58:10 +0400 Subject: [PATCH 10/20] Add myself to AUTHORS file --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 1db99ce..8d0e4af 100644 --- a/AUTHORS +++ b/AUTHORS @@ -17,3 +17,4 @@ Simarpreet Singh Alexander Polyakov Amanda Andrade Geoff Hickey +Yuriy Taraday From f960aceaee1533d05d68eb4058f39bdfebeb7df6 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 1 Mar 2018 20:14:55 +0400 Subject: [PATCH 11/20] Factor out sendStream method from requestStream --- rpc.go | 62 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/rpc.go b/rpc.go index e1ee7ff..c2ced94 100644 --- a/rpc.go +++ b/rpc.go @@ -329,38 +329,7 @@ func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, out abortOutStream = make(chan bool) outStreamErr = make(chan error) go func() { - var err error - var n int - buf := make([]byte, 1<<22-24) - for { - select { - case <-abortOutStream: - err = l.sendPacket(serial, proc, program, nil, Stream, StatusError) - break - default: - } - n, err = outStream.Read(buf) - if err != nil { - if err == io.EOF { - err = l.sendPacket(serial, proc, program, nil, Stream, StatusOK) - } else { - // keep original error - err := l.sendPacket(serial, proc, program, nil, Stream, StatusError) - if err != nil { - outStreamErr <- err - return - } - } - break - } - if n > 0 { - err = l.sendPacket(serial, proc, program, buf[:n], Stream, StatusContinue) - if err != nil { - break - } - } - } - outStreamErr <- err + outStreamErr <- l.sendStream(serial, proc, program, outStream, abortOutStream) }() } @@ -402,6 +371,35 @@ func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, out return resp, nil } +func (l *Libvirt) sendStream(serial uint32, proc uint32, program uint32, stream io.Reader, abort chan bool) error { + buf := make([]byte, 1<<22-24) + for { + select { + case <-abort: + return l.sendPacket(serial, proc, program, nil, Stream, StatusError) + default: + } + n, err := stream.Read(buf) + if err != nil { + if err == io.EOF { + return l.sendPacket(serial, proc, program, nil, Stream, StatusOK) + } + // keep original error + err2 := l.sendPacket(serial, proc, program, nil, Stream, StatusError) + if err2 != nil { + return err2 + } + return err + } + if n > 0 { + err = l.sendPacket(serial, proc, program, buf[:n], Stream, StatusContinue) + if err != nil { + return err + } + } + } +} + func (l *Libvirt) sendPacket(serial uint32, proc uint32, program uint32, payload []byte, typ uint32, status uint32) error { size := constants.PacketLengthSize + constants.HeaderSize if payload != nil { From 16e61b53a730b62790c0b5a1936405304312c52d Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 1 Mar 2018 20:19:56 +0400 Subject: [PATCH 12/20] Remove unused parts of ProcMeta Also replace if-else if chain with switch and fix error strings. --- internal/lvgen/generate.go | 57 ++++---------------------------------- 1 file changed, 5 insertions(+), 52 deletions(-) diff --git a/internal/lvgen/generate.go b/internal/lvgen/generate.go index d0c385d..2b655e8 100644 --- a/internal/lvgen/generate.go +++ b/internal/lvgen/generate.go @@ -170,34 +170,10 @@ type Proc struct { WriteStreamIdx int // The index of read stream in function argument list } -// ProcMetaGenerate is a type for flags from @generate annotation -type ProcMetaGenerate int - -// @generate annotation can be none, client, server or both -const ( - ProcMetaGenerateNone ProcMetaGenerate = iota - ProcMetaGenerateClient - ProcMetaGenerateServer - ProcMetaGenerateBoth -) - -// ProcMetaPriority is a type for values from @priority annotation -type ProcMetaPriority int - -// @priority annotation can be low or high -const ( - ProcMetaPriorityLow ProcMetaPriority = iota - ProcMetaPriorityHigh -) - // ProcMeta holds information from annotations attached to a libvirt procedure type ProcMeta struct { - Generate ProcMetaGenerate ReadStream int WriteStream int - Priority ProcMetaPriority - Acls []string - Aclfilter string } type structStack []*Structure @@ -671,42 +647,19 @@ func parseMeta(meta string) (*ProcMeta, error) { return nil, fmt.Errorf("invalid annotation: %s", meta) } spl[1] = strings.Trim(spl[1], " ") - if spl[0] == "generate" { - if spl[1] == "none" { - res.Generate = ProcMetaGenerateNone - } else if spl[1] == "client" { - res.Generate = ProcMetaGenerateClient - } else if spl[1] == "server" { - res.Generate = ProcMetaGenerateServer - } else if spl[1] == "both" { - res.Generate = ProcMetaGenerateBoth - } else { - return nil, fmt.Errorf("invalid value for generate: %s", spl[1]) - } - } else if spl[0] == "readstream" { + 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 readstread: %s", spl[1]) + return nil, fmt.Errorf("invalid value for readstream: %s", spl[1]) } - } else if spl[0] == "writestream" { + case "writestream": var err error res.WriteStream, err = strconv.Atoi(spl[1]) if err != nil { - return nil, fmt.Errorf("invalid value for readstread: %s", spl[1]) + return nil, fmt.Errorf("invalid value for writestream: %s", spl[1]) } - } else if spl[0] == "priority" { - if spl[1] == "low" { - res.Priority = ProcMetaPriorityLow - } else if spl[1] == "high" { - res.Priority = ProcMetaPriorityHigh - } else { - return nil, fmt.Errorf("invalid value for priority: %s", spl[1]) - } - } else if spl[0] == "acl" { - res.Acls = append(res.Acls, spl[1]) - } else if spl[0] == "aclfilter" { - res.Aclfilter = spl[1] } } return res, nil From 35cd6327cf66bd97a3717ce4105e648b2afb07cb Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Thu, 1 Mar 2018 21:27:02 +0400 Subject: [PATCH 13/20] Don't drain callback channel, just close it and recover Reverts 07dbf86, adds recovering from writing on eventually closed channel in callback(). --- rpc.go | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/rpc.go b/rpc.go index c2ced94..7ab6224 100644 --- a/rpc.go +++ b/rpc.go @@ -191,10 +191,14 @@ func (l *Libvirt) listen() { func (l *Libvirt) callback(id uint32, res response) { l.cm.Lock() c, ok := l.callbacks[id] + l.cm.Unlock() if ok { + // we close channel in deregister() so that we don't block here forever without receiver + defer func() { + recover() + }() c <- res } - l.cm.Unlock() } // route sends incoming packets to their listeners. @@ -281,19 +285,7 @@ func (l *Libvirt) register(id uint32, c chan response) { // deregister destroys a method response callback func (l *Libvirt) deregister(id uint32) { - lockChan := make(chan bool) - go func() { - l.cm.Lock() - lockChan <- true - }() -Loop: - for { - select { - case _ = <-l.callbacks[id]: - case _ = <-lockChan: - break Loop - } - } + l.cm.Lock() close(l.callbacks[id]) delete(l.callbacks, id) l.cm.Unlock() From 8965adaafbd5964e476d21af463904535c586485 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Fri, 2 Mar 2018 00:26:38 +0400 Subject: [PATCH 14/20] Expand some comments by Geoff's request --- internal/lvgen/generate.go | 11 +++++++++++ internal/lvgen/lvlexer.go | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/lvgen/generate.go b/internal/lvgen/generate.go index 2b655e8..07379ab 100644 --- a/internal/lvgen/generate.go +++ b/internal/lvgen/generate.go @@ -564,6 +564,17 @@ func AddEnumVal(name, val string) error { } // AddEnumValMeta will add a new enum value with attached metadata to the list. +// 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 AddEnumValMeta(name, val, meta string) error { ev, err := parseNumber(val) if err != nil { diff --git a/internal/lvgen/lvlexer.go b/internal/lvgen/lvlexer.go index be133fc..5bc7eba 100644 --- a/internal/lvgen/lvlexer.go +++ b/internal/lvgen/lvlexer.go @@ -259,10 +259,12 @@ func lexText(l *Lexer) stateFn { // 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. + // Found the end. Advance past the '*/' and discard the comment body + // unless it's a metadata comment l.next() l.next() if metadataComment { From b27200c99b98833b46a3cf3688a96c4ae7881e09 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sat, 5 May 2018 22:27:31 +0400 Subject: [PATCH 15/20] Better explain what 1<<22-24 means for packet length --- rpc.go | 3 ++- units.go | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 units.go diff --git a/rpc.go b/rpc.go index 7ab6224..447e853 100644 --- a/rpc.go +++ b/rpc.go @@ -364,7 +364,8 @@ func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, out } func (l *Libvirt) sendStream(serial uint32, proc uint32, program uint32, stream io.Reader, abort chan bool) error { - buf := make([]byte, 1<<22-24) + // Keep total packet length under 4 MiB to follow possible limitation in libvirt server code + buf := make([]byte, 4*MiB-constants.HeaderSize) for { select { case <-abort: diff --git a/units.go b/units.go new file mode 100644 index 0000000..c60d1b5 --- /dev/null +++ b/units.go @@ -0,0 +1,24 @@ +// 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 libvirt + +const ( + B = 1 + KiB = 1024 * B + MiB = 1024 * KiB +) From 8d6ee20a7c3bf62b5a619d28f3d6c43cd0dbac98 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sat, 5 May 2018 22:34:13 +0400 Subject: [PATCH 16/20] Fix error return when stream send failed --- rpc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc.go b/rpc.go index 447e853..3f02b22 100644 --- a/rpc.go +++ b/rpc.go @@ -356,7 +356,7 @@ func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, out if outStream != nil { err = <-outStreamErr if err != nil { - return response{}, nil + return response{}, err } } From f6ceaff755f444ec5291b3a059f849bf58dc012a Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sat, 5 May 2018 23:11:29 +0400 Subject: [PATCH 17/20] Add comments to B, KiB and MiB units --- units.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/units.go b/units.go index c60d1b5..0368650 100644 --- a/units.go +++ b/units.go @@ -18,7 +18,10 @@ package libvirt const ( + // B - byte B = 1 + // KiB - kibibyte KiB = 1024 * B + // MiB - mebibyte MiB = 1024 * KiB ) From 7442c709b1392fc635e676c92e5c18c91c5de547 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sun, 6 May 2018 00:56:21 +0400 Subject: [PATCH 18/20] Extract processIncomingStream func to make requestStream cleaner --- rpc.go | 62 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/rpc.go b/rpc.go index 3f02b22..ca973c8 100644 --- a/rpc.go +++ b/rpc.go @@ -298,6 +298,27 @@ func (l *Libvirt) request(proc uint32, program uint32, payload []byte) (response return l.requestStream(proc, program, payload, nil, nil) } +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 here means end of stream + if resp.Status == StatusOK { + return resp, nil + } + // StatusError is handled in getResponse, so this is StatusContinue + // StatusContinue is valid here only for stream packets + if inStream != nil { + _, err = inStream.Write(resp.Payload) + if err != nil { + return response{}, err + } + } + } +} + func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, outStream io.Reader, inStream io.Writer) (response, error) { serial := l.serial() c := make(chan response) @@ -315,49 +336,26 @@ func (l *Libvirt) requestStream(proc uint32, program uint32, payload []byte, out return resp, err } - var abortOutStream chan bool - var outStreamErr chan error if outStream != nil { - abortOutStream = make(chan bool) - outStreamErr = make(chan error) + abortOutStream := make(chan bool) + outStreamErr := make(chan error) go func() { outStreamErr <- l.sendStream(serial, proc, program, outStream, abortOutStream) }() - } - // Even without incoming stream server sends confirmation once all data is received - if outStream != nil || inStream != nil { - for { - resp, err = l.getResponse(c) - if err != nil { - if outStream != nil { - abortOutStream <- true - } - return resp, err - } - // Continue is valid here only for stream packets - if resp.Status == StatusContinue { - if inStream != nil { - _, err = inStream.Write(resp.Payload) - if err != nil { - if outStream != nil { - abortOutStream <- true - } - return response{}, err - } - } - } else { - // StatusError is handled in getResponse, so this is StatusOK, end of stream - break - } + // Even without incoming stream server sends confirmation once all data is received + resp, err = l.processIncomingStream(c, inStream) + if err != nil { + abortOutStream <- true + return resp, err } - } - if outStream != nil { err = <-outStreamErr if err != nil { return response{}, err } + } else if inStream != nil { + return l.processIncomingStream(c, inStream) } return resp, nil From 9adcb04498be2c08e2fd10317e5f8dfda86e4989 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sun, 6 May 2018 00:56:50 +0400 Subject: [PATCH 19/20] Fix volume download --- rpc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rpc.go b/rpc.go index ca973c8..adb3c3c 100644 --- a/rpc.go +++ b/rpc.go @@ -310,6 +310,10 @@ func (l *Libvirt) processIncomingStream(c chan response, inStream io.Writer) (re } // StatusError is handled in getResponse, so this is StatusContinue // StatusContinue is valid here only for stream packets + // libvirtd breaks protocol and returns StatusContinue with empty Payload when stream finishes + if len(resp.Payload) == 0 { + return resp, nil + } if inStream != nil { _, err = inStream.Write(resp.Payload) if err != nil { From 714fd9efff4e0e35d1a2ae069b683ba86926bbdc Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Sun, 6 May 2018 00:57:24 +0400 Subject: [PATCH 20/20] Add test for volume upload and download --- libvirt_integration_test.go | 53 +++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/libvirt_integration_test.go b/libvirt_integration_test.go index 719108b..9e8f27b 100644 --- a/libvirt_integration_test.go +++ b/libvirt_integration_test.go @@ -17,6 +17,7 @@ package libvirt import ( + "bytes" "encoding/xml" "net" "sync" @@ -252,6 +253,58 @@ func TestXMLIntegration(t *testing.T) { } } +func TestVolumeUploadDownloadIntegration(t *testing.T) { + testdata := []byte("Hello, world!") + l := New(testConn(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) {