- 博客(66)
- 资源 (3)
- 收藏
- 关注
原创 libvirt 中的image cache
在nova/virt/libvirt/driver.py 中的_create_image 会生成instance的镜像,且会调用cache来进行缓存到本地def _create_image(self, context, instance, disk_mapping, injection_info=None, suffix='',
2017-10-31 14:40:19 976
原创 模块API之module_is_live
module_is_live 用于判断模块是否处于活动状态使用的实例如下所示:bool try_module_get(struct module *module){ bool ret = true; if (module) { preempt_disable(); /* Note: here, we can fail to get a reference */ if (li
2017-10-31 14:11:21 485
原创 LocalAPI和API的区别
从nova/conductor/__init__.py中可以看到conductor最终定义了四种classCONF = nova.conf.CONFdef API(*args, **kwargs): use_local = kwargs.pop('use_local', False) if CONF.conductor.use_local or use_local:
2017-10-30 16:00:01 1272
原创 compute中得到image的name
在nova/compute/manager.py 中的class ComputeManager(manager.Manager): def _build_and_run_instance(self, context, instance, image, request_spec): image_name = image.get('name')这里通过image.get得到这个image
2017-10-30 15:41:18 429
原创 模块API之find_module
find_module 函数根据模块的name返回指向这个模块的指针其用法如下: if (mutex_lock_interruptible(&module_mutex) != 0) return -EINTR; mod = find_module(name); if (!mod) { ret = -ENOENT; goto out; } mutex_
2017-10-30 15:17:17 1279
原创 模块API之__module_text_address
__module_text_addres函数根据位于模块代码段的地址,返回这个模块具体例子在kernel/jump_label.c struct module *mod; preempt_disable(); mod = __module_text_address((unsigned long)start); WARN_ON_ONCE(__module_text_address((un
2017-10-28 17:30:08 679
原创 context中包含的内容
在nova/service.py 中通过from nova import context 来导入context.py这样在start函数中就可以通过ctxt = context.get_admin_context()来得到context,那这个context里面到底都包含了啥呢?继续看nova.context.py 中的def get_admin_context(read_deleted="
2017-10-28 15:38:54 1132
原创 模块API之__module_address
在kernel中的__module_address 可以根据一个跟定的内存地址,获得该内存地址所在的门口。例如下面的例子,源码在kernel/jump_lable.c 中jump_label_add_module函数preempt_disable();jlm2->mod = __module_address((unsigned long)key);preempt_enable();可以看
2017-10-27 17:03:30 1336
原创 nova中的glance接口
在nova/image 这个目录下是nova调用glance的接口。首先看class API 这个类这里的glance来自from nova.image import glanceclass API(object): def _get_session_and_image_id(self, context, id_or_uri): return gla
2017-10-27 16:03:29 1042
原创 objdump和addr2line 使用的例子
addr2line:通过地址找symbolobjdump kernel的汇编源码从中可以知道handle_IPI->ipi_cpu_stop->cpu_relax 对应的汇编源码如下:
2017-10-27 14:30:11 2313
原创 通过nova.utils.execute 执行shell命令
下面这段code 其实是执行rm -rf 这个命令,来删除一个路径下的东西 target = libvirt_utils.get_instance_path(instance) + '_resize' if os.path.exists(target): # Deletion can fail over NFS, so retry the
2017-10-25 17:33:41 1579
原创 nova resize时候的确认和取消操作
在执行resize的时候最后会让用户确实是否真的要resize还是要revert当前resize的操作。这种确认操作在在nova api中都有对应的操作先看如果要取消resize的操作。其入口代码在nova/api/openstack/compute/servers.py,方法是_action_revert_resize,如下 @wsgi.response(202) @extensi
2017-10-25 16:27:04 2095 1
原创 在pcie设备中找到pcie的root port
pcie 设备是通过一种树状的方式连接在root port上,有时候需要知道自己连在哪个root port上就可以通过pcie_find_root_port来找到root port。例如下例就是找到root port,然后判断root port是否支持aer功能 struct pci_dev *dev, *rpdev; dev = pci_get_domain_bus_and_slot(ei
2017-10-25 15:51:58 14634
原创 pcie的quirk函数的执行优先级
在drivers/pci/quirks.c 中可以注册函数修复pcie的bug。例如static void quirk_mellanox_tavor(struct pci_dev *dev){ dev->broken_parity_status = 1; /* This device gives false positives */}DECLARE_PCI_FIXUP_FINAL(PCI
2017-10-25 15:44:29 1764
原创 通过periodic_task.periodic_task 实现周期性任务的原理
在nova中可以通过添加@periodic_task.periodic_task 来产生一个周期任务。例如使用默认周期的任务: @periodic_task.periodic_task def _poll_rebooting_instances(self, context): if CONF.reboot_timeout > 0: filt
2017-10-24 17:26:46 6845
原创 numa_node_id是得到当前cpu对应的numa id
在定义CONFIG_USE_PERCPU_NUMA_NODE_ID的时候可以通过static inline int numa_node_id(void){ return raw_cpu_read(numa_node);}得到当前cpu的numa id注意这里的numa_node 是一个per_cpu 变量,其定义如下:DECLARE_PER_CPU(int, numa_node);
2017-10-24 16:15:26 5314
原创 每个cpu代表一个device
在arch/arm64/kernel/setup.c 中的topology_init函数中会为每个cpu注册一个device,每个device都在可以在/sys/devices/system/cpu 这个路径下看到.static int __init topology_init(void){ int i; for_each_possible_cpu(i) { struct cpu *c
2017-10-24 15:37:32 1864
原创 syslog
syslog的配置在/etc/syslog.conf 中,其log保存在/var/log/syslog 中,例如下面就是在syslog中记录的一次ssh登录的例子
2017-10-24 14:32:04 372
原创 libvirt的log在/var/log中
virsh 使用libvirt管理的虚拟机的log在/var/log中,从log中能看到很多虚拟机相关的信息
2017-10-24 14:17:43 2033
原创 ceph log的实现
在src/commin/ceph_context.cc 中有初始化ceph的log模块CephContext::CephContext(uint32_t module_type_, int init_flags_) : nref(1), _conf(new md_config_t(is_daemon(module_type_))), _log(NULL),{ ceph_
2017-10-20 17:15:01 1245
原创 subsys_system_register 会在/sys/devices/system下面建立一个目录
subsys_system_register 会在/sys/devices/system下面建立一个目录,int subsys_system_register(struct bus_type *subsys, const struct attribute_group **groups){ return subsys_register(subsys, groups, &system
2017-10-20 16:08:42 1209
原创 nova resize
resize的入口代码在nova/api/openstack/compute/servers.py,方法是_resize(),如下 def _resize(self, req, instance_id, flavor_id, **kwargs): """Begin the resize process with given instance/flavor."""
2017-10-20 15:31:48 1045 1
原创 从dts中得到电压和电流赋值给opp table
驱动中通过dev_pm_opp_of_add_table来从dts中得到cpu工作的电压和电流,例如如下code ret = dev_pm_opp_of_add_table(dvfs_info->dev); if (ret) { dev_err(dvfs_info->dev, "failed to init OPP table: %d\n", ret); goto err_put_n
2017-10-20 14:48:01 2782 1
原创 通过循环找出一组数据的最大值和最小值的小技巧
通过for循环找到一组数中的最大值和最小值,这里有个小技巧,在初始化的时候要给最小值赋一个最大值,给最大值赋一个最小值。说的有点绕。看下面的code就明白的了这里给最小值赋的是~0表示unsigned long的最大值,这里也是个小技巧给最大值赋值的是0 struct { unsigned long min; unsigned long max; } *uV; for (i =
2017-10-20 14:36:54 13102
原创 zone device是如何决定使用哪个governer的
我们知道调节温度的governer有五种,分别是fair_share/gov_bang_bang/step_wise/user_space/power_allocator。在thermal_init->thermal_register_governors 中我们看到这五种governer其实默认都已经注册给kernel了static int __init thermal_register_g
2017-10-20 14:31:27 1098
原创 在shell中插入expect命令。
#!/bin/bashn=0while :do n=$((n+1)) echo "test count=" $n expect << __EOF set timeout 30 spawn ssh root@192.168.2.195 expect { "(yes
2017-10-19 17:22:02 9772 4
原创 nova update
update的入口代码在nova/api/openstack/compute/servers.py,方法是update(),如下 def update(self, req, id, body): """Update server then pass on to version-specific controller.""" ctxt = req.envir
2017-10-19 16:47:52 834
原创 thermal的cpu cool device
在drivers/thermal/lmx_thermal.c 中的imx_thermal_probe中有注册cpu cool device data->cdev = cpufreq_cooling_register(cpu_present_mask); if (IS_ERR(data->cdev)) { ret = PTR_ERR(data->cdev); if (ret != -EP
2017-10-19 16:08:44 1738
原创 nova中通过FixedIntervalLoopingCall实现的定时任务
在nova/virt/libvirt/driver.py 中通过FixedIntervalLoopingCall 实现了一个定时任务 def _wait_for_destroy(expected_domid): """Called at an interval until the VM is gone.""" # NOTE(vish)
2017-10-19 14:44:11 1202
原创 如何在kernel中得到cpu的电压和频率
可以参考下面的code拿到cpu的电压和频率static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device, u32 capacitance){ struct power_table *power_table; struct dev_pm_opp *opp; struct device
2017-10-19 14:31:01 4277
原创 让instance使用hugepage
首先判断host是否支持hugepage如果没有的/dev/hugepages的话,要手动建这样就可以通过设置flavor会这通过指定image来使用hugepage通过image来设定openstack image set [IMAGE_ID] --property hw_mem_page_size=1GB可见都是通过设置flavor和image中的metada
2017-10-18 16:36:27 634
原创 nova 根据conf动态加载虚拟化驱动
在nova/virt/driver.py 中的ComputeDriver 类中定义了load_compute_driver来加载用于虚拟化的driver。def load_compute_driver(virtapi, compute_driver=None): """Load a compute driver module. Load the compute driver m
2017-10-18 16:07:45 1263
原创 nova create
instance的入口代码在nova/api/openstack/compute/servers.py,方法是create(),如下 def create(self, req, body): """Creates a new server for a given user.""" (instances, resv_id) = self.compute
2017-10-18 15:51:41 816
原创 从neutron/setup.cfg 的[entry_points] 可以知道组成neutron个个子系统的源码路径
neutron代码的配置文件在neutron/setup.cfg 中[metadata]name = neutron从metadata 看出网络部分的name是neutron可以看出l3的代码路径是neutron/cmd/eventlet/agents/l3入口函数是main.neutron-l3-agent = neutron.cmd.eventlet.agents.l3:main类
2017-10-17 15:26:28 1007
原创 查看mysql和rabbitmq的log
从下图可以看出在controller机器的/var/log/ 目录下放着个个组件的log。也包括libvirt/mysql/rabbitmq/dashboard的log,假如系统有什么问题,可以查看/var/log/下的个个log
2017-10-16 16:54:41 981
原创 通过加log debug nova
通过在create 函数中加log因为我们的log是加在nova-api中,因此重启nova-api然后在create 虚拟机的时候就可以看到自己加的log
2017-10-16 16:32:25 864
EDK_II_UserManual_0_7.pdf
2017-03-24
EDK_II Module Writer_s Guide_0_7.pdf
2017-03-24
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人