resources: virt: Allow hotplugging

This allows hot (un)plugging of CPU's! It also includes some general
cleanups which were necessary to support this as well as some other
features to the virt resource. Hotunplug requires Fedora 25.

It also comes with a mini shell script to help demo this capability.

Many thanks to pkrempa for his help with the libvirt API!
This commit is contained in:
James Shubin
2017-01-10 02:12:51 -05:00
parent 74dfb9d88d
commit bec7f1726f
5 changed files with 603 additions and 139 deletions

View File

@@ -108,10 +108,15 @@ opened in the `Init` method and were using throughout the resource.
```golang
// Close runs some cleanup code for this resource.
func (obj *FooRes) Close() error {
err := obj.conn.Close() // close some internal connection
obj.Conn.Close() // ignore error in this case
return obj.BaseRes.Close() // call base close, b/c we're overriding
// call base close, b/c we're overriding
if e := obj.BaseRes.Close(); err == nil {
err = e
} else if e != nil {
err = multierr.Append(err, e) // list of errors
}
return err
}
```