Skip to content

Commit 5f36a7a

Browse files
author
gitlab
committed
Merge branch 'master' into 'master'
merge 3.10.0-xinchuang to master See merge request zstackio/zstack-utility!343
2 parents bb0290a + 4981a99 commit 5f36a7a

File tree

19 files changed

+134
-97
lines changed

19 files changed

+134
-97
lines changed

baremetalpxeserver/ansible/baremetalpxeserver.py

+18-14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
baremetalpxeserver_pushgateway_root="/var/lib/zstack/baremetal/"
2828
baremetalpxeserver_pushgateway_persistence="/var/lib/zstack/baremetal/persistence.data"
2929
baremetalpxeserver_pushgateway_port=9093
30+
update_packages = 'false'
3031

3132
# get parameter from shell
3233
parser = argparse.ArgumentParser(description='Deploy baremetal pxeserver agent to host')
@@ -109,7 +110,8 @@
109110
mips64el_ns10 = "dnsmasq nginx vsftpd nmap net-tools"
110111
dep_pkg = eval("%s_%s" % (host_arch, releasever))
111112
if zstack_repo != 'false':
112-
command = ("pkg_list=`rpm -q %s | grep \"not installed\" | awk '{ print $2 }'` && for pkg in $pkg_list; do yum --disablerepo=* --enablerepo=%s install -y $pkg; done;") % (dep_pkg, zstack_repo)
113+
command = ("pkg_list=`rpm -q %s | grep \"not installed\" | awk '{ print $2 }'` && for pkg in %s; do yum --disablerepo=* --enablerepo=%s install -y $pkg; done;") % \
114+
(dep_pkg, dep_pkg if update_packages == 'true' else '$pkg_list', zstack_repo)
113115
run_remote_command(command, host_post_info)
114116
else:
115117
for pkg in ["dnsmasq", "nginx", "vsftpd", "syslinux", "nmap"]:
@@ -129,9 +131,10 @@
129131
command = """
130132
basearch=`uname -m`;releasever=`awk '{print $3}' /etc/zstack-release`;
131133
[ -f /opt/zstack-dvd/$basearch/$releasever/GPL ] || exit 1;
132-
mkdir -p /var/lib/zstack/baremetal/{dnsmasq,ftp/{ks,zstack-dvd,scripts},tftpboot/{zstack,pxelinux.cfg},vsftpd} /var/log/zstack/baremetal/;
134+
mkdir -p /var/lib/zstack/baremetal/{dnsmasq,ftp/{ks,zstack-dvd,scripts},tftpboot/{zstack/$basearch,pxelinux.cfg},vsftpd} /var/log/zstack/baremetal/;
133135
cp -f /usr/share/syslinux/pxelinux.0 /var/lib/zstack/baremetal/tftpboot/;
134-
cp -f /opt/zstack-dvd/$basearch/$releasever/images/pxeboot/{vmlinuz,initrd.img} /var/lib/zstack/baremetal/tftpboot/zstack/;
136+
cp -f /opt/zstack-dvd/$basearch/$releasever/EFI/BOOT/grubaa64.efi /var/lib/zstack/baremetal/tftpboot/;
137+
cp -f /opt/zstack-dvd/$basearch/$releasever/images/pxeboot/{vmlinuz,initrd.img} /var/lib/zstack/baremetal/tftpboot/zstack/$basearch/;
135138
grep 'zstack-dvd' /etc/fstab || echo "/opt/zstack-dvd/$basearch/$releasever /var/lib/zstack/baremetal/ftp/zstack-dvd none defaults,bind 0 0" >> /etc/fstab;
136139
mount -a;
137140
"""
@@ -188,11 +191,12 @@
188191
copy(copy_arg, host_post_info)
189192

190193
# name: copy shellinaboxd
194+
shellinaboxd_name = "shellinaboxd_{}".format(host_arch)
191195
VSFTPD_ROOT_PATH = "/var/lib/zstack/baremetal/ftp"
192196
copy_arg = CopyArg()
193-
copy_arg.src = "%s/shellinaboxd" % file_root
194-
copy_arg.dest = VSFTPD_ROOT_PATH
195197
copy_arg.args = "force=yes"
198+
copy_arg.src = "%s/%s" % (file_root, shellinaboxd_name)
199+
copy_arg.dest = os.path.join(VSFTPD_ROOT_PATH, "shellinaboxd")
196200
copy(copy_arg, host_post_info)
197201

