Fixes "Can't determine storage size if instance_path is share"
This patch fixes this problem by using the get_disk_info method from diskutils that works for both UNC paths and normal paths. Closes-Bug: #1563877 Change-Id: I99666e90c2a1fcac42d95c74deefafe8a94dccd8
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
Management class for host operations.
|
||||
"""
|
||||
import datetime
|
||||
import os
|
||||
import platform
|
||||
import time
|
||||
|
||||
@@ -58,6 +57,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class HostOps(object):
|
||||
def __init__(self):
|
||||
self._diskutils = utilsfactory.get_diskutils()
|
||||
self._hostutils = utilsfactory.get_hostutils()
|
||||
self._pathutils = pathutils.PathUtils()
|
||||
self._vmutils = utilsfactory.get_vmutils()
|
||||
@@ -100,9 +100,10 @@ class HostOps(object):
|
||||
free_mem_mb = free_mem_kb // 1024
|
||||
return (total_mem_mb, free_mem_mb, total_mem_mb - free_mem_mb)
|
||||
|
||||
def _get_local_hdd_info_gb(self):
|
||||
drive = os.path.splitdrive(self._pathutils.get_instances_dir())[0]
|
||||
(size, free_space) = self._hostutils.get_volume_info(drive)
|
||||
def _get_storage_info_gb(self):
|
||||
instances_dir = self._pathutils.get_instances_dir()
|
||||
(size, free_space) = self._diskutils.get_disk_capacity(
|
||||
instances_dir)
|
||||
|
||||
total_gb = size // units.Gi
|
||||
free_gb = free_space // units.Gi
|
||||
@@ -170,7 +171,7 @@ class HostOps(object):
|
||||
|
||||
(total_hdd_gb,
|
||||
free_hdd_gb,
|
||||
used_hdd_gb) = self._get_local_hdd_info_gb()
|
||||
used_hdd_gb) = self._get_storage_info_gb()
|
||||
|
||||
cpu_info = self._get_cpu_info()
|
||||
cpu_topology = cpu_info['topology']
|
||||
|
||||
Reference in New Issue
Block a user