Move snapshot storage initialization to the core.

Change-Id: I2c2b782fe4711cc8c323433e7976222b878cf679
diff --git a/vl-android.c b/vl-android.c
index d07b6c0..04fed59 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -3775,6 +3775,7 @@
     DisplayChangeListener *dcl;
     int cyls, heads, secs, translation;
     QemuOpts *hda_opts = NULL;
+    QemuOpts *hdb_opts = NULL;
     const char *net_clients[MAX_NET_CLIENTS];
     int nb_net_clients;
     const char *bt_opts[MAX_BT_CMDLINE];
@@ -3987,6 +3988,9 @@
                                  ",trans=none" : "");
                  break;
             case QEMU_OPTION_hdb:
+                hdb_opts = drive_add(optarg, HD_ALIAS, 1);
+                break;
+
             case QEMU_OPTION_hdc:
             case QEMU_OPTION_hdd:
                 drive_add(optarg, HD_ALIAS, popt->index - QEMU_OPTION_hda);
@@ -4853,6 +4857,19 @@
         }
     }
 
+    if (hdb_opts == NULL) {
+        const char* spath = android_hw->disk_snapStorage_path;
+        if (spath && *spath) {
+            if (!path_exists(spath)) {
+                PANIC("Snapshot storage file does not exist: %s", spath);
+            }
+            if (filelock_create(spath) == NULL) {
+                PANIC("Snapshot storag already in use: %s", spath);
+            }
+            hdb_opts = drive_add(spath, HD_ALIAS, 1);
+        }
+    }
+
     /* Set the VM's max heap size, passed as a boot property */
     if (android_hw->vm_heapSize > 0) {
         char  tmp[64];