- 10 3月, 2011 4 次提交
-
-
由 Eric Blake 提交于
* src/qemu/qemu_audit.h (qemuAuditCgroupMajor) (qemuAuditCgroupPath): Add parameter. * src/qemu/qemu_audit.c (qemuAuditCgroupMajor) (qemuAuditCgroupPath): Add 'acl=rwm' to cgroup audit entries. * src/qemu/qemu_cgroup.c: Update clients. * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Likewise.
-
由 Eric Blake 提交于
Adding audit points showed that we were granting too much privilege to qemu; it should not need any mknod rights to recreate any devices. On the other hand, lxc should have all device privileges. The solution is adding a flag parameter. This also lets us restrict write access to read-only disks. * src/util/cgroup.h (virCgroup*Device*): Adjust prototypes. * src/util/cgroup.c (virCgroupAllowDevice) (virCgroupAllowDeviceMajor, virCgroupAllowDevicePath) (virCgroupDenyDevice, virCgroupDenyDeviceMajor) (virCgroupDenyDevicePath): Add parameter. * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update clients. * src/lxc/lxc_controller.c (lxcSetContainerResources): Likewise. * src/qemu/qemu_cgroup.c: Likewise. (qemuSetupDiskPathAllow): Also, honor read-only disks.
-
由 Eric Blake 提交于
Also add ATTRIBUTE_NONNULL markers. * src/qemu/qemu_audit.h: The pattern qemuDomainXXXAudit is inconsistent; prefer qemuAuditXXX instead. * src/qemu/qemu_audit.c: Reflect the renames. * src/qemu/qemu_driver.c: Likewise. * src/qemu/qemu_hotplug.c: Likewise. * src/qemu/qemu_migration.c: Likewise. * src/qemu/qemu_process.c: Likewise.
-
由 Eric Blake 提交于
Device names can be manipulated, so it is better to also log the major/minor device number corresponding to the cgroup ACL changes that libvirt made. This required some refactoring of the relatively new qemu cgroup audit code. Also, qemuSetupChardevCgroup was only auditing on failure, not success. * src/qemu/qemu_audit.h (qemuDomainCgroupAudit): Delete. (qemuAuditCgroup, qemuAuditCgroupMajor, qemuAuditCgroupPath): New prototypes. * src/qemu/qemu_audit.c (qemuDomainCgroupAudit): Rename... (qemuAuditCgroup): ...and drop a parameter. (qemuAuditCgroupMajor, qemuAuditCgroupPath): New functions, to allow listing device major/minor in audit. (qemuAuditGetRdev): New helper function. * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Adjust callers. * src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow) (qemuSetupHostUsbDeviceCgroup, qemuSetupCgroup) (qemuTeardownDiskPathDeny): Likewise. (qemuSetupChardevCgroup): Likewise, fixing missing audit.
-
- 09 3月, 2011 2 次提交
-
-
由 Cole Robinson 提交于
virRun gives pretty useful error output, let's not overwrite it unless there is a good reason. Some places were providing more information about what the commands were _attempting_ to do, however that's usually less useful from a debugging POV than what actually happened.
-
由 Hu Tao 提交于
* src/qemu/qemu_driver.c: qemuDomainUpdateDeviceFlags() is not disk specific as the message suggests
-
- 08 3月, 2011 2 次提交
-
-
由 Wen Congyang 提交于
Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
-
由 Wen Congyang 提交于
The way to detach a USB disk is the same as that to detach a SCSI disk. Rename this function and we can use it to detach a USB disk. Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
-
- 02 3月, 2011 1 次提交
-
-
由 Eric Blake 提交于
qemudDomainSaveImageStartVM was evil - it closed the incoming fd argument on some, but not all, code paths, without informing the caller about that action. No wonder that this resulted in double-closes: https://bugzilla.redhat.com/show_bug.cgi?id=672725 * src/qemu/qemu_driver.c (qemudDomainSaveImageStartVM): Alter signature, to avoid double-close. (qemudDomainRestore, qemudDomainObjRestore): Update callers.
-
- 25 2月, 2011 5 次提交
-
-
由 Daniel P. Berrange 提交于
Relax the restriction that the hash table key must be a string by allowing an arbitrary hash code generator + comparison func to be provided * util/hash.c, util/hash.h: Allow any pointer as a key * internal.h: Include stdbool.h as standard. * conf/domain_conf.c, conf/domain_conf.c, conf/nwfilter_params.c, nwfilter/nwfilter_gentech_driver.c, nwfilter/nwfilter_gentech_driver.h, nwfilter/nwfilter_learnipaddr.c, qemu/qemu_command.c, qemu/qemu_driver.c, qemu/qemu_process.c, uml/uml_driver.c, xen/xm_internal.c: s/char */void */ in hash callbacks
-
由 Eric Blake 提交于
* src/qemu/qemu_audit.h (qemuDomainMemoryAudit) (qemuDomainVcpuAudit): New prototypes. * src/qemu/qemu_audit.c (qemuDomainResourceAudit) (qemuDomainMemoryAudit, qemuDomainVcpuAudit): New functions. (qemuDomainStartAudit): Call as appropriate. * src/qemu/qemu_driver.c (qemudDomainSetMemory) (qemudDomainHotplugVcpus): Likewise.
-
由 Eric Blake 提交于
* src/qemu/qemu_audit.h (qemuDomainCgroupAudit): New prototype. * src/qemu/qemu_audit.c (qemuDomainCgroupAudit): Implement it. * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Add audit. * src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow) (qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup) (qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.
-
由 Eric Blake 提交于
* src/qemu/qemu_cgroup.h (struct qemuCgroupData): New helper type. (qemuSetupDiskPathAllow, qemuSetupChardevCgroup) (qemuTeardownDiskPathDeny): Drop unneeded prototypes. (qemuSetupDiskCgroup, qemuTeardownDiskCgroup): Adjust prototype. * src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow, qemuSetupChardevCgroup) (qemuTeardownDiskPathDeny): Mark static and use new type. (qemuSetupHostUsbDeviceCgroup): Use new type. (qemuSetupDiskCgroup): Alter signature. (qemuSetupCgroup): Adjust caller. * src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice) (qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice): Likewise. * src/qemu/qemu_driver.c (qemudDomainAttachDevice) (qemuDomainUpdateDeviceFlags): Likewise.
-
由 Eric Blake 提交于
* src/util/cgroup.c (virCgroupAllowDevicePath) (virCgroupDenyDevicePath): Don't fail with EINVAL for non-devices. * src/qemu/qemu_driver.c (qemudDomainSaveFlag): Update caller. * src/qemu/qemu_cgroup.c (qemuSetupDiskPathAllow) (qemuSetupChardevCgroup, qemuSetupHostUsbDeviceCgroup) (qemuSetupCgroup, qemuTeardownDiskPathDeny): Likewise.
-
- 24 2月, 2011 3 次提交
-
-
由 Daniel P. Berrange 提交于
Remove the <stdbool.h> header from all source files / headers and just put it into internal.h * src/internal.h: Add <stdbool.h>
-
由 Jiri Denemark 提交于
This is done for two reasons: - we are getting very close to 64 flags which is the maximum we can use with unsigned long long - by using LL constants in enum we already violates C99 constraint that enum values have to fit into int
-
由 Jiri Denemark 提交于
The new name complies more with the fact that it contains a set of qemuCapsFlags.
-
- 23 2月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Leak introduced in commit d6623003. * src/qemu/qemu_driver.c (qemuSecurityInit): Avoid leak on failure. * src/security/security_stack.c (virSecurityStackClose): Avoid leaking component drivers.
-
- 17 2月, 2011 3 次提交
-
-
由 Daniel P. Berrange 提交于
The introduction of the v3 migration protocol, along with support for migration cookies, will significantly expand the size of the migration code. Move it all to a separate file to make it more manageable The functions are not moved 100%. The API entry points remain in the main QEMU driver, but once the public virDomainPtr is resolved to the internal virDomainObjPtr, all following code is moved. This will allow the new v3 API entry points to call into the same shared internal migration functions * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add qemuDomainFormatXML helper method * src/qemu/qemu_driver.c: Remove all migration code * src/qemu/qemu_migration.c, src/qemu/qemu_migration.h: Add all migration code.
-
由 Daniel P. Berrange 提交于
Move the qemudStartVMDaemon and qemudShutdownVMDaemon methods into a separate file, renaming them to qemuProcessStart, qemuProcessStop. All helper methods called by these are also moved & renamed to match * src/Makefile.am: Add qemu_process.c/.h * src/qemu/qemu_command.c: Add qemuDomainAssignPCIAddresses * src/qemu/qemu_command.h: Add VNC port min/max * src/qemu/qemu_domain.c, src/qemu/qemu_domain.h: Add domain event queue helpers * src/qemu/qemu_driver.c, src/qemu/qemu_driver.h: Remove all QEMU process startup/shutdown functions * src/qemu/qemu_process.c, src/qemu/qemu_process.h: Add all QEMU process startup/shutdown functions
-
由 Osier Yang 提交于
"qemudDomainSaveFlag" goto wrong label "endjob", which will cause error when security manager trying to restore label (regression). As it's more reasonable to check if vm is shutoff immediately, and return right away if it is, remove the checking in "qemudDomainSaveFlag", and add checking in "qemudDomainSave". * src/qemu/qemu_driver.c
-
- 16 2月, 2011 1 次提交
-
-
由 Eric Blake 提交于
The processWatchdogEvent fix is real, although it can only trigger on OOM, since bad things happen if doCoreDump is called with a NULL pathname argument. The other fixes silence clang, but aren't a real bug because virReportErrorHelper tolerates a NULL format string even though *printf does not. * src/qemu/qemu_driver.c (processWatchdogEvent): Exit on OOM. (qemuDomainIsActive, qemuDomainIsPersistent, qemuDomainIsUpdated): Provide valid message.
-
- 15 2月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
Commit 9962e406 introduced a problem where if the VM failed to startup, it would not be correctly cleaned up. Amongst other things the SELinux security label would not be removed, which prevents the VM from ever starting again. The virDomainIsActive() check at the start of qemudShutdownVMDaemon checks for vm->def->id not being -1. By moving the assignment of the VM id to the start of qemudStartVMDaemon, we can ensure cleanup will occur on failure * src/qemu/qemu_driver.c: Move initialization of 'vm->def->id' so that qemudShutdownVMDaemon() will process the shutdown
-
- 12 2月, 2011 1 次提交
-
-
由 Matthias Bolte 提交于
Also use VIR_ERR_OPERATION_INVALID instead of VIR_ERR_NO_SUPPORT, as the operation could succeed when the cgroup controller was mounted.
-
- 11 2月, 2011 1 次提交
-
-
由 Wen Congyang 提交于
QEMUD_CMD_FLAG_PCI_MULTIBUS should be set in the function qemuCapsExtractVersionInfo() The flag QEMUD_CMD_FLAG_PCI_MULTIBUS is used in the function qemuBuildDeviceAddressStr(). All callers get qemuCmdFlags by the function qemuCapsExtractVersionInfo() except that testCompareXMLToArgvFiles() in qemuxml2argvtest.c. So we should set QEMUD_CMD_FLAG_PCI_MULTIBUS in the function qemuCapsExtractVersionInfo() instead of qemuBuildCommandLine() because the function qemuBuildCommandLine() does not be called when we attach a pci device. tests: set QEMUD_CMD_FLAG_PCI_MULTIBUS in testCompareXMLToArgvFiles() set QEMUD_CMD_FLAG_PCI_MULTIBUS before calling qemuBuildCommandLine() as the flags is not set by qemuCapsExtractVersionInfo(). Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
-
- 10 2月, 2011 1 次提交
-
-
由 Daniel P. Berrange 提交于
Quite a few hosts don't have cgroups mounted and so see warnings from libvirt logged, which then cause bug reports, etc. Reduce the log level to INFO so they're not visible by default * src/qemu/qemu_driver.c: Reduce log level for cgroups
-
- 09 2月, 2011 2 次提交
-
-
由 Eric Blake 提交于
* src/qemu/qemu_driver.c (qemuGetSysinfo): New function. (qemuDriver): Install it.
-
由 Eric Blake 提交于
* src/driver.h (virDrvGetSysinfo): New typedef. (_virDriver): New callback member. * src/esx/esx_driver.c (esxDriver): Add stub for driver. * src/lxc/lxc_driver.c (lxcDriver): Likewise. * src/opennebula/one_driver.c (oneDriver): Likewise. * src/openvz/openvz_driver.c (openvzDriver): Likewise. * src/phyp/phyp_driver.c (phypDriver): Likewise. * src/qemu/qemu_driver.c (qemuDriver): Likewise. * src/remote/remote_driver.c (remote_driver): Likewise. * src/test/test_driver.c (testDriver): Likewise. * src/uml/uml_driver.c (umlDriver): Likewise. * src/vbox/vbox_tmpl.c (Driver): Likewise. * src/vmware/vmware_driver.c (vmwareDriver): Likewise. * src/xen/xen_driver.c (xenUnifiedDriver): Likewise. * src/xenapi/xenapi_driver.c (xenapiDriver): Likewise.
-
- 04 2月, 2011 2 次提交
-
-
由 Jiri Denemark 提交于
Currently users who want to use virDomainQemuMonitorCommand() API or it's virsh equivalent has to use the same protocol as libvirt uses for communication to qemu. Since the protocol is QMP with current qemu and HMP much more usable for humans, one ends up typing something like the following: virsh qemu-monitor-command DOM \ '{"execute":"human-monitor-command","arguments":{"command-line":"info kvm"}}' which is not a very convenient way of debugging qemu. This patch introduces --hmp option to qemu-monitor-command, which says that the provided command is in HMP. If libvirt uses QMP to talk with qemu, the command will automatically be converted into QMP. So the example above is simplified to just virsh qemu-monitor-command --hmp DOM "info kvm" Also the result is converted from {"return":"kvm support: enabled\r\n"} to just plain HMP: kvm support: enabled If libvirt talks to qemu in HMP, --hmp flag is obviously a noop.
-
由 Eric Blake 提交于
* src/qemu/qemu_driver.c (qemudShutdownVMDaemon): Check that vm is still active. Reported by Wen Congyang as follows: Steps to reproduce this bug: 1. use gdb to debug libvirtd, and set breakpoint in the function qemuConnectMonitor() 2. start a vm, and the libvirtd will be stopped in qemuConnectMonitor() 3. kill -STOP $(cat /var/run/libvirt/qemu/<domain>.pid) 4. continue to run libvirtd in gdb, and libvirtd will be blocked in the function qemuMonitorSetCapabilities() 5. kill -9 $(cat /var/run/libvirt/qemu/<domain>.pid) Here is log of the qemu: ========= LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin ... char device redirected to /dev/pts/3 2011-01-27 09:38:48.101: shutting down 2011-01-27 09:41:26.401: shutting down ========= The vm is shut down twice. I do not know whether this behavior has side effect, but I think we should shutdown the vm only once.
-
- 31 1月, 2011 1 次提交
-
-
由 Osier Yang 提交于
* src/qemu/qemu_driver.c
-
- 28 1月, 2011 4 次提交
-
-
由 Daniel P. Berrange 提交于
The refactoring of QEMU command startup was comitted with a couple of VIR_WARN lines left in from debugging. * src/qemu/qemu_driver.c: Remove log warning lines
-
由 Daniel P. Berrange 提交于
When qemuMonitorSetCapabilities() fails, there is no need to call qemuMonitorClose(), because the caller will already see the error code and tear down the entire VM. The extra call to qemuMonitorClose resulted in a double-free due to it removing a ref count prematurely. * src/qemu/qemu_driver.c: Remove premature close of monitor
-
由 Eric Blake 提交于
Regression in commit caa805ea let a lot of bad messages slip in. * cfg.mk (msg_gen_function): Fix function name. * src/qemu/qemu_cgroup.c (qemuRemoveCgroup): Fix fallout from 'make syntax-check'. * src/qemu/qemu_driver.c (qemudDomainGetInfo) (qemuDomainWaitForMigrationComplete, qemudStartVMDaemon) (qemudDomainSaveFlag, qemudDomainAttachDevice) (qemuDomainUpdateDeviceFlags): Likewise. * src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice) (qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice): Likewise.
-
由 Wen Congyang 提交于
Steps to reproduce this bug: 1. service libvirtd start 2. virsh start <domain> 3. kill -STOP $(cat /var/run/libvirt/qemu/<domain>.pid) 4. service libvirtd restart 5. kill -9 $(cat /var/run/libvirt/qemu/<domain>.pid) Then libvirtd will core dump or be in deadlock state. Make sure that json is built into libvirt and the version of qemu is newer than 0.13.0. The reason of libvirtd cores dump is that: We add vm->refs when we alloc the memory, and decrease it in the function qemuHandleMonitorEOF() in other thread. We add vm->refs in the function qemuConnectMonitor() and decrease it when the vm is inactive. The libvirtd will block in the function qemuMonitorSetCapabilities() because the vm is stopped by signal SIGSTOP. Now the vm->refs is 2. Then we kill the vm by signal SIGKILL. The function qemuMonitorSetCapabilities() failed, and then we will decrease vm->refs in the function qemuMonitorClose(). In another thread, mon->fd is broken and the function qemuHandleMonitorEOF() is called. If qemuHandleMonitorEOF() decreases vm->refs before qemuConnectMonitor() returns, vm->refs will be decrease to 0 and the memory is freed. We will call qemudShutdownVMDaemon() as qemuConnectMonitor() failed. The memory has been freed, so qemudShutdownVMDaemon() is too dangerous. We will reference NULL pointer in the function virDomainConfVMNWFilterTeardown(): ============= void virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) { int i; if (nwfilterDriver != NULL) { for (i = 0; i < vm->def->nnets; i++) virDomainConfNWFilterTeardown(vm->def->nets[i]); } } ============ vm->def->nnets is not 0 but vm->def->nets is NULL(We don't set vm->def->nnets to 0 when we free vm). We should add an extra reference of vm to avoid vm to be deleted if qemuConnectMonitor() failed. Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
-
- 26 1月, 2011 3 次提交
-
-
由 Laine Stump 提交于
If a guest image is saved in compressed format, and the restore fails in some way after the intermediate process used to uncompress the image has been started, but before qemu has been started to hook up to the uncompressor, libvirt will endlessly wait for the uncompressor to finish, but it never will because it's still waiting to have something hooked up to drain its output. The solution is to close the pipes on both sides of the uncompressor, then send a SIGTERM before calling waitpid on it (only if the restore has failed, of course).
-
由 Laine Stump 提交于
This patch is a partial resolution to the following bug: https://bugzilla.redhat.com/show_bug.cgi?id=667756 (to complete the fix, an updated selinux-policy package is required, to add the policy that allows libvirt to set the context of a fifo, which was previously not allowed). Explanation : When an incoming migration is over a pipe (for example, if the image was compressed and is being fed through gzip, or was on a root-squash nfs server, so needed to be opened by a child process running as a different uid), qemu cannot read it unless the selinux context label for the pipe has been set properly. The solution is to check the fd used as the source of the migration just before passing it to qemu; if it's a fifo (implying that it's a pipe), we call the newly added virSecurityManagerSetFDLabel() function to set the context properly.
-
由 Osier Yang 提交于
The problem was introduced by commit 4303c91c, which removed the checking of domain state, this patch is to fix it. Otherwise, improper error will be thrown, e.g. error: Failed to save domain rhel6 state error: cannot resolve symlink /var/lib/libvirt/qemu/save/rhel6.save: No such file or directory
-
- 22 1月, 2011 2 次提交
-
-
由 Cole Robinson 提交于
QEMU supports serving VNC over a unix domain socket rather than traditional TCP host/port. This is specified with: <graphics type='vnc' socket='/foo/bar/baz'/> This provides better security access control than VNC listening on 127.0.0.1, but will cause issues with tools that rely on the lax security (virt-manager in fedora runs as regular user by default, and wouldn't be able to access a socket owned by 'qemu' or 'root'). Also not currently supported by any clients, though I have patches for virt-manager, and virt-viewer should be simple to update. v2: schema: Make listen vs. socket a <choice>
-
由 Cole Robinson 提交于
This will allow us to record transient runtime state in vm->def, like default VNC parameters. Accomplish this by adding an extra 'live' parameter to SetDefTransient, with similar semantics to the 'live' flag for AssignDef.
-