conf: domain: Remove VIR_DOMAIN_DEF_PARSE_DISK_SOURCE parser flag

There's no code which would assert it at this point. Remove the flag.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-04-14 18:04:31 +02:00
parent 62a4023d8a
commit 91d9ff75e6
2 changed files with 28 additions and 33 deletions

View File

@ -9603,14 +9603,13 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
* to indicate no media present. LUN is for raw access CD-ROMs
* that are not attached to a physical device presently */
if (virStorageSourceIsEmpty(def->src) &&
(def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE))) {
def->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
virReportError(VIR_ERR_NO_SOURCE,
target ? "%s" : NULL, target);
return NULL;
}
if (!target && !(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
if (!target) {
if (def->src->srcpool) {
tmp = g_strdup_printf("pool = '%s', volume = '%s'",
def->src->srcpool->pool, def->src->srcpool->volume);
@ -9623,29 +9622,27 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
return NULL;
}
if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
!STRPREFIX(target, "fd")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid floppy device name: %s"), target);
return NULL;
}
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
!STRPREFIX(target, "fd")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid floppy device name: %s"), target);
return NULL;
}
/* Force CDROM to be listed as read only */
if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
def->src->readonly = true;
/* Force CDROM to be listed as read only */
if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
def->src->readonly = true;
if ((def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
def->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
!STRPREFIX((const char *)target, "hd") &&
!STRPREFIX((const char *)target, "sd") &&
!STRPREFIX((const char *)target, "vd") &&
!STRPREFIX((const char *)target, "xvd") &&
!STRPREFIX((const char *)target, "ubd")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid harddisk device name: %s"), target);
return NULL;
}
if ((def->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
def->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
!STRPREFIX((const char *)target, "hd") &&
!STRPREFIX((const char *)target, "sd") &&
!STRPREFIX((const char *)target, "vd") &&
!STRPREFIX((const char *)target, "xvd") &&
!STRPREFIX((const char *)target, "ubd")) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid harddisk device name: %s"), target);
return NULL;
}
if (snapshot) {
@ -9686,7 +9683,7 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt,
} else {
if (def->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
def->bus = VIR_DOMAIN_DISK_BUS_FDC;
} else if (!(flags & VIR_DOMAIN_DEF_PARSE_DISK_SOURCE)) {
} else {
if (STRPREFIX(target, "hd"))
def->bus = VIR_DOMAIN_DISK_BUS_IDE;
else if (STRPREFIX(target, "sd"))

View File

@ -3353,25 +3353,23 @@ typedef enum {
VIR_DOMAIN_DEF_PARSE_ALLOW_ROM = 1 << 4,
/* internal flag passed to device info sub-parser to allow specifying boot order */
VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT = 1 << 5,
/* parse only source half of <disk> */
VIR_DOMAIN_DEF_PARSE_DISK_SOURCE = 1 << 6,
/* perform RNG schema validation on the passed XML document */
VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA = 1 << 7,
VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA = 1 << 6,
/* allow updates in post parse callback that would break ABI otherwise */
VIR_DOMAIN_DEF_PARSE_ABI_UPDATE = 1 << 8,
VIR_DOMAIN_DEF_PARSE_ABI_UPDATE = 1 << 7,
/* skip definition validation checks meant to be executed on define time only */
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE = 1 << 9,
VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE = 1 << 8,
/* skip parsing of security labels */
VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL = 1 << 10,
VIR_DOMAIN_DEF_PARSE_SKIP_SECLABEL = 1 << 9,
/* Allows updates in post parse callback for incoming persistent migration
* that would break ABI otherwise. This should be used only if it's safe
* to do such change. */
VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION = 1 << 11,
VIR_DOMAIN_DEF_PARSE_ABI_UPDATE_MIGRATION = 1 << 10,
/* Allows to ignore certain failures in the post parse callbacks, which
* may happen due to missing packages and can be fixed by re-running the
* post parse callbacks before starting. Failure of the post parse callback
* is recorded as def->postParseFail */
VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL = 1 << 12,
VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL = 1 << 11,
} virDomainDefParseFlags;
typedef enum {