cmdlib: Extract instance query related functionality
[ganeti-local] / lib / bdev.py
index 080880c..b1e1ef9 100644 (file)
@@ -1,7 +1,7 @@
 #
 #
 
-# Copyright (C) 2006, 2007, 2010, 2011, 2012 Google Inc.
+# Copyright (C) 2006, 2007, 2010, 2011, 2012, 2013 Google Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -184,7 +184,9 @@ def _CheckFileStoragePath(path, allowed):
       break
   else:
     raise errors.FileStoragePathError("Path '%s' is not acceptable for file"
-                                      " storage" % path)
+                                      " storage. A possible fix might be to add"
+                                      " it to /etc/ganeti/file-storage-paths"
+                                      " on all nodes." % path)
 
 
 def _LoadAllowedFileStoragePaths(filename):
@@ -255,7 +257,7 @@ class BlockDev(object):
       an attached instance (lvcreate)
     - attaching of a python instance to an existing (real) device
 
-  The second point, the attachement to a device, is different
+  The second point, the attachment to a device, is different
   depending on whether the device is assembled or not. At init() time,
   we search for a device with the same unique_id as us. If found,
   good. It also means that the device is already assembled. If not,
@@ -642,7 +644,7 @@ class LogicalVolume(BlockDev):
 
   @staticmethod
   def _GetVolumeInfo(lvm_cmd, fields):
-    """Returns LVM Volumen infos using lvm_cmd
+    """Returns LVM Volume infos using lvm_cmd
 
     @param lvm_cmd: Should be one of "pvs", "vgs" or "lvs"
     @param fields: Fields to return
@@ -836,7 +838,7 @@ class LogicalVolume(BlockDev):
     """
     self.attached = False
     result = utils.RunCmd(["lvs", "--noheadings", "--separator=,",
-                           "--units=m", "--nosuffix",
+                           "--units=k", "--nosuffix",
                            "-olv_attr,lv_kernel_major,lv_kernel_minor,"
                            "vg_extent_size,stripes", self.dev_path])
     if result.failed:
@@ -1029,10 +1031,12 @@ class LogicalVolume(BlockDev):
       if not self.Attach():
         _ThrowError("Can't attach to LV during Grow()")
     full_stripe_size = self.pe_size * self.stripe_count
+    # pe_size is in KB
+    amount *= 1024
     rest = amount % full_stripe_size
     if rest != 0:
       amount += full_stripe_size - rest
-    cmd = ["lvextend", "-L", "+%dm" % amount]
+    cmd = ["lvextend", "-L", "+%dk" % amount]
     if dryrun:
       cmd.append("--test")
     # we try multiple algorithms since the 'best' ones might not have