198202
# name: copy noVNC.tar.gz
@@ -202,13 +206,12 @@
202206
copy_arg.args = "force=yes"
203207
copy(copy_arg, host_post_info)
204208

205-
if host_arch != "mips64el":
206-
# name: copy zwatch-vm-agent
207-
zwatch_vm_agent_name = "zwatch-vm-agent{}".format('' if host_arch == 'x86_64' else '_' + host_arch)
208-
copy_arg = CopyArg()
209-
copy_arg.src = os.path.join(kvm_file_root, zwatch_vm_agent_name)
210-
copy_arg.dest = os.path.join(VSFTPD_ROOT_PATH, 'zwatch-vm-agent')
211-
copy(copy_arg, host_post_info)
209+
# name: copy zwatch-vm-agent
210+
zwatch_vm_agent_name = "zwatch-vm-agent{}".format('' if host_arch == 'x86_64' else '_' + host_arch)
211+
copy_arg = CopyArg()
212+
copy_arg.src = os.path.join(kvm_file_root, zwatch_vm_agent_name)
213+
copy_arg.dest = os.path.join(VSFTPD_ROOT_PATH, 'zwatch-vm-agent')
214+
copy(copy_arg, host_post_info)
212215

213216
copy_arg = CopyArg()
214217
copy_arg.src = "%s/agent_version" % file_root
@@ -235,10 +238,11 @@
235238
copy(copy_arg, host_post_info)
236239

237240
# name: copy pushgateway
241+
pushgateway_name = "pushgateway_%s" % host_arch
238242
copy_arg = CopyArg()
239-
copy_arg.src = "%s/pushgateway" % file_root
240-
copy_arg.dest = baremetalpxeserver_pushgateway_root
241243
copy_arg.args = "mode=a+x"
244+
copy_arg.src = "%s/%s" % (file_root, pushgateway_name)
245+
copy_arg.dest = "%s/pushgateway" % baremetalpxeserver_pushgateway_root
242246
copy(copy_arg, host_post_info)
243247

244248
run_remote_command(("systemctl restart pxeServerPushGateway"), host_post_info)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../kvmagent/ansible/pushgateway_aarch64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../kvmagent/ansible/pushgateway_mips64el
Binary file not shown.

baremetalpxeserver/baremetalpxeserver/pxeserveragent.py

+50-9
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ class PxeServerAgent(object):
111111
NGINX_TERMINAL_PROXY_CONF_PATH = "/etc/nginx/conf.d/terminal/"
112112
NOVNC_INSTALL_PATH = BAREMETAL_LIB_PATH + "noVNC/"
113113
NOVNC_TOKEN_PATH = NOVNC_INSTALL_PATH + "tokens/"
114+
ARM_GRUB_CFG = TFTPBOOT_PATH + "grub.cfg"
114115

115116
NMAP_BROADCAST_DHCP_DISCOVER_PATH = "/usr/share/nmap/scripts/broadcast-dhcp-discover.nse"
116117

