@@ -86,7 +86,38 @@ type Devid int
type MemKB uint64
-type Uuid C.libxl_uuid
+// Uuid is a domain UUID.
+type Uuid [16]byte
+
+// String formats a Uuid in the form "xxxx-xx-xx-xx-xxxxxx".
+func (u Uuid) String() string {
+ s := "%x%x%x%x-%x%x-%x%x-%x%x-%x%x%x%x%x%x"
+ opts := make([]interface{}, 16)
+
+ for i, v := range u {
+ opts[i] = v
+ }
+
+ return fmt.Sprintf(s, opts...)
+}
+
+func (u *Uuid) fromC(c *C.libxl_uuid) error {
+ for i := range *u {
+ u[i] = byte(c.uuid[i])
+ }
+
+ return nil
+}
+
+func (u *Uuid) toC() (C.libxl_uuid, error) {
+ var c C.libxl_uuid
+
+ for i, v := range u {
+ c.uuid[i] = C.uint8_t(v)
+ }
+
+ return c, nil
+}
// defboolVal represents a defbool value.
type defboolVal int
@@ -495,7 +526,7 @@ type Dominfo struct {
func (cdi *C.libxl_dominfo) toGo() (di *Dominfo) {
di = &Dominfo{}
- di.Uuid = Uuid(cdi.uuid)
+ di.Uuid.fromC(&cdi.uuid)
di.Domid = Domid(cdi.domid)
di.Ssidref = uint32(cdi.ssidref)
di.SsidLabel = C.GoString(cdi.ssid_label)