Re: [Libvir] PATCH: Implement CDROM media change for QEMU/KVM driver

2007-10-15 Thread Richard W.M. Jones
+char *cmd; +char *reply; +/* XXX QEMU only supports a single CDROM for now */ +/*cmd = malloc(strlen(change ) + strlen(olddisk-dst) + 1 + strlen(newdisk-src) + 2);*/ +cmd = malloc(strlen(change ) + strlen(cdrom) + 1 + strlen(newdisk-src) + 2); +if (!cmd) { +

Re: [Libvir] PATCH: Implement CDROM media change for QEMU/KVM driver

2007-10-15 Thread Richard W.M. Jones
Richard W.M. Jones wrote: +strcat(cmd, newdisk-src); Also, is quoting/escaping required? In a naive libvirt-based app, it's plausible that the string is provided by the user and could contain \n to send arbitrary commands to the qemu console. Rich. -- Emerging Technologies, Red Hat -

Re: [Libvir] PATCH: Implement CDROM media change for QEMU/KVM driver

2007-10-15 Thread Jim Paris
Richard W.M. Jones wrote: +char *cmd; +char *reply; +/* XXX QEMU only supports a single CDROM for now */ +/*cmd = malloc(strlen(change ) + strlen(olddisk-dst) + 1 + strlen(newdisk-src) + 2);*/ +cmd = malloc(strlen(change ) + strlen(cdrom) + 1 + strlen(newdisk-src) +

Re: [Libvir] PATCH: Implement CDROM media change for QEMU/KVM driver

2007-10-13 Thread Jim Paris
Hi Dan, That's definitely be a useful feature. Some comments... @@ -453,7 +454,7 @@ static int qemudOpenMonitor(virConnectPt char buf[1024]; int ret = -1; -if (!(monfd = open(monitor, O_RDWR))) { +if (!(monfd = open(monitor, O_NOCTTY |O_RDWR))) { Is this just to

[Libvir] PATCH: Implement CDROM media change for QEMU/KVM driver

2007-10-12 Thread Daniel P. Berrange
Hugh recently added support for CDROM media change to the Xen driver, so I thought it was time I did the same for the QEMU/KVM driver. The attached patch implements the virDomainAttachDevice API to support changing the media of the CDROM device. To re-use the existing QEMU code for parsing I had