예제 #1
0
func (d *VirDomain) GetName() (string, error) {
	name := C.virDomainGetName(d.ptr)
	if name == nil {
		return "", errors.New(GetLastError())
	}
	return C.GoString(name), nil
}
예제 #2
0
func (d *Domain) GetName() (string, error) {
	result := C.virDomainGetName(d.cptr)
	if result == nil {
		return "", GetLastError()
	}

	name := C.GoString(result)
	return name, nil
}
예제 #3
0
// Name gets the public name for that domain.
func (dom Domain) Name() (string, error) {
	dom.log.Println("reading domain name...")
	cName := C.virDomainGetName(dom.virDomain)

	if cName == nil {
		err := LastError()
		dom.log.Printf("an error occurred: %v\n", err)
		return "", err
	}

	name := C.GoString(cName)
	dom.log.Printf("domain name: %v\n", name)

	return name, nil
}