[lxc-devel] [go-lxc/v2] add support for liblxc's new action_script member in migrate_opts
tych0 on Github
lxc-bot at linuxcontainers.org
Thu Jul 7 23:21:01 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160707/9c334179/attachment.bin>
-------------- next part --------------
From 0c025de58fa8b54f9afaa6a494731a2fffce5503 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Wed, 6 Jul 2016 23:50:47 +0000
Subject: [PATCH 1/2] actually send the predump dir through
In particular s/:=/=/
Also drop unneeded initialization.
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
container.go | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/container.go b/container.go
index d8d0a93..dcf37b2 100644
--- a/container.go
+++ b/container.go
@@ -1502,10 +1502,9 @@ func (c *Container) Migrate(cmd uint, opts MigrateOptions) error {
defer C.free(unsafe.Pointer(cdirectory))
var cpredumpdir *C.char
- cpredumpdir = nil
if opts.PredumpDir != "" {
- cpredumpdir := C.CString(opts.PredumpDir)
+ cpredumpdir = C.CString(opts.PredumpDir)
defer C.free(unsafe.Pointer(cpredumpdir))
}
From 658520b0f87e54b37ce19683784c0fecaaf942e7 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Wed, 6 Jul 2016 23:58:07 +0000
Subject: [PATCH 2/2] c/r: add support for liblxc's action_script
Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
container.go | 7 +++++++
lxc-binding.c | 4 ++++
lxc-binding.h | 1 +
options.go | 1 +
4 files changed, 13 insertions(+)
diff --git a/container.go b/container.go
index dcf37b2..5d253f8 100644
--- a/container.go
+++ b/container.go
@@ -1518,8 +1518,15 @@ func (c *Container) Migrate(cmd uint, opts MigrateOptions) error {
predump_dir: cpredumpdir,
}
+ var cActionScript *C.char
+ if opts.ActionScript != "" {
+ cActionScript = C.CString(opts.ActionScript)
+ defer C.free(unsafe.Pointer(cActionScript))
+ }
+
extras := C.struct_extra_migrate_opts{
preserves_inodes: C.bool(opts.PreservesInodes),
+ action_script: cActionScript,
}
ret := C.int(C.go_lxc_migrate(c.container, C.uint(cmd), &copts, &extras))
diff --git a/lxc-binding.c b/lxc-binding.c
index 90ba45c..7712d8e 100644
--- a/lxc-binding.c
+++ b/lxc-binding.c
@@ -366,6 +366,10 @@ bool go_lxc_restore(struct lxc_container *c, char *directory, bool verbose) {
}
int go_lxc_migrate(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, struct extra_migrate_opts *extras) {
+#if VERSION_AT_LEAST(2, 0, 4)
+ opts->action_script = extras->action_script;
+#endif
+
#if VERSION_AT_LEAST(2, 0, 1)
opts->preserves_inodes = extras->preserves_inodes;
#endif
diff --git a/lxc-binding.h b/lxc-binding.h
index e114494..da046f0 100644
--- a/lxc-binding.h
+++ b/lxc-binding.h
@@ -87,6 +87,7 @@ struct migrate_opts {
*/
struct extra_migrate_opts {
bool preserves_inodes;
+ char *action_script;
};
int go_lxc_migrate(struct lxc_container *c, unsigned int cmd, struct migrate_opts *opts, struct extra_migrate_opts *extras);
diff --git a/options.go b/options.go
index 030c35f..47dc392 100644
--- a/options.go
+++ b/options.go
@@ -194,4 +194,5 @@ type MigrateOptions struct {
Stop bool
PredumpDir string
PreservesInodes bool
+ ActionScript string
}
More information about the lxc-devel
mailing list