mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 21:15:20 +00:00
Disks are always block devices, never character devices
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> (cherry picked from commit d24e6b8b1eb87daa6ee467b76cf343725468949c)
This commit is contained in:
parent
3ed96444bb
commit
0241e111c4
@ -3061,9 +3061,9 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!S_ISCHR(sb.st_mode) && !S_ISBLK(sb.st_mode)) {
|
if (!S_ISBLK(sb.st_mode)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
_("Disk source %s must be a character/block device"),
|
_("Disk source %s must be a block device"),
|
||||||
def->src);
|
def->src);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -3075,11 +3075,7 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver,
|
|||||||
if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
|
if (VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
mode = 0700;
|
mode = 0700 | S_IFBLK;
|
||||||
if (S_ISCHR(sb.st_mode))
|
|
||||||
mode |= S_IFCHR;
|
|
||||||
else
|
|
||||||
mode |= S_IFBLK;
|
|
||||||
|
|
||||||
/* Yes, the device name we're creating may not
|
/* Yes, the device name we're creating may not
|
||||||
* actually correspond to the major:minor number
|
* actually correspond to the major:minor number
|
||||||
|
Loading…
x
Reference in New Issue
Block a user