func (d *VirDomain) GetID() (uint, error) { id := uint(C.virDomainGetID(d.ptr)) if id == ^uint(0) { return id, GetLastError() } return id, nil }
func (d *Domain) GetId() (uint, error) { id := C.virDomainGetID(d.cptr) if int(id) == -1 { return 0, GetLastError() } return uint(id), nil }
// ID gets the hypervisor ID number for the domain. func (dom Domain) ID() (uint32, error) { dom.log.Println("reading domain ID...") cID := C.virDomainGetID(dom.virDomain) id := uint32(cID) if id == ^uint32(0) { // Go: ^uint32(0) == C: (unsigned int) -1 err := errors.New("domain doesn't have an ID") dom.log.Printf("an error occurred: %v\n", err) return 0, err } dom.log.Printf("domain ID: %v\n", id) return id, nil }