|
|
022f11 |
From 1e421afa988195bead6650c421d9752fed32b73f Mon Sep 17 00:00:00 2001
|
|
|
022f11 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
022f11 |
Date: Sat, 31 Aug 2013 22:48:04 +0100
|
|
|
022f11 |
Subject: [PATCH] rescue: Use cachemode "unsafe" for the virt-rescue --scratch
|
|
|
022f11 |
option.
|
|
|
022f11 |
|
|
|
022f11 |
(cherry picked from commit 3f0748f1fc64e42517c0d4535c27b1f32da86023)
|
|
|
022f11 |
---
|
|
|
022f11 |
fish/options.c | 5 +++++
|
|
|
022f11 |
fish/options.h | 1 +
|
|
|
022f11 |
rescue/virt-rescue.c | 1 +
|
|
|
022f11 |
3 files changed, 7 insertions(+)
|
|
|
022f11 |
|
|
|
022f11 |
diff --git a/fish/options.c b/fish/options.c
|
|
|
022f11 |
index 6d63afa..75d61ad 100644
|
|
|
022f11 |
--- a/fish/options.c
|
|
|
022f11 |
+++ b/fish/options.c
|
|
|
022f11 |
@@ -110,6 +110,10 @@ add_drives (struct drv *drv, char next_drive)
|
|
|
022f11 |
ad_optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_FORMAT_BITMASK;
|
|
|
022f11 |
ad_optargs.format = drv->a.format;
|
|
|
022f11 |
}
|
|
|
022f11 |
+ if (drv->a.cachemode) {
|
|
|
022f11 |
+ ad_optargs.bitmask |= GUESTFS_ADD_DRIVE_OPTS_CACHEMODE_BITMASK;
|
|
|
022f11 |
+ ad_optargs.cachemode = drv->a.cachemode;
|
|
|
022f11 |
+ }
|
|
|
022f11 |
|
|
|
022f11 |
r = guestfs_add_drive_opts_argv (g, drv->a.filename, &ad_optargs);
|
|
|
022f11 |
if (r == -1)
|
|
|
022f11 |
@@ -254,6 +258,7 @@ free_drives (struct drv *drv)
|
|
|
022f11 |
case drv_a:
|
|
|
022f11 |
free (drv->a.filename);
|
|
|
022f11 |
/* a.format is an optarg, so don't free it */
|
|
|
022f11 |
+ /* a.cachemode is a static string, so don't free it */
|
|
|
022f11 |
break;
|
|
|
022f11 |
case drv_uri:
|
|
|
022f11 |
free (drv->uri.path);
|
|
|
022f11 |
diff --git a/fish/options.h b/fish/options.h
|
|
|
022f11 |
index 507ec1c..e2192b5 100644
|
|
|
022f11 |
--- a/fish/options.h
|
|
|
022f11 |
+++ b/fish/options.h
|
|
|
022f11 |
@@ -60,6 +60,7 @@ struct drv {
|
|
|
022f11 |
struct {
|
|
|
022f11 |
char *filename; /* disk filename */
|
|
|
022f11 |
const char *format; /* format (NULL == autodetect) */
|
|
|
022f11 |
+ const char *cachemode;/* cachemode (NULL == default) */
|
|
|
022f11 |
} a;
|
|
|
022f11 |
struct {
|
|
|
022f11 |
char *path; /* disk path */
|
|
|
022f11 |
diff --git a/rescue/virt-rescue.c b/rescue/virt-rescue.c
|
|
|
022f11 |
index 65dd473..942c54a 100644
|
|
|
022f11 |
--- a/rescue/virt-rescue.c
|
|
|
022f11 |
+++ b/rescue/virt-rescue.c
|
|
|
022f11 |
@@ -580,6 +580,7 @@ add_scratch_disk (struct drv **drvs)
|
|
|
022f11 |
exit (EXIT_FAILURE);
|
|
|
022f11 |
}
|
|
|
022f11 |
drv->a.format = "raw";
|
|
|
022f11 |
+ drv->a.cachemode = "unsafe"; /* because it's a scratch disk */
|
|
|
022f11 |
drv->next = *drvs;
|
|
|
022f11 |
*drvs = drv;
|
|
|
022f11 |
}
|
|
|
022f11 |
--
|
|
|
022f11 |
1.8.3.1
|
|
|
022f11 |
|