[RFC PATCHv2 1/2] driver: Implement new state driver field

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This implements a new field in the virStateDrvier struct. In order to
prevent possible compilation issues, this patch also implements the new
field in all of the existing drivers. Additionally, a change was needed
to check-driverimpls.pl to prevent a make check problem. Other than
those two items, all other changes are a single line addition to the
driver source files to define this field.

Signed-off-by: Adam Walters <adam@xxxxxxxxxxxxxxxxx>
---
 src/check-driverimpls.pl                | 1 +
 src/driver.h                            | 7 +++++++
 src/interface/interface_backend_netcf.c | 1 +
 src/libxl/libxl_driver.c                | 1 +
 src/lxc/lxc_driver.c                    | 1 +
 src/network/bridge_driver.c             | 1 +
 src/node_device/node_device_hal.c       | 1 +
 src/node_device/node_device_udev.c      | 1 +
 src/nwfilter/nwfilter_driver.c          | 1 +
 src/qemu/qemu_driver.c                  | 1 +
 src/remote/remote_driver.c              | 1 +
 src/secret/secret_driver.c              | 1 +
 src/storage/storage_driver.c            | 1 +
 src/uml/uml_driver.c                    | 1 +
 src/xen/xen_driver.c                    | 1 +
 15 files changed, 21 insertions(+)

diff --git a/src/check-driverimpls.pl b/src/check-driverimpls.pl
index 17e2b48..f726403 100755
--- a/src/check-driverimpls.pl
+++ b/src/check-driverimpls.pl
@@ -37,6 +37,7 @@ while (<>) {
 
             next if $api eq "no";
             next if $api eq "name";
+            next if $api eq "stateDrvType";
 
             my $suffix = $impl;
             my $prefix = $impl;
diff --git a/src/driver.h b/src/driver.h
index 5f4cd8d..943e1b1 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -1834,6 +1834,12 @@ typedef int
 typedef int
 (*virDrvStateStop)(void);
 
+typedef enum {
+    VIR_DRV_STATE_DRV_LIBVIRT = 1,
+    VIR_DRV_STATE_DRV_HYPERVISOR = 2,
+    VIR_DRV_STATE_DRV_LAST,
+} virDrvStateDrvType;
+
 typedef struct _virStateDriver virStateDriver;
 typedef virStateDriver *virStateDriverPtr;
 
@@ -1844,6 +1850,7 @@ struct _virStateDriver {
     virDrvStateCleanup stateCleanup;
     virDrvStateReload stateReload;
     virDrvStateStop stateStop;
+    virDrvStateDrvType stateDrvType;
 };
 # endif
 
diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c
index c525ca9..7c80fbe 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -1186,6 +1186,7 @@ static virStateDriver interfaceStateDriver = {
     .stateInitialize = netcfStateInitialize,
     .stateCleanup = netcfStateCleanup,
     .stateReload = netcfStateReload,
+    .stateDrvType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int netcfIfaceRegister(void) {
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index fc0efa2..826fd81 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4420,6 +4420,7 @@ static virStateDriver libxlStateDriver = {
     .stateAutoStart = libxlStateAutoStart,
     .stateCleanup = libxlStateCleanup,
     .stateReload = libxlStateReload,
+    .stateDrvType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 982f3fc..6fb3cf8 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -5440,6 +5440,7 @@ static virStateDriver lxcStateDriver = {
     .stateAutoStart = lxcStateAutoStart,
     .stateCleanup = lxcStateCleanup,
     .stateReload = lxcStateReload,
+    .stateDrvType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 int lxcRegister(void)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 0b43a67..e437fde 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3134,6 +3134,7 @@ static virStateDriver networkStateDriver = {
     .stateAutoStart  = networkStateAutoStart,
     .stateCleanup = networkStateCleanup,
     .stateReload = networkStateReload,
+    .stateDrvType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int networkRegister(void) {
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index fafd520..15cdecb 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -827,6 +827,7 @@ static virStateDriver halStateDriver = {
     .stateInitialize = nodeStateInitialize, /* 0.5.0 */
     .stateCleanup = nodeStateCleanup, /* 0.5.0 */
     .stateReload = nodeStateReload, /* 0.5.0 */
+    .stateDrvType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 5d49968..91f8e9d 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1816,6 +1816,7 @@ static virStateDriver udevStateDriver = {
     .stateInitialize = nodeStateInitialize, /* 0.7.3 */
     .stateCleanup = nodeStateCleanup, /* 0.7.3 */
     .stateReload = nodeStateReload, /* 0.7.3 */
+    .stateDrvType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int udevNodeRegister(void)
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index d21dd82..f29e723 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -702,6 +702,7 @@ static virStateDriver stateDriver = {
     .stateInitialize = nwfilterStateInitialize,
     .stateCleanup = nwfilterStateCleanup,
     .stateReload = nwfilterStateReload,
+    .stateDrvType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6e21267..899ddd8 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16621,6 +16621,7 @@ static virStateDriver qemuStateDriver = {
     .stateCleanup = qemuStateCleanup,
     .stateReload = qemuStateReload,
     .stateStop = qemuStateStop,
+    .stateDrvType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 int qemuRegister(void) {
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index ca86e3c..c032529 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -7300,6 +7300,7 @@ static virNWFilterDriver nwfilter_driver = {
 static virStateDriver state_driver = {
     .name = "Remote",
     .stateInitialize = remoteStateInitialize,
+    .stateDrvType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 #endif
 
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 9f7f946..f3aea8f 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -1189,6 +1189,7 @@ static virStateDriver stateDriver = {
     .stateInitialize = secretStateInitialize,
     .stateCleanup = secretStateCleanup,
     .stateReload = secretStateReload,
+    .stateDrvType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index c83aa8a..d753e34 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -2640,6 +2640,7 @@ static virStateDriver stateDriver = {
     .stateAutoStart = storageStateAutoStart,
     .stateCleanup = storageStateCleanup,
     .stateReload = storageStateReload,
+    .stateDrvType = VIR_DRV_STATE_DRV_LIBVIRT,
 };
 
 int storageRegister(void)
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 89afefe..82d207a 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -2904,6 +2904,7 @@ static virStateDriver umlStateDriver = {
     .stateAutoStart = umlStateAutoStart,
     .stateCleanup = umlStateCleanup,
     .stateReload = umlStateReload,
+    .stateDrvType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 int umlRegister(void) {
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index c45d980..3e5d860 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -276,6 +276,7 @@ static virStateDriver state_driver = {
     .name = "Xen",
     .stateInitialize = xenUnifiedStateInitialize,
     .stateCleanup = xenUnifiedStateCleanup,
+    .stateDrvType = VIR_DRV_STATE_DRV_HYPERVISOR,
 };
 
 /*----- Dispatch functions. -----*/
-- 
1.8.5.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]