* in a reliable fashion if merely after a list of partitions & sizes,
* though it is fine for creating partitions.
*
- * Copyright (C) 2007-2008, 2010, 2013 Red Hat, Inc.
+ * Copyright (C) 2007-2008, 2010, 2013, 2016 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
const char *path;
char *canonical_path;
const char *partsep;
+ bool devmap_nopartsep = false;
if (setlocale(LC_ALL, "") == NULL ||
bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
if (argc == 3 && STREQ(argv[2], "-g")) {
cmd = DISK_GEOMETRY;
+ } else if (argc == 3 && STREQ(argv[2], "-p")) {
+ devmap_nopartsep = true;
} else if (argc != 2) {
- fprintf(stderr, _("syntax: %s DEVICE [-g]\n"), argv[0]);
+ fprintf(stderr, _("syntax: %s DEVICE [-g]|[-p]\n"), argv[0]);
return 1;
}
path = argv[1];
if (virIsDevMapperDevice(path)) {
- partsep = "p";
+ /* The 'devmap_nopartsep' option will not append the partsep of "p"
+ * onto the name unless the 'path' ends in a number
+ */
+ if (c_isdigit(path[strlen(path)-1]) || !devmap_nopartsep)
+ partsep = "p";
+ else
+ partsep = "";
if (VIR_STRDUP_QUIET(canonical_path, path) < 0)
return 2;
} else {
/*
* storage_backend_disk.c: storage backend for disk handling
*
- * Copyright (C) 2007-2014 Red Hat, Inc.
+ * Copyright (C) 2007-2016 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
pool->def->source.devices[0].path,
NULL);
+ /* Check for the presence of the part_separator='no'. Pass this
+ * along to the libvirt_parthelper as option '-p'. This will cause
+ * libvirt_parthelper to not append the "p" partition separator to
+ * the generated device name, unless the name ends with a number.
+ */
+ if (pool->def->source.devices[0].part_separator ==
+ VIR_TRISTATE_BOOL_NO)
+ virCommandAddArg(cmd, "-p");
+
/* If a volume is passed, virStorageBackendDiskMakeVol only updates the
* pool allocation for that single volume.
*/