@@ -223,7 +224,10 @@ def init(self, req):
223224
dhcp_conf = """interface={DHCP_INTERFACE}
224225
port=0
225226
bind-interfaces
226-
dhcp-boot=pxelinux.0
227+
dhcp-match=x86PC, option:client-arch, 0 #LEGACLY x86
228+
dhcp-match=AARCH64_EFI, option:client-arch, 11 #EFI AARCH64
229+
dhcp-boot=tag:x86PC,pxelinux.0
230+
dhcp-boot=tag:AARCH64_EFI,grubaa64.efi
227231
enable-tftp
228232
tftp-root={TFTPBOOT_PATH}
229233
log-facility={DNSMASQ_LOG_PATH}
@@ -265,7 +269,7 @@ def init(self, req):
265269
listen_ipv6=YES
266270
pam_service_name=vsftpd
267271
userlist_enable=YES
268-
tcp_wrappers=YES
272+
#tcp_wrappers=YES
269273
xferlog_enable=YES
270274
xferlog_std_format=YES
271275
xferlog_file={VSFTPD_LOG_PATH}
@@ -278,13 +282,24 @@ def init(self, req):
278282
pxelinux_cfg = """default zstack_baremetal
279283
prompt 0
280284
label zstack_baremetal
281-
kernel zstack/vmlinuz
285+
kernel zstack/x86_64/vmlinuz
282286
ipappend 2
283-
append initrd=zstack/initrd.img devfs=nomount ksdevice=bootif ks=ftp://{PXESERVER_DHCP_NIC_IP}/ks/inspector_ks.cfg vnc
287+
append initrd=zstack/x86_64/initrd.img devfs=nomount ksdevice=bootif ks=ftp://{PXESERVER_DHCP_NIC_IP}/ks/inspector_ks.cfg vnc
284288
""".format(PXESERVER_DHCP_NIC_IP=pxeserver_dhcp_nic_ip)
285289
with open(self.PXELINUX_DEFAULT_CFG, 'w') as f:
286290
f.write(pxelinux_cfg)
287291

292+
#init grub.cfg for arm
293+
grub_cfg = """set timeout=10
294+
menuentry 'ZStack Get Hardware Info' {
295+
linux zstack/aarch64/vmlinuz ip=dhcp inst.repo=ftp://%s/zstack-dvd inst.ks=ftp://%s/ks/inspector_ks.cfg \
296+
console=tty0 console=ttyS0,115200n8 rd.debug rd.udev.debug systemd.log_level=debug
297+
initrd zstack/aarch64/initrd.img
298+
}
299+
""" % (pxeserver_dhcp_nic_ip, pxeserver_dhcp_nic_ip)
300+
with open(self.ARM_GRUB_CFG, 'w') as f:
301+
f.write(grub_cfg)
302+
288303
# init inspector_ks.cfg
289304
ks_tmpl_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ks_tmpl')
290305
with open("%s/inspector_ks_tmpl" % ks_tmpl_path, 'r') as fr:
@@ -366,10 +381,10 @@ def ping(self, req):
366381

367382
# DETECT ROGUE DHCP SERVER
368383
cmd = json_object.loads(req[http.REQUEST_BODY])
369-
if platform.machine() == "x86_64":
370-
ret, output = bash_ro("nmap -sU -p67 --script broadcast-dhcp-discover -e %s | grep 'Server Identifier'" % cmd.dhcpInterface)
371-
if ret == 0:
372-
raise PxeServerError("rogue dhcp server[IP:%s] detected" % output.strip().split(' ')[-1])
384+
mac = self._get_mac_address(cmd.dhcpInterface)
385+
ret, output = bash_ro("nmap -sU -p67 --script broadcast-dhcp-discover --script-args broadcast-dhcp-discover.mac=%s -e %s | grep 'Server Identifier'" % (mac, cmd.dhcpInterface))
386+
if ret == 0:
387+
raise PxeServerError("rogue dhcp server[IP:%s] detected" % output.strip().split(' ')[-1])
373388

374389
# make sure pxeserver is running if it's Enabled
375390
if cmd.enabled:
@@ -468,6 +483,23 @@ def _create_pxelinux_cfg(self, cmd):
468483
with open(pxe_cfg_file, 'w') as f:
469484
f.write(pxelinux_cfg)
470485

486+
# init grub.cfg-MAC for arm
487+
pxe_cfg_file_arm = os.path.join(self.TFTPBOOT_PATH, "grub.cfg-01-" + cmd.pxeNicMac)
488+
pxeserver_dhcp_nic_ip = self._get_ip_address(cmd.dhcpInterface).strip()
489+
grub_cfg = """set default="0"
490+
set timeout=10
491+
menuentry 'ZStack Baremetal' {{
492+
linux {IMAGEUUID}/vmlinuz ip=dhcp inst.repo=ftp://{PXESERVER_DHCP_NIC_IP}/{IMAGEUUID}/ inst.ks=ftp://{PXESERVER_DHCP_NIC_IP}/ks/{KS_CFG_NAME} \
493+
console=tty0 console=ttyS0,115200n8 rd.debug rd.udev.debug systemd.log_level=debug
494+
initrd {IMAGEUUID}/initrd.img
495+
}}
496+
""".format(IMAGEUUID=cmd.imageUuid,
497+
PXESERVER_DHCP_NIC_IP=pxeserver_dhcp_nic_ip,
498+
KS_CFG_NAME=ks_cfg_name
499+
)
500+
with open(pxe_cfg_file_arm, 'w') as f:
501+
f.write(grub_cfg)
502+
471503
def _create_preconfiguration_file(self, cmd):
472504
# in case user didn't seleted a preconfiguration template etc.
473505
cmd.preconfigurationContent = cmd.preconfigurationContent if cmd.preconfigurationContent != "" else """
@@ -969,12 +1001,18 @@ def delete_bm_configs(self, req):
9691001
bash_r("rm -f %s/*" % self.NGINX_TERMINAL_PROXY_CONF_PATH)
9701002
if os.path.exists(self.NOVNC_TOKEN_PATH):
9711003
bash_r("rm -f %s/*" % self.NOVNC_TOKEN_PATH)
1004+
if os.path.exists(self.TFTPBOOT_PATH):
1005+
bash_r("rm -f %s/grub.cfg*" % self.TFTPBOOT_PATH)
9721006
else:
9731007
mac_as_name = cmd.pxeNicMac.replace(":", "-")
9741008
pxe_cfg_file = os.path.join(self.PXELINUX_CFG_PATH, "01-" + mac_as_name)
9751009
if os.path.exists(pxe_cfg_file):
9761010
os.remove(pxe_cfg_file)
9771011

