components/openstack/nova/files/solariszones/driver.py
changeset 6912 d4b1a12dae66
parent 6901 2c7a24ff439f
child 6913 473a2401e764
--- a/components/openstack/nova/files/solariszones/driver.py	Thu Sep 15 11:53:59 2016 -0700
+++ b/components/openstack/nova/files/solariszones/driver.py	Thu Sep 15 10:02:21 2016 -0700
@@ -1132,7 +1132,7 @@
             image_meta = glanceapi.get(context, instance['image_ref'])
             image_properties = image_meta.get('properties')
             if image_properties.get('architecture') is None:
-                reason = reason + (_("The 'architecture' property is not set "
+                reason = reason + (_(" The 'architecture' property is not set "
                                      "on the Glance image."))
 
             raise exception.ImageUnacceptable(image_id=instance['image_ref'],
@@ -3044,6 +3044,19 @@
         :param image_id: Reference to a pre-created image that will
                          hold the snapshot.
         """
+        name = instance['name']
+        zone = self._get_zone_by_name(name)
+        if zone is None:
+            raise exception.InstanceNotFound(instance_id=name)
+
+        # look to see if the zone is a kernel zone and is powered off.  If it
+        # is raise an exception before trying to archive it
+        extra_specs = self._get_extra_specs(instance)
+        brand = extra_specs.get('zonecfg:brand', ZONE_BRAND_SOLARIS)
+        if zone.state != ZONE_STATE_RUNNING and \
+                brand == ZONE_BRAND_SOLARIS_KZ:
+            raise exception.InstanceNotRunning(instance_id=name)
+
         # Get original base image info
         (base_service, base_id) = glance.get_remote_image_service(
             context, instance['image_ref'])