+def _Tags_PUT(kind, tags, name=""):
+ """Helper function to set tags.
+
+ """
+ cl = luxi.Client()
+ return cl.SubmitJob([ganeti.opcodes.OpAddTags(kind=kind, name=name,
+ tags=tags)])
+
+
+def _Tags_DELETE(kind, tags, name=""):
+ """Helper function to delete tags.
+
+ """
+ cl = luxi.Client()
+ return cl.SubmitJob([ganeti.opcodes.OpDelTags(kind=kind, name=name,
+ tags=tags)])
+
+
+def MapBulkFields(itemslist, fields):
+ """Map value to field name in to one dictionary.
+
+ @param itemslist: a list of items values
+ @param fields: a list of items names
+
+ @return: a list of mapped dictionaries
+
+ """
+ items_details = []
+ for item in itemslist:
+ mapped = MapFields(fields, item)
+ items_details.append(mapped)
+ return items_details
+
+
+def MakeParamsDict(opts, params):
+ """Makes params dictionary out of a option set.
+
+ This function returns a dictionary needed for hv or be parameters. But only
+ those fields which provided in the option set. Takes parameters frozensets
+ from constants.
+
+ @type opts: dict
+ @param opts: selected options
+ @type params: frozenset
+ @param params: subset of options
+ @rtype: dict
+ @return: dictionary of options, filtered by given subset.
+
+ """
+ result = {}
+
+ for p in params:
+ try:
+ value = opts[p]
+ except KeyError:
+ continue
+ result[p] = value
+
+ return result
+
+