Adds StoragePool(), StoragePoolRefresh() (#28)

This adds two new methods:
- `StoragePool()`, used to lookup a storage pool by name.
- `StoragePoolRefresh()`, used to refresh a storage pool by name.
This commit is contained in:
Ben LeMasurier
2017-01-09 14:54:30 -07:00
committed by GitHub
parent 591f6798f1
commit cfa567708b
5 changed files with 202 additions and 0 deletions

View File

@@ -217,6 +217,34 @@ var testDomainStateReply = []byte{
0x00, 0x00, 0x00, 0x01, // reason
}
var testStoragePoolLookup = []byte{
0x00, 0x00, 0x00, 0x38, // length
0x20, 0x00, 0x80, 0x86, // program
0x00, 0x00, 0x00, 0x01, // version
0x00, 0x00, 0x00, 0x54, // procedure
0x00, 0x00, 0x00, 0x01, // type
0x00, 0x00, 0x00, 0x00, // serial
0x00, 0x00, 0x00, 0x00, // status
// pool: name = default
0x00, 0x00, 0x00, 0x07, 0x64, 0x65, 0x66, 0x61,
0x75, 0x6c, 0x74, 0x00,
// uuid = bb30a11c084648278bba3e6b5cf1b65f
0xbb, 0x30, 0xa1, 0x1c, 0x08, 0x46, 0x48, 0x27,
0x8b, 0xba, 0x3e, 0x6b, 0x5c, 0xf1, 0xb6, 0x5f,
}
var testStoragePoolRefresh = []byte{
0x00, 0x00, 0x00, 0x1c, // length
0x20, 0x00, 0x80, 0x86, // program
0x00, 0x00, 0x00, 0x01, // version
0x00, 0x00, 0x00, 0x53, // procedure
0x00, 0x00, 0x00, 0x01, // type
0x00, 0x00, 0x00, 0x00, // serial
0x00, 0x00, 0x00, 0x00, // status
}
var testListPoolsReply = []byte{
0x00, 0x00, 0x00, 0x40, // length
0x20, 0x00, 0x80, 0x86, // program
@@ -333,6 +361,10 @@ func (m *MockLibvirt) handleRemote(procedure uint32, conn net.Conn) {
switch procedure {
case constants.ProcAuthList:
conn.Write(m.reply(testAuthReply))
case constants.ProcStoragePoolRefresh:
conn.Write(m.reply(testStoragePoolRefresh))
case constants.ProcStoragePoolLookupByName:
conn.Write(m.reply(testStoragePoolLookup))
case constants.ProcConnectOpen:
conn.Write(m.reply(testConnectReply))
case constants.ProcConnectClose: