// SetAutostart sets the autostart flag. func (pool StoragePool) SetAutostart(autostart bool) error { var autostartInt int32 if autostart { pool.log.Println("enabling storage pool autostart...") autostartInt = 1 } else { pool.log.Println("disabling storage pool autostart...") autostartInt = 0 } cRet := C.virStoragePoolSetAutostart(pool.virStoragePool, C.int(autostartInt)) ret := int32(cRet) if ret == -1 { err := LastError() pool.log.Printf("an error occurred: %v\n", err) return err } if autostart { pool.log.Printf("autostart enabled") } else { pool.log.Printf("autostart disabled") } return nil }
func (p *VirStoragePool) SetAutostart(autostart bool) error { var cAutostart C.int switch autostart { case true: cAutostart = 1 default: cAutostart = 0 } result := C.virStoragePoolSetAutostart(p.ptr, cAutostart) if result == -1 { return errors.New(GetLastError()) } return nil }