func (p *VirStoragePool) GetAutostart() (bool, error) { var out C.int result := C.virStoragePoolGetAutostart(p.ptr, (*C.int)(unsafe.Pointer(&out))) if result == -1 { return false, errors.New(GetLastError()) } switch out { case 1: return true, nil default: return false, nil } }
// Autostart fetches the value of the autostart flag, which determines whether // the pool is automatically started at boot time. func (pool StoragePool) Autostart() (bool, error) { var cAutostart C.int pool.log.Println("checking whether storage pool autostarts...") cRet := C.virStoragePoolGetAutostart(pool.virStoragePool, &cAutostart) ret := int32(cRet) if ret == -1 { err := LastError() pool.log.Printf("an error occurred: %v\n", err) return false, err } autostart := (int32(cAutostart) == 1) if autostart { pool.log.Println("pool autostarts") } else { pool.log.Println("pool does not autostart") } return autostart, nil }