changeset 35:f01dc83040a9

Change mount point and template xml
author atton
date Thu, 05 Nov 2015 18:28:03 +0900
parents ccac5d8090f6
children ebeeb6c20d0a
files ie-virsh.c newvm.py
diffstat 2 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ie-virsh.c	Thu Nov 05 18:09:23 2015 +0900
+++ b/ie-virsh.c	Thu Nov 05 18:28:03 2015 +0900
@@ -35,6 +35,8 @@
 
 static char bad_name[] = "Bad vmname. Try 01 or 02 ... 04\n";
 
+const char newvm_command[] = "/usr/local/bin/newvm.py -c /etc/libvirt/qemu/fedora23.xml -n ";
+
 enum {
     NAME_LENGTH = 50,
     VM_NAME_LENGTH = 50
@@ -206,19 +208,15 @@
 
 int main(int argc, char **argv)
 {
-    int gid;
-    int uid;
+    /* Set euid and egid to actual user */
+    int uid    = getuid();
+    int gid    = getgid();
+    char *name = getlogin();
 
-    /* Set euid and egid to actual user */
-
-    char *name = getlogin();
-    uid = getuid();
-    gid = getgid();
     printf("uid %d gid %d name %s\n", uid,gid,name);
     setegid(getgid());
     seteuid(getuid());
 
-
     int account_type = check_user_name(name);
     if (account_type < 0) {
         fprintf(stderr, "Parmission denied. :%s\n", name);
@@ -234,6 +232,11 @@
        }
      */
 
+    if (argc<2) {
+        usage();
+        exit(0);
+    }
+
     /* Set uid, gid, euid and egid to root */
 
     setegid(0);
@@ -272,7 +275,7 @@
             strncpy(vm_path, vm_name, VM_NAME_LENGTH);
             change_delimiter_to_slash(vm_path);
             char exec[1024];
-            strncpy(exec, "/usr/local/bin/newvm.py -c /etc/libvirt/qemu/fedora20.xml -n ",900);
+            strncpy(exec, newvm_command ,900);
             strncat(exec, vm_path,1000);
             fprintf(stdout, "excuting %s\n",exec );
             system(exec);
@@ -305,11 +308,7 @@
             print_vmlist(vmlist);
             exit(0);
         }
-    } else if (argc<2) {
-        print_vmlist(vmlist);
-        usage();
-        exit(0);
-    }
+    } 
 
     /* Check argv for proper arguments and run 
      * the corresponding script, if invoked.
--- a/newvm.py	Thu Nov 05 18:09:23 2015 +0900
+++ b/newvm.py	Thu Nov 05 18:28:03 2015 +0900
@@ -10,7 +10,7 @@
 else:
     import xml.etree.ElementTree as ET
 
-mount_point = '/media/fcs/' # root directory
+mount_point = '/media/iscsi/' # root directory
 
 # vm_name should be
 #     students/e10/e105730/01