Revision 3b80eb2c lib/hypervisor/hv_fake.py

b/lib/hypervisor/hv_fake.py
61 61
    @return: tuple of (name, id, memory, vcpus, stat, times)
62 62

  
63 63
    """
64
    file_name = "%s/%s" % (self._ROOT_DIR, instance_name)
64
    file_name = self._InstanceFile(instance_name)
65 65
    if not os.path.exists(file_name):
66 66
      return None
67 67
    try:
......
88 88
    data = []
89 89
    for file_name in os.listdir(self._ROOT_DIR):
90 90
      try:
91
        fh = open(self._ROOT_DIR + "/" + file_name, "r")
91
        fh = open(utils.PathJoin(self._ROOT_DIR, file_name), "r")
92 92
        inst_id = "-1"
93 93
        memory = 0
94 94
        vcpus = 1
......
107 107
        raise errors.HypervisorError("Failed to list instances: %s" % err)
108 108
    return data
109 109

  
110

  
111
  def _InstanceFile(self, instance_name):
110
  @classmethod
111
  def _InstanceFile(cls, instance_name):
112 112
    """Compute the instance file for an instance name.
113 113

  
114 114
    """
115
    return self._ROOT_DIR + "/%s" % instance_name
115
    return utils.PathJoin(cls._ROOT_DIR, instance_name)
116 116

  
117 117
  def _IsAlive(self, instance_name):
118 118
    """Checks if an instance is alive.

Also available in: Unified diff