Skip to content

Commit

Permalink
allow multiple product strings to be matched for flash disk detection
Browse files Browse the repository at this point in the history
  • Loading branch information
byxorna committed Mar 13, 2014
1 parent d5a28e0 commit a827b6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions app/util/config/LshwConfig.scala
Expand Up @@ -6,13 +6,15 @@ object LshwConfig extends Configurable {
override val referenceConfigFilename = "lshw_reference.conf"

def flashProduct = getString("flashProduct", "flashmax").toLowerCase
def flashProducts = Set(flashProduct) ++ getStringSet("flashProducts", Set[String]()).map(s => s.toLowerCase)
def flashSize = getLong("flashSize", 1400000000000L)
def includeDisabledCpu = getBoolean("includeDisabledCpu", false)
def includeEmptySocket = getBoolean("includeEmptySocket", false)
def defaultNicCapacity = getString("defaultNicCapacity")(ConfigValue.Optional)

override protected def validateConfig() {
flashProduct
flashProducts
flashSize
includeDisabledCpu
includeEmptySocket
Expand Down
2 changes: 1 addition & 1 deletion app/util/parsers/LshwParser.scala
Expand Up @@ -100,7 +100,7 @@ class LshwParser(txt: String) extends CommonParser[LshwRepresentation](txt) {
case size => ByteStorageUnit(size.toLong)
}
Disk(size, _type, asset.description, asset.product, asset.vendor)
case n if (n \ "@class" text) == "memory" && (n \ "product" text).toLowerCase.contains(LshwConfig.flashProduct) =>
case n if (n \ "@class" text) == "memory" && LshwConfig.flashProducts.exists(s => (n \ "product" text).toLowerCase.contains(s)) =>
val asset = getAsset(n)
val size = ByteStorageUnit(LshwConfig.flashSize)
Disk(size, Disk.Type.Flash, asset.description, asset.product, asset.vendor)
Expand Down
2 changes: 1 addition & 1 deletion conf/dev_base.conf
Expand Up @@ -199,7 +199,7 @@ ipmi {
}

lshw {
flashProduct="flashmax"
flashProducts = ["fusionio", "tachION", "flashmax"]
flashSize="1400000000000"

# For assets whose NIC capacity cannot be determined
Expand Down

0 comments on commit a827b6b

Please sign in to comment.