Add Secrets() (#29)

This adds the `Secrets()` method, used to retrieve all secrets managed
by the libvirt daemon.
This commit is contained in:
Ben LeMasurier
2017-01-19 20:40:31 -06:00
committed by GitHub
parent cfa567708b
commit 2609dd2697
7 changed files with 177 additions and 0 deletions

View File

@@ -217,6 +217,33 @@ var testDomainStateReply = []byte{
0x00, 0x00, 0x00, 0x01, // reason
}
var testSecretsReply = []byte{
0x00, 0x00, 0x00, 0x40, // length
0x20, 0x00, 0x80, 0x86, // program
0x00, 0x00, 0x00, 0x01, // version
0x00, 0x00, 0x01, 0x1f, // procedure
0x00, 0x00, 0x00, 0x01, // type
0x00, 0x00, 0x00, 0x00, // serial
0x00, 0x00, 0x00, 0x00, // status
// list of secrets
0x00, 0x00, 0x00, 0x01,
// first secret
// UUID: 19fdc2f2fa64-46f3bacf42a8aafca6dd
0x19, 0xfd, 0xc2, 0xf2, 0xfa, 0x64, 0x46, 0xf3,
0xba, 0xcf, 0x42, 0xa8, 0xaa, 0xfc, 0xa6, 0xdd,
// usage type: (1, volume)
0x00, 0x00, 0x00, 0x01,
// usage id: "/tmp"
0x00, 0x00, 0x00, 0x04, 0x2f, 0x74, 0x6d, 0x70,
// end of secrets
0x00, 0x00, 0x00, 0x01,
}
var testStoragePoolLookup = []byte{
0x00, 0x00, 0x00, 0x38, // length
0x20, 0x00, 0x80, 0x86, // program
@@ -377,6 +404,8 @@ func (m *MockLibvirt) handleRemote(procedure uint32, conn net.Conn) {
conn.Write(m.reply(testDomainsReply))
case constants.ProcConnectListAllStoragePools:
conn.Write(m.reply(testListPoolsReply))
case constants.ProcConnectListAllSecrets:
conn.Write(m.reply(testSecretsReply))
case constants.ProcDomainGetState:
conn.Write(m.reply(testDomainStateReply))
case constants.ProcDomainMigrateSetMaxSpeed: