mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
Storage debug and scratch files in ~/.cache/virt-manager (bz 693028)
This commit is contained in:
parent
7a23ece986
commit
0b58badfc1
@ -144,8 +144,8 @@ cloning the original guest.
|
||||
=item -d, --debug
|
||||
|
||||
Print debugging information to the terminal when running the install process.
|
||||
The debugging information is also stored in C<$HOME/.virtinst/virt-clone.log>
|
||||
even if this parameter is omitted.
|
||||
The debugging information is also stored in
|
||||
C<~/.cache/virt-manager/virt-clone.log> even if this parameter is omitted.
|
||||
|
||||
=back
|
||||
|
||||
|
@ -1346,8 +1346,8 @@ Only print fatal error messages.
|
||||
=item -d, --debug
|
||||
|
||||
Print debugging information to the terminal when running the install process.
|
||||
The debugging information is also stored in C<$HOME/.virtinst/virt-install.log>
|
||||
even if this parameter is omitted.
|
||||
The debugging information is also stored in
|
||||
C<~/.cache/virt-manager/virt-install.log> even if this parameter is omitted.
|
||||
|
||||
=back
|
||||
|
||||
|
@ -37,7 +37,7 @@ Specify the hypervisor connection C<URI>
|
||||
=item --debug
|
||||
|
||||
List debugging output to the console (normally this is only logged in
|
||||
~/.virt-manager/virt-manager.log). This function implies --no-fork.
|
||||
~/.cache/virt-manager/virt-manager.log). This function implies --no-fork.
|
||||
|
||||
=item --no-fork
|
||||
|
||||
|
@ -147,11 +147,7 @@ def setupLogging(appname, debug_stdout, do_quiet, cli_app=True):
|
||||
global quiet
|
||||
quiet = do_quiet
|
||||
|
||||
dirname = "~/.virtinst"
|
||||
if appname == "virt-manager":
|
||||
dirname = "~/.virt-manager"
|
||||
|
||||
vi_dir = os.path.expanduser(dirname)
|
||||
vi_dir = util.get_cache_dir()
|
||||
if not os.access(vi_dir, os.W_OK):
|
||||
if os.path.exists(vi_dir):
|
||||
raise RuntimeError("No write access to directory %s" % vi_dir)
|
||||
|
@ -479,7 +479,7 @@ def make_scratchdir(conn, hvtype):
|
||||
if (not scratch or
|
||||
not os.path.exists(scratch) or
|
||||
not os.access(scratch, os.W_OK)):
|
||||
scratch = os.path.expanduser("~/.virtinst/boot")
|
||||
scratch = os.path.join(get_cache_dir(), "boot")
|
||||
if not os.path.exists(scratch):
|
||||
os.makedirs(scratch, 0751)
|
||||
|
||||
@ -500,3 +500,19 @@ def pretty_bytes(val):
|
||||
return "%2.2f GB" % (val / (1024.0 * 1024.0 * 1024.0))
|
||||
else:
|
||||
return "%2.2f MB" % (val / (1024.0 * 1024.0))
|
||||
|
||||
|
||||
def get_cache_dir():
|
||||
ret = ""
|
||||
try:
|
||||
# We don't want to depend on glib for virt-install
|
||||
from gi.repository import GLib # pylint: disable=E0611
|
||||
ret = GLib.get_user_cache_dir()
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
if not ret:
|
||||
ret = os.environ.get("XDG_CACHE_HOME")
|
||||
if not ret:
|
||||
ret = os.path.expanduser("~/.cache")
|
||||
return os.path.join(ret, "virt-manager")
|
||||
|
Loading…
Reference in New Issue
Block a user