Revision 01121d61 lib/hypervisor.py

b/lib/hypervisor.py
347 347
      config.write("extra = '%s'\n" % extra_args)
348 348
    # just in case it exists
349 349
    utils.RemoveFile("/etc/xen/auto/%s" % instance.name)
350
    f = open("/etc/xen/%s" % instance.name, "w")
351
    f.write(config.getvalue())
352
    f.close()
350
    try:
351
      f = open("/etc/xen/%s" % instance.name, "w")
352
      try:
353
        f.write(config.getvalue())
354
      finally:
355
        f.close()
356
    except IOError, err:
357
      raise errors.OpExecError("Cannot write Xen instance confile"
358
                               " file /etc/xen/%s: %s" % (instance.name, err))
353 359
    return True
354 360

  
355 361
  @staticmethod

Also available in: Unified diff