wp-mirror-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wp-mirror-list] [PATCH RFC] hdparm: tolerate being in a Virtual Machine


From: Jason Cooper
Subject: [Wp-mirror-list] [PATCH RFC] hdparm: tolerate being in a Virtual Machine
Date: Mon, 9 Dec 2013 11:34:55 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

Kent,

On Sun, Dec 08, 2013 at 04:48:20PM -0500, Jason Cooper wrote:
> All,
> 
> I just learned about wp-mirror yesterday, so forgive me if this is a
> naive question.
> 
> I just did a clean install of Debian Wheezy to a VM with ~200G.  My
> first problem is that 'wp-mirror --mirror' insists on running hdparm on
> the root LV, which is backed by /dev/vda2...  I worked around this by
> setting:
> 
> (defparameter *whereis-hdparm*               "/bin/true")
> 
> in local.conf.  I don't think this is the proper way to disable this
> option and I'd appreciate some suggestions.  Honestly, I've never seen a
> config file format like this before...
> 
> The second problem is that in working around hdparm, I then get:
> 
> -----asserting-prerequisite-hardware-begin----
> [ ok ]count-cpu
> [ ok ]assert-disk-space-if-large-wikipedia-p
> [ ok ]assert-physical-memory-if-large-wikipedia-p
> [ ok ]assert-partition-free-images
> [....]assert-hdd-write-cache-p
> *** - regexp:regexp-exec: argument nil is not a string
> 
> based on it's use in default.conf, I assume that nil is legitimate
> syntax, so something else must be wrong.  Any idea what could be wrong
> here?  I suspect that this is fallout from my first hack, but I can't be
> sure.

Ok, here's a preliminary patch that works on my system.  I'm currently
pulling the default simple.  I'm submitting this RFC as I'd never seen
lisp before yesterday, and it is definitely a hack (the patch, not lisp
;-) ).  It would be better to check the return value of hdparm directly.

thx,

Jason.

----------8<-------------
commit 21caca022a4627fdd8cb1763e80f97e4534d8732
Author: Jason Cooper <address@hidden>
Date:   Mon Dec 9 11:27:37 2013 -0500

    hdparm: tolerate being in a Virtual Machine
    
    Signed-off-by: Jason Cooper <address@hidden>

diff --git a/wp-mirror-0.6.lisp b/wp-mirror-0.6.lisp
index e14653b..317a0cf 100755
--- a/wp-mirror-0.6.lisp
+++ b/wp-mirror-0.6.lisp
@@ -1869,7 +1869,10 @@ Return four character string."
         ;;                   :  write-caching =  1 (on)
         (line           (fourth lines)))
     ;; confirm that result is the intended one
-    (or (and (regexp:match "off" line) (eql *system-hdd-write-cache* 0))
+    ;; hdparm fails when running in a VM, which causes line = nil
+    ;; in this case, assume the cache is enabled.
+    (or (and (eq           nil   line) (setq line "on"))
+       (and (regexp:match "off" line) (eql *system-hdd-write-cache* 0))
        (and (regexp:match "on"  line) (eql *system-hdd-write-cache* 1)))))
 
 (defun shell-hdparm-write-cache-flush (block-device &key (put nil))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]