1012+
arm_pxe_cfg_file = os.path.join(self.TFTPBOOT_PATH, "grub.cfg-01-" + mac_as_name)
1013+
if os.path.exists(arm_pxe_cfg_file):
1014+
os.remove(arm_pxe_cfg_file)
1015+
9781016
ks_cfg_file = os.path.join(self.KS_CFG_PATH, mac_as_name)
9791017
if os.path.exists(ks_cfg_file):
9801018
os.remove(ks_cfg_file)
@@ -1098,7 +1136,10 @@ def download_imagestore(self, req):
10981136
# SUSE
10991137
ret5 = bash_r("cp %s %s" % (os.path.join(mount_path, "boot/*/loader/linux"), os.path.join(vmlinuz_path, "vmlinuz")))
11001138
ret6 = bash_r("cp %s %s" % (os.path.join(mount_path, "boot/*/loader/initrd"), os.path.join(vmlinuz_path, "initrd.img")))
1101-
if (ret1 != 0 or ret2 != 0) and (ret3 != 0 or ret4 != 0) and (ret5 != 0 or ret6 != 0):
1139+
# ns10
1140+
ret7 = bash_r("cp %s %s" % (os.path.join(mount_path, "images/pxeboot/vmlinuz"), os.path.join(vmlinuz_path, "vmlinuz")))
1141+
ret8 = bash_r("cp %s %s" % (os.path.join(mount_path, "images/pxeboot/initrd.img"), os.path.join(vmlinuz_path, "initrd.img")))
1142+
if (ret1 != 0 or ret2 != 0) and (ret3 != 0 or ret4 != 0) and (ret5 != 0 or ret6 != 0) and (ret7 != 0 or ret8 != 0):
11021143
raise PxeServerError("failed to copy vmlinuz and initrd.img from image[uuid:%s] to baremetal tftp server" % cmd.imageUuid)
11031144

11041145
logger.info("successfully downloaded image[uuid:%s] and mounted it" % cmd.imageUuid)

imagestorebackupstorage/ansible/imagestorebackupstorage.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@
7474
else:
7575
src_pkg_imagestorebackupstorage = "zstack-store.bin"
7676
src_pkg_exporter = "collectd_exporter"
77-
dst_pkg_imagestorebackupstorage = "zstack-store.bin"
77+
78+
if client != "true":
79+
dst_pkg_imagestorebackupstorage = "zstack-store.bin"
80+
else:
81+
dst_pkg_imagestorebackupstorage = "zstack-store-client.bin"
7882
dst_pkg_exporter = "collectd_exporter"
7983

8084
# include zstacklib.py
@@ -109,6 +113,7 @@
109113
aarch64_ns10 = "qemu-img fuse-sshfs nmap collectd"
110114
mips64el_ns10 = "qemu-img-ev fuse-sshfs nmap collectd"
111115
x86_64_ns10 = "qemu-img fuse-sshfs nmap collectd"
116+
112117
qemu_pkg = eval("%s_%s" % (host_arch, releasever))
113118
# skip these packages
114119
_skip_list = re.split(r'[|;,\s]\s*', skip_packages)
@@ -191,8 +196,7 @@
191196
run_remote_command("sudo chown -R -H --dereference %s: %s" % (remote_user, fs_rootpath), host_post_info)
192197

193198
# name: restart image store server
194-
server = client != "true" or run_remote_command("pkill -0 zstore", host_post_info, return_status=True, return_output=False)
195-
if server:
199+
if client != "true":
196200
# integrate zstack-store with init.d
197201
run_remote_command("/bin/cp -f /usr/local/zstack/imagestore/bin/zstack-imagestorebackupstorage /etc/init.d/", host_post_info)
198202
if distro in RPM_BASED_OS:

installation/install.sh

