Sandro Bonazzola has uploaded a new change for review.

Change subject: bin: extended hosted-engine capabilities
......................................................................

bin: extended hosted-engine capabilities

added --vm-destroy for destroying the vm
added --start-pool for starting the storage pool

If the pool is down, the VM will not start due to
missing volume. Then you have to destroy the VM
and start the pool before starting again the VM.

Change-Id: Iea0755188efe0dfe1f61da762d3b0f290b8efd2c
Signed-off-by: Sandro Bonazzola <sbona...@redhat.com>
---
M src/bin/hosted-engine.in
M src/ovirt_hosted_engine_setup/constants.py
M src/plugins/ovirt-hosted-engine-setup/core/conf.py
M src/plugins/ovirt-hosted-engine-setup/storage/storage.py
M templates/hosted-engine.conf.in
5 files changed, 67 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/13/17113/1

diff --git a/src/bin/hosted-engine.in b/src/bin/hosted-engine.in
index c5239e5..be37410 100644
--- a/src/bin/hosted-engine.in
+++ b/src/bin/hosted-engine.in
@@ -25,6 +25,8 @@
         Create a temporary password for vnc/spice connection
     --check-liveliness
         Checks liveliness page of engine
+    --start-pool
+        Start the storage pool manually
 
 
 __EOF__
@@ -58,6 +60,13 @@
                 echo "You must run --deploy first"
             fi
         ;;
+        --vm-destroy)
+            if [ -n "${vmid}" ] ; then
+                vdsClient -s localhost destroy "${vmid}"
+            else
+                echo "You must run --deploy first"
+            fi
+        ;;
         --vm-status)
             echo "This option is not yet supported"
         ;;
@@ -71,6 +80,41 @@
         --check-liveliness)
             python -m ovirt_hosted_engine_setup.check_liveliness
         ;;
+        --start-pool)
+            if [ "${domainType}" == "nfs" ] ; then
+                storageType=1
+            elif [ "${domainType}" == "glusterfs" ] ; then
+                storageType=7
+            else
+                echo "Storage type not supported: ${domainType}"
+                exit 1
+            fi
+            echo "Connecting Storage Server"
+            vdsClient -s localhost connectStorageServer \
+                ${storageType} \
+                ${spUUID} \
+                
connection=${storage},iqn=,portal=,user=kvm,password=,id=${connectionUUID},port=
+            echo "Connecting Storage Pool"
+            vdsClient -s localhost connectStoragePool \
+                ${spUUID} \
+                ${host_id} \
+                ${spUUID} \
+                ${sdUUID} \
+                1
+            echo "Starting SPM"
+            vdsClient -s localhost spmStart \
+                ${spUUID} \
+                -1 \
+                -1 \
+                -1 \
+                false \
+                250 \
+                3
+            echo "Activating Storage Domain"
+            vdsClient -s localhost activateStorageDomain \
+                ${sdUUID}
+                ${spUUID}
+        ;;
         --help)
             rc=0
             usage
diff --git a/src/ovirt_hosted_engine_setup/constants.py 
b/src/ovirt_hosted_engine_setup/constants.py
index 64f6ace..933aaac 100644
--- a/src/ovirt_hosted_engine_setup/constants.py
+++ b/src/ovirt_hosted_engine_setup/constants.py
@@ -277,6 +277,12 @@
     @ohostedattrs(
         answerfile=True,
     )
+    def STORAGE_TYPE(self):
+        return 'OVEHOSTED_STORAGE/storageType'
+
+    @ohostedattrs(
+        answerfile=True,
+    )
     def VOL_UUID(self):
         return 'OVEHOSTED_STORAGE/volUUID'
 
diff --git a/src/plugins/ovirt-hosted-engine-setup/core/conf.py 
b/src/plugins/ovirt-hosted-engine-setup/core/conf.py
index a2ec1e5..ec52bd4 100644
--- a/src/plugins/ovirt-hosted-engine-setup/core/conf.py
+++ b/src/plugins/ovirt-hosted-engine-setup/core/conf.py
@@ -72,7 +72,7 @@
                     ohostedcons.NetworkEnv.OVIRT_HOSTED_ENGINE_FQDN
                 ],
                 '@VM_DISK_ID@': self.environment[
-                    ohostedcons.NetworkEnv.OVIRT_HOSTED_ENGINE_FQDN
+                    self.environment[ohostedcons.StorageEnv.IMG_UUID]
                 ],
                 '@SHARED_STORAGE@': self.environment[
                     ohostedcons.StorageEnv.STORAGE_DOMAIN_CONNECTION
@@ -85,6 +85,14 @@
                 ],
                 '@CONF_FILE@': ohostedcons.FileLocations.ENGINE_VM_CONF,
                 '@HOST_ID@': self.environment[ohostedcons.StorageEnv.HOST_ID],
+                '@DOMAIN_TYPE@': self.environment[
+                    ohostedcons.StorageEnv.DOMAIN_TYPE
+                ],
+                '@SP_UUID@': self.environment[ohostedcons.StorageEnv.SP_UUID],
+                '@SD_UUID@': self.environment[ohostedcons.StorageEnv.SD_UUID],
+                '@CONNECTION_UUID@': self.environment[
+                    ohostedcons.StorageEnv.CONNECTION_UUID
+                ],
             }
         )
         with transaction.Transaction() as localtransaction:
diff --git a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py 
b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
index 5049549..3ed1102 100644
--- a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
+++ b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py
@@ -421,6 +421,10 @@
             None
         )
         self.environment.setdefault(
+            ohostedcons.StorageEnv.STORAGE_TYPE,
+            None
+        )
+        self.environment.setdefault(
             ohostedcons.CoreEnv.ADDITIONAL_HOST_ENABLED,
             False
         )
diff --git a/templates/hosted-engine.conf.in b/templates/hosted-engine.conf.in
index 395c112..933658b 100644
--- a/templates/hosted-engine.conf.in
+++ b/templates/hosted-engine.conf.in
@@ -6,3 +6,7 @@
 service_start_time=0
 host_id=@HOST_ID@
 console=@CONSOLE_TYPE@
+domainType=@DOMAIN_TYPE@
+spUUID=@SP_UUID@
+sdUUID=@SD_UUID@
+connectionUUID=@CONNECTION_UUID@


-- 
To view, visit http://gerrit.ovirt.org/17113
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iea0755188efe0dfe1f61da762d3b0f290b8efd2c
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to