
19 Jan
2017
19 Jan
'17
9:27 a.m.
On 19/01/17 00:00, John Ferlan wrote: > > On 01/17/2017 09:10 AM, Olga Krishtal wrote: >> Added general defenitions for vstorage pool backend > definitions > >> Signed-off-by: Olga Krishtal <okrishtal@virtuozzo.com> >> --- >> include/libvirt/libvirt-storage.h | 1 + >> po/POTFILES.in | 1 + >> src/Makefile.am | 9 +++++++++ >> src/conf/storage_conf.c | 17 ++++++++++++++++- >> src/conf/storage_conf.h | 1 + >> src/storage/storage_backend.c | 6 ++++++ >> src/storage/storage_backend_vstorage.c | 16 ++++++++++++++++ >> src/storage/storage_backend_vstorage.h | 28 ++++++++++++++++++++++++++++ >> src/storage/storage_driver.c | 2 ++ >> tools/virsh-pool.c | 3 +++ >> tools/virsh.c | 3 +++ >> 11 files changed, 86 insertions(+), 1 deletion(-) >> create mode 100644 src/storage/storage_backend_vstorage.c >> create mode 100644 src/storage/storage_backend_vstorage.h >> > FWIW: The could be conflicts w/ pkrempa's series to move the bulk of > storage_backend.c into src/util/storage_util.c. I'm watching both and > can make appropriate adjustments > > >> diff --git a/include/libvirt/libvirt-storage.h b/include/libvirt/libvirt-storage.h >> index 8a861e4..45ec720 100644 >> --- a/include/libvirt/libvirt-storage.h >> +++ b/include/libvirt/libvirt-storage.h >> @@ -240,6 +240,7 @@ typedef enum { >> VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG = 1 << 15, >> VIR_CONNECT_LIST_STORAGE_POOLS_GLUSTER = 1 << 16, >> VIR_CONNECT_LIST_STORAGE_POOLS_ZFS = 1 << 17, >> + VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE = 1 << 18, >> } virConnectListAllStoragePoolsFlags; >> >> int virConnectListAllStoragePools(virConnectPtr conn, >> diff --git a/po/POTFILES.in b/po/POTFILES.in >> index 59efd91..b4fac0e 100644 >> --- a/po/POTFILES.in >> +++ b/po/POTFILES.in >> @@ -175,6 +175,7 @@ src/storage/storage_backend_mpath.c >> src/storage/storage_backend_rbd.c >> src/storage/storage_backend_scsi.c >> src/storage/storage_backend_sheepdog.c >> +src/storage/storage_backend_vstorage.c >> src/storage/storage_backend_zfs.c >> src/storage/storage_driver.c >> src/test/test_driver.c > This causes a syntax-check failure for *this* patch because there's > nothing to translate in it yet, it belongs in the next patch... Causes > syntax-check failure. > > I will adjust before pushing > >> diff --git a/src/Makefile.am b/src/Makefile.am >> index 21a78e0..78e64f2 100644 >> --- a/src/Makefile.am >> +++ b/src/Makefile.am >> @@ -1005,6 +1005,10 @@ STORAGE_DRIVER_GLUSTER_SOURCES = \ >> STORAGE_DRIVER_ZFS_SOURCES = \ >> storage/storage_backend_zfs.h storage/storage_backend_zfs.c >> >> +STORAGE_DRIVER_VSTORAGE_SOURCES = \ >> + storage/storage_backend_vstorage.h \ >> + storage/storage_backend_vstorage.c >> + > It seems the \ should be aligned as they are for others (uses <tabs> too > - I usually just cut-n-paste the previous line and alter the name). > > I will adjust before pushing. > > >> STORAGE_HELPER_DISK_SOURCES = \ >> storage/parthelper.c >> >> @@ -1712,6 +1716,10 @@ if WITH_STORAGE_ZFS >> libvirt_driver_storage_impl_la_SOURCES += $(STORAGE_DRIVER_ZFS_SOURCES) >> endif WITH_STORAGE_ZFS >> >> +if WITH_STORAGE_VSTORAGE >> +libvirt_driver_storage_impl_la_SOURCES += $(STORAGE_DRIVER_VSTORAGE_SOURCES) >> +endif WITH_STORAGE_VSTORAGE >> + >> if WITH_NODE_DEVICES >> # Needed to keep automake quiet about conditionals >> if WITH_DRIVER_MODULES >> @@ -1923,6 +1931,7 @@ EXTRA_DIST += \ >> $(STORAGE_DRIVER_SHEEPDOG_SOURCES) \ >> $(STORAGE_DRIVER_GLUSTER_SOURCES) \ >> $(STORAGE_DRIVER_ZFS_SOURCES) \ >> + $(STORAGE_DRIVER_VSTORAGE_SOURCES) \ > Again more alignment stuff. Make it all look similar. I can change. Use > of <tabs> too > > The remainder seems OK > > ACK w/ adjustments and I'll push once pkrempa's series is in. > > John > >> $(NODE_DEVICE_DRIVER_SOURCES) \ >> $(NODE_DEVICE_DRIVER_HAL_SOURCES) \ >> $(NODE_DEVICE_DRIVER_UDEV_SOURCES) \ >> diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c >> index c53f080..c9b93aa 100644 >> --- a/src/conf/storage_conf.c >> +++ b/src/conf/storage_conf.c >> @@ -60,7 +60,8 @@ VIR_ENUM_IMPL(virStoragePool, >> "dir", "fs", "netfs", >> "logical", "disk", "iscsi", >> "scsi", "mpath", "rbd", >> - "sheepdog", "gluster", "zfs") >> + "sheepdog", "gluster", "zfs", >> + "vstorage") >> >> VIR_ENUM_IMPL(virStoragePoolFormatFileSystem, >> VIR_STORAGE_POOL_FS_LAST, >> @@ -274,6 +275,16 @@ static virStoragePoolTypeInfo poolTypeInfo[] = { >> .defaultFormat = VIR_STORAGE_FILE_RAW, >> }, >> }, >> + {.poolType = VIR_STORAGE_POOL_VSTORAGE, >> + .poolOptions = { >> + .flags = VIR_STORAGE_POOL_SOURCE_NAME, >> + }, >> + .volOptions = { >> + .defaultFormat = VIR_STORAGE_FILE_RAW, >> + .formatFromString = virStorageVolumeFormatFromString, >> + .formatToString = virStorageFileFormatTypeToString, >> + }, >> + }, >> }; >> >> >> @@ -2611,6 +2622,10 @@ virStoragePoolSourceFindDuplicate(virConnectPtr conn, >> /* Only one mpath pool is valid per host */ >> matchpool = pool; >> break; >> + case VIR_STORAGE_POOL_VSTORAGE: >> + if (STREQ(pool->def->source.name, def->source.name)) >> + matchpool = pool; >> + break; >> case VIR_STORAGE_POOL_RBD: >> case VIR_STORAGE_POOL_LAST: >> break; >> diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h >> index b35471d..e952f5f 100644 >> --- a/src/conf/storage_conf.h >> +++ b/src/conf/storage_conf.h >> @@ -95,6 +95,7 @@ typedef enum { >> VIR_STORAGE_POOL_SHEEPDOG, /* Sheepdog device */ >> VIR_STORAGE_POOL_GLUSTER, /* Gluster device */ >> VIR_STORAGE_POOL_ZFS, /* ZFS */ >> + VIR_STORAGE_POOL_VSTORAGE, /* Virtuozzo Storage */ >> >> VIR_STORAGE_POOL_LAST, >> } virStoragePoolType; >> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c >> index 18433e9..207a534 100644 >> --- a/src/storage/storage_backend.c >> +++ b/src/storage/storage_backend.c >> @@ -103,6 +103,9 @@ >> #if WITH_STORAGE_ZFS >> # include "storage_backend_zfs.h" >> #endif >> +#if WITH_STORAGE_VSTORAGE >> +# include "storage_backend_vstorage.h" >> +#endif >> >> #define VIR_FROM_THIS VIR_FROM_STORAGE >> >> @@ -143,6 +146,9 @@ static virStorageBackendPtr backends[] = { >> #if WITH_STORAGE_ZFS >> &virStorageBackendZFS, >> #endif >> +#if WITH_STORAGE_VSTORAGE >> + &virStorageBackendVstorage, >> +#endif >> NULL >> }; >> >> diff --git a/src/storage/storage_backend_vstorage.c b/src/storage/storage_backend_vstorage.c >> new file mode 100644 >> index 0000000..3a57385 >> --- /dev/null >> +++ b/src/storage/storage_backend_vstorage.c >> @@ -0,0 +1,16 @@ >> +#include <config.h> >> + >> +#include "viralloc.h" >> +#include "virerror.h" >> +#include "virfile.h" >> +#include "storage_backend_vstorage.h" >> +#include "virlog.h" >> +#include "virstring.h" >> + >> +#define VIR_FROM_THIS VIR_FROM_STORAGE >> + >> +VIR_LOG_INIT("storage.storage_backend_vstorage"); >> + >> +virStorageBackend virStorageBackendVstorage = { >> + .type = VIR_STORAGE_POOL_VSTORAGE, >> +}; >> diff --git a/src/storage/storage_backend_vstorage.h b/src/storage/storage_backend_vstorage.h >> new file mode 100644 >> index 0000000..262e454 >> --- /dev/null >> +++ b/src/storage/storage_backend_vstorage.h >> @@ -0,0 +1,28 @@ >> +/* >> + * storage_backend_vstorage.h: storage backend for Virtuozzo storage >> + * handling >> + * >> + * This library is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU Lesser General Public >> + * License as published by the Free Software Foundation; either >> + * version 2.1 of the License, or (at your option) any later version. >> + * >> + * This library is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >> + * Lesser General Public License for more details. >> + * >> + * You should have received a copy of the GNU Lesser General Public >> + * License along with this library. If not, see >> + * <http://www.gnu.org/licenses/>. >> + * >> + */ >> + >> +#ifndef __VIR_STORAGE_BACKEND_VSTORAGE_H__ >> +# define __VIR_STORAGE_BACKEND_VSTORAGE_H__ >> + >> +# include "storage_backend.h" >> + >> +extern virStorageBackend virStorageBackendVstorage; >> + >> +#endif /* __VIR_STORAGE_BACKEND_VSTORAGE_H__ */ >> diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c >> index 8f1d3f0..257af80 100644 >> --- a/src/storage/storage_driver.c >> +++ b/src/storage/storage_driver.c >> @@ -1618,6 +1618,7 @@ storageVolLookupByPath(virConnectPtr conn, >> case VIR_STORAGE_POOL_ISCSI: >> case VIR_STORAGE_POOL_SCSI: >> case VIR_STORAGE_POOL_MPATH: >> + case VIR_STORAGE_POOL_VSTORAGE: >> stable_path = virStorageBackendStablePath(pool, >> cleanpath, >> false); >> @@ -3501,6 +3502,7 @@ virStorageTranslateDiskSourcePool(virConnectPtr conn, >> case VIR_STORAGE_POOL_DISK: >> case VIR_STORAGE_POOL_SCSI: >> case VIR_STORAGE_POOL_ZFS: >> + case VIR_STORAGE_POOL_VSTORAGE: >> if (!(def->src->path = virStorageVolGetPath(vol))) >> goto cleanup; >> >> diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c >> index 6806b7a..f766be6 100644 >> --- a/tools/virsh-pool.c >> +++ b/tools/virsh-pool.c >> @@ -1166,6 +1166,9 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) >> case VIR_STORAGE_POOL_ZFS: >> flags |= VIR_CONNECT_LIST_STORAGE_POOLS_ZFS; >> break; >> + case VIR_STORAGE_POOL_VSTORAGE: >> + flags |= VIR_CONNECT_LIST_STORAGE_POOLS_VSTORAGE; >> + break; >> case VIR_STORAGE_POOL_LAST: >> break; >> } >> diff --git a/tools/virsh.c b/tools/virsh.c >> index 1068447..7eb51ab 100644 >> --- a/tools/virsh.c >> +++ b/tools/virsh.c >> @@ -648,6 +648,9 @@ virshShowVersion(vshControl *ctl ATTRIBUTE_UNUSED) >> #ifdef WITH_STORAGE_ZFS >> vshPrint(ctl, " ZFS"); >> #endif >> +#ifdef WITH_STORAGE_VSTORAGE >> + vshPrint(ctl, "Virtuozzo Storage"); >> +#endif >> vshPrint(ctl, "\n"); >> >> vshPrint(ctl, "%s", _(" Miscellaneous:")); >> Ok -- Best regards, Olga