1. raw raw格式是最简单,什么都没有,所以叫raw格式。连头文件都没有,就是一个直接给虚拟机进行读写的文件。raw不支持动态增长空间,必须一开始就指定空间大小。所以相当的耗费磁盘空间。但是对于支持稀疏文件的文件系统(如ext4)而言,这方面并不突出。ext4下默认创建的文件就是稀疏文件,所以不要做什么额外的工作。用 du -sh 文件名 可以查看文件的实际大小。也就是说,不管磁盘空间有多大,运行下面的指令没有任何问题: qemu-img create -f raw test.img 10000G raw镜像格式是虚拟机种I/O性能最好的一种格式,大家在使用时都会和raw进行参照,性能越接近raw的越好。但是raw没有任何其他功能。对于稀疏文件的出现,像qcow这一类的运行时分配空间的镜像就没有任何优势了。
[root@linux-node1 ~]# ps aux | grep dns
nobody 1343 0.0 0.0 15544 964 ? S Feb06 0:00 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
root 1344 0.0 0.0 15516 300 ? S Feb06 0:00 /sbin/dnsmasq --conf-file=/var/lib/libvirt/dnsmasq/default.conf --leasefile-ro --dhcp-script=/usr/libexec/libvirt_leaseshelper
root 7701 0.0 0.0 112648 968 pts/0 S+ 00:36 0:00 grep --colour=auto dns
[root@linux-node1 ~]# cat /var/lib/libvirt/dnsmasq/default.conf
##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
##OVERWRITTEN AND LOST. Changes to this configuration should be made using:
## virsh net-edit default
## or other application using the libvirt API.
##
## dnsmasq conf file created by libvirt
strict-order
pid-file=/var/run/libvirt/network/default.pid
except-interface=lo
bind-dynamic
interface=virbr0
dhcp-range=192.168.122.2,192.168.122.254
dhcp-no-override
dhcp-lease-max=253
dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
[root@linux-node1 ~]# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.5254002430ec yes virbr0-nic
vnet0
[root@linux-node1 ~]# brctl addbr br0
[root@linux-node1 ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000000000000 no
virbr0 8000.5254002430ec yes virbr0-nic
vnet0
# 下面操作过程中会断网。我们可以写成脚本形式执行
[root@linux-node1 ~]# cd /tools
[root@linux-node1 ~]# vim edit-net.sh
[root@linux-node1 ~]# cat edit-net.sh
brctl addif br0 eth0
ip addr del dev eth0 192.168.145.133/24
ifconfig br0 192.168.145.133/24 up
route add default gw 192.168.145.2
[root@linux-node1 ~]# sh edit-net.sh &
# 可以看到eth0上就没有ip地址了,同时eth0桥接到了br0上了
[root@linux-node1 ~]# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.000c29a71724 no eth0
virbr0 8000.5254002430ec yes virbr0-nic
vnet0
本篇文章重点说明什么是函数柯里化,这个语法现象的背后动机是什么,有什么样的应用场景,以及与部分应用函数(Partial Applied Function)之间的联系 1. 什么是柯里化函数
A way to write functions with multiple parameter lists. For instance
def f(x: Int)(y: Int) is a
ApplicationContext能读取多个Bean定义文件,方法是:
ApplicationContext appContext = new ClassPathXmlApplicationContext(
new String[]{“bean-config1.xml”,“bean-config2.xml”,“bean-config3.xml”,“bean-config4.xml
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information re
参考了
http://zhedahht.blog.163.com/blog/static/25411174201142733927831/
但是用java来实现有一个问题。
由于Java无法像C那样“传递参数的地址,函数返回时能得到参数的值”,唯有新建一个辅助类:AuxClass
import ljn.help.*;
public class BalancedBTree {
BeanUtils.copyProperties VS PropertyUtils.copyProperties
作为两个bean属性copy的工具类,他们被广泛使用,同时也很容易误用,给人造成困然;比如:昨天发现同事在使用BeanUtils.copyProperties copy有integer类型属性的bean时,没有考虑到会将null转换为0,而后面的业