+7
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ DEFAULT_MN_PORT='8080'
122122
MN_PORT="$DEFAULT_MN_PORT"
123123

124124
DEFAULT_UI_PORT='5000'
125+
RESOLV_CONF='/etc/resolv.conf'
125126

126127
BASEARCH=`uname -m`
127128
ZSTACK_RELEASE=''
@@ -859,6 +860,11 @@ zstack hard nproc $nr_open
859860
EOF
860861
}
861862

863+
do_check_resolv_conf(){
864+
[ ! -f $RESOLV_CONF ] && touch $RESOLV_CONF
865+
chmod a+r $RESOLV_CONF
866+
}
867+
862868
do_config_ansible(){
863869
mkdir -p /etc/ansible
864870
mkdir -p /var/log/ansible
@@ -953,6 +959,7 @@ You can also add '-q' to installer, then Installer will help you to remove it.
953959
fi
954960
do_enable_sudo
955961
do_config_limits
962+
do_check_resolv_conf
956963
pass
957964
}
958965

kvmagent/ansible/agent_version

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
zwatch-vm-agent=4.0.0
22
md5-zwatch-vm-agent=43a93d10db8b4661bab173ea788bc502
3+
md5-zwatch-vm-agent_aarch64=aa19a4f6ef9929ac64505117ac0277aa
4+
md5-zwatch-vm-agent_mips64el=e580f8982e140ceb76a915771178f522

kvmagent/ansible/kvm.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def install_release_on_host(is_rpm):
144144
# copy and install zstack-release
145145
if is_rpm:
146146
src_pkg = '/opt/zstack-dvd/{0}/{1}/Packages/zstack-release-{1}-1.el7.zstack.noarch.rpm'.format(host_arch, releasever)
147-
install_cmd = "rpm -q zstack-release || yum install -y /opt/zstack-release-{}-1.el7.zstack.noarch.rpm".format(releasever)
147+
install_cmd = "rpm -q zstack-release || yum --disablerepo=* install -y /opt/zstack-release-{}-1.el7.zstack.noarch.rpm".format(releasever)
148148
else:
149149
src_pkg = '/opt/zstack-dvd/{0}/{1}/Packages/zstack-release_{1}_all.deb'.format(host_arch, releasever)
150150
install_cmd = "dpkg -l zstack-release || dpkg -i /opt/zstack-release_{}_all.deb".format(releasever)
@@ -224,6 +224,12 @@ def rpm_based_install():
224224
net-tools nfs-utils nmap openssh-clients OpenIPMI-modalias pciutils python-pyudev pv rsync sed \
225225
qemu-kvm-ev smartmontools sshpass usbutils vconfig wget audit dnsmasq tuned collectd-virt"
226226

227+
x86_64_ns10 = "bridge-utils chrony conntrack-tools cyrus-sasl-md5 device-mapper-multipath expect ipmitool iproute ipset \
228+
usbredir-server iputils iscsi-initiator-utils libvirt libvirt-client libvirt-python lighttpd lsof \
229+
net-tools nfs-utils nmap openssh-clients OpenIPMI pciutils pv rsync sed \
230+
smartmontools sshpass usbutils vconfig wget audit dnsmasq \
231+
qemu collectd-virt storcli edk2.git-ovmf-x64 python2-pyudev collectd-disk"
232+
227233
# handle zstack_repo
228234
if zstack_repo != 'false':
229235
common_dep_list = eval("%s_%s" % (host_arch, releasever))
@@ -304,9 +310,8 @@ def rpm_based_install():
304310
host_post_info.post_label = "ansible.shell.disable.service"
305311
host_post_info.post_label_param = "firewalld"
306312
run_remote_command(command, host_post_info)
307-
308-
if host_arch == "aarch64" and releasever == "ns10":
309-
# name: enable NetworkManager in arm ns10
313+
if host_arch in ["aarch64", "x86_64"] and releasever == "ns10":
314+
# name: enable NetworkManager in arm and x86 ns10
310315
service_status("NetworkManager", "state=started enabled=yes", host_post_info, ignore_error=True)
311316
else:
312317
# name: disable NetworkManager in RHEL7 and Centos7
@@ -522,7 +527,7 @@ def do_network_config():
522527
elif distro in DEB_BASED_OS:
523528
copy_arg = CopyArg()
524529
copy_arg.src = "%s/ip6tables" % file_root
525-
copy_arg.dest = "/sbin/ip6tables"
530+
copy_arg.dest = "/etc/iptables/rules.v6"
526531
copy(copy_arg, host_post_info)
527532
command = "ip6tables-save"
528533
run_remote_command(command, host_post_info)

kvmagent/ansible/vm-tools.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ if [[ ! ${AGENT_VERSION} =~ ${BIN_NAME} ]]; then
3030
exit 1
3131
fi
3232

33-
echo "downloading ${BIN_NAME}"
34-
curl http://169.254.169.254/${BIN_NAME} --silent -O
33+
echo "downloading zwatch-vm-agent"
34+
curl http://169.254.169.254/zwatch-vm-agent --silent -O
3535

36-
BIN_MD5=`md5sum ${BIN_NAME} | awk '{print $1}'`
36+
BIN_MD5=`md5sum zwatch-vm-agent | awk '{print $1}'`
3737
if [[ ! ${AGENT_VERSION} =~ "md5-${BIN_NAME}=${BIN_MD5}" ]]; then
38-
echo "there was an error downloading the ${BIN_NAME}, check md5sum fail"
38+
echo "there was an error downloading the zwatch-vm-agent, check md5sum fail"
3939
exit 1
4040
fi
4141

@@ -45,12 +45,12 @@ version=`echo $AGENT_VERSION | awk -F '=' '{print $2}' | awk '{print $1}'`
4545
echo "stopping zwatch-vm-agent"
4646
service zwatch-vm-agent stop
4747

48-
echo "install ${BIN_NAME}"
49-
chmod +x ${BIN_NAME}
50-
./${BIN_NAME} -i
48+
echo "install zwatch-vm-agent"
49+
chmod +x zwatch-vm-agent
50+
./zwatch-vm-agent -i
5151
if [ $? != 0 ]; then
5252
curl -H "Content-Type: application/json" -H "commandpath: /host/zwatchInstallResult" -X POST -d "{\"vmInstanceUuid\": \"${vmInstanceUuid}\", \"version\": \"${InstallFailed}\"}" http://169.254.169.254/host/zwatchInstallResult
53-
echo "install ${BIN_NAME} fail"
53+
echo "install zwatch-vm-agent fail"
5454
exit 1
5555
fi
5656

-1.86 MB
Binary file not shown.
17.2 MB
Binary file not shown.

kvmagent/kvmagent/plugins/kvm_v2v_plugin.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,16 @@ def init(self, req):
359359
spath = getRealStoragePath(cmd.storagePath)
360360
linux.mkdir(spath)
361361

362+
if not os.path.isdir("/etc/exports.d"):
363+
linux.mkdir("/etc/exports.d")
362364
with open('/etc/exports.d/zs-v2v.exports', 'w') as f:
363365
f.write("{} *(rw,sync,no_root_squash)\n".format(spath))
364366

365367
shell.check_run('systemctl restart nfs-server')
366368

367369
if spath is not None:
368370
fstype = shell.call("""stat -f -c '%T' {}""".format(spath)).strip()
369-
if fstype not in [ "xfs", "ext2", "ext3", "ext4", "jfs", "btrfs" ]:
371+
if fstype not in [ "xfs", "ext2", "ext3", "ext4", "jfs", "btrfs", "ext2/ext3" ]:
370372
raise Exception("unexpected fstype '{}' on '{}'".format(fstype, cmd.storagePath))
371373

372374
return jsonobject.dumps(rsp)

kvmagent/kvmagent/plugins/prometheus.py

+3
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ def start_prometheus_exporter(self, req):
345345
@in_bash
346346
def start_collectd(cmd):
347347
conf_path = os.path.join(os.path.dirname(cmd.binaryPath), 'collectd.conf')
348+
ingore_block_device = "/:sd[c-e]/" if kvmagent.os_arch in ["mips64el", "aarch64"] else "//"
348349

349350
conf = '''Interval {{INTERVAL}}
350351
# version {{VERSION}}
@@ -410,6 +411,7 @@ def start_collectd(cmd):
410411
HostnameFormat name
411412
PluginInstanceFormat name
412413
BlockDevice "/:hd[a-z]/"
414+
BlockDevice "{{IGNORE}}"
413415
IgnoreSelected true
414416
ExtraStats "vcpu memory"
415417
</Plugin>
@@ -425,6 +427,7 @@ def start_collectd(cmd):
425427
'INTERVAL': cmd.interval,
426428
'INTERFACES': interfaces,
427429
'VERSION': cmd.version,
430+
'IGNORE': ingore_block_device
428431
})
429432

430433
need_restart_collectd = False

0 commit comments

Comments
 (0)