Revision 9dfa16fc

b/doc/hooks.rst
581 581
VM_CAPABLE
582 582
  Whether the node can host instances.
583 583

  
584
INSTANCE_TAGS
585
  A space-delimited list of the instance's tags.
586

  
584 587
NODE_NAME
585 588
  The target node of this operation (not the node on which the hook
586 589
  runs).
b/lib/cmdlib.py
861 861

  
862 862
def _BuildInstanceHookEnv(name, primary_node, secondary_nodes, os_type, status,
863 863
                          memory, vcpus, nics, disk_template, disks,
864
                          bep, hvp, hypervisor_name):
864
                          bep, hvp, hypervisor_name, tags):
865 865
  """Builds instance related env variables for hooks
866 866

  
867 867
  This builds the hook environment from individual variables.
......
893 893
  @param hvp: the hypervisor parameters for the instance
894 894
  @type hypervisor_name: string
895 895
  @param hypervisor_name: the hypervisor for the instance
896
  @type tags: list
897
  @param tags: list of instance tags as strings
896 898
  @rtype: dict
897 899
  @return: the hook environment for this instance
898 900

  
......
940 942

  
941 943
  env["INSTANCE_DISK_COUNT"] = disk_count
942 944

  
945
  if not tags:
946
    tags = []
947

  
948
  env["INSTANCE_TAGS"] = " ".join(tags)
949

  
943 950
  for source, kind in [(bep, "BE"), (hvp, "HV")]:
944 951
    for key, value in source.items():
945 952
      env["INSTANCE_%s_%s" % (kind, key)] = value
......
1003 1010
    'bep': bep,
1004 1011
    'hvp': hvp,
1005 1012
    'hypervisor_name': instance.hypervisor,
1013
    'tags': instance.tags,
1006 1014
  }
1007 1015
  if override:
1008 1016
    args.update(override)
......
8057 8065
      bep=self.be_full,
8058 8066
      hvp=self.hv_full,
8059 8067
      hypervisor_name=self.op.hypervisor,
8068
      tags=self.op.tags,
8060 8069
    ))
8061 8070

  
8062 8071
    return env

Also available in: Unified diff