modify the versionfile address to /var/lib/daisy/versionfile/os
Change-Id: I009158ff0c74ef29e81b74d15010d899d1383b09
This commit is contained in:
parent
1332f1a2de
commit
ad50ac29c0
@ -597,7 +597,7 @@ class OSInstall():
|
||||
host_detail['os_version_id'])
|
||||
if version_info:
|
||||
os_version = version_info['name']
|
||||
os_version_file = "/var/lib/daisy/" + os_version
|
||||
os_version_file = "/var/lib/daisy/versionfile/os/" + os_version
|
||||
if os_version_file:
|
||||
test_os_version_exist = 'test -f %s' % os_version_file
|
||||
try:
|
||||
@ -1042,7 +1042,7 @@ def _os_thread_bin(req, host_ip, host_id, update_file, update_script):
|
||||
daisy_cmn.subprocess_call(cmd, fp)
|
||||
cmd = 'clush -S -b -w %s "rm -rf /home/daisy_update/*"' % (host_ip,)
|
||||
daisy_cmn.subprocess_call(cmd, fp)
|
||||
cmd = 'clush -S -w %s -c /var/lib/daisy/tecs/%s\
|
||||
cmd = 'clush -S -w %s -c /var/lib/daisy/versionfile/os/%s\
|
||||
/var/lib/daisy/os/%s \
|
||||
--dest=/home/daisy_update' % (
|
||||
host_ip, update_file, update_script,)
|
||||
@ -1140,7 +1140,7 @@ def _cmp_os_version(new_os_file, old_os_version,
|
||||
"/usr/sbin/" % (password, target_host_ip, shell_file)]
|
||||
daisy_cmn.run_scrip(scripts)
|
||||
|
||||
cmp_script = "tfg_showversion /var/lib/daisy/tecs/%s %s"\
|
||||
cmp_script = "tfg_showversion /var/lib/daisy/versionfile/os/%s %s"\
|
||||
% (new_os_file, old_os_version)
|
||||
try:
|
||||
result = subprocess.check_output(cmp_script, shell=True,
|
||||
|
@ -919,7 +919,8 @@ class TestHostsApiConfig(test.TestCase):
|
||||
u'id': u'4b6970c5-ef1d-4599-a1d7-70175a888e6d',
|
||||
u'description': u'default',
|
||||
u'hwm_ip': None,
|
||||
u'os_version_file': "/var/lib/daisy/redhat123.iso",
|
||||
u'os_version_file': "/var/lib/daisy/versionfile"
|
||||
"/os/redhat123.iso",
|
||||
u'dmi_uuid': u'03000200-0400-0500-0006-000700080009',
|
||||
u'hwm_id': None,
|
||||
u'pci_high_cpuset': None,
|
||||
@ -1121,7 +1122,7 @@ class TestHostsApiConfig(test.TestCase):
|
||||
|
||||
def test_get_os_version_when_host_meta_has_os_version_file(self):
|
||||
host_meta = set_host_meta()
|
||||
host_meta['os_version'] = '/var/lib/daisy/redhat123.iso'
|
||||
host_meta['os_version'] = '/var/lib/daisy/versionfile/os/redhat123.iso'
|
||||
orig_host_meta = set_orig_host_meta()
|
||||
os_version = self.controller._get_os_version(host_meta,
|
||||
orig_host_meta)
|
||||
@ -1131,16 +1132,19 @@ class TestHostsApiConfig(test.TestCase):
|
||||
host_meta = set_host_meta()
|
||||
orig_host_meta = set_orig_host_meta()
|
||||
orig_host_meta['os_version_id'] = None
|
||||
orig_host_meta['os_version_file'] = '/var/lib/daisy/redhat321.iso'
|
||||
orig_host_meta['os_version_file'] = '/var/lib/daisy/' \
|
||||
'versionfile/os/redhat321.iso'
|
||||
os_version = self.controller._get_os_version(host_meta,
|
||||
orig_host_meta)
|
||||
self.assertEqual(orig_host_meta['os_version_file'], os_version)
|
||||
|
||||
def test_get_os_version_when_host_and_orig_host_has_os_version_file(self):
|
||||
host_meta = set_host_meta()
|
||||
host_meta['os_version'] = '/var/lib/daisy/redhat123.iso'
|
||||
host_meta['os_version'] = '/var/lib/daisy/versionfile/os' \
|
||||
'/redhat123.iso'
|
||||
orig_host_meta = set_orig_host_meta()
|
||||
orig_host_meta['os_version_id'] = '/var/lib/daisy/redhat321.iso'
|
||||
orig_host_meta['os_version_id'] = '/var/lib/daisy/versionfile' \
|
||||
'/os/redhat321.iso'
|
||||
os_version = self.controller._get_os_version(host_meta,
|
||||
orig_host_meta)
|
||||
self.assertEqual(host_meta['os_version'], os_version)
|
||||
@ -1238,7 +1242,7 @@ class TestHostsApiConfig(test.TestCase):
|
||||
self.controller._check_os_version = mock.Mock(return_value=None)
|
||||
mock_do_request.side_effect = self.fake_do_request
|
||||
update_host = self.controller.update_host(req, id, host_meta)
|
||||
self.assertEqual('/var/lib/daisy/redhat123.iso',
|
||||
self.assertEqual('/var/lib/daisy/versionfile/os/redhat123.iso',
|
||||
update_host['host_meta']['os_version_file'])
|
||||
|
||||
@mock.patch("daisy.api.v1.hosts.Controller.get_host_meta_or_404")
|
||||
|
@ -2,7 +2,6 @@
|
||||
# Copyright ZTE
|
||||
# Daisy Tools Dashboard
|
||||
#
|
||||
import os
|
||||
from django.http import HttpResponse
|
||||
from django.views.decorators.csrf import csrf_exempt
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
@ -111,22 +110,6 @@ def get_version_path():
|
||||
return getattr(settings, 'DAISY_VER_PATH', "/var/lib/daisy/kolla/")
|
||||
|
||||
|
||||
def get_version_files():
|
||||
ver_path = get_version_path()
|
||||
ver_files = []
|
||||
ver_file_format = ['.iso']
|
||||
try:
|
||||
items = os.listdir(ver_path)
|
||||
for item in items:
|
||||
full_path = os.path.join(ver_path, item)
|
||||
if os.path.isfile(full_path) \
|
||||
and os.path.splitext(full_path)[1] in ver_file_format:
|
||||
ver_files.append(item)
|
||||
except Exception, e:
|
||||
ver_files = []
|
||||
return ver_files
|
||||
|
||||
|
||||
def get_format_memory_size(str_memory):
|
||||
memory_size = None
|
||||
compose = str_memory.strip().split(" ")
|
||||
@ -239,7 +222,6 @@ class IndexView(tables.DataTableView):
|
||||
context["current_cluster"] = \
|
||||
self.get_current_cluster(context['clusters'],
|
||||
context["cluster_id"])
|
||||
context['version_files'] = get_version_files()
|
||||
return context
|
||||
|
||||
|
||||
|
@ -90,7 +90,11 @@
|
||||
var url = "/dashboard/environment/version/get_appointed_system_versions/";
|
||||
do_post(url, JSON.stringify({'file_type': $("#file_type").val()}), update_correspond_file_option);
|
||||
}
|
||||
check_disk_space_and_file_exist();
|
||||
|
||||
if ($("#local_file").attr('checked') == 'checked')
|
||||
check_disk_space_and_file_exist();
|
||||
else
|
||||
$("#server_file").click();
|
||||
});
|
||||
|
||||
$(".file_position").on("click", function(){
|
||||
@ -104,8 +108,11 @@
|
||||
$(".form-server-file").removeClass("hide");
|
||||
|
||||
// 获取服务端文件信息
|
||||
var params = {
|
||||
"file_type": $("#file_type").val()
|
||||
}
|
||||
var url = "/dashboard/environment/version/get_headstrong_server_files/";
|
||||
do_post(url, JSON.stringify({}), update_server_file_option);
|
||||
do_post(url, JSON.stringify(params), update_server_file_option);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -30,7 +30,11 @@ LOG = logging.getLogger(__name__)
|
||||
def get_version_path(file_type=None):
|
||||
if file_type and file_type == "zenic":
|
||||
return getattr(settings, 'DAISY_ZENIC_VER_PATH',
|
||||
"/var/lib/daisy/zenic/")
|
||||
"/var/lib/daisy/versionfile/zenic/")
|
||||
if file_type and file_type in ['redhat 6.5', 'redhat 7.0', 'suse',
|
||||
'centos 7.0', 'windows', 'vplat']:
|
||||
return getattr(settings, 'DAISY_OS_VER_PATH',
|
||||
"/var/lib/daisy/versionfile/os/")
|
||||
return getattr(settings, 'DAISY_VER_PATH',
|
||||
"/var/lib/daisy/kolla/")
|
||||
|
||||
@ -385,7 +389,8 @@ def get_appointed_system_versions(request):
|
||||
|
||||
|
||||
def get_headstrong_server_files(request):
|
||||
version_path = get_version_path()
|
||||
data = json.loads(request.body)
|
||||
version_path = get_version_path(data["file_type"])
|
||||
file_names = get_version_file_names(request)
|
||||
|
||||
server_file_types = [".bin", ".iso"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user