]> xenbits.xensource.com Git - libvirt.git/commitdiff
Disks are always block devices, never character devices
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 5 Feb 2014 11:01:09 +0000 (11:01 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 17 Feb 2014 15:39:55 +0000 (15:39 +0000)
The LXC disk hotplug code was allowing block or character devices
to be given as disk. A disk is always a block device.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/lxc/lxc_driver.c

index 251a53ea9facde38471add85b7212454b6e7799e..b47fac8f968aeb639dd4391f2b802512690162e8 100644 (file)
@@ -3698,9 +3698,9 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver,
         goto cleanup;
     }
 
-    if (!S_ISCHR(sb.st_mode) && !S_ISBLK(sb.st_mode)) {
+    if (!S_ISBLK(sb.st_mode)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Disk source %s must be a character/block device"),
+                       _("Disk source %s must be a block device"),
                        def->src);
         goto cleanup;
     }
@@ -3712,11 +3712,7 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver,
     if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
         goto cleanup;
 
-    mode = 0700;
-    if (S_ISCHR(sb.st_mode))
-        mode |= S_IFCHR;
-    else
-        mode |= S_IFBLK;
+    mode = 0700 | S_IFBLK;
 
     /* Yes, the device name we're creating may not
      * actually correspond to the major:minor number