[22/30] security: dac: Restore image label for externalDataStore

Message ID d14ca479ac8c829dbd3782871015c687d94288af.1570482718.git.crobinso@redhat.com
State Accepted
Commit ee5a367d06cf46abee9d540e7babb0d4e3ecf7d6
Headers show
Series
  • storagefile, security: qcow2 data_file support
Related show

Commit Message

Cole Robinson Oct. 7, 2019, 9:49 p.m.
Rename the existing virSecurityDACRestoreImageLabelInt
to virSecurityDACRestoreImageLabelSingle, and extend the new
ImageLabelInt handle externalDataStore

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/security/security_dac.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

-- 
2.23.0

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

Comments

Daniel Henrique Barboza Oct. 10, 2019, 3:56 p.m. | #1
On 10/7/19 6:49 PM, Cole Robinson wrote:
> Rename the existing virSecurityDACRestoreImageLabelInt

> to virSecurityDACRestoreImageLabelSingle, and extend the new

> ImageLabelInt handle externalDataStore

>

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---


Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>


>   src/security/security_dac.c | 28 ++++++++++++++++++++++++----

>   1 file changed, 24 insertions(+), 4 deletions(-)

>

> diff --git a/src/security/security_dac.c b/src/security/security_dac.c

> index 6d0c8a9b1c..befa388791 100644

> --- a/src/security/security_dac.c

> +++ b/src/security/security_dac.c

> @@ -954,10 +954,10 @@ virSecurityDACSetImageLabel(virSecurityManagerPtr mgr,

>   

>   

>   static int

> -virSecurityDACRestoreImageLabelInt(virSecurityManagerPtr mgr,

> -                                   virDomainDefPtr def,

> -                                   virStorageSourcePtr src,

> -                                   bool migrated)

> +virSecurityDACRestoreImageLabelSingle(virSecurityManagerPtr mgr,

> +                                      virDomainDefPtr def,

> +                                      virStorageSourcePtr src,

> +                                      bool migrated)

>   {

>       virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);

>       virSecurityLabelDefPtr secdef;

> @@ -1008,6 +1008,26 @@ virSecurityDACRestoreImageLabelInt(virSecurityManagerPtr mgr,

>   }

>   

>   

> +static int

> +virSecurityDACRestoreImageLabelInt(virSecurityManagerPtr mgr,

> +                                   virDomainDefPtr def,

> +                                   virStorageSourcePtr src,

> +                                   bool migrated)

> +{

> +    if (virSecurityDACRestoreImageLabelSingle(mgr, def, src, migrated) < 0)

> +        return -1;

> +

> +    if (src->externalDataStore &&

> +        virSecurityDACRestoreImageLabelSingle(mgr,

> +                                              def,

> +                                              src->externalDataStore,

> +                                              migrated) < 0)

> +        return -1;

> +

> +    return 0;

> +}

> +

> +

>   static int

>   virSecurityDACRestoreImageLabel(virSecurityManagerPtr mgr,

>                                   virDomainDefPtr def,


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

Patch

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 6d0c8a9b1c..befa388791 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -954,10 +954,10 @@  virSecurityDACSetImageLabel(virSecurityManagerPtr mgr,
 
 
 static int
-virSecurityDACRestoreImageLabelInt(virSecurityManagerPtr mgr,
-                                   virDomainDefPtr def,
-                                   virStorageSourcePtr src,
-                                   bool migrated)
+virSecurityDACRestoreImageLabelSingle(virSecurityManagerPtr mgr,
+                                      virDomainDefPtr def,
+                                      virStorageSourcePtr src,
+                                      bool migrated)
 {
     virSecurityDACDataPtr priv = virSecurityManagerGetPrivateData(mgr);
     virSecurityLabelDefPtr secdef;
@@ -1008,6 +1008,26 @@  virSecurityDACRestoreImageLabelInt(virSecurityManagerPtr mgr,
 }
 
 
+static int
+virSecurityDACRestoreImageLabelInt(virSecurityManagerPtr mgr,
+                                   virDomainDefPtr def,
+                                   virStorageSourcePtr src,
+                                   bool migrated)
+{
+    if (virSecurityDACRestoreImageLabelSingle(mgr, def, src, migrated) < 0)
+        return -1;
+
+    if (src->externalDataStore &&
+        virSecurityDACRestoreImageLabelSingle(mgr,
+                                              def,
+                                              src->externalDataStore,
+                                              migrated) < 0)
+        return -1;
+
+    return 0;
+}
+
+
 static int
 virSecurityDACRestoreImageLabel(virSecurityManagerPtr mgr,
                                 virDomainDefPtr def,