3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
19 self.by_path = '/dev/disk/by-path'
21 self.hwtype = 'Generic'
22 self.vendor_name = 'Generic'
23 self.productfamily = 'Unknown'
24 self.disk_map = {'os' : '', 'osd': []}
26 def get_disk_by_name(self, name):
27 return self.disk_map.get(name, None)
31 return self.vendor_name
34 def product_family(self):
35 return self.productfamily
41 def match(self, info):
43 for key, value in self.matches.iteritems():
44 #Exact match has more value than regexp
45 if info.get(key, '') == value:
46 criteria_matches += 10
47 elif re.match(value, info.get(key, '')):
53 return criteria_matches