Exemplo n.º 1
0
 def create_host(id, cpu, mem, disk, constraint_set, overcommit):
     from psim.universe import Universe
     networks = [constraint
                 for constraint in constraint_set
                 if constraint.type == RCT.NETWORK]
     datastores = [constraint
                   for constraint in constraint_set
                   if constraint.type == RCT.DATASTORE]
     if not networks:
         # create a dummy network so host handler doesn't throw warnings
         networks.append(ResourceConstraint(RCT.NETWORK, ["VM Network"]))
     local_ds_name = Universe.add_local_ds(id, disk)
     datastores.append(ResourceConstraint(RCT.DATASTORE, [local_ds_name]))
     host = Host(id, networks, datastores, cpu, mem, disk, overcommit)
     return host