[Pkg-libvirt-commits] [libguestfs] 19/384: uuid: add support to change uuid of swap partition

Hilko Bengen bengen at moszumanska.debian.org
Sun Mar 29 16:55:08 UTC 2015


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to branch experimental
in repository libguestfs.

commit 95644f33cd51e37467ba32086e7b1ee01bd21dfe
Author: Hu Tao <hutao at cn.fujitsu.com>
Date:   Fri Nov 28 15:58:05 2014 +0800

    uuid: add support to change uuid of swap partition
    
    Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
---
 daemon/uuids.c                        | 19 +++++++++++++++++++
 sysprep/sysprep_operation_fs_uuids.ml |  2 --
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/daemon/uuids.c b/daemon/uuids.c
index 672f3db..431d867 100644
--- a/daemon/uuids.c
+++ b/daemon/uuids.c
@@ -29,6 +29,7 @@
 
 GUESTFSD_EXT_CMD(str_tune2fs, tune2fs);
 GUESTFSD_EXT_CMD(str_xfs_admin, xfs_admin);
+GUESTFSD_EXT_CMD(str_swaplabel, swaplabel);
 
 static int
 e2uuid (const char *device, const char *uuid)
@@ -75,6 +76,21 @@ xfsuuid (const char *device, const char *uuid)
   return 0;
 }
 
+static int
+swapuuid (const char *device, const char *uuid)
+{
+  int r;
+  CLEANUP_FREE char *err = NULL;
+
+  r = command (NULL, &err, str_swaplabel, "-U", uuid, device, NULL);
+  if (r == -1) {
+    reply_with_error ("%s", err);
+    return -1;
+  }
+
+  return 0;
+}
+
 int
 do_set_uuid (const char *device, const char *uuid)
 {
@@ -91,6 +107,9 @@ do_set_uuid (const char *device, const char *uuid)
   else if (STREQ (vfs_type, "xfs"))
     r = xfsuuid (device, uuid);
 
+  else if (STREQ (vfs_type, "swap"))
+    r = swapuuid (device, uuid);
+
   else {
     reply_with_error ("don't know how to set the UUID for '%s' filesystems",
                       vfs_type);
diff --git a/sysprep/sysprep_operation_fs_uuids.ml b/sysprep/sysprep_operation_fs_uuids.ml
index ccd8ef6..b67c131 100644
--- a/sysprep/sysprep_operation_fs_uuids.ml
+++ b/sysprep/sysprep_operation_fs_uuids.ml
@@ -29,8 +29,6 @@ let rec fs_uuids_perform ~verbose ~quiet g root side_effects =
   let fses = g#list_filesystems () in
   List.iter (function
   | _, "unknown" -> ()
-  | _, "swap" ->
-    (* XXX Not implemented *) ()
   | dev, typ ->
     let new_uuid = Common_utils.uuidgen ~prog () in
     try

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git



More information about the Pkg-libvirt-commits mailing list