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:
@@ -